diff --git a/.gitignore b/.gitignore index 08346d41c..5c64716a3 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ Release/ binary/ build/ ipch/ +lib/ Nethack.sln Nethack.sdf Nethack.opensdf @@ -54,3 +55,29 @@ Makefile.gcc-orig .vs # Win32-specific ignores end .DS_Store +# ms-dos +# resulting zip +NH*DOS.ZIP +# 8.3 versions +dat/data.bas +sys/share/posixreg.c +include/patchlev.h +doc/guidebk.txt +# folders compiler, target objs, binary results +djgpp/ +src/msdos_o/ +msdos-binary/ +dat/NHTILES.BMP +dat/msdoshlp.txt +src/host_o/ +util/djgpp-linux64-gcc550.tar.bz2 +util/djgpp-osx-gcc550.tar.bz2 +util/djgpp-mingw-gcc550-standalone.zip +util/dlb_main +util/thintile +util/til2bin2 +util/tile2bin +win/share/monthin.txt +win/share/objthin.txt +win/share/oththin.txt +# end of ms-dos diff --git a/.travis.yml b/.travis.yml index 67d05077d..cc707bb88 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,11 @@ matrix: - os: linux env: DESCR=linux-xenial-gcc HINTS=linux compiler: gcc - script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" + script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make fetch-lua && make install" - os: linux env: DESCR=linux-xenial-clang HINTS=linux compiler: clang - script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" + script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make fetch-lua && make install" - os: linux env: DESCR=linux-xenial-gcc-x11 HINTS=linux-x11 compiler: gcc @@ -18,7 +18,7 @@ matrix: - libx11-dev - libxaw7-dev - xfonts-utils - script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" + script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make fetch-lua && make install" - os: linux env: DESCR=linux-xenial-gcc-qt5 HINTS=linux-qt5 compiler: gcc @@ -31,7 +31,7 @@ matrix: - qtbase5-dev - qtmultimedia5-dev - qtbase5-dev-tools - script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && QT_SELECT=5 make MOC=moc install" + script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make fetch-lua && make QT_SELECT=5 MOC=moc install" - os: linux env: DESCR=linux-bionic-gcc-x11 HINTS=linux-x11 dist: bionic @@ -42,7 +42,7 @@ matrix: - libx11-dev - libxaw7-dev - xfonts-utils - script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" + script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make fetch-lua && make install" - os: linux env: DESCR=linux-xenial-gcc-minimal HINTS=linux-minimal compiler: gcc @@ -67,46 +67,23 @@ matrix: sed -i '/^#define SHELL/d' include/unixconf.h sed -i '/^#define SUSPEND/d' include/unixconf.h sed -i 's/^#define TEXTCOLOR//' include/unixconf.h - make install + make fetch-lua && make install cat dat/options - os: windows env: DESCR=windows-visualstudio language: shell script: -# - find /c/Program\ Files\ \(x86\) -iname 'rc.exe' -print -# - export - - export VSVER=2017 - - export MSVER=14.16.27023 - - export SDKVER=10.0.17763.0 - - export FRAMEVER=4.0.30319 - - export NETFXVER=4.6.1 - - export WKITVER=10.0.17134.0 -# - export TOOLSVER=Community - - export TOOLSVER=BuildTools - - export PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/Common7/IDE/VC/VCPackages:$PATH - - export PATH=/c/Program\ Files\ \(x86\)/Windows\ Kits/10/bin/$WKITVER/x64:$PATH - - export PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/VC/Tools/MSVC/$MSVER/bin/HostX64/x64:$PATH - - export PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/VC/Tools/MSVC/$MSVER/bin/HostX64/x86:$PATH - - export PATH=$PATH:/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/Common7/IDE/CommonExtensions/Microsoft/TestWindow - - export PATH=$PATH:/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/MSBuild/Current/bin/Roslyn - - export INCLUDE=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/$TOOLSVER/VC/Tools/MSVC/$MSVER/include - - export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/Include/$WKITVER/ucrt - - export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/include/$WKITVER/ucrt - - export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/include/$WKITVER/shared - - export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/include/$WKITVER/um - - export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/include/$WKITVER/winrt - - export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/include/$WKITVER/cppwinrt - - export LIB=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/VC/Tools/MSVC/$MSVER/ATLMFC/lib/x86 - - export LIB=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/VC/Tools/MSVC/$MSVER/lib/x86:$LIB - - export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/10/lib/$WKITVER/ucrt/x86:$LIB - - export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/10/lib/$WKITVER/um/x86:$LIB -# - export - - git clone --depth 1 https://github.com/wmcbrine/PDCurses.git ../pdcurses - - export ADD_CURSES=Y - - export PDCURSES_TOP=../../pdcurses - - cd src - - cp ../sys/winnt/Makefile.msc ./Makefile - - nmake install + - ./win/win32/vs2017/travisci.sh + - os: linux + env: DESCR=msdos-cross-on-linux HINTS=linux LUA_VERSION=5.3.5 + compiler: gcc + script: +# - export + - cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ + - make fetch-lua + - cd lib/lua-$LUA_VERSION/src && make a && cd ../../.. + - sh sys/msdos/msdos-cross-compile.sh + exclude: - os: windows # install: choco install mingw env: DESCR=windows-mingw @@ -117,7 +94,11 @@ matrix: - cd src - cp ../sys/winnt/Makefile.gcc ./Makefile - mingw32-make install - exclude: +# - os: osx +# osx_image: xcode10.3 +# env: DESCR=osx-xcode10.3-x11 HINTS=macosx10.14 WANT_WIN_CURSES=1 WANT_WIN_X11=1 USE_XPM=1 +# compiler: clang +# script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make install" - os: osx osx_image: xcode10.2 env: HINTS=macosx10.14 @@ -129,3 +110,17 @@ notifications: email: recipients: - devteam@nethack.org +# +deploy: + provider: releases + api_key: + secure: "U0Dt2CXrcG8Yi4taUCT/6AnM+0IJtdCv6IVG/2rGooUY3pZjNWE9XDM6X9ZeAmbI79aN6FPTppjUf3KbB/upYeJt+8mrjnxEk/ZTO1xXDDW8iL/DiqnczoFsMGmPsTM+Fkeak8bu0SifI7Qkx9i1N+zOyl2VdlaxGjchPfl/OJw2jcQs7rOGRfr23/rapZKTcFq+BFlxMiIHa0dXbCJ9vagdlyAeclOCtPjw1VoH/Cb/+0/Xlx2MFPncw4/1P+bO/fPantHyehh3/WCDVCnI4M7ftONpsTVRrQ+Hml89teUH9/1xXUOpbCeVghWr1rumLcQzMqLKNj2lP/gm9co2/DKpxiUPUzBfO/9Jvl1CNoEwPYQBRNb38kggDvAT4vKX38Oi5sZvumFEO4L0y7o4cW6SA4/CYIykfxOdkrryt8ltfWwopdy3I/DothYw31vJ9GsZOCAShFRAy3hJxYUbHhT+7SDUBadVSEkb4UqxQ+7zntAVT+Lp4DXLAfvsWxZGrQoP/IrWAgNOLRKILubpzh+YpadMH3Ygha2JRAeJAEZ3DnXf3vOOAucWnk4mNXDbW35GTDTAJDWMvddZCfsrUI/uHxgaRjFs9fLX1X5tqhGnsr27sKLWyX+zrIPVV0TPl3AzYPAf6Bc8Okeu+JEGQERvvgSasCuYcmhgYznBVJI=" + file_glob: true + file: + - "$TRAVIS_TAG.x86.zip" + skip_cleanup: true + on: + tags: true + prerelease: true + name: "Pre-Release build of NetHack 3.7.0" + body: "This is an auto generated Pre-Release build of NetHack 3.7.0" diff --git a/Cross-compiling b/Cross-compiling new file mode 100644 index 000000000..b3dbba6f6 --- /dev/null +++ b/Cross-compiling @@ -0,0 +1,510 @@ +Cross-compiling NetHack 3.7 Last edit: December 1, 2019 + +The NetHack 3.7 build process differs from the build process of previous +versions in some important ways that make it possible to use a cross-compiler +running on one platform (the "host" platform of the build) to produce a binary +NetHack package that can execute on an entirely different platform. + +Part A Contents: + A1. Why cross-compile? + A2. Building NetHack 3.6 (before) + A3. Building NetHack 3.7 (going forward) + A4. How was the build procedure reduced to 5 steps? + A5. How can I help with the cross-compiling initiative? + +Part B Contents: + B1. Two sets of compiles and procedures + B2. What needs to be built and executed on the HOST? + B3. What needs to be built for the TARGET? + B4. Case sample: msdos + +-------------------------------------------------------------------------------- + Part A - Cross-compiling NetHack +-------------------------------------------------------------------------------- + + +--------------------------+ + | A1. Why cross-compile? | + +--------------------------+ + +By using cross-compilers on host platforms with fast processors, plenty of RAM +and storage resources, and an available cross-compiler, it may be possible to +keep or resurrect a working version of NetHack on platforms that are now too +constrained to carry out the build process natively on the platform any more. + +Some of the constraints in carrying out a native build on the desired target +may include, but not necessarily be limited to, any of the following: + + o Access: Somebody with a working knowledge of the NetHack build process may + not have the desired target build platform available to them. Conversly, + somebody with a keen knowledge of the target platform, and access to it, + may not be all that familiar with the NetHack build process. + + o Resources: Address space limitations, insufficient RAM, low amounts of disk + storage, slow processor performance, may impede the ability to execute the + compile process on the target platform. + + o Compilers: Some of the native compilers on historical platforms may only + support the particular dialect of C that was popular when the platform and + compiler were in their prime. + +Another useful potential result of cross-compiling, is that it paves the way +for carrying out test and production builds of NetHack for multiple target +platforms through automated steps carried out on the host platform(s). + + + +-------------------------------------+ + | A2. Building NetHack 3.6 (before) | + +-------------------------------------+ + +Very generally, the build of NetHack in past versions required the following +steps to be carried out: + + 1. Compile and link util/makedefs. + 2. Run makedefs repeatedly with different command line options to produce + several output files that are required for: + (a) additional build steps to follow, including some header + files: pm.h, onames.h, date.h. + (b) creation of files, containing information required by, + or about the game during its execution, that are stored in a + portable, platform-independent way, that need to be inserted + into the game package. + (c) creation of files containing information required by, or about + the game during its execution, that are stored in an architecture + and/or platform and/or operating system dependent way, that need + to be inserted into the game package (the quest text format is + one example). + 3. Compile and link the level compiler. This step needs to execute + work-alike tools to lex and yacc, or needs to build pre-built lex and + yacc output (.c, .h files) that are provided in the sys/share part of + the NetHack source code tree. + 4. Execute the level compiler to read dat/*.des files and create + a set of binary output files that are architecture and/or operating + system dependent on the build platform, for use by the game during + its execution. + 5. Compile and link the dungeon compiler. Like the level compiler, this + step needs to execute work-alike tools to lex and yacc, or needs to + build pre-built lex and yacc output (.c, .h files) that are provided + in the sys/share part of the NetHack source code tree. + 6. Execute the dungeon compiler to read dat/dungeon.def and create + a set of binary output files that are architecture and/or operating + system dependent on the build platform, for use by the game during + its execution. + 7. Compile and link several less critical utilities such as uudecode, + tile-generation utilities, and so forth, all of which need to execute + on the build platform during the build process to produce output files + for use during the game, that are reasonably portable (not architecture + and/or operating system dependent; only the output of the utilities + becomes part of the game package, not the executable utilities + themselves. + 8. Compile and link the game itself. + 9. Package the game and its required files including the output from + previous steps 2b, 2c, 4, 6, 7 and 8 above. + +Steps 1, 2a, 2b, 7, and 9 above are not impediments to cross-compiling NetHack. + +Steps 2c, 3, 4, 5, 6 and 8 above are impediments to cross-compiling NetHack. + +That's because the files that those steps produce are very much tied to the +platform where the build of NetHack is being carried out. Variations between +platforms (such as 32-bit vs 64-bit, integer sizes, pointer sizes, processor +byte order, data alignment requirements, struct padding and the way bitfields +are stored) impact the portability of those data files between different +platforms and operating systems. If all those things happen to match, the files +might, just might, be usable across platforms, but the chances are against it, +and that certainly cannot be counted on. + + +------------------------------------------+ + | A3. Building NetHack 3.7 (going forward) | + +------------------------------------------+ + +Again, very generally, the build of NetHack in 3.7 requires the following +steps to be carried out: + + 1. Compile and link util/makedefs. + 2. Run makedefs repeatedly with different command line options to produce + several output files that are required for: + (a) additional build steps to follow, including some header + files: pm.h, onames.h, date.h. + (b) creation of files, containing information required by, + or about the game during its execution, that are stored in a + portable, platform-independent way, that need to be inserted + into the game package. + 3. Compile and link several less critical utilities such as uudecode, + tile-generation utilities, and so forth, all of which need to execute + on the build platform during the build process to produce output files + for use during the game, that are reasonably portable (not architecture + and/or operating system dependent; only the output of the utilities + becomes part of the game package, not the executable utilities + themselves. + 4. Compile and link the game components for the TARGET; that includes + NetHack itself, Lua, and any optional regular-expression or window port + libraries that you plan to link into the NetHack game executable. + 5. Package the game and its required files including the output from + previous steps 2b, 3 and 4 above. + +Step 4 is now the only impediment to cross-compiling NetHack, and is resolved +by executing step 4 using a cross-compiler that runs on the build (host) +platform to produce a resulting binary for the target platform, instead of +executing the native compiler. + + +-----------------------------------------------------+ + | A4. How was the build procedure reduced to 5 steps? | + +-----------------------------------------------------+ + +The following are among several design changes planned in NetHack 3.7, +and these specific changes are what altered the build process to make +cross-compiling possible: + + o There is no creation of platform-dependent files, such as the quest + text files, by makedefs during the build process. Instead, the quest + text files have been converted to Lua and are inserted into the game + package for processing by the embedded Lua + during execution of NetHack. + + o There is no build-time level compiler involved. Instead, the level + descriptions have been converted to Lua and are inserted into the game + package for processing by the embeded Lua + during execution of NetHack. + + o There is no build-time dungeon compiler involved. Instead, the dungeon + description has been converted to Lua and is inserted into the game + package for processing by the embeded Lua + during execution of NetHack. + + o Some of the build and option information that was formerly produced + during build time by makedefs, and contained information about the + build-platform specifically, is now produced at runtime within the + game under a cross-compiled build. As such, it now produces information + applicable to the target NetHack environment, not the build environment. + + +------------------------------------------------------------+ + | A5. How can I help with the cross-compiling initiative? | + +------------------------------------------------------------+ + + o If you have a favourite target platform (let's call it XX-Platform for + example purposes) that you'd like to see NetHack be able to run on, do + some research to find out if a cross-compiler exists that: + - produces output for XX-Platform. + - executes on a platform that you use and love (Linux, Windows, + Mac OS X are some examples of platforms that have cross-compilers + for other targets available) + + o Then, make the community, devteam, and otheres aware that you're starting + a cross-compile of NetHack for XX-Platform. You might need to ask some + "starting out" questions initially, and as you get deeper into it, you + might need to ask some tougher questions. + + o Perhaps consider forking from NetHack on GitHub, and do the + cross-compiler work there in your fork. Strive to get it to a point where + its ready to play-test on XX-Platform, or perhaps even use an emulator + of XX-Platform if one is available. We live in a time where plenty do. + + Doing your work on a GitHub fork has the following advantages: + - It will make it really simple to integrate your work back into + the NetHack source tree if that's one of your goals. + - It will make it possible and straightforward to merge upstream + NetHack changes into your work for the XX-Platform cross-compile + so that it stays current with the game as it evolves. + - You may get help from others in the form of suggestions, or + pull-requests, or offers to join the development. Chances are, + you aren't the only person out there that would like to + establish/resurrect/maintain NetHack on XX-Platform. + + Have fun! + +----------------------------------------------------------------------------- + Part B - Cross-compiling details +----------------------------------------------------------------------------- + +Part B Contents: + B1. Two sets of compiles and procedures + B2. What needs to be built and executed on the HOST? + B3. What needs to be built for the TARGET? + B4. Case sample: msdos + + +-----------------------------------------+ + | B1. Two sets of compiles and procedures | + +-----------------------------------------+ + +The HOST is the platform/place that you're running the build procedures using +the native compiler/linker, and the cross-compiler/linker that runs on the HOST +to build the game for a TARGET platform. + +You have to: + 1. Build mandatory utilities on the HOST. + 2. Execute the mandatory utilities to generate components that will be used + during step 4 to build the game itself, or that will generate components + that will become part of the TARGET game package. + 3. Build optional or enhancing utilities on the HOST, execute those + optional or enhancing utilities on the HOST to generate components that + will become part of the TARGET game package. + 4. Execute a supported cross-compiler to compile the rest of the game + components like NetHack, Lua, and any optional libraries. + (the word "supported", in this sense, means a compiler that runs on your + HOST build platform, and generates output executable files for the TARGET + platform. + +It should be mentioned that you can execute the cross-compile build approach +even to generate binaries for the same platform as the host, where the HOST +compilerand the TARGET compiler are actually one and the same. + + + +------------------------------------------------------+ + | B2. What needs to be built and executed on the HOST? | + +------------------------------------------------------+ + +On the HOST, here are the mandatory things that have to be built. + + a) Using the HOST native compiler, build HOST native utility makedefs + + Compile and link the following with these compiler switches: + -DCROSSCOMPILE and -DCROSSCOMPILE_HOST + from sources: util/makedefs.c, src/mdlib.c, src/monst.c, src/objects.c + + b) Execute HOST native makedefs utility, util/makedefs, as follows: + util/makedefs -v + util/makedefs -o + util/makedefs -p + util/makedefs -z + util/makedefs -d + util/makedefs -r + util/makedefs -h + util/makedefs -s + + c) Using the HOST native compiler, build these additional utilities if your + target platform requires components that they produce. It is important + to note that all of the required source files need to be compiled to + native obj files for linking into the HOST-side utility. Some of the + source files (src/monst.c, src/objects.c) were likely already compiled + as native HOST-side obj files in order to build the native HOST utility + 'makedefs' HOST utility above, and you don't need to compile them again + for use in linking other HOST utilities if the HOST-native obj files + produced from them are still around. + + NOTE: A few other source files (src/drawing.c, src/decl.c) that need to + be compiled for native HOST utilities, also need to be compiled again + later as TARGET obj files for linking into the TARGET executable. It is + important to keep the compiled HOST-side obj files produced by the HOST + native compiler, and the TARGET-side obj files produced by the + cross-compiler separate and distinct from one another. That can be done + either by naming the differing object files a little differently + (perhaps with a suffix), or by placing the HOST-side obj files and the + TARGET-side obj files into different folders during the build process. + Whatever works best for your cross-compile. + + util/dlb + + from sources: src/dlb.c, src/dlb_main.c, src/alloc.c, + src/panic.c + purpose: For packaging up many files that are + required components of the TARGET game + into a single nhdat or nhdat370 combined + file + + util/uudecode + + from sources: sys/share/uudecode.c + purpose: convert some binary files, that are + distributed in the NetHack sources in + uuencoded format, back into their + original binary state + util/tilemap + + from sources: win/share/tilemap.c + purpose: produce output file src/tile.c that is + required for building TARGET packages with + tile support + + util/tile2bmp + + from sources: win/share/tile2bmp.c, win/share/tiletext.c, + win/share/tilemap.c, src/drawing.c, + src/decl.c, src/monst.c, src/objects.c + purpose: + + util/gif2txt + + from sources: win/share/gifread.c, win/share/tiletext.c, + win/share/tilemap.c, src/drawing.c, + src/decl.c, src/monst.c, src/objects.c, + src/alloc.c, src/panic.c + purpose: + + util/ppmwrite + + from sources: win/share/ppmwrite.c, win/share/tiletext.c, + win/share/tilemap.c, src/drawing.c, + src/decl.c, src/monst.c, src/objects.c, + src/alloc.c, src/panic.c + purpose: + + + +--------------------------------------------+ + | B3. What needs to be built for the TARGET? | + +--------------------------------------------+ + + +For the TARGET side, here are the mandatory things that have to be built via +the HOST-executed cross-compiler that generates code for the TARGET platform. + +Using the cross-compiler, build the following targets: + + a) NetHack sources (core is mandatory) + + With the cross-compiler and linker for the TARGET platform, + cross-compile and link with these compiler switches: + -DCROSSCOMPILE and -DCROSSCOMPILE_TARGET + + core sources (2019): src/allmain.c, src/apply.c, src/artifact.c, + src/attrib.c, src/ball.c, src/bones.c, + src/botl.c, src/cmd.c, src/dbridge.c, src/decl.c, + src/detect.c, src/dig.c, src/display.c, src/do.c, + src/do_name.c, src/do_wear.c, src/dog.c, + src/dogmove.c, src/dokick.c, src/dothrow.c, + src/drawing.c, src/dungeon.c, src/eat.c, src/end.c, + src/engrave.c, src/exper.c, src/explode.c, + src/extralev.c, src/files.c, src/fountain.c, + src/hack.c, src/hacklib.c, src/invent.c, + src/isaac64.c, src/light.c, src/lock.c, src/mail.c, + src/makemon.c, src/mapglyph.c, src/mcastu.c, + src/mdlib.c, src/mhitm.c, src/mhitu.c, src/minion.c, + src/mklev.c, src/mkmap.c, src/mkmaze.c, src/mkobj.c, + src/mkroom.c, src/mon.c, src/mondata.c, src/monmove.c, + src/monst.c, src/mplayer.c, src/mthrowu.c, src/muse.c, + src/music.c, src/nhlsel.c, src/nhlua.c, src/o_init.c, + src/objects.c, src/objnam.c, src/options.c, + src/pager.c, src/pickup.c, src/pline.c, + src/polyself.c, src/potion.c, src/pray.c, + src/priest.c, src/quest.c, src/questpgr.c, + src/random.c, src/read.c, src/rect.c, src/region.c, + src/restore.c, src/rip.c, src/rnd.c, src/role.c, + src/rumors.c, src/save.c, src/sfstruct.c, + src/shk.c, src/shknam.c, src/sit.c, src/sounds.c, + src/sp_lev.c, src/spell.c, src/steal.c, src/steed.c, + src/sys.c, src/teleport.c, src/tile.c, + src/timeout.c, src/topten.c, src/track.c, + src/trap.c, src/u_init.c, src/uhitm.c, src/vault.c, + src/version.c, src/vis_tab.c, src/vision.c, + src/weapon.c, src/were.c, src/wield.c, src/windows.c, + src/wizard.c, src/worm.c, src/worn.c, src/write.c, + src/zap.c, sys/share/cppregex.cpp + + tty sources: win/tty/getline.c, win/tty/termcap.c, + win/tty/topl.c, win/tty/wintty.c + + plus your platform-specific source files that contain main, typically + *main.c, and unix support in *unix.c, tty support in *tty.c, and other + system support in *sys.c as well as others sources pertaining to your + specific target platform(s). + + b) Lua (mandatory in 3.7) + + lib/lua-5.3.5/src + + from sources: lua.c, lapi.c, lauxlib.c, lbaselib.c, lcode.c, + lcorolib.c, lctype.c, ldblib.c, ldebug.c, + ldo.c, ldump.c, lfunc.c, lgc.c, linit.c, + liolib.c, llex.c, lmathlib.c, lmem.c, + loadlib.c, lobject.c, lopcodes.c, + loslib.c, lparser.c, lstate.c, lstring.c, + lstrlib.c, ltable.c, ltablib.c, ltm.c, + lundump.c, lutf8lib.c, lvm.c, lzio.c, + lbitlib.c + purpose: links into the game executable to interpret + lua level description files, lua dungeon + description files, and a lua quest text file. + + d) recover (optional if desired/required; some targets have recover + functionality built into NetHack itself) + + c) Additional optional library packages/obj files as required + + lib/pdcurses/... + + from sources: addch.c, addchstr.c, addstr.c, attr.c, beep.c, + bkgd.c, border.c, clear.c, color.c, delch.c, + deleteln.c, getch.c, getstr.c, getyx.c, + inch.c, inchstr.c, initscr.c, inopts.c, + insch.c, insstr.c, instr.c, kernel.c, + keyname.c, mouse.c, move.c, outopts.c, + overlay.c, pad.c, panel.c, printw.c, + refresh.c, scanw.c, scr_dump.c, scroll.c, + slk.c, termattr.c, touch.c, util.c, window.c, + debug.c, pdcclip.c, pdcdisp.c, pdcgetsc.c, + pdckbd.c, pdcutil.c + purpose: underlying curses platform support for some + target platforms where inclusion of the + NetHack curses window port in win/curses is + desired + + +-------------------------+ + | B4. Case sample: msdos | + +-------------------------+ + +Cross-compiler used: Andrew Wu's djgpp cross-compiler +Cross-compiler url: https://github.com/andrewwutw/build-djgpp +Cross-compiler pre-built binary downloads: + https://github.com/andrewwutw/build-djgpp/releases/download/v2.9/ + Mac OS X pre-built binary: djgpp-osx-gcc550.tar.bz2 (tested) + Linux pre-built binary : djgpp-linux64-gcc550.tar.bz2 (tested) + mingw pre-built binary : djgpp-mingw-gcc550-standalone.zip (untested) + +The msdos cross-compile for NetHack 3.7 uses two phases of compiles: +Phase1 is the host-side prerequisite stuff that needs to be done first. +Phase2 is the cross-compile pieces using the djgpp cross-compiler hosted on +Linux, Mac OS X, or Windows mingw. + +First, on the host platform, you need to set up for a native Unix NetHack +build in the usual way. For example, on linux: + cd sys/unix + sh setup.sh hints/linux + cd ../.. + make fetch-lua + +Now, you could proceed to go ahead and issue + make all +to build a native NetHack at that point if you wish, but it is not needed +for the msdos cross-compile. + +Instead, a test shell script has been put together that will next accomplish +each of the following tasks when it is executed. The shell script can be +invoked by: + sh sys/msdos/msdos-cross-compile.sh +but before you do that, please read the paragraphs below. + +The shell script is meant to accomplish the following things: + + Prep : the script downloads the djgpp cross-compiler for the host + platform into lib/djgpp (it doesn't install anything on the + system, nor does it need to, it just downloads them into the + identified directories), it downloads a copy of the msdos + dos-extender into lib/djgpp/cwsdpmi for later packaging up with + the msdos game, and it downloads pdcurses into lib/pdcurses + for cross-compiling during the TARGET build. + + Be certain to ensure the right products are at the url's + identified above *before* you execute the Case sample msdos + cross-compile script. The correct products were at those url's + at the time this was written in Dec 2019, but we don't assume + any responsibility for what is at those url's now or in the + future. You need to check before executing the script. + + Phase1 : the script uses the Makefile sys/msdos/Makefile1.cross + to complete the host-side build steps using the native gcc + compiler for the host platform. During phase1 the host obj + files are put in subfolder src/host_o to keep them separated + and distinguishable from the target obj files that will be + built in phase2. + + Phase2 : the script uses the Makefile sys/msdos/Makefile2.cross + to complete the target-side build steps using the + cross-compiler that was obtained during the prep step of the + script described above. During phase2 the target obj files + are put in src/msdos_o to keep them separated and + distinguishable from the host obj files + + Package: the script then packages up the results that reside in + msdos-binary into a zip file which it places in lib called + nh370dos.zip. + + diff --git a/Files b/Files index 90d78de52..93cde626b 100644 --- a/Files +++ b/Files @@ -7,7 +7,8 @@ from or not transferred to your system if you wish. .: (files in top directory) -.clang-format .travis.yml Files Porting README +.clang-format .travis.yml Cross-compiling Files +Porting README DEVEL: (files for people developing changes to NetHack) @@ -30,29 +31,49 @@ prepare-commit-msg dat: (files for all versions) -Arch.des Barb.des Caveman.des GENFILES Healer.des -Knight.des Monk.des Priest.des Ranger.des Rogue.des -Samurai.des Tourist.des Valkyrie.des Wizard.des bigroom.des -bogusmon.txt castle.des cmdhelp data.base dungeon.def -endgame.des engrave.txt epitaph.txt gehennom.des help -hh history keyhelp knox.des license -medusa.des mines.des opthelp oracle.des oracles.txt -quest.txt rumors.fal rumors.tru sokoban.des symbols -tower.des tribute wizhelp yendor.des +Arc-fila.lua Arc-filb.lua Arc-goal.lua Arc-loca.lua Arc-strt.lua +Bar-fila.lua Bar-filb.lua Bar-goal.lua Bar-loca.lua Bar-strt.lua +Cav-fila.lua Cav-filb.lua Cav-goal.lua Cav-loca.lua Cav-strt.lua +GENFILES Hea-fila.lua Hea-filb.lua Hea-goal.lua Hea-loca.lua +Hea-strt.lua Kni-fila.lua Kni-filb.lua Kni-goal.lua Kni-loca.lua +Kni-strt.lua Mon-fila.lua Mon-filb.lua Mon-goal.lua Mon-loca.lua +Mon-strt.lua Pri-fila.lua Pri-filb.lua Pri-goal.lua Pri-loca.lua +Pri-strt.lua Ran-fila.lua Ran-filb.lua Ran-goal.lua Ran-loca.lua +Ran-strt.lua Rog-fila.lua Rog-filb.lua Rog-goal.lua Rog-loca.lua +Rog-strt.lua Sam-fila.lua Sam-filb.lua Sam-goal.lua Sam-loca.lua +Sam-strt.lua Tou-fila.lua Tou-filb.lua Tou-goal.lua Tou-loca.lua +Tou-strt.lua Val-fila.lua Val-filb.lua Val-goal.lua Val-loca.lua +Val-strt.lua Wiz-fila.lua Wiz-filb.lua Wiz-goal.lua Wiz-loca.lua +Wiz-strt.lua air.lua asmodeus.lua astral.lua baalz.lua +bigrm-1.lua bigrm-2.lua bigrm-3.lua bigrm-4.lua bigrm-5.lua +bigrm-6.lua bigrm-7.lua bigrm-8.lua bigrm-9.lua bigrm-10.lua +bogusmon.txt castle.lua cmdhelp data.base dungeon.lua +earth.lua engrave.txt epitaph.txt fakewiz1.lua fakewiz2.lua +fire.lua help hh history juiblex.lua +keyhelp knox.lua license medusa-1.lua medusa-2.lua +medusa-3.lua medusa-4.lua minefill.lua minend-1.lua minend-2.lua +minend-3.lua minetn-1.lua minetn-2.lua minetn-3.lua minetn-4.lua +minetn-5.lua minetn-6.lua minetn-7.lua nhlib.lua opthelp +oracle.lua oracles.txt orcus.lua quest.lua rumors.fal +rumors.tru sanctum.lua soko1-1.lua soko1-2.lua soko2-1.lua +soko2-2.lua soko3-1.lua soko3-2.lua soko4-1.lua soko4-2.lua +symbols tower1.lua tower2.lua tower3.lua tribute +valley.lua water.lua wizard1.lua wizard2.lua wizard3.lua +wizhelp doc: (files for all versions) -Guidebook.mn Guidebook.tex Guidebook.txt config.nh dgn_comp.6 -dgn_comp.txt dlb.6 dlb.txt fixes10.0 fixes14.f -fixes22.0 fixes23.e fixes30.0 fixes30.pl01 fixes30.pl02 -fixes30.pl03 fixes30.pl04 fixes30.pl05 fixes30.pl06 fixes30.pl07 -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 mn.7 -mnh.7 nethack.6 nethack.txt recover.6 recover.txt -tmac.n tmac.nh window.doc +Guidebook.mn Guidebook.tex Guidebook.txt config.nh dlb.6 +dlb.txt fixes10.0 fixes14.f fixes22.0 fixes23.e +fixes30.0 fixes30.pl01 fixes30.pl02 fixes30.pl03 fixes30.pl04 +fixes30.pl05 fixes30.pl06 fixes30.pl07 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 fixes36.3 fixes36.4 +fixes36.5 fixes37.0 fixesXX.X 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) @@ -61,9 +82,6 @@ bitmfile.h gem_rsc.h load_img.h wingem.h (file for GNOME versions) winGnome.h -(files for Qt versions) -qt_clust.h qt_kde0.h qt_win.h qt_xpms.h qttableview.h - (files for X versions) tile2x11.h winX.h xwindow.h xwindowp.h @@ -73,16 +91,16 @@ beconf.h botl.h color.h config.h config1.h context.h coord.h decl.h def_os2.h dgn_file.h display.h dlb.h dungeon.h engrave.h extern.h flag.h func_tab.h global.h hack.h integer.h -isaac64.h lev.h lint.h mail.h mextra.h -mfndpos.h micro.h mkroom.h monattk.h mondata.h -monflag.h monst.h monsym.h ntconf.h obj.h -objclass.h os2conf.h patchlevel.h pcconf.h permonst.h -prop.h qtext.h quest.h rect.h region.h -rm.h skills.h sp_lev.h spell.h sys.h -system.h tcap.h tileset.h timeout.h tosconf.h -tradstdc.h trampoli.h trap.h unixconf.h vision.h -vmsconf.h wceconf.h winami.h wincurs.h winprocs.h -wintype.h you.h youprop.h +isaac64.h lint.h mail.h mextra.h mfndpos.h +micro.h mkroom.h monattk.h mondata.h monflag.h +monst.h monsym.h ntconf.h obj.h objclass.h +os2conf.h patchlevel.h pcconf.h permonst.h prop.h +quest.h rect.h region.h rm.h skills.h +sp_lev.h spell.h sys.h system.h tcap.h +tileset.h timeout.h tosconf.h tradstdc.h trampoli.h +trap.h unixconf.h vision.h vmsconf.h wceconf.h +winami.h wincurs.h winprocs.h wintype.h you.h +youprop.h (file for tty versions) wintty.h @@ -100,36 +118,36 @@ dog.c dogmove.c dokick.c dothrow.c drawing.c dungeon.c eat.c end.c engrave.c exper.c explode.c extralev.c files.c fountain.c hack.c hacklib.c invent.c isaac64.c light.c lock.c mail.c makemon.c mapglyph.c mcastu.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 o_init.c objects.c -objnam.c options.c pager.c pickup.c pline.c polyself.c -potion.c pray.c priest.c quest.c questpgr.c read.c -rect.c region.c restore.c rip.c rnd.c role.c -rumors.c save.c shk.c shknam.c sit.c sounds.c -sp_lev.c spell.c steal.c steed.c sys.c teleport.c -timeout.c topten.c track.c trap.c u_init.c uhitm.c -vault.c version.c vision.c weapon.c were.c wield.c -windows.c wizard.c worm.c worn.c write.c zap.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 nhlobj.c +nhlsel.c nhlua.c o_init.c objects.c objnam.c options.c +pager.c pickup.c pline.c polyself.c potion.c pray.c +priest.c quest.c questpgr.c read.c rect.c region.c +restore.c rip.c rnd.c role.c rumors.c save.c +sfstruct.c shk.c shknam.c sit.c sounds.c sp_lev.c +spell.c steal.c steed.c sys.c teleport.c timeout.c +topten.c track.c trap.c u_init.c uhitm.c vault.c +version.c vision.c weapon.c were.c wield.c windows.c +wizard.c worm.c worn.c write.c zap.c sys/amiga: -(files for Amiga versions - untested for 3.6.2) +(files for Amiga versions - untested for 3.6.4) Build.ami Install.ami Makefile.agc Makefile.ami NetHack.cnf amidos.c amidos.p amifont.uu amifont8.uu amigst.c -amii.hlp amimenu.c amirip.c amisnd.c amistack.c -amitty.c amiwind.c amiwind.p clipwin.c colorwin.c -cvtsnd.c grave16.xpm ifchange mkdmake txt2iff.c -winami.c winami.p winchar.c windefs.h winext.h -winfuncs.c winkey.c winmenu.c winproto.h winreq.c -winstr.c xpm2iff.c +amii.hlp amimenu.c amirip.c amistack.c amitty.c +amiwind.c amiwind.p clipwin.c colorwin.c grave16.xpm +ifchange mkdmake txt2iff.c winami.c winami.p +winchar.c windefs.h winext.h winfuncs.c winkey.c +winmenu.c winproto.h winreq.c winstr.c xpm2iff.c sys/atari: -(files for Atari version - untested for 3.6.2) +(files for Atari version - untested for 3.6.4) Install.tos atarifnt.uue nethack.mnu setup.g tos.c unx2atar.sed sys/be: -(files for BeOS version - untested for 3.6.2) +(files for BeOS version - untested for 3.6.4) README bemain.c sys/mac: @@ -137,23 +155,27 @@ sys/mac: Files.r Install.mw MacHelp NHDeflts NHrsrc.hqx NHsound.hqx News README carbon.plist dprintf.c maccurs.c macerrs.c macfile.c machelp.hqx macmain.c -macmenu.c macsnd.c mactopl.c mactty.c macunix.c -macwin.c mgetline.c mmodal.c mrecover.c mrecover.hqx -mttymain.c +macmenu.c mactopl.c mactty.c macunix.c macwin.c +mgetline.c mmodal.c mrecover.c mrecover.hqx mttymain.c sys/msdos: -(files for MSDOS version - untested for 3.6.2) -Install.dos Makefile.BC Makefile.GCC Makefile.MSC SCHEMA35.MSC -moveinit.pat msdos.c msdoshlp.txt ovlinit.c pckeys.c -pctiles.c pctiles.h pcvideo.h portio.h schema1.BC -schema2.BC schema3.MSC setup.bat sound.c tile2bin.c -vesa.h video.c vidtxt.c vidvesa.c vidvga.c +(files for MSDOS version - tested for 3.6.4 via partial cross-compile only) +Install.dos Makefile.BC Makefile.GCC +Makefile.MSC Makefile1.cross Makefile2.cross +SCHEMA35.MSC moveinit.pat msdos-cross-compile.sh +msdos.c msdoshlp.txt ovlinit.c +pckeys.c pctiles.c pctiles.h +pcvideo.h portio.h schema1.BC +schema2.BC schema3.MSC setup.bat +sysconf tile2bin.c vesa.h +video.c vidtxt.c vidvesa.c +vidvga.c (files for running MSDOS binary under Windows) nhico.uu nhpif.uu sys/os2: -(files for OS/2 version - untested for 3.6.2) +(files for OS/2 version - untested for 3.6.4) Install.os2 Makefile.os2 nhpmico.uu os2.c sys/share: @@ -163,10 +185,10 @@ random.c (Berkeley uudecode file, which may be used in build process of any version) uudecode.c -(file for MSDOS, OS/2, Amiga, and Atari versions - untested for 3.6.2) +(file for MSDOS, OS/2, Amiga, and Atari versions - untested for 3.6.4) pcmain.c -(file for MSDOS, OS/2, and Atari versions - untested for 3.6.2) +(file for MSDOS, OS/2, and Atari versions - untested for 3.6.4) NetHack.cnf pctty.c (file for MSDOS, OS/2, and VMS versions) @@ -178,18 +200,15 @@ nhlan.c (file for VMS version) tclib.c -(files for MSDOS and OS/2 versions - untested for 3.6.2) +(files for MSDOS and OS/2 versions - untested for 3.6.4) Makefile.lib termcap.uu -(files for MSDOS, OS/2 and Atari versions - untested for 3.6.2) +(files for MSDOS, OS/2 and Atari versions - tested on MSDOS for 3.6.4 via partial cross-compile only) pcsys.c pcunix.c (files for UNIX and Be versions) ioctl.c unixtty.c -(lex/yacc output for special level and dungeon compilers) -dgn_comp.h dgn_lex.c dgn_yacc.c lev_comp.h lev_lex.c lev_yacc.c - (posix regex for versions that include regex in their C library) posixregex.c @@ -199,11 +218,6 @@ cppregex.cpp (pmatch regex for other versions) pmatchregex.c -sys/share/sounds: -(files for Amiga and Macintosh versions) -README bell.uu bugle.uu erthdrum.uu firehorn.uu frsthorn.uu -lethdrum.uu mgcflute.uu mgcharp.uu toolhorn.uu wdnflute.uu wdnharp.uu - sys/unix: (files for UNIX versions) Install.unx Makefile.dat Makefile.doc Makefile.src @@ -215,9 +229,6 @@ unixmain.c unixres.c unixunix.c (files for replacement cpp, only needed by some ancient UNIX systems) cpp1.shr cpp2.shr cpp3.shr -(file for sound driver for 386 UNIX) -snd86unx.shr - sys/unix/NetHack.xcodeproj: (file for UNIX versions) project.pbxproj @@ -251,7 +262,7 @@ spec_lev.com sysconf vmsbuild.com vmsfiles.c vmsmail.c vmsmain.c vmsmisc.c vmstty.c vmsunix.c sys/wince: -(files for Windows CE and PocketPC - untested for 3.6.2) +(files for Windows CE and PocketPC - untested for 3.6.4) Install.ce bootstrp.mak celib.c cesetup.bat cesound.c defaults.nh keypad.uu menubar.uu mhaskyn.c mhaskyn.h mhcmd.c mhcmd.h mhcolor.c mhcolor.h mhdlg.c @@ -264,7 +275,7 @@ resource.h winMS.h winhack.c winhack.rc winhcksp.rc winmain.c sys/wince/ceinc: -(header files for Windows CE and PocketPC - untested for 3.6.2) +(header files for Windows CE and PocketPC - untested for 3.6.4) assert.h errno.h fcntl.h sys/wince/ceinc/sys: @@ -273,42 +284,46 @@ stat.h sys/winnt: (files for Windows 7/8.x/10 version) -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 stub-pdcscrn.c stubs.c -sysconf win10.c win10.h win32api.h -windmain.c winnt.c winos.h +.nethackrc.template Install.nt Makefile.gcc +Makefile.msc console.rc nethack.def +nh340key.c nhdefkey.c nhico.uu +nhraykey.c nhsetup.bat ntsound.c +nttty.c porthelp stub-pdcscrn.c +stubs.c sysconf.template win10.c +win10.h win32api.h windmain.c +winnt.c winos.h + +test: +(files in top directory) +test_des.lua test_lev.lua test_obj.lua test_sel.lua test_src.lua +testwish.lua util: (files for all versions) -dgn_main.c dlb_main.c lev_main.c makedefs.c mdgrep.h mdgrep.pl -panic.c recover.c - -(lex/yacc input for special level and dungeon compilers) -dgn_comp.l dgn_comp.y lev_comp.l lev_comp.y +dlb_main.c makedefs.c mdgrep.h mdgrep.pl panic.c recover.c win/Qt: +(files for the Qt 4 or 5 widget library - X11, Windows, Mac OS X) +qt_bind.cpp qt_bind.h qt_click.cpp qt_click.h qt_clust.cpp +qt_clust.h qt_delay.cpp qt_delay.h qt_glyph.cpp qt_glyph.h +qt_icon.cpp qt_icon.h qt_inv.cpp qt_inv.h qt_kde0.h +qt_key.cpp qt_key.h qt_line.cpp qt_line.h qt_main.cpp +qt_main.h qt_map.cpp qt_map.h qt_menu.cpp qt_menu.h +qt_msg.cpp qt_msg.h qt_plsel.cpp qt_plsel.h qt_rip.cpp +qt_rip.h qt_set.cpp qt_set.h qt_stat.cpp qt_stat.h +qt_str.cpp qt_str.h qt_streq.cpp qt_streq.h qt_svsel.cpp +qt_svsel.h qt_win.cpp qt_win.h qt_xcmd.cpp qt_xcmd.h +qt_xpms.h qt_yndlg.cpp qt_yndlg.h + +win/Qt3: (files for the Qt 3 widget library - X11, Windows, Mac OS X, or Qtopia) Info.plist Install.Qt knethack.lnk -knh-mini.xpm knh.xpm nhicns.uu -nhsplash.xpm qpe-nethack.control qt_clust.cpp -qt_win.cpp qttableview.cpp tileedit.cpp +knh-mini.xpm knh.xpm qpe-nethack.control +qt3_clust.cpp qt3_clust.h qt3_kde0.h +qt3_win.cpp qt3_win.h qt3_xpms.h +qt3tableview.cpp qt3tableview.h tileedit.cpp tileedit.h -win/Qt4: -(files for the Qt 4 widget library - X11, Windows, Mac OS X) -qt4bind.cpp qt4bind.h qt4click.cpp qt4click.h qt4clust.cpp -qt4clust.h qt4delay.cpp qt4delay.h qt4glyph.cpp qt4glyph.h -qt4icon.cpp qt4icon.h qt4inv.cpp qt4inv.h qt4kde0.h -qt4key.cpp qt4key.h qt4line.cpp qt4line.h qt4main.cpp -qt4main.h qt4map.cpp qt4map.h qt4menu.cpp qt4menu.h -qt4msg.cpp qt4msg.h qt4plsel.cpp qt4plsel.h qt4rip.cpp -qt4rip.h qt4set.cpp qt4set.h qt4stat.cpp qt4stat.h -qt4str.cpp qt4str.h qt4streq.cpp qt4streq.h qt4svsel.cpp -qt4svsel.h qt4win.cpp qt4win.h qt4xcmd.cpp qt4xcmd.h -qt4yndlg.cpp qt4yndlg.h - win/X11: (files for X versions) Install.X11 NetHack.ad Window.c dialogs.c ibm.bdf @@ -328,12 +343,12 @@ cursinit.h cursinvt.c cursinvt.h cursmain.c cursmesg.c cursmesg.h cursmisc.c cursmisc.h cursstat.c cursstat.h curswins.c curswins.h win/gem: -(files for GEM versions - untested for 3.6.2) +(files for GEM versions - untested for 3.6.4) Install.gem bitmfile.c gem_rsc.uu gem_rso.uu gr_rect.c gr_rect.h load_img.c tile2img.c title.uu wingem.c wingem1.c xpm2img.c win/gnome: -(files for GNOME versions - untested for 3.6.2) +(files for GNOME versions - untested for 3.6.4) README gn_xpms.h gnaskstr.c gnaskstr.h gnbind.c gnbind.h gnglyph.c gnglyph.h gnmain.c gnmain.h gnmap.c gnmap.h gnmenu.c gnmenu.h gnmesg.c gnmesg.h gnomeprv.h gnopts.c @@ -348,10 +363,10 @@ NetHackTerm.applescript recover.pl win/share: (files for versions using optional tiles) -bmptiles.c gifread.c giftiles.c monsters.txt objects.txt -other.txt ppmwrite.c renumtiles.pl safeproc.c thintile.c -tile.doc tile.h tile2bmp.c tilemap.c tileset.c -tiletext.c +bmptiles.c gifread.c giftiles.c monsters.txt nhicns.uu +nhsplash.xpm objects.txt other.txt ppmwrite.c renumtiles.pl +safeproc.c thintile.c tile.doc tile.h tile2bmp.c +tilemap.c tileset.c tiletext.c win/tty: (files for tty versions) @@ -359,74 +374,106 @@ getline.c termcap.c topl.c wintty.c win/win32: (files for Windows versions - tested up to Windows 10) -NetHackW.exe.manifest dgnstuff-mingw32.mak dgnstuff.mak -levstuff-mingw32.mak levstuff.mak mhaskyn.c -mhaskyn.h mhdlg.c mhdlg.h -mhfont.c mhfont.h mhinput.c -mhinput.h mhmain.c mhmain.h -mhmap.c mhmap.h mhmenu.c -mhmenu.h mhmsg.h mhmsgwnd.c -mhmsgwnd.h mhrip.c mhrip.h -mhsplash.c mhsplash.h mhstatus.c -mhstatus.h mhtext.c mhtext.h -mnsel.uu mnselcnt.uu mnunsel.uu -mswproc.c nethack.rc nhresource.h -petmark.uu pilemark.uu record.uu -resource.h rip.uu splash.uu -tiles-mingw32.mak tiles.mak winMS.h -winhack.c winhack.rc +NetHackW.c NetHackW.exe.manifest NetHackW.rc +mhaskyn.c mhaskyn.h mhdlg.c +mhdlg.h mhfont.c mhfont.h +mhinput.c mhinput.h mhmain.c +mhmain.h mhmap.c mhmap.h +mhmenu.c mhmenu.h mhmsg.h +mhmsgwnd.c mhmsgwnd.h mhrip.c +mhrip.h mhsplash.c mhsplash.h +mhstatus.c mhstatus.h mhtext.c +mhtext.h mnsel.uu mnselcnt.uu +mnunsel.uu mswproc.c nethack.rc +nhresource.h petmark.uu pilemark.uu +record.uu resource.h rip.uu +splash.uu tiles-mingw32.mak tiles.mak +winMS.h win/win32/vs2017: (files for Visual Studio 2017 Community Edition builds) -NetHack.sln NetHack.vcxproj NetHackW.vcxproj -PDCurses.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 default_lib.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 +NetHackPackage.appxmanifest NetHackPackage.wapproj +NetHackProperties.props NetHackW.vcxproj +PDCurses.vcxproj Package.StoreAssociation.xml +ScreenShot.PNG afterdlb.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 +default_lib.props dirs.props +dlb.vcxproj dll.props +files.props makedefs.vcxproj +nh340key.def nh340key.vcxproj +nhdefkey.def nhdefkey.vcxproj +nhraykey.def nhraykey.vcxproj +recover.vcxproj tile2bmp.vcxproj +tilemap.vcxproj tiles.vcxproj +travisci.sh uudecode.vcxproj + +win/win32/vs2017/Images: +(files for Visual Studio 2017 Community Edition builds) +BadgeLogo.scale-100.png +BadgeLogo.scale-125.png +BadgeLogo.scale-150.png +BadgeLogo.scale-200.png +BadgeLogo.scale-400.png +LargeTile.scale-100.png +LargeTile.scale-125.png +LargeTile.scale-150.png +LargeTile.scale-200.png +LargeTile.scale-400.png +LockScreenLogo.scale-200.png +SmallTile.scale-100.png +SmallTile.scale-125.png +SmallTile.scale-150.png +SmallTile.scale-200.png +SmallTile.scale-400.png +SplashScreen.scale-100.png +SplashScreen.scale-125.png +SplashScreen.scale-150.png +SplashScreen.scale-200.png +SplashScreen.scale-400.png +Square150x150Logo.scale-100.png +Square150x150Logo.scale-125.png +Square150x150Logo.scale-150.png +Square150x150Logo.scale-200.png +Square150x150Logo.scale-400.png +Square44x44Logo.altform-unplated_targetsize-16.png +Square44x44Logo.altform-unplated_targetsize-256.png +Square44x44Logo.altform-unplated_targetsize-32.png +Square44x44Logo.altform-unplated_targetsize-48.png +Square44x44Logo.scale-100.png +Square44x44Logo.scale-125.png +Square44x44Logo.scale-150.png +Square44x44Logo.scale-200.png +Square44x44Logo.scale-400.png +Square44x44Logo.targetsize-16.png +Square44x44Logo.targetsize-24.png +Square44x44Logo.targetsize-24_altform-unplated.png +Square44x44Logo.targetsize-256.png +Square44x44Logo.targetsize-32.png +Square44x44Logo.targetsize-48.png +StoreLogo.backup.png +StoreLogo.scale-100.png +StoreLogo.scale-125.png +StoreLogo.scale-150.png +StoreLogo.scale-200.png +StoreLogo.scale-400.png +Wide310x150Logo.scale-100.png +Wide310x150Logo.scale-125.png +Wide310x150Logo.scale-150.png +Wide310x150Logo.scale-200.png +Wide310x150Logo.scale-400.png 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 -Hea-fila.lev Hea-filb.lev Hea-goal.lev Hea-loca.lev Hea-strt.lev -Kni-fila.lev Kni-filb.lev Kni-goal.lev Kni-loca.lev Kni-strt.lev -Mon-fila.lev Mon-filb.lev Mon-goal.lev Mon-loca.lev Mon-strt.lev -Pri-fila.lev Pri-filb.lev Pri-goal.lev Pri-loca.lev Pri-strt.lev -Ran-fila.lev Ran-filb.lev Ran-goal.lev Ran-loca.lev Ran-strt.lev -Rog-fila.lev Rog-filb.lev Rog-goal.lev Rog-loca.lev Rog-strt.lev -Sam-fila.lev Sam-filb.lev Sam-goal.lev Sam-loca.lev Sam-strt.lev -Tou-fila.lev Tou-filb.lev Tou-goal.lev Tou-loca.lev Tou-strt.lev -Val-fila.lev Val-filb.lev Val-goal.lev Val-loca.lev Val-strt.lev -Wiz-fila.lev Wiz-filb.lev Wiz-goal.lev Wiz-loca.lev Wiz-strt.lev -air.lev asmodeus.lev astral.lev baalz.lev bigrm-1.lev -bigrm-2.lev bigrm-3.lev bigrm-4.lev bigrm-5.lev bigrm-6.lev -bigrm-7.lev bigrm-8.lev bigrm-9.lev bigrm-10.lev castle.lev -earth.lev fakewiz1.lev fakewiz2.lev fire.lev juiblex.lev -knox.lev medusa-1.lev medusa-2.lev medusa-3.lev medusa-4.lev -minefill.lev minend-1.lev minend-2.lev minend-3.lev minetn-1.lev -minetn-2.lev minetn-3.lev minetn-4.lev minetn-5.lev minetn-6.lev -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 +data options oracles rumors (files generated for Qt interface on Mac OS X) Info.plist nethack.icns diff --git a/Porting b/Porting index baccb37d5..cc27f9965 100644 --- a/Porting +++ b/Porting @@ -1,4 +1,4 @@ - NetHack Porting Guidelines v 3.6 1999-11-29 + NetHack Porting Guidelines v 3.7 2019-12-05 1.0 Introduction @@ -6,7 +6,7 @@ This document goes through the steps required to port NetHack to a new machine. The basic steps in porting the program are: - 1. Get the code onto your machine. The parts of the current + 1. Get the code onto your build machine. The parts of the current directory setup you definitely need include src (NetHack code shared by all systems), include (include files), util (code for utility programs), and dat (various data files). The @@ -14,6 +14,10 @@ new machine. The basic steps in porting the program are: have the files in the top directory since you're reading this one. :-) + If you will be cross-compiling for your target platform on + a different platform, you may want to read Cross-compiling + in the Top folder as well. + A full list of the distribution files and their associated OSes may be found in the top-level file "Files". @@ -53,7 +57,8 @@ new machine. The basic steps in porting the program are: possibly send us some mail. We might be able to help. 6. Mail all of your fixes to us in a contextual form so that we can - easily integrate them into the code. + easily integrate them into the code, or fork the NetHack + repository on GitHub and issue a pull-request for your changes. One general rule of thumb exists. Always add code. Don't delete somebody else's code for yours -- it won't work on their machine if you do. @@ -120,13 +125,6 @@ files for the game. You may have to create an OS-specific module to handle things you want to use, like a mouse or a ram-disk. - The utility compilers "dgn_comp" and "lev_comp" may be a better -place to start. They also require "makedefs" but are independent of -"nethack". They are usually the last programs made, but since they are -much smaller they may be more tractable when first arguing with the include -files. These programs create binary data files that "nethack" uses to -guide its dungeon creation. - 3.1 Makefiles This distribution provides makefiles for several kinds of systems. @@ -167,11 +165,107 @@ for raw I/O, etc. to. This file contains some OS dependencies concerning time and filename creation. - An object of the NetHack development project is to get the game working on as many different types of hardware and under as many different operating systems as is practical. Any assistance will be appreciated. +Cross-compiling may allow porting of NetHack to a machine where there may +be challenges building on the platform directly, and may help maintain a +working version of NetHack on that platform. See the file Cross-compiling +for more information. + + 4.0 Build Process + +NetHack requires the following steps to be carried out: + + 4.1. makedefs + +Compile and link util/makedefs. Run makedefs repeatedly with different command +line options to produce several output files that are required for: + (a) additional build steps to follow, including some header + files: pm.h, onames.h, date.h. + (b) creation of files, containing information required by, + or about the game during its execution, that are stored in a + portable, platform-independent way, that need to be inserted + into the final game package. + + util/makedefs -v + util/makedefs -o + util/makedefs -p + util/makedefs -z + util/makedefs -d + util/makedefs -r + util/makedefs -h + util/makedefs -s + + 4.2. Other utilities + + Compile and link other utilities such as uudecode, tile-generation +utilities, and so forth. Those produce output files for use during the game and +need to be included in the packaging of the game. + + 4.3. Lua + + Compile and link into a library, or obtain a prebuilt Lua library for +your platform. Place the Lua source into lib/lua-5.3.5 (or other folder +representing an appropriate Lua version); place the compiled Lua library into +lib. + + 4.4 Compile NetHack sources + + Compile the source code of the game, including a suitable +regular-expression choice from several options available in sys/share. Pick one +that is supported by your OS or that you have obtained a 3rd party library for. + + 4.5 Compile optional window port components into a library + + If your platform requires 3rd party sources in order to support the +window port options that you have chosen, such as curses sources for the curses +window port, you may store the sources for that library in a subfolder under +lib. + + 4.6. Link the game + + Link the game to the Lua library, and to any window port support +libraries. + + 4.7 Package the game + + + + 5.0 Design Updates + +The following design updates were introduced in NetHack 3.7. + + 5.1 Quest text files + + The quest text files that were formerly converted from their source +text by makedefs during the build process, have been replaced by Lua versions +and are inserted into the game package for processing by the embedded Lua +interpreter during game execution. + + 5.2 Level Compiler + + There is no longer a build-time level compiler. Instead, the level +descriptions have been converted to Lua and are inserted into the game package +for processing by the embeded Lua interpreter during game execution. + + 5.3 Dungeon Compiler + + There is no longer a build-time dungeon compiler. Instead, the dungeon +description has been converted to Lua and is inserted into the game package for +processing by the embeded Lua interpreter during game execution. + + + 5.4 Run-time Options + + Some of the build and option information that was formerly produced at +build-time by makedefs, and contained information about the game platform and +options selected during the build of the game can now be produced at run-time +by code within the game itself. That was done to facilitate cross-compiling of +NetHack on one platform for game execution on another. + + # NetHack 3.6 Porting $NHDT-Date: 1524689603 2018/04/25 20:53:23 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.5 $ # Copyright (c) 2005 by Michael Allison # NetHack may be freely redistributed. See license for details. diff --git a/README b/README index 0592a5efc..2597748e0 100644 --- a/README +++ b/README @@ -1,24 +1,65 @@ - NetHack 3.6.2 -- General information + NetHack 3.7.0 work-in-progress -- General information -NetHack 3.6 is an enhancement to the dungeon exploration game NetHack, +NetHack 3.7 is an enhancement to the dungeon exploration game NetHack, which is a distant descendent of Rogue and Hack, and a direct descendent of -NetHack 3.4 as there was no NetHack 3.5 release. +NetHack 3.6. -NetHack 3.6.2 contains a collection of about 320 bug fixes to NetHack 3.6.1 -and more than 20 enhancements. The file doc/fixes36.2 in the source -distribution has a full list of them. The text in there was written for the -development team's own use and is provided "as is", so please do not ask us -to further explain the entries in that file. Some entries might be considered -"spoilers", particularly in the "new features" section. +NetHack 3.7.0 work-in-progress is not a release of NetHack. As a .0 version, +and still very early in its development cycle, there has already been changes +made, and there will continue to be many more prior to an eventual release. +The file doc/fixes37.0 in the source distribution will be updated with a list +of fixes as they are committed. -Below you will find some other general notes that were not considered -spoilers: -* Performance optimizations with tty including the ability to do per field - updating -* sys/winnt/nttty performance improvements mainly through the introduction - of a back buffer approach -* a couple of windows crash bug fixes -* adoption of the curses window port that was in use in the community +In short -- there are likely to be bugs. Don't treat NetHack-3.7 branch as +released code, and if stability is paramount, then the most recent +NetHack 3.6.4 release is safest for you. + +We're making the .0 work-in-progress available so that you can observe, test +out, and contribute to its development. Constructive suggestions, GitHub pull +requests, and bug reports are all welcome and encouraged. + +The file doc/fixes37.0 in the source distribution has a full list of bug-fixes +included so far, as well as brief mentions of some of the other code changes. +The text in there was written for the development team's own use and is +provided "as is", so please do not ask us to further explain the entries in +that file. Some entries might be considered "spoilers", particularly in the +"new features" section. + +Along with the game improvements and bug fixes, NetHack 3.7 strives to make +some general architectural improvements to the game or to its building +process. Among them: + + * Remove barriers to building NetHack on one platform and operating system, + for later execution on another (possibly quite different) platform and/or + operating system. That capability is generally known as "cross-compiling." + See the file "Cross-compiling" in the top-level folder for more information + on that. + + * Replace the build-time "yacc and lex"-based level compiler, the "yacc and + lex"-based dungeon compiler, and the quest text file processing done + by NetHack's "makedefs" utility, with Lua text alternatives that are + loaded and processed by the game during play. + + * Write game savefiles and bonesfiles in a more portable and consistent way + to open up the possibility of utilizing them between different platforms, + such as between your desktop computer and your hand-held device. + + * Add support to make the game restartable without exit (a.k.a. "play again" + support). Toward that end, many previously scattered and separate variables + have been gathered into a central 'g' structure in decl.h/decl.c. That + will benefit the porting effort to some platforms that are under + consideration. + +Here are some other general notes on the changes in NetHack 3.7 that were not +considered spoilers: + - automatic annotation "gateway to Moloch's Sanctum" for vibrating square + level once that square's location becomes known (found or magic + mapped); goes away once sanctum temple is found (entered or high altar + mapped) + - savefile: add support to deconstruct internal data structures down into + their individual fields and save those fields instead of the entire + struct + - savefile: use little-endian format for fields where that makes a difference - - - - - - - - - - - @@ -29,13 +70,13 @@ Please read items (1), (2) and (3) BEFORE doing anything with your new code. call it. 2. Having unpacked, you should have a file called 'Files' in your Top - directory. + directory. This file contains the list of all the files you now SHOULD have in each directory. Please check the files in each directory against this list to make sure that you have a complete set. - This file also contains a list of what files are created during + This file also contains a list of what files are created during the build process. The names of the directories listed should not be changed unless you @@ -46,7 +87,11 @@ Please read items (1), (2) and (3) BEFORE doing anything with your new code. "license" in the 'dat' subdirectory. It is expected that you comply with the terms of that license, and we are very serious about it. -4. If everything is in order, you can now turn to trying to get the program +4. If you are attempting to build NetHack on one platform/processor, to + produce a game on a different platform/processor it may behoove you to + read the file "Cross-compiling" in your Top directory. + +5. If everything is in order, you can now turn to trying to get the program to compile and run on your particular system. It is worth mentioning that the default configuration is SysV/Sun/Solaris2.x (simply because the code was housed on such a system). @@ -57,21 +102,23 @@ Please read items (1), (2) and (3) BEFORE doing anything with your new code. for particular windowing environments. Reading them, and the man pages, should answer most of your questions. - At the time of this release, NetHack 3.6 has been tested to run/compile - on: - Intel Pentium or better (or clone) running Linux, BSDI, or + At the time of the most recent official release, NetHack 3.6, it had + been tested to run/compile on: + + Intel Pentium or better (or clone) running Linux, BSDI, or Windows (7 through 10) Intel 80386 or greater (or clone) boxes running Linux, or BSDI Mac OS X 10.11 (follow the instructions in sys/unix, not sys/mac) OpenVMS (aka VMS) V8.4 on Alpha and on Integrity/Itanium/IA64 Instructions have been provided by way of community contribution on: - msdos protected mode using djgpp + msdos protected mode using djgpp including a Linux-host djgpp + cross-compile - Previous versions of NetHack were tested and known to run on the - following systems, but it is unknown if they can still build and - execute NetHack 3.6: + Previous versions of NetHack were tested and known to run on the + following systems, but it is unknown if they can still build and + execute NetHack 3.6 or NetHack 3.7: Apple Macintosh running MacOS 7.5 or higher, LinuxPPC, BeOS 4.0 Atari ST/TT/Falcon running TOS (or MultiTOS) with GCC @@ -123,10 +170,9 @@ Please read items (1), (2) and (3) BEFORE doing anything with your new code. - - - - - - - - - - - -If you have problems building the game, or you find bugs in it, we recommend +If you have problems building the game, or you find bugs in it, we recommend filing a bug report from our "Contact Us" web page at: - https://www.nethack.org/common/contact.html or - http://www.nethack.org/common/contact.html + https://www.nethack.org/common/contact.html Please include the version information from #version or the command line option --version in the appropriate field. @@ -138,12 +184,12 @@ available can be obtained via git here: When sending correspondence, please observe the following: o Please be sure to include your machine type, OS, and patchlevel. -o Please avoid sending us binary files (e.g. save files or bones files). +o Please avoid sending us binary files (e.g. save files or bones files). If you have found a bug and think that your save file would aid in solving - the problem, send us a description in words of the problem, your machine - type, your operating system, and the version of NetHack. Tell us that you + the problem, send us a description in words of the problem, your machine + type, your operating system, and the version of NetHack. Tell us that you have a save file, but do not actually send it. - You may then be contacted by a member of the development team with the + You may then be contacted by a member of the development team with the address of a specific person to send the save file to. o Though we make an effort to reply to each bug report, it may take some time before you receive feedback. This is especially true during the @@ -152,21 +198,21 @@ o We don't give hints for playing the game. o Don't bother to ask when the next version will be out or you can expect to receive a stock answer. -If you want to submit a patch for the NetHack source code via email directly, +If you want to submit a patch for the NetHack source code via email directly, you can direct it to this address: nethack-bugs (at) nethack.org -If a feature is not accepted you are free, of course, to post the patches +If a feature is not accepted you are free, of course, to post the patches to the net yourself and let the marketplace decide their worth. All of this amounts to the following: If you decide to apply a free-lanced patch to your 3.6 code, you are welcome to do so, of course, but we won't -be able to provide support or receive bug reports for it. +be able to provide support or receive bug reports for it. In our own patches, we will assume that your code is synchronized with ours. -- Good luck, and happy Hacking -- -# $NHDT-Date: 1557077369 2019/05/05 17:29:29 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.55 $ +# $NHDT-Date: 1572309271 2019/10/29 00:34:31 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.57 $ # Copyright (c) 2012 by Michael Allison # NetHack may be freely redistributed. See license for details. diff --git a/dat/Arc-fila.lua b/dat/Arc-fila.lua new file mode 100644 index 000000000..2e2dc1578 --- /dev/null +++ b/dat/Arc-fila.lua @@ -0,0 +1,59 @@ +-- NetHack 3.6 Arch.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- +des.room({ type = "ordinary", + contents = function() + des.stair("up") + des.object() + des.monster("S") + end +}); + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.monster("S") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.object() + des.monster("S") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.stair("down") + des.object() + des.trap() + des.monster("S") + des.monster("human mummy") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.trap() + des.monster("S") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.monster("S") + end +}) + +des.random_corridors() diff --git a/dat/Arc-filb.lua b/dat/Arc-filb.lua new file mode 100644 index 000000000..8b3f1d257 --- /dev/null +++ b/dat/Arc-filb.lua @@ -0,0 +1,59 @@ +-- NetHack 3.6 Arch.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- +des.room({ type = "ordinary", + contents = function() + des.stair("up") + des.object() + des.monster("M") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.monster("M") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.object() + des.monster("M") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.stair("down") + des.object() + des.trap() + des.monster("S") + des.monster("human mummy") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.trap() + des.monster("S") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.monster("S") + end +}) + +des.random_corridors() diff --git a/dat/Arc-goal.lua b/dat/Arc-goal.lua new file mode 100644 index 000000000..4f48ec516 --- /dev/null +++ b/dat/Arc-goal.lua @@ -0,0 +1,115 @@ +-- NetHack 3.6 Arch.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.map([[ + + --------- + |..|.|..| + -----------|..S.S..|----------- + |.|........|+-|.|-+|........|.| + |.S........S..|.|..S........S.| + |.|........|..|.|..|........|.| + ------------------+------------------ + |..|..........|.......|..........|..| + |..|..........+.......|..........S..| + |..S..........|.......+..........|..| + |..|..........|.......|..........|..| + ------------------+------------------ + |.|........|..|.|..|........|.| + |.S........S..|.|..S........S.| + |.|........|+-|.|-+|........|.| + -----------|..S.S..|----------- + |..|.|..| + --------- + +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,19), "lit") +des.region(selection.area(35,02,36,03), "unlit") +des.region(selection.area(40,02,41,03), "unlit") +des.region(selection.area(24,04,24,06), "unlit") +des.region(selection.area(26,04,33,06), "lit") +des.region(selection.area(38,02,38,06), "unlit") +des.region(selection.area(43,04,50,06), "lit") +des.region(selection.area(52,04,52,06), "unlit") +des.region(selection.area(35,05,36,06), "unlit") +des.region(selection.area(40,05,41,06), "unlit") +des.region(selection.area(21,08,22,11), "unlit") +des.region(selection.area(24,08,33,11), "lit") +des.region(selection.area(35,08,41,11), "unlit") +des.region(selection.area(43,08,52,11), "lit") +des.region(selection.area(54,08,55,11), "unlit") +des.region(selection.area(24,13,24,15), "unlit") +des.region(selection.area(26,13,33,15), "unlit") +des.region(selection.area(35,13,36,14), "unlit") +des.region(selection.area(35,16,36,17), "unlit") +des.region(selection.area(38,13,38,17), "unlit") +des.region(selection.area(40,13,41,14), "unlit") +des.region(selection.area(40,16,41,17), "unlit") +des.region({ region={43,13, 50,15}, lit=0, type="temple", prefilled=0 }) +des.region(selection.area(52,13,52,15), "unlit") +-- Stairs +des.stair("up", 38,10) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- The altar of Huhetotl. Unattended. +des.altar({ x=50,y=14,align="chaos",type="altar" }) +-- Objects +des.object({ id = "crystal ball", x=50, y=14,buc="blessed",spe=5,name="The Orb of Detection" }) +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap("rolling boulder",46,14) +-- Random monsters. +des.monster("Minion of Huhetotl", 50, 14) +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("human mummy") +des.monster("human mummy") +des.monster("human mummy") +des.monster("human mummy") +des.monster("human mummy") +des.monster("human mummy") +des.monster("human mummy") +des.monster("human mummy") +des.monster("M") diff --git a/dat/Arc-loca.lua b/dat/Arc-loca.lua new file mode 100644 index 000000000..374deb595 --- /dev/null +++ b/dat/Arc-loca.lua @@ -0,0 +1,145 @@ +-- NetHack 3.6 Arch.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "hardfloor") + +des.map([[ +............................................................................ +............................................................................ +............................................................................ +........................-------------------------------..................... +........................|....|.S......................|..................... +........................|....|.|.|+------------------.|..................... +........................|....|.|.|.|.........|......|.|..................... +........................|....|.|.|.|.........|......|.|..................... +........................|---+-.|.|.|..---....+......|.|..................... +........................|....|.|.|.---|.|....|......|.|..................... +........................|....S.|.|.+..S.|--S-----S--|.|..................... +........................|....|.|.|.---|.|....|......+.|..................... +........................|---+-.|.|.|..---....|.------.|..................... +........................|....|.|.|.|.........|.|....+.|..................... +........................|....|.|.|.|.........|+|....|-|..................... +........................|....|.|.|------------+------.S..................... +........................|....|.S......................|..................... +........................-------------------------------..................... +............................................................................ +............................................................................ +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,19), "lit") +des.region({ region={25,04, 28,07}, lit=1, type="temple", prefilled=0 }) +des.region({ region={25,09, 28,11}, lit=0, type="temple", prefilled=0 }) +des.region({ region={25,13, 28,16}, lit=1, type="temple", prefilled=0 }) +des.region(selection.area(30,04,30,16), "lit") +des.region(selection.area(32,04,32,16), "unlit") +des.region({ region={33,04, 53,04}, lit=0, type="ordinary", prefilled=0, irregular=1 }) +des.region(selection.area(36,10,37,10), "unlit") +des.region(selection.area(39,09,39,11), "unlit") +des.region({ region={36,06, 42,08}, lit=0, type="ordinary", prefilled=0, irregular=1 }) +des.region({ region={36,12, 42,14}, lit=0, type="ordinary", prefilled=0, irregular=1 }) +des.region(selection.area(46,06,51,09), "unlit") +des.region({ region={46,11, 49,11}, lit=0, type="ordinary", prefilled=0, irregular=1 }) +des.region(selection.area(48,13,51,14), "unlit") +-- Doors +des.door("closed",31,04) +des.door("closed",28,08) +des.door("locked",29,10) +des.door("closed",28,12) +des.door("closed",31,16) +des.door("locked",34,05) +des.door("locked",35,10) +des.door("locked",38,10) +des.door("closed",43,10) +des.door("closed",45,08) +des.door("locked",46,14) +des.door("locked",46,15) +des.door("locked",49,10) +des.door("locked",52,11) +des.door("closed",52,13) +des.door("closed",54,15) +-- Stairs +des.stair("up", 03,17) +des.stair("down", 39,10) +-- Altars - three types. All are unattended. +des.altar({ x=26,y=05,align=align[1], type="altar" }) +des.altar({ x=26,y=10,align=align[2], type="altar" }) +des.altar({ x=26,y=15,align=align[3], type="altar" }) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- Objects +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Treasure? +des.engraving({ type="engrave", text="X marks the spot." }) +des.engraving({ type="engrave", text="X marks the spot." }) +des.engraving({ type="engrave", text="X marks the spot." }) +des.engraving({ type="engrave", text="X marks the spot." }) +-- Random traps +des.trap("spiked pit",24,02) +des.trap("spiked pit",37,00) +des.trap("spiked pit",23,05) +des.trap("spiked pit",26,19) +des.trap("spiked pit",55,10) +des.trap("spiked pit",55,08) +des.trap("pit",51,01) +des.trap("pit",23,18) +des.trap("pit",31,18) +des.trap("pit",48,19) +des.trap("pit",55,15) +des.trap("magic",60,04) +des.trap("statue",72,07) +des.trap("statue") +des.trap("statue") +des.trap("anti magic",64,12) +des.trap("sleep gas") +des.trap("sleep gas") +des.trap("dart") +des.trap("dart") +des.trap("dart") +des.trap("rolling boulder",32,10) +des.trap("rolling boulder",40,16) +-- Random monsters. +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("S") +des.monster("M") +des.monster("human mummy") +des.monster("human mummy") +des.monster("human mummy") +des.monster("human mummy") +des.monster("human mummy") +des.monster("human mummy") +des.monster("human mummy") +des.monster("M") diff --git a/dat/Arc-strt.lua b/dat/Arc-strt.lua new file mode 100644 index 000000000..9292d40ca --- /dev/null +++ b/dat/Arc-strt.lua @@ -0,0 +1,113 @@ +-- NetHack 3.6 Arch.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- The "start" level for the quest. +-- +-- Here you meet your (besieged) class leader, Lord Carnarvon +-- and receive your quest assignment. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor") + +des.map([[ +............................................................................ +............................................................................ +............................................................................ +............................................................................ +....................}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}................. +....................}-------------------------------------}................. +....................}|..S......+.................+.......|}................. +....................}-S---------------+----------|.......|}................. +....................}|.|...............|.......+.|.......|}................. +....................}|.|...............---------.---------}................. +....................}|.S.\.............+.................+.................. +....................}|.|...............---------.---------}................. +....................}|.|...............|.......+.|.......|}................. +....................}-S---------------+----------|.......|}................. +....................}|..S......+.................+.......|}................. +....................}-------------------------------------}................. +....................}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}................. +............................................................................ +............................................................................ +............................................................................ +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,19), "lit") +des.region(selection.area(22,06,23,06), "unlit") +des.region(selection.area(25,06,30,06), "unlit") +des.region(selection.area(32,06,48,06), "unlit") +des.region(selection.area(50,06,56,08), "lit") +des.region(selection.area(40,08,46,08), "unlit") +des.region(selection.area(22,08,22,12), "unlit") +des.region(selection.area(24,08,38,12), "unlit") +des.region(selection.area(48,08,48,08), "lit") +des.region(selection.area(40,10,56,10), "lit") +des.region(selection.area(48,12,48,12), "lit") +des.region(selection.area(40,12,46,12), "unlit") +des.region(selection.area(50,12,56,14), "lit") +des.region(selection.area(22,14,23,14), "unlit") +des.region(selection.area(25,14,30,14), "unlit") +des.region(selection.area(32,14,48,14), "unlit") +-- Stairs +des.stair("down", 55,07) +-- Portal arrival point +des.levregion({ region = {63,06,63,06}, type="branch" }) +-- Doors +des.door("closed",22,07) +des.door("closed",38,07) +des.door("locked",47,08) +des.door("locked",23,10) +des.door("locked",39,10) +des.door("locked",57,10) +des.door("locked",47,12) +des.door("closed",22,13) +des.door("closed",38,13) +des.door("locked",24,14) +des.door("closed",31,14) +des.door("locked",49,14) +-- Lord Carnarvon +des.monster("Lord Carnarvon", 25, 10) +-- The treasure of Lord Carnarvon +des.object("chest", 25, 10) +-- student guards for the audience chamber +des.monster("student", 26, 09) +des.monster("student", 27, 09) +des.monster("student", 28, 09) +des.monster("student", 26, 10) +des.monster("student", 28, 10) +des.monster("student", 26, 11) +des.monster("student", 27, 11) +des.monster("student", 28, 11) +-- city watch guards in the antechambers +des.monster("watchman", 50, 06) +des.monster("watchman", 50, 14) +-- Eels in the moat +des.monster("giant eel", 20, 10) +des.monster("giant eel", 45, 04) +des.monster("giant eel", 33, 16) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Monsters on siege duty. +des.monster("S", 60, 09) +des.monster("M", 60, 10) +des.monster("S", 60, 11) +des.monster("S", 60, 12) +des.monster("M", 60, 13) +des.monster("S", 61, 10) +des.monster("S", 61, 11) +des.monster("S", 61, 12) +des.monster("S", 30, 03) +des.monster("M", 20, 17) +des.monster("S", 67, 02) +des.monster("S", 10, 19) diff --git a/dat/Arch.des b/dat/Arch.des deleted file mode 100644 index 9335f7d2f..000000000 --- a/dat/Arch.des +++ /dev/null @@ -1,472 +0,0 @@ -# NetHack 3.6 Arch.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# Copyright (c) 1991 by M. Stephenson -# NetHack may be freely redistributed. See license for details. -# -# The "start" level for the quest. -# -# Here you meet your (besieged) class leader, Lord Carnarvon -# and receive your quest assignment. -# -MAZE: "Arc-strt",' ' -FLAGS: noteleport,hardfloor -GEOMETRY:center,center -MAP -............................................................................ -............................................................................ -............................................................................ -............................................................................ -....................}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}................. -....................}-------------------------------------}................. -....................}|..S......+.................+.......|}................. -....................}-S---------------+----------|.......|}................. -....................}|.|...............|.......+.|.......|}................. -....................}|.|...............---------.---------}................. -....................}|.S.\.............+.................+.................. -....................}|.|...............---------.---------}................. -....................}|.|...............|.......+.|.......|}................. -....................}-S---------------+----------|.......|}................. -....................}|..S......+.................+.......|}................. -....................}-------------------------------------}................. -....................}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}................. -............................................................................ -............................................................................ -............................................................................ -ENDMAP -# Dungeon Description -REGION:(00,00,75,19),lit,"ordinary" -REGION: (22,06,23,06),unlit,"ordinary" -REGION: (25,06,30,06),unlit,"ordinary" -REGION: (32,06,48,06),unlit,"ordinary" -REGION: (50,06,56,08),lit,"ordinary" -REGION: (40,08,46,08),unlit,"ordinary" -REGION: (22,08,22,12),unlit,"ordinary" -REGION: (24,08,38,12),unlit,"ordinary" -REGION: (48,08,48,08),lit,"ordinary" -REGION: (40,10,56,10),lit,"ordinary" -REGION: (48,12,48,12),lit,"ordinary" -REGION: (40,12,46,12),unlit,"ordinary" -REGION: (50,12,56,14),lit,"ordinary" -REGION: (22,14,23,14),unlit,"ordinary" -REGION: (25,14,30,14),unlit,"ordinary" -REGION: (32,14,48,14),unlit,"ordinary" -# Stairs -STAIR:(55,07),down -# Portal arrival point -BRANCH:(63,06,63,06),(0,0,0,0) -# Doors -DOOR:closed,(22,07) -DOOR:closed,(38,07) -DOOR:locked,(47,08) -DOOR:locked,(23,10) -DOOR:locked,(39,10) -DOOR:locked,(57,10) -DOOR:locked,(47,12) -DOOR:closed,(22,13) -DOOR:closed,(38,13) -DOOR:locked,(24,14) -DOOR:closed,(31,14) -DOOR:locked,(49,14) -# Lord Carnarvon -MONSTER:('@',"Lord Carnarvon"),(25,10) -# The treasure of Lord Carnarvon -OBJECT:('(',"chest"),(25,10) -# student guards for the audience chamber -MONSTER:('@',"student"),(26,09) -MONSTER:('@',"student"),(27,09) -MONSTER:('@',"student"),(28,09) -MONSTER:('@',"student"),(26,10) -MONSTER:('@',"student"),(28,10) -MONSTER:('@',"student"),(26,11) -MONSTER:('@',"student"),(27,11) -MONSTER:('@',"student"),(28,11) -# city watch guards in the antechambers -MONSTER:('@',"watchman"),(50,06) -MONSTER:('@',"watchman"),(50,14) -# Eels in the moat -MONSTER:(';',"giant eel"),(20,10) -MONSTER:(';',"giant eel"),(45,04) -MONSTER:(';',"giant eel"),(33,16) -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Monsters on siege duty. -MONSTER: 'S',(60,09) -MONSTER: 'M',(60,10) -MONSTER: 'S',(60,11) -MONSTER: 'S',(60,12) -MONSTER: 'M',(60,13) -MONSTER: 'S',(61,10) -MONSTER: 'S',(61,11) -MONSTER: 'S',(61,12) -MONSTER: 'S',(30,03) -MONSTER: 'M',(20,17) -MONSTER: 'S',(67,02) -MONSTER: 'S',(10,19) - -# -# The "locate" level for the quest. -# -# Here you have to find the Entrance to the Tomb of the Toltec Kings -# to go further towards your assigned quest. -# - -MAZE: "Arc-loca",' ' -FLAGS: hardfloor -GEOMETRY:center,center -MAP -............................................................................ -............................................................................ -............................................................................ -........................-------------------------------..................... -........................|....|.S......................|..................... -........................|....|.|.|+------------------.|..................... -........................|....|.|.|.|.........|......|.|..................... -........................|....|.|.|.|.........|......|.|..................... -........................|---+-.|.|.|..---....+......|.|..................... -........................|....|.|.|.---|.|....|......|.|..................... -........................|....S.|.|.+..S.|--S-----S--|.|..................... -........................|....|.|.|.---|.|....|......+.|..................... -........................|---+-.|.|.|..---....|.------.|..................... -........................|....|.|.|.|.........|.|....+.|..................... -........................|....|.|.|.|.........|+|....|-|..................... -........................|....|.|.|------------+------.S..................... -........................|....|.S......................|..................... -........................-------------------------------..................... -............................................................................ -............................................................................ -ENDMAP -# Dungeon Description -REGION:(00,00,75,19),lit,"ordinary" -REGION:(25,04,28,07),lit,"temple" -REGION:(25,09,28,11),unlit,"temple" -REGION:(25,13,28,16),lit,"temple" -REGION:(30,04,30,16),lit,"ordinary" -REGION:(32,04,32,16),unlit,"ordinary" -REGION:(33,04,53,04),unlit,"ordinary",unfilled,irregular -REGION:(36,10,37,10),unlit,"ordinary" -REGION:(39,09,39,11),unlit,"ordinary" -REGION:(36,06,42,08),unlit,"ordinary",unfilled,irregular -REGION:(36,12,42,14),unlit,"ordinary",unfilled,irregular -REGION:(46,06,51,09),unlit,"ordinary" -REGION:(46,11,49,11),unlit,"ordinary",unfilled,irregular -REGION:(48,13,51,14),unlit,"ordinary" -# Doors -DOOR:closed,(31,04) -DOOR:closed,(28,08) -DOOR:locked,(29,10) -DOOR:closed,(28,12) -DOOR:closed,(31,16) -DOOR:locked,(34,05) -DOOR:locked,(35,10) -DOOR:locked,(38,10) -DOOR:closed,(43,10) -DOOR:closed,(45,08) -DOOR:locked,(46,14) -DOOR:locked,(46,15) -DOOR:locked,(49,10) -DOOR:locked,(52,11) -DOOR:closed,(52,13) -DOOR:closed,(54,15) -# Stairs -STAIR:(03,17),up -STAIR:(39,10),down -# Altars - three types. All are unattended. -ALTAR:(26,05),align[0],altar -ALTAR:(26,10),align[1],altar -ALTAR:(26,15),align[2],altar -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# Objects -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Treasure? -ENGRAVING:random,engrave,"X marks the spot." -ENGRAVING:random,engrave,"X marks the spot." -ENGRAVING:random,engrave,"X marks the spot." -ENGRAVING:random,engrave,"X marks the spot." -# Random traps -TRAP:"spiked pit",(24,02) -TRAP:"spiked pit",(37,00) -TRAP:"spiked pit",(23,05) -TRAP:"spiked pit",(26,19) -TRAP:"spiked pit",(55,10) -TRAP:"spiked pit",(55,08) -TRAP:"pit",(51,01) -TRAP:"pit",(23,18) -TRAP:"pit",(31,18) -TRAP:"pit",(48,19) -TRAP:"pit",(55,15) -TRAP:"magic",(60,04) -TRAP:"statue",(72,07) -TRAP:"statue",random -TRAP:"statue",random -TRAP:"anti magic",(64,12) -TRAP:"sleep gas",random -TRAP:"sleep gas",random -TRAP:"dart",random -TRAP:"dart",random -TRAP:"dart",random -TRAP:"rolling boulder",(32,10) -TRAP:"rolling boulder",(40,16) -# Random monsters. -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'M',random -MONSTER:('M',"human mummy"),random -MONSTER:('M',"human mummy"),random -MONSTER:('M',"human mummy"),random -MONSTER:('M',"human mummy"),random -MONSTER:('M',"human mummy"),random -MONSTER:('M',"human mummy"),random -MONSTER:('M',"human mummy"),random -MONSTER:'M',random - -# -# The "goal" level for the quest. -# -# Here you meet Minion of Huhetotl your nemesis monster. You have to -# defeat Minion of Huhetotl in combat to gain the artifact you have -# been assigned to retrieve. -# - -MAZE: "Arc-goal", ' ' -GEOMETRY:center,center -MAP - - --------- - |..|.|..| - -----------|..S.S..|----------- - |.|........|+-|.|-+|........|.| - |.S........S..|.|..S........S.| - |.|........|..|.|..|........|.| - ------------------+------------------ - |..|..........|.......|..........|..| - |..|..........+.......|..........S..| - |..S..........|.......+..........|..| - |..|..........|.......|..........|..| - ------------------+------------------ - |.|........|..|.|..|........|.| - |.S........S..|.|..S........S.| - |.|........|+-|.|-+|........|.| - -----------|..S.S..|----------- - |..|.|..| - --------- - -ENDMAP -# Dungeon Description -REGION:(00,00,75,19),lit,"ordinary" -REGION:(35,02,36,03),unlit,"ordinary" -REGION:(40,02,41,03),unlit,"ordinary" -REGION:(24,04,24,06),unlit,"ordinary" -REGION:(26,04,33,06),lit,"ordinary" -REGION:(38,02,38,06),unlit,"ordinary" -REGION:(43,04,50,06),lit,"ordinary" -REGION:(52,04,52,06),unlit,"ordinary" -REGION:(35,05,36,06),unlit,"ordinary" -REGION:(40,05,41,06),unlit,"ordinary" -REGION:(21,08,22,11),unlit,"ordinary" -REGION:(24,08,33,11),lit,"ordinary" -REGION:(35,08,41,11),unlit,"ordinary" -REGION:(43,08,52,11),lit,"ordinary" -REGION:(54,08,55,11),unlit,"ordinary" -REGION:(24,13,24,15),unlit,"ordinary" -REGION:(26,13,33,15),unlit,"ordinary" -REGION:(35,13,36,14),unlit,"ordinary" -REGION:(35,16,36,17),unlit,"ordinary" -REGION:(38,13,38,17),unlit,"ordinary" -REGION:(40,13,41,14),unlit,"ordinary" -REGION:(40,16,41,17),unlit,"ordinary" -REGION:(43,13,50,15),unlit,"temple" -REGION:(52,13,52,15),unlit,"ordinary" -# Stairs -STAIR:(38,10),up -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# The altar of Huhetotl. Unattended. -ALTAR:(50,14),chaos,altar -# Objects -OBJECT:('(',"crystal ball"),(50,14),blessed,5,name:"The Orb of Detection" -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:"rolling boulder",(46,14) -# Random monsters. -MONSTER:('&',"Minion of Huhetotl"),(50,14) -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:'S',random -MONSTER:('M',"human mummy"),random -MONSTER:('M',"human mummy"),random -MONSTER:('M',"human mummy"),random -MONSTER:('M',"human mummy"),random -MONSTER:('M',"human mummy"),random -MONSTER:('M',"human mummy"),random -MONSTER:('M',"human mummy"),random -MONSTER:('M',"human mummy"),random -MONSTER:'M',random - -# -# The "fill" levels for the quest. -# -# These levels are used to fill out any levels not occupied by specific -# levels as defined above. "filla" is the upper filler, between the -# start and locate levels, and "fillb" the lower between the locate -# and goal levels. -# - -LEVEL: "Arc-fila" -# -ROOM: "ordinary" , random, random, random, random { - STAIR: random, up - OBJECT: random,random - MONSTER: 'S', random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random,random - MONSTER: 'S', random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - OBJECT: random,random - MONSTER: 'S', random -} - -ROOM: "ordinary" , random, random, random, random { - STAIR: random, down - OBJECT: random, random - TRAP: random, random - MONSTER: 'S', random - MONSTER: ('M', "human mummy"), random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random, random - TRAP: random, random - MONSTER: 'S', random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - MONSTER: 'S', random -} - -RANDOM_CORRIDORS - -LEVEL: "Arc-filb" -# -ROOM: "ordinary" , random, random, random, random { - STAIR: random, up - OBJECT: random,random - MONSTER: 'M', random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random,random - MONSTER: 'M', random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - OBJECT: random,random - MONSTER: 'M', random -} - -ROOM: "ordinary" , random, random, random, random { - STAIR: random, down - OBJECT: random, random - TRAP: random, random - MONSTER: 'S', random - MONSTER: ('M', "human mummy"), random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random, random - TRAP: random, random - MONSTER: 'S', random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - MONSTER: 'S', random -} - -RANDOM_CORRIDORS diff --git a/dat/Bar-fila.lua b/dat/Bar-fila.lua new file mode 100644 index 000000000..3f685c50b --- /dev/null +++ b/dat/Bar-fila.lua @@ -0,0 +1,33 @@ +-- NetHack 3.6 Barb.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.level_init({ style="mines", fg=".", bg=".", smoothed=true, joined=true, lit=0, walled=false }) + +-- +des.stair("up") +des.stair("down") +-- +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- +des.trap() +des.trap() +des.trap() +des.trap() +-- +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ class = "O", peaceful=0 }) +des.monster({ id = "rock troll", peaceful=0 }) diff --git a/dat/Bar-filb.lua b/dat/Bar-filb.lua new file mode 100644 index 000000000..15d9f33a5 --- /dev/null +++ b/dat/Bar-filb.lua @@ -0,0 +1,44 @@ +-- NetHack 3.6 Barb.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.level_init({ style="mines", fg=".", bg=" ", smoothed=true, joined=true, lit=0, walled=true }) + +-- +des.stair("up") +des.stair("down") +-- +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- +des.trap() +des.trap() +des.trap() +des.trap() +-- +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ class = "O", peaceful=0 }) +des.monster({ id = "rock troll", peaceful=0 }) +des.monster({ id = "rock troll", peaceful=0 }) +des.monster({ id = "rock troll", peaceful=0 }) +des.monster({ class = "T", peaceful=0 }) diff --git a/dat/Bar-goal.lua b/dat/Bar-goal.lua new file mode 100644 index 000000000..31754a4c0 --- /dev/null +++ b/dat/Bar-goal.lua @@ -0,0 +1,95 @@ +-- NetHack 3.6 Barb.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.map([[ + + ............. + .................. + .... ......................... .... + ....... .......................... ....... + ...... ........................ ....... + .. ...................................... .. + .. ..................... .. + .. .................. .. + .. ..S...S.............. ................ + .. ........ ... + ......... .. + ...... .. ... .... + .. ... .. ...... ........ + .... .. .................. ........ ...... + ...... ...................... ...... .. + .... .................. ........... + .............. + ........... + +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,19), "unlit") +-- Secret doors +des.door("locked",22,09) +des.door("locked",26,09) +-- Stairs +des.stair("up", 36,05) +-- The altar. Unattended. +des.altar({ x=63,y=04,align="noncoaligned", type="altar" }) +des.non_diggable(selection.area(00,00,75,19)) +-- Objects +des.object({ id = "luckstone", x=63, y=04,buc="blessed",spe=0,name="The Heart of Ahriman" }) +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Random monsters. +des.monster({ id = "Thoth Amon", x=63, y=04, peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ class = "O", peaceful=0 }) +des.monster({ class = "O", peaceful=0 }) +des.monster({ id = "rock troll", peaceful=0 }) +des.monster({ id = "rock troll", peaceful=0 }) +des.monster({ id = "rock troll", peaceful=0 }) +des.monster({ id = "rock troll", peaceful=0 }) +des.monster({ id = "rock troll", peaceful=0 }) +des.monster({ id = "rock troll", peaceful=0 }) +des.monster({ id = "rock troll", peaceful=0 }) +des.monster({ id = "rock troll", peaceful=0 }) +des.monster({ class = "T", peaceful=0 }) +des.wallify() + diff --git a/dat/Bar-loca.lua b/dat/Bar-loca.lua new file mode 100644 index 000000000..df1e7d8aa --- /dev/null +++ b/dat/Bar-loca.lua @@ -0,0 +1,107 @@ +-- NetHack 3.6 Barb.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "hardfloor") + +des.map([[ +..........PPP......................................... +...........PP.......................................... ....... +..........PP...........-----..........------------------ .......... +...........PP..........+...|..........|....S...........|.. ............ +..........PPP..........|...|..........|-----...........|... ............. +...........PPP.........-----..........+....+...........|... ............. +..........PPPPPPPPP...................+....+...........S................. +........PPPPPPPPPPPPP.........-----...|-----...........|................ +......PPPPPPPPPPPPPP..P.......+...|...|....S...........| ... +.....PPPPPPP......P..PPPP.....|...|...------------------.. ... +....PPPPPPP.........PPPPPP....-----........................ ........ +...PPPPPPP..........PPPPPPP.................................. .......... +....PPPPPPP........PPPPPPP.................................... .......... +.....PPPPP........PPPPPPP.........-----........................ ........ +......PPP..PPPPPPPPPPPP...........+...|......................... ..... +..........PPPPPPPPPPP.............|...|......................... .... +..........PPPPPPPPP...............-----......................... . +..............PPP................................................. +...............PP.................................................... +................PPP................................................... +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,19), "lit") +des.region(selection.area(24,03,26,04), "unlit") +des.region(selection.area(31,08,33,09), "unlit") +des.region(selection.area(35,14,37,15), "unlit") +des.region(selection.area(39,03,54,08), "lit") +des.region(selection.area(56,00,75,08), "unlit") +des.region(selection.area(64,09,75,16), "unlit") +-- Doors +des.door("open",23,03) +des.door("open",30,08) +des.door("open",34,14) +des.door("locked",38,05) +des.door("locked",38,06) +des.door("closed",43,03) +des.door("closed",43,05) +des.door("closed",43,06) +des.door("closed",43,08) +des.door("locked",55,06) +-- Stairs +des.stair("up", 05,02) +des.stair("down", 70,13) +-- Objects +des.object({ x = 42, y = 03 }) +des.object({ x = 42, y = 03 }) +des.object({ x = 42, y = 03 }) +des.object({ x = 41, y = 03 }) +des.object({ x = 41, y = 03 }) +des.object({ x = 41, y = 03 }) +des.object({ x = 41, y = 03 }) +des.object({ x = 41, y = 08 }) +des.object({ x = 41, y = 08 }) +des.object({ x = 42, y = 08 }) +des.object({ x = 42, y = 08 }) +des.object({ x = 42, y = 08 }) +des.object({ x = 71, y = 13 }) +des.object({ x = 71, y = 13 }) +des.object({ x = 71, y = 13 }) +-- Random traps +des.trap("spiked pit",10,13) +des.trap("spiked pit",21,07) +des.trap("spiked pit",67,08) +des.trap("spiked pit",68,09) +des.trap() +des.trap() +des.trap() +des.trap() +-- Random monsters. +des.monster({ id = "ogre", x=12, y=09, peaceful=0 }) +des.monster({ id = "ogre", x=18, y=11, peaceful=0 }) +des.monster({ id = "ogre", x=45, y=05, peaceful=0 }) +des.monster({ id = "ogre", x=45, y=06, peaceful=0 }) +des.monster({ id = "ogre", x=47, y=05, peaceful=0 }) +des.monster({ id = "ogre", x=46, y=05, peaceful=0 }) +des.monster({ id = "ogre", x=56, y=03, peaceful=0 }) +des.monster({ id = "ogre", x=56, y=04, peaceful=0 }) +des.monster({ id = "ogre", x=56, y=05, peaceful=0 }) +des.monster({ id = "ogre", x=56, y=06, peaceful=0 }) +des.monster({ id = "ogre", x=57, y=03, peaceful=0 }) +des.monster({ id = "ogre", x=57, y=04, peaceful=0 }) +des.monster({ id = "ogre", x=57, y=05, peaceful=0 }) +des.monster({ id = "ogre", x=57, y=06, peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ id = "ogre", peaceful=0 }) +des.monster({ class = "O", peaceful=0 }) +des.monster({ class = "T", peaceful=0 }) +des.monster({ id = "rock troll", x=46, y=06, peaceful=0 }) +des.monster({ id = "rock troll", x=47, y=06, peaceful=0 }) +des.monster({ id = "rock troll", x=56, y=07, peaceful=0 }) +des.monster({ id = "rock troll", x=57, y=07, peaceful=0 }) +des.monster({ id = "rock troll", x=70, y=13, peaceful=0 }) +des.monster({ id = "rock troll", peaceful=0 }) +des.monster({ id = "rock troll", peaceful=0 }) +des.monster({ class = "T", peaceful=0 }) + diff --git a/dat/Bar-strt.lua b/dat/Bar-strt.lua new file mode 100644 index 000000000..c3a98de04 --- /dev/null +++ b/dat/Bar-strt.lua @@ -0,0 +1,103 @@ +-- NetHack 3.6 Barb.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- The "start" level for the quest. +-- +-- Here you meet your (besieged) class leader, Pelias, +-- and receive your quest assignment. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor") + +des.map([[ +..................................PP........................................ +...................................PP....................................... +...................................PP....................................... +....................................PP...................................... +........--------------......-----....PPP.................................... +........|...S........|......+...|...PPP..................................... +........|----........|......|...|....PP..................................... +........|.\..........+......-----........................................... +........|----........|...............PP..................................... +........|...S........|...-----.......PPP.................................... +........--------------...+...|......PPPPP................................... +.........................|...|.......PPP.................................... +...-----......-----......-----........PP.................................... +...|...+......|...+..--+--.............PP................................... +...|...|......|...|..|...|..............PP.................................. +...-----......-----..|...|.............PPPP................................. +.....................-----............PP..PP................................ +.....................................PP...PP................................ +....................................PP...PP................................. +....................................PP....PP................................ +]]); + +-- the forest beyond the river +des.replace_terrain({ region={37,00, 59,19}, fromterrain=".", toterrain="T", chance=5 }) +des.replace_terrain({ region={60,00, 64,19}, fromterrain=".", toterrain="T", chance=10 }) +des.replace_terrain({ region={65,00, 75,19}, fromterrain=".", toterrain="T", chance=20 }) +-- guarantee a path and free spot for the portal +des.terrain(selection.randline(selection.new(), 37,7, 62,02, 7), ".") +des.terrain({62,02}, ".") + +-- Dungeon Description +des.region(selection.area(00,00,75,19), "lit") +des.region(selection.area(09,05,11,05), "unlit") +des.region(selection.area(09,07,11,07), "lit") +des.region(selection.area(09,09,11,09), "unlit") +des.region(selection.area(13,05,20,09), "lit") +des.region(selection.area(29,05,31,06), "lit") +des.region(selection.area(26,10,28,11), "lit") +des.region(selection.area(04,13,06,14), "lit") +des.region(selection.area(15,13,17,14), "lit") +des.region(selection.area(22,14,24,15), "lit") +-- Stairs +des.stair("down", 09,09) +-- Portal arrival point +des.levregion({ region = {62,02,62,02}, type="branch" }) +-- Doors +des.door("locked",12,05) +des.door("locked",12,09) +des.door("closed",21,07) +des.door("open",07,13) +des.door("open",18,13) +des.door("open",23,13) +des.door("open",25,10) +des.door("open",28,05) +-- Elder +des.monster("Pelias", 10, 07) +-- The treasure of Pelias +des.object("chest", 09, 05) +-- chieftain guards for the audience chamber +des.monster("chieftain", 10, 05) +des.monster("chieftain", 10, 09) +des.monster("chieftain", 11, 05) +des.monster("chieftain", 11, 09) +des.monster("chieftain", 14, 05) +des.monster("chieftain", 14, 09) +des.monster("chieftain", 16, 05) +des.monster("chieftain", 16, 09) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- One trap to keep the ogres at bay. +des.trap("spiked pit",37,07) +-- Eels in the river +des.monster("giant eel", 36, 01) +des.monster("giant eel", 37, 09) +des.monster("giant eel", 39, 15) +-- Monsters on siege duty. +des.monster({ id = "ogre", x=40, y=08, peaceful=0 }) +des.monster({ id = "ogre", x=41, y=06, peaceful=0 }) +des.monster({ id = "ogre", x=41, y=07, peaceful=0 }) +des.monster({ id = "ogre", x=41, y=08, peaceful=0 }) +des.monster({ id = "ogre", x=41, y=09, peaceful=0 }) +des.monster({ id = "ogre", x=41, y=10, peaceful=0 }) +des.monster({ id = "ogre", x=42, y=06, peaceful=0 }) +des.monster({ id = "ogre", x=42, y=07, peaceful=0 }) +des.monster({ id = "ogre", x=42, y=08, peaceful=0 }) +des.monster({ id = "ogre", x=42, y=09, peaceful=0 }) +des.monster({ id = "ogre", x=42, y=10, peaceful=0 }) diff --git a/dat/Barb.des b/dat/Barb.des deleted file mode 100644 index 0be480636..000000000 --- a/dat/Barb.des +++ /dev/null @@ -1,377 +0,0 @@ -# NetHack 3.6 Barb.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# Copyright (c) 1991 by M. Stephenson -# NetHack may be freely redistributed. See license for details. -# -# The "start" level for the quest. -# -# Here you meet your (besieged) class leader, Pelias, -# and receive your quest assignment. -# -MAZE: "Bar-strt",' ' -FLAGS: noteleport,hardfloor -GEOMETRY:center,center -MAP -..................................PP........................................ -...................................PP....................................... -...................................PP....................................... -....................................PP...................................... -........--------------......-----....PPP.................................... -........|...S........|......+...|...PPP..................................... -........|----........|......|...|....PP..................................... -........|.\..........+......-----........................................... -........|----........|...............PP..................................... -........|...S........|...-----.......PPP.................................... -........--------------...+...|......PPPPP................................... -.........................|...|.......PPP.................................... -...-----......-----......-----........PP.................................... -...|...+......|...+..--+--.............PP................................... -...|...|......|...|..|...|..............PP.................................. -...-----......-----..|...|.............PPPP................................. -.....................-----............PP..PP................................ -.....................................PP...PP................................ -....................................PP...PP................................. -....................................PP....PP................................ -ENDMAP - -# the forest beyond the river -REPLACE_TERRAIN:(37,0,59,19),'.','T', 5% -REPLACE_TERRAIN:(60,0,64,19),'.','T', 10% -REPLACE_TERRAIN:(65,0,75,19),'.','T', 20% -# guarantee a path and free spot for the portal -TERRAIN:(randline (37,7),(62,02),7), '.' -TERRAIN:(62,02),'.' - -# Dungeon Description -REGION:(00,00,75,19),lit,"ordinary" -REGION:(09,05,11,05),unlit,"ordinary" -REGION:(09,07,11,07),lit,"ordinary" -REGION:(09,09,11,09),unlit,"ordinary" -REGION:(13,05,20,09),lit,"ordinary" -REGION:(29,05,31,06),lit,"ordinary" -REGION:(26,10,28,11),lit,"ordinary" -REGION:(04,13,06,14),lit,"ordinary" -REGION:(15,13,17,14),lit,"ordinary" -REGION:(22,14,24,15),lit,"ordinary" -# Stairs -STAIR:(09,09),down -# Portal arrival point -BRANCH:(62,02,62,02),(0,0,0,0) -# Doors -DOOR:locked,(12,05) -DOOR:locked,(12,09) -DOOR:closed,(21,07) -DOOR:open,(07,13) -DOOR:open,(18,13) -DOOR:open,(23,13) -DOOR:open,(25,10) -DOOR:open,(28,05) -# Elder -MONSTER:('@',"Pelias"),(10,07) -# The treasure of Pelias -OBJECT:('(',"chest"),(09,05) -# chieftain guards for the audience chamber -MONSTER:('@',"chieftain"),(10,05) -MONSTER:('@',"chieftain"),(10,09) -MONSTER:('@',"chieftain"),(11,05) -MONSTER:('@',"chieftain"),(11,09) -MONSTER:('@',"chieftain"),(14,05) -MONSTER:('@',"chieftain"),(14,09) -MONSTER:('@',"chieftain"),(16,05) -MONSTER:('@',"chieftain"),(16,09) -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# One trap to keep the ogres at bay. -TRAP:"spiked pit",(37,07) -# Eels in the river -MONSTER:(';',"giant eel"),(36,01) -MONSTER:(';',"giant eel"),(37,09) -MONSTER:(';',"giant eel"),(39,15) -# Monsters on siege duty. -MONSTER:('O',"ogre"),(40,08),hostile -MONSTER:('O',"ogre"),(41,06),hostile -MONSTER:('O',"ogre"),(41,07),hostile -MONSTER:('O',"ogre"),(41,08),hostile -MONSTER:('O',"ogre"),(41,09),hostile -MONSTER:('O',"ogre"),(41,10),hostile -MONSTER:('O',"ogre"),(42,06),hostile -MONSTER:('O',"ogre"),(42,07),hostile -MONSTER:('O',"ogre"),(42,08),hostile -MONSTER:('O',"ogre"),(42,09),hostile -MONSTER:('O',"ogre"),(42,10),hostile - -# -# The "locate" level for the quest. -# -# Here you have to infiltrate the Duali Oasis to go -# further towards your assigned quest. -# - -MAZE: "Bar-loca",' ' -FLAGS: hardfloor -GEOMETRY:center,center -MAP -..........PPP......................................... -...........PP.......................................... ....... -..........PP...........-----..........------------------ .......... -...........PP..........+...|..........|....S...........|.. ............ -..........PPP..........|...|..........|-----...........|... ............. -...........PPP.........-----..........+....+...........|... ............. -..........PPPPPPPPP...................+....+...........S................. -........PPPPPPPPPPPPP.........-----...|-----...........|................ -......PPPPPPPPPPPPPP..P.......+...|...|....S...........| ... -.....PPPPPPP......P..PPPP.....|...|...------------------.. ... -....PPPPPPP.........PPPPPP....-----........................ ........ -...PPPPPPP..........PPPPPPP.................................. .......... -....PPPPPPP........PPPPPPP.................................... .......... -.....PPPPP........PPPPPPP.........-----........................ ........ -......PPP..PPPPPPPPPPPP...........+...|......................... ..... -..........PPPPPPPPPPP.............|...|......................... .... -..........PPPPPPPPP...............-----......................... . -..............PPP................................................. -...............PP.................................................... -................PPP................................................... -ENDMAP -# Dungeon Description -REGION:(00,00,75,19),lit,"ordinary" -REGION:(24,03,26,04),unlit,"ordinary" -REGION:(31,08,33,09),unlit,"ordinary" -REGION:(35,14,37,15),unlit,"ordinary" -REGION:(39,03,54,08),lit,"ordinary" -REGION:(56,00,75,08),unlit,"ordinary" -REGION:(64,09,75,16),unlit,"ordinary" -# Doors -DOOR:open,(23,03) -DOOR:open,(30,08) -DOOR:open,(34,14) -DOOR:locked,(38,05) -DOOR:locked,(38,06) -DOOR:closed,(43,03) -DOOR:closed,(43,05) -DOOR:closed,(43,06) -DOOR:closed,(43,08) -DOOR:locked,(55,06) -# Stairs -STAIR:(05,02),up -STAIR:(70,13),down -# Objects -OBJECT:random,(42,03) -OBJECT:random,(42,03) -OBJECT:random,(42,03) -OBJECT:random,(41,03) -OBJECT:random,(41,03) -OBJECT:random,(41,03) -OBJECT:random,(41,03) -OBJECT:random,(41,08) -OBJECT:random,(41,08) -OBJECT:random,(42,08) -OBJECT:random,(42,08) -OBJECT:random,(42,08) -OBJECT:random,(71,13) -OBJECT:random,(71,13) -OBJECT:random,(71,13) -# Random traps -TRAP:"spiked pit",(10,13) -TRAP:"spiked pit",(21,07) -TRAP:"spiked pit",(67,08) -TRAP:"spiked pit",(68,09) -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('O',"ogre"),(12,09),hostile -MONSTER:('O',"ogre"),(18,11),hostile -MONSTER:('O',"ogre"),(45,05),hostile -MONSTER:('O',"ogre"),(45,06),hostile -MONSTER:('O',"ogre"),(47,05),hostile -MONSTER:('O',"ogre"),(46,05),hostile -MONSTER:('O',"ogre"),(56,03),hostile -MONSTER:('O',"ogre"),(56,04),hostile -MONSTER:('O',"ogre"),(56,05),hostile -MONSTER:('O',"ogre"),(56,06),hostile -MONSTER:('O',"ogre"),(57,03),hostile -MONSTER:('O',"ogre"),(57,04),hostile -MONSTER:('O',"ogre"),(57,05),hostile -MONSTER:('O',"ogre"),(57,06),hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:'O',random,hostile -MONSTER:'T',random,hostile -MONSTER:('T',"rock troll"),(46,06),hostile -MONSTER:('T',"rock troll"),(47,06),hostile -MONSTER:('T',"rock troll"),(56,07),hostile -MONSTER:('T',"rock troll"),(57,07),hostile -MONSTER:('T',"rock troll"),(70,13),hostile -MONSTER:('T',"rock troll"),random,hostile -MONSTER:('T',"rock troll"),random,hostile -MONSTER:'T',random,hostile - -# -# The "goal" level for the quest. -# -# Here you meet Thoth Amon, your nemesis monster. You have to -# defeat Thoth Amon in combat to gain the artifact you have -# been assigned to retrieve. -# - -MAZE: "Bar-goal", ' ' -GEOMETRY:center,center -MAP - - ............. - .................. - .... ......................... .... - ....... .......................... ....... - ...... ........................ ....... - .. ...................................... .. - .. ..................... .. - .. .................. .. - .. ..S...S.............. ................ - .. ........ ... - ......... .. - ...... .. ... .... - .. ... .. ...... ........ - .... .. .................. ........ ...... - ...... ...................... ...... .. - .... .................. ........... - .............. - ........... - -ENDMAP -# Dungeon Description -REGION:(00,00,75,19),unlit,"ordinary" -# Secret doors -DOOR:locked,(22,09) -DOOR:locked,(26,09) -# Stairs -STAIR:(36,05),up -# The altar. Unattended. -ALTAR:(63,04),noncoaligned,altar -NON_DIGGABLE:(00,00,75,19) -# Objects -OBJECT:('*',"luckstone"),(63,04),blessed,0,name:"The Heart of Ahriman" -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('@',"Thoth Amon"),(63,04),hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:('O',"ogre"),random,hostile -MONSTER:'O',random,hostile -MONSTER:'O',random,hostile -MONSTER:('T',"rock troll"),random,hostile -MONSTER:('T',"rock troll"),random,hostile -MONSTER:('T',"rock troll"),random,hostile -MONSTER:('T',"rock troll"),random,hostile -MONSTER:('T',"rock troll"),random,hostile -MONSTER:('T',"rock troll"),random,hostile -MONSTER:('T',"rock troll"),random,hostile -MONSTER:('T',"rock troll"),random,hostile -MONSTER:'T',random,hostile -WALLIFY - -# -# The "fill" levels for the quest. -# -# These levels are used to fill out any levels not occupied by specific -# levels as defined above. "filla" is the upper filler, between the -# start and locate levels, and "fillb" the lower between the locate -# and goal levels. -# - -MAZE: "Bar-fila" , ' ' -INIT_MAP: mines, '.' , '.' , true , true , unlit , false -NOMAP -# -STAIR: random, up -STAIR: random, down -# -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -# -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random -# -MONSTER: ('O', "ogre"), random, hostile -MONSTER: ('O', "ogre"), random, hostile -MONSTER: 'O', random, hostile -MONSTER: ('T', "rock troll"), random, hostile - -MAZE: "Bar-filb" , ' ' -INIT_MAP: mines, '.' , ' ' , true , true , unlit , true -NOMAP -# -STAIR: random, up -STAIR: random, down -# -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -# -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random -# -MONSTER: ('O', "ogre"), random, hostile -MONSTER: ('O', "ogre"), random, hostile -MONSTER: ('O', "ogre"), random, hostile -MONSTER: ('O', "ogre"), random, hostile -MONSTER: ('O', "ogre"), random, hostile -MONSTER: ('O', "ogre"), random, hostile -MONSTER: ('O', "ogre"), random, hostile -MONSTER: 'O' , random, hostile -MONSTER: ('T', "rock troll"), random, hostile -MONSTER: ('T', "rock troll"), random, hostile -MONSTER: ('T', "rock troll"), random, hostile -MONSTER: 'T' , random, hostile diff --git a/dat/Cav-fila.lua b/dat/Cav-fila.lua new file mode 100644 index 000000000..b32a90854 --- /dev/null +++ b/dat/Cav-fila.lua @@ -0,0 +1,35 @@ +-- NetHack 3.6 Caveman.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.level_init({ style = "mines", fg = ".", bg = " ", smoothed=true, joined=true, walled=true }) + +-- +des.stair("up") +des.stair("down") +-- +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- +des.trap() +des.trap() +des.trap() +des.trap() +-- +des.monster({ id = "bugbear", peaceful=0 }) +des.monster({ id = "bugbear", peaceful=0 }) +des.monster({ id = "bugbear", peaceful=0 }) +des.monster({ id = "bugbear", peaceful=0 }) +des.monster({ id = "bugbear", peaceful=0 }) +des.monster({ class = "h", peaceful=0 }) +des.monster({ id = "hill giant", peaceful=0 }) diff --git a/dat/Cav-filb.lua b/dat/Cav-filb.lua new file mode 100644 index 000000000..0e0c24542 --- /dev/null +++ b/dat/Cav-filb.lua @@ -0,0 +1,41 @@ +-- NetHack 3.6 Caveman.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.level_init({ style = "mines", fg = ".", bg = " ", smoothed=true, joined=true, walled=true }) + +-- +des.stair("up") +des.stair("down") +-- +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- +des.trap() +des.trap() +des.trap() +des.trap() +-- +des.monster({ id = "bugbear", peaceful=0 }) +des.monster({ id = "bugbear", peaceful=0 }) +des.monster({ id = "bugbear", peaceful=0 }) +des.monster({ id = "bugbear", peaceful=0 }) +des.monster({ class = "h", peaceful=0 }) +des.monster({ class = "h", peaceful=0 }) +des.monster({ id = "hill giant", peaceful=0 }) +des.monster({ id = "hill giant", peaceful=0 }) diff --git a/dat/Cav-goal.lua b/dat/Cav-goal.lua new file mode 100644 index 000000000..98919b04f --- /dev/null +++ b/dat/Cav-goal.lua @@ -0,0 +1,59 @@ +-- NetHack 3.6 Caveman.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.map([[ + + ..................... + ....................... + ......................... + ........................... + ............................. + ............................... + ................................. + ................................... + ..................................... + ....................................... + ..................................... + ................................... + ................................. + ............................... + ............................. + ........................... + ......................... + ....................... + +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,19), "lit") +-- Stairs +des.stair("up") +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- Objects +des.object({ id = "mace", x=23, y=10, buc="blessed", spe=0, name="The Sceptre of Might" }) +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- monsters. +des.monster({ id = "Chromatic Dragon", x=23, y=10, asleep=1 }) +des.monster("shrieker", 26, 13) +des.monster("shrieker", 25, 8) +des.monster("shrieker", 45, 11) +des.wallify() diff --git a/dat/Cav-loca.lua b/dat/Cav-loca.lua new file mode 100644 index 000000000..e3b970948 --- /dev/null +++ b/dat/Cav-loca.lua @@ -0,0 +1,101 @@ +-- NetHack 3.6 Caveman.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "hardfloor") + +des.map([[ + + ............. ........... + ............... ............. + ............. ............... .......... + ........... ............. ............... + ... ... .................. + ... .......... ... .................. + ... ............ BBB................... + ... .......... ...................... + ..... .. .....B........................ + .... ............... . ........B.......................... + ...... .. .............S.............. .................. + .... .. ........... ............... + .. ... .................... + .... BB................... + .. .. .. ............... + .. ....... .... ..... .... .. ....... S + ............ ....... .. ....... ..... ... .... + ....... ..... ...... ....... + +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,19), "unlit") +des.region({ region={52,06, 73,15}, lit=1, type="ordinary", prefilled=0, irregular=1 }) +-- Doors +des.door("locked",28,11) +-- Stairs +des.stair("up", 04,03) +des.stair("down", 73,10) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- Objects +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Random monsters. +des.monster({ id = "bugbear", x=02, y=10, peaceful=0 }) +des.monster({ id = "bugbear", x=03, y=11, peaceful=0 }) +des.monster({ id = "bugbear", x=04, y=12, peaceful=0 }) +des.monster({ id = "bugbear", x=02, y=11, peaceful=0 }) +des.monster({ id = "bugbear", x=16, y=16, peaceful=0 }) +des.monster({ id = "bugbear", x=17, y=17, peaceful=0 }) +des.monster({ id = "bugbear", x=18, y=18, peaceful=0 }) +des.monster({ id = "bugbear", x=19, y=16, peaceful=0 }) +des.monster({ id = "bugbear", x=30, y=06, peaceful=0 }) +des.monster({ id = "bugbear", x=31, y=07, peaceful=0 }) +des.monster({ id = "bugbear", x=32, y=08, peaceful=0 }) +des.monster({ id = "bugbear", x=33, y=06, peaceful=0 }) +des.monster({ id = "bugbear", x=34, y=07, peaceful=0 }) +des.monster({ id = "bugbear", peaceful=0 }) +des.monster({ id = "bugbear", peaceful=0 }) +des.monster({ id = "bugbear", peaceful=0 }) +des.monster({ id = "bugbear", peaceful=0 }) +des.monster({ class = "h", peaceful=0 }) +des.monster({ class = "H", peaceful=0 }) +des.monster({ id = "hill giant", x=03, y=12, peaceful=0 }) +des.monster({ id = "hill giant", x=20, y=17, peaceful=0 }) +des.monster({ id = "hill giant", x=35, y=08, peaceful=0 }) +des.monster({ id = "hill giant", peaceful=0 }) +des.monster({ id = "hill giant", peaceful=0 }) +des.monster({ id = "hill giant", peaceful=0 }) +des.monster({ id = "hill giant", peaceful=0 }) +des.monster({ class = "H", peaceful=0 }) +des.wallify() + +-- +-- The "goal" level for the quest. +-- +-- Here you meet Tiamat your nemesis monster. You have to +-- defeat Tiamat in combat to gain the artifact you have +-- been assigned to retrieve. +-- diff --git a/dat/Cav-strt.lua b/dat/Cav-strt.lua new file mode 100644 index 000000000..eae5c35d1 --- /dev/null +++ b/dat/Cav-strt.lua @@ -0,0 +1,91 @@ +-- NetHack 3.6 Caveman.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- The "start" level for the quest. +-- +-- Here you meet your (besieged) class leader, Shaman Karnov +-- and receive your quest assignment. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor") + +des.map([[ + + ...... .......................... ... .... ...... + ...... .......................... ........ .... ..... + ..BB ............................. ......... .... .. + .. ...................... ....... .. .... .. + .. .................... .. ....... .. ... + .. S BB ..... ....... .... .... + .. ... . .. ........ .. .. .. ... + .. ...... .. ............ .. ... + . .... .. ........ .. ........... + ... .. .. ............. ................... + ..... ..... ............................... ........... + .....B................ ... ... + ..... . .......... .... . ... .......... ... + ... .. ............. .. ................... .... + BB .. ......... BB ... .......... .. ... ... + ...... ..... B ........ .. .. .... ... + .......... .......... ..... ... ..... ........ + .. ... . ..... .... .. ... .. + +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,19), "unlit") +des.region({ region={13,01, 40,05}, lit=1, type="temple", prefilled=0, irregular=1 }) +-- The occupied rooms. +des.region({ region={02,01, 08,03}, lit=1, type="ordinary", prefilled=0, irregular=1 }) +des.region({ region={01,11, 06,14}, lit=1, type="ordinary", prefilled=0, irregular=1 }) +des.region({ region={13,08, 18,10}, lit=1, type="ordinary", prefilled=0, irregular=1 }) +des.region({ region={05,17, 14,18}, lit=1, type="ordinary", prefilled=0, irregular=1 }) +des.region({ region={17,16, 23,18}, lit=1, type="ordinary", prefilled=0, irregular=1 }) +des.region({ region={35,16, 44,18}, lit=1, type="ordinary", prefilled=0, irregular=1 }) +-- Stairs +des.stair("down", 02,03) +-- Portal arrival point +des.levregion({ region = {71,09,71,09}, type="branch" }) +-- Doors +des.door("locked",19,06) +-- The temple altar (this will force a priest(ess) to be created) +des.altar({ x=36,y=02, align="coaligned", type="shrine" }) +-- Shaman Karnov +des.monster("Shaman Karnov", 35, 02) +-- The treasure of Shaman Karnov +des.object("chest", 34, 02) +-- neanderthal guards for the audience chamber +des.monster("neanderthal", 20, 03) +des.monster("neanderthal", 20, 02) +des.monster("neanderthal", 20, 01) +des.monster("neanderthal", 21, 03) +des.monster("neanderthal", 21, 02) +des.monster("neanderthal", 21, 01) +des.monster("neanderthal", 22, 01) +des.monster("neanderthal", 26, 09) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- Random traps +des.trap("pit",47,11) +des.trap("pit",57,10) +des.trap() +des.trap() +des.trap() +des.trap() +-- Monsters on siege duty (in the outer caves). +des.monster({ id ="bugbear", x=47, y=02, peaceful=0 }) +des.monster({ id ="bugbear", x=48, y=03, peaceful=0 }) +des.monster({ id ="bugbear", x=49, y=04, peaceful=0 }) +des.monster({ id ="bugbear", x=67, y=03, peaceful=0 }) +des.monster({ id ="bugbear", x=69, y=04, peaceful=0 }) +des.monster({ id ="bugbear", x=51, y=13, peaceful=0 }) +des.monster({ id ="bugbear", x=53, y=14, peaceful=0 }) +des.monster({ id ="bugbear", x=55, y=15, peaceful=0 }) +des.monster({ id ="bugbear", x=63, y=10, peaceful=0 }) +des.monster({ id ="bugbear", x=65, y=09, peaceful=0 }) +des.monster({ id ="bugbear", x=67, y=10, peaceful=0 }) +des.monster({ id ="bugbear", x=69, y=11, peaceful=0 }) +des.wallify() diff --git a/dat/Caveman.des b/dat/Caveman.des deleted file mode 100644 index a2e2ec9b8..000000000 --- a/dat/Caveman.des +++ /dev/null @@ -1,316 +0,0 @@ -# NetHack 3.6 Caveman.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# Copyright (c) 1991 by M. Stephenson -# NetHack may be freely redistributed. See license for details. -# -# The "start" level for the quest. -# -# Here you meet your (besieged) class leader, Shaman Karnov -# and receive your quest assignment. -# -MAZE: "Cav-strt",' ' -FLAGS: noteleport,hardfloor -GEOMETRY:center,center -MAP - - ...... .......................... ... .... ...... - ...... .......................... ........ .... ..... - ..BB ............................. ......... .... .. - .. ...................... ....... .. .... .. - .. .................... .. ....... .. ... - .. S BB ..... ....... .... .... - .. ... . .. ........ .. .. .. ... - .. ...... .. ............ .. ... - . .... .. ........ .. ........... - ... .. .. ............. ................... - ..... ..... ............................... ........... - .....B................ ... ... - ..... . .......... .... . ... .......... ... - ... .. ............. .. ................... .... - BB .. ......... BB ... .......... .. ... ... - ...... ..... B ........ .. .. .... ... - .......... .......... ..... ... ..... ........ - .. ... . ..... .... .. ... .. - -ENDMAP -# Dungeon Description -REGION:(00,00,75,19),unlit,"ordinary" -REGION:(13,01,40,05),lit,"temple",unfilled,irregular -# The occupied rooms. -REGION:(02,01,08,03),lit,"ordinary",unfilled,irregular -REGION:(01,11,06,14),lit,"ordinary",unfilled,irregular -REGION:(13,08,18,10),lit,"ordinary",unfilled,irregular -REGION:(05,17,14,18),lit,"ordinary",unfilled,irregular -REGION:(17,16,23,18),lit,"ordinary",unfilled,irregular -REGION:(35,16,44,18),lit,"ordinary",unfilled,irregular -# Stairs -STAIR:(02,03),down -# Portal arrival point -BRANCH:(71,09,71,09),(0,0,0,0) -# Doors -DOOR:locked,(19,06) -# The temple altar (this will force a priest(ess) to be created) -ALTAR:(36,02),coaligned,shrine -# Shaman Karnov -MONSTER:('@',"Shaman Karnov"),(35,02) -# The treasure of Shaman Karnov -OBJECT:('(',"chest"),(34,02) -# neanderthal guards for the audience chamber -MONSTER:('@',"neanderthal"),(20,03) -MONSTER:('@',"neanderthal"),(20,02) -MONSTER:('@',"neanderthal"),(20,01) -MONSTER:('@',"neanderthal"),(21,03) -MONSTER:('@',"neanderthal"),(21,02) -MONSTER:('@',"neanderthal"),(21,01) -MONSTER:('@',"neanderthal"),(22,01) -MONSTER:('@',"neanderthal"),(26,09) -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# Random traps -TRAP:"pit",(47,11) -TRAP:"pit",(57,10) -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Monsters on siege duty (in the outer caves). -MONSTER: ('h',"bugbear"),(47,02),hostile -MONSTER: ('h',"bugbear"),(48,03),hostile -MONSTER: ('h',"bugbear"),(49,04),hostile -MONSTER: ('h',"bugbear"),(67,03),hostile -MONSTER: ('h',"bugbear"),(69,04),hostile -MONSTER: ('h',"bugbear"),(51,13),hostile -MONSTER: ('h',"bugbear"),(53,14),hostile -MONSTER: ('h',"bugbear"),(55,15),hostile -MONSTER: ('h',"bugbear"),(63,10),hostile -MONSTER: ('h',"bugbear"),(65,09),hostile -MONSTER: ('h',"bugbear"),(67,10),hostile -MONSTER: ('h',"bugbear"),(69,11),hostile -WALLIFY - -# -# The "locate" level for the quest. -# -# Here you have to find the lair of Tiamat to go -# further towards your assigned quest. -# - -MAZE: "Cav-loca",' ' -FLAGS: hardfloor -GEOMETRY:center,center -MAP - - ............. ........... - ............... ............. - ............. ............... .......... - ........... ............. ............... - ... ... .................. - ... .......... ... .................. - ... ............ BBB................... - ... .......... ...................... - ..... .. .....B........................ - .... ............... . ........B.......................... - ...... .. .............S.............. .................. - .... .. ........... ............... - .. ... .................... - .... BB................... - .. .. .. ............... - .. ....... .... ..... .... .. ....... S - ............ ....... .. ....... ..... ... .... - ....... ..... ...... ....... - -ENDMAP -# Dungeon Description -REGION:(00,00,75,19),unlit,"ordinary" -REGION:(52,06,73,15),lit,"ordinary",unfilled,irregular -# Doors -DOOR:locked,(28,11) -# Stairs -STAIR:(04,03),up -STAIR:(73,10),down -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# Objects -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('h',"bugbear"),(02,10),hostile -MONSTER:('h',"bugbear"),(03,11),hostile -MONSTER:('h',"bugbear"),(04,12),hostile -MONSTER:('h',"bugbear"),(02,11),hostile -MONSTER:('h',"bugbear"),(16,16),hostile -MONSTER:('h',"bugbear"),(17,17),hostile -MONSTER:('h',"bugbear"),(18,18),hostile -MONSTER:('h',"bugbear"),(19,16),hostile -MONSTER:('h',"bugbear"),(30,06),hostile -MONSTER:('h',"bugbear"),(31,07),hostile -MONSTER:('h',"bugbear"),(32,08),hostile -MONSTER:('h',"bugbear"),(33,06),hostile -MONSTER:('h',"bugbear"),(34,07),hostile -MONSTER:('h',"bugbear"),random,hostile -MONSTER:('h',"bugbear"),random,hostile -MONSTER:('h',"bugbear"),random,hostile -MONSTER:('h',"bugbear"),random,hostile -MONSTER:'h',random,hostile -MONSTER:'H',random,hostile -MONSTER:('H',"hill giant"),(03,12),hostile -MONSTER:('H',"hill giant"),(20,17),hostile -MONSTER:('H',"hill giant"),(35,08),hostile -MONSTER:('H',"hill giant"),random,hostile -MONSTER:('H',"hill giant"),random,hostile -MONSTER:('H',"hill giant"),random,hostile -MONSTER:('H',"hill giant"),random,hostile -MONSTER:'H',random,hostile -WALLIFY - -# -# The "goal" level for the quest. -# -# Here you meet Tiamat your nemesis monster. You have to -# defeat Tiamat in combat to gain the artifact you have -# been assigned to retrieve. -# - -MAZE: "Cav-goal", ' ' -GEOMETRY:center,center -MAP - - ..................... - ....................... - ......................... - ........................... - ............................. - ............................... - ................................. - ................................... - ..................................... - ....................................... - ..................................... - ................................... - ................................. - ............................... - ............................. - ........................... - ......................... - ....................... - -ENDMAP -# Dungeon Description -REGION:(00,00,75,19),lit,"ordinary" -# Stairs -STAIR:random,up -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# Objects -OBJECT:(')',"mace"),(23,10),blessed,0,name:"The Sceptre of Might" -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# monsters. -MONSTER:('D',"Chromatic Dragon"),(23,10),asleep -MONSTER:('F',"shrieker"),(26,13) -MONSTER:('F',"shrieker"),(25,8) -MONSTER:('F',"shrieker"),(45,11) -WALLIFY - -# -# The "fill" levels for the quest. -# -# These levels are used to fill out any levels not occupied by specific -# levels as defined above. "filla" is the upper filler, between the -# start and locate levels, and "fillb" the lower between the locate -# and goal levels. -# - -MAZE: "Cav-fila" , ' ' -INIT_MAP: mines, '.' , ' ' , true , true , random , true -NOMAP -# -STAIR: random, up -STAIR: random, down -# -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -# -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random -# -MONSTER: ('h', "bugbear"), random, hostile -MONSTER: ('h', "bugbear"), random, hostile -MONSTER: ('h', "bugbear"), random, hostile -MONSTER: ('h', "bugbear"), random, hostile -MONSTER: ('h', "bugbear"), random, hostile -MONSTER: 'h', random, hostile -MONSTER: ('H', "hill giant"), random, hostile - -MAZE: "Cav-filb" , ' ' -INIT_MAP: mines, '.' , ' ' , true , true , random , true -NOMAP -# -STAIR: random, up -STAIR: random, down -# -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -# -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random -# -MONSTER: ('h', "bugbear"), random, hostile -MONSTER: ('h', "bugbear"), random, hostile -MONSTER: ('h', "bugbear"), random, hostile -MONSTER: ('h', "bugbear"), random, hostile -MONSTER: 'h', random, hostile -MONSTER: 'h', random, hostile -MONSTER: ('H', "hill giant"), random, hostile -MONSTER: ('H', "hill giant"), random, hostile diff --git a/dat/GENFILES b/dat/GENFILES index c360d940f..1a49c97a2 100755 --- a/dat/GENFILES +++ b/dat/GENFILES @@ -9,17 +9,17 @@ ($dir = $0) =~ s!^(.*/)(.*)!$1!; -print "T (files generated by lev_comp at playground creation time)\n"; - -foreach $des (<$dir*.des>){ - open IN, "<", $des or warn("Can't open $des: $!"); - while(){ - m/^(MAZE|LEVEL):\s*"(.*?)"/ && do { - print "F $2.lev\n"; - }; - } - close IN; -} +#print "T (files generated by lev_comp at playground creation time)\n"; +# +#foreach $des (<$dir*.des>){ +# open IN, "<", $des or warn("Can't open $des: $!"); +# while(){ +# m/^(MAZE|LEVEL):\s*"(.*?)"/ && do { +# print "F $2.lev\n"; +# }; +# } +# close IN; +#} while(){ print; } @@ -41,10 +41,6 @@ T (files generated for win32 gui at compile time) F guioptions T (files generated by makedefs at playground creation time) F data -F dungeon.pdf F options F oracles -F quest.dat F rumors -T (file generated by dgn_comp at playground creation time) -F dungeon diff --git a/dat/Hea-fila.lua b/dat/Hea-fila.lua new file mode 100644 index 000000000..bee89587f --- /dev/null +++ b/dat/Hea-fila.lua @@ -0,0 +1,42 @@ +-- NetHack 3.6 Healer.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991, 1993 by M. Stephenson, P. Winner +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = "P" }); + +des.level_flags("mazelevel"); + +des.level_init({ style="mines", fg=".", bg="P", smoothed=false, joined=true, lit=1, walled=false }) + +-- +des.stair("up") +des.stair("down") +-- +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- +des.monster("rabid rat") +des.monster({ class = "r", peaceful=0 }) +des.monster({ class = "r", peaceful=0 }) +des.monster("giant eel") +des.monster("giant eel") +des.monster("electric eel") +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +-- +des.trap() +des.trap() +des.trap() +des.trap() diff --git a/dat/Hea-filb.lua b/dat/Hea-filb.lua new file mode 100644 index 000000000..ac6325866 --- /dev/null +++ b/dat/Hea-filb.lua @@ -0,0 +1,50 @@ +-- NetHack 3.6 Healer.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991, 1993 by M. Stephenson, P. Winner +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = "P" }); + +des.level_flags("mazelevel"); + +des.level_init({ style="mines", fg=".", bg="P", smoothed=false, joined=true, lit=1, walled=false }) + +-- +des.stair("up") +des.stair("down") +-- +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- +des.monster("rabid rat") +des.monster("rabid rat") +des.monster({ class = "r", peaceful=0 }) +des.monster({ class = "r", peaceful=0 }) +des.monster("giant eel") +des.monster("giant eel") +des.monster("giant eel") +des.monster("giant eel") +des.monster("giant eel") +des.monster("electric eel") +des.monster("electric eel") +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +-- +des.trap() +des.trap() +des.trap() +des.trap() diff --git a/dat/Hea-goal.lua b/dat/Hea-goal.lua new file mode 100644 index 000000000..48d6fbae4 --- /dev/null +++ b/dat/Hea-goal.lua @@ -0,0 +1,90 @@ +-- NetHack 3.6 Healer.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991, 1993 by M. Stephenson, P. Winner +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = "P" }); + +des.level_flags("mazelevel"); + +-- +des.level_init({ style="mines", fg=".", bg="P", smoothed=false, joined=true, lit=1, walled=false }) + +des.map([[ +.P....................................PP. +PP.......PPPPPPP....PPPPPPP....PPPP...PP. +...PPPPPPP....PPPPPPP.....PPPPPP..PPP...P +...PP..............................PPP... +..PP..............................PP..... +..PP..............................PPP.... +..PPP..............................PP.... +.PPP..............................PPPP... +...PP............................PPP...PP +..PPPP...PPPPP..PPPP...PPPPP.....PP...PP. +P....PPPPP...PPPP..PPPPP...PPPPPPP...PP.. +PPP..................................PPP. +]]); +-- Dungeon Description +des.region(selection.area(00,00,40,11), "lit") +-- Stairs +des.stair("up", 39,10) +-- Non diggable walls +des.non_diggable(selection.area(00,00,40,11)) +-- Objects +des.object({ id = "quarterstaff", x=20, y=06, buc="blessed", spe=0, name="The Staff of Aesculapius" }) +des.object("lightning", 20, 06) +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Random monsters. +des.monster({ id = "Cyclops", x=20, y=06, peaceful=0 }) +des.monster("rabid rat") +des.monster("rabid rat") +des.monster("rabid rat") +des.monster({ class = "r", peaceful=0 }) +des.monster({ class = "r", peaceful=0 }) +des.monster("giant eel") +des.monster("giant eel") +des.monster("giant eel") +des.monster("giant eel") +des.monster("giant eel") +des.monster("giant eel") +des.monster("electric eel") +des.monster("electric eel") +des.monster("shark") +des.monster("shark") +des.monster({ class = ";", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) + diff --git a/dat/Hea-loca.lua b/dat/Hea-loca.lua new file mode 100644 index 000000000..fdc432471 --- /dev/null +++ b/dat/Hea-loca.lua @@ -0,0 +1,97 @@ +-- NetHack 3.6 Healer.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991, 1993 by M. Stephenson, P. Winner +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "hardfloor"); +-- +des.level_init({ style="mines", fg=".", bg="P", smoothed=true ,joined=true, lit=1, walled=false }) + +des.map([[ +PPPPPPPPPPPPP.......PPPPPPPPPPP +PPPPPPPP...............PPPPPPPP +PPPP.....-------------...PPPPPP +PPPPP....|.S.........|....PPPPP +PPP......+.|.........|...PPPPPP +PPP......+.|.........|..PPPPPPP +PPPP.....|.S.........|..PPPPPPP +PPPPP....-------------....PPPPP +PPPPPPPP...............PPPPPPPP +PPPPPPPPPPP........PPPPPPPPPPPP +]]); +-- Dungeon Description +des.region(selection.area(00,00,30,09), "lit") +des.region({ region={12,03, 20,06}, lit=1, type="temple" }) +-- Doors +des.door("closed",09,04) +des.door("closed",09,05) +des.door("locked",11,03) +des.door("locked",11,06) +-- Stairs +des.stair("up", 04,04) +des.stair("down", 20,06) +-- Non diggable walls +des.non_diggable(selection.area(11,02,21,07)) +-- Altar in the temple. +des.altar({ x=13,y=05, align="chaos", type="shrine" }) +-- Objects +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Random monsters. +des.monster("rabid rat") +des.monster("rabid rat") +des.monster("rabid rat") +des.monster("rabid rat") +des.monster("rabid rat") +des.monster("rabid rat") +des.monster("rabid rat") +des.monster("rabid rat") +des.monster({ class = "r", peaceful=0 }) +des.monster("giant eel") +des.monster("giant eel") +des.monster("giant eel") +des.monster("giant eel") +des.monster("giant eel") +des.monster("electric eel") +des.monster("electric eel") +des.monster("kraken") +des.monster("shark") +des.monster("shark") +des.monster({ class = ";", peaceful=0 }) +des.monster({ class = ";", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) diff --git a/dat/Hea-strt.lua b/dat/Hea-strt.lua new file mode 100644 index 000000000..665c73097 --- /dev/null +++ b/dat/Hea-strt.lua @@ -0,0 +1,107 @@ +-- NetHack 3.6 Healer.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991, 1993 by M. Stephenson, P. Winner +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- The "start" level for the quest. +-- +-- Here you meet your (besieged) class leader, Hippocrates +-- and receive your quest assignment. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor") + +des.map([[ +PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP +PPPP........PPPP.....PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP.P..PPPPP......PPPPPPPP +PPP..........PPPP...PPPPP.........................PPPP..PPPPP........PPPPPPP +PP............PPPPPPPP..............................PPP...PPPP......PPPPPPPP +P.....PPPPPPPPPPPPPPP................................PPPPPPPPPPPPPPPPPPPPPPP +PPPP....PPPPPPPPPPPP...................................PPPPP.PPPPPPPPPPPPPPP +PPPP........PPPPP.........-----------------------........PP...PPPPPPP.....PP +PPP............PPPPP....--|.|......S..........S.|--.....PPPP.PPPPPPP.......P +PPPP..........PPPPP.....|.S.|......-----------|S|.|......PPPPPP.PPP.......PP +PPPPPP......PPPPPP......|.|.|......|...|......|.|.|.....PPPPPP...PP.......PP +PPPPPPPPPPPPPPPPPPP.....+.|.|......S.\.S......|.|.+......PPPPPP.PPPP.......P +PPP...PPPPP...PPPP......|.|.|......|...|......|.|.|.......PPPPPPPPPPP.....PP +PP.....PPP.....PPP......|.|S|-----------......|.S.|......PPPPPPPPPPPPPPPPPPP +PPP..PPPPP...PPPP.......--|.S..........S......|.|--.....PPPPPPPPP....PPPPPPP +PPPPPPPPPPPPPPPP..........-----------------------..........PPPPP..........PP +PPPPPPPPPPPPPPPPP........................................PPPPPP............P +PPP.............PPPP...................................PPP..PPPP..........PP +PP...............PPPPP................................PPPP...PPPP........PPP +PPP.............PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP....PPPPPP +PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP +]]); + +des.replace_terrain({ region={01,01, 74,18}, fromterrain="P", toterrain=".", chance=10 }) + +-- Dungeon Description +des.region(selection.area(00,00,75,19), "lit") +-- Stairs +des.stair("down", 37,9) +-- Portal arrival point +des.levregion({ region = {04,12,04,12}, type="branch" }) +-- altar for the Temple +des.altar({ x=32,y=09,align="neutral",type="altar" }) +-- Doors +des.door("locked",24,10) +des.door("closed",26,08) +des.door("closed",27,12) +des.door("locked",28,13) +des.door("closed",35,07) +des.door("locked",35,10) +des.door("locked",39,10) +des.door("closed",39,13) +des.door("locked",46,07) +des.door("closed",47,08) +des.door("closed",48,12) +des.door("locked",50,10) +-- Hippocrates +des.monster("Hippocrates", 37, 10) +-- The treasure of Hippocrates +des.object("chest", 37, 10) +-- intern guards for the audience chamber +des.monster("attendant", 29, 08) +des.monster("attendant", 29, 09) +des.monster("attendant", 29, 10) +des.monster("attendant", 29, 11) +des.monster("attendant", 40, 09) +des.monster("attendant", 40, 10) +des.monster("attendant", 40, 11) +des.monster("attendant", 40, 13) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Monsters on siege duty. +des.monster("rabid rat") +des.monster("rabid rat") +des.monster("rabid rat") +des.monster("rabid rat") +des.monster("rabid rat") +des.monster("rabid rat") +des.monster("rabid rat") +des.monster("rabid rat") +des.monster("rabid rat") +des.monster("rabid rat") +des.monster("giant eel") +des.monster("shark") +des.monster(";") +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) +des.monster({ class = "S", peaceful=0 }) diff --git a/dat/Healer.des b/dat/Healer.des deleted file mode 100644 index 1f8e3497d..000000000 --- a/dat/Healer.des +++ /dev/null @@ -1,380 +0,0 @@ -# NetHack 3.6 Healer.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# Copyright (c) 1991, 1993 by M. Stephenson, P. Winner -# NetHack may be freely redistributed. See license for details. -# -# The "start" level for the quest. -# -# Here you meet your (besieged) class leader, Hippocrates -# and receive your quest assignment. -# -MAZE: "Hea-strt",' ' -FLAGS: noteleport,hardfloor -GEOMETRY:center,center -MAP -PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP -PPPP........PPPP.....PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP.P..PPPPP......PPPPPPPP -PPP..........PPPP...PPPPP.........................PPPP..PPPPP........PPPPPPP -PP............PPPPPPPP..............................PPP...PPPP......PPPPPPPP -P.....PPPPPPPPPPPPPPP................................PPPPPPPPPPPPPPPPPPPPPPP -PPPP....PPPPPPPPPPPP...................................PPPPP.PPPPPPPPPPPPPPP -PPPP........PPPPP.........-----------------------........PP...PPPPPPP.....PP -PPP............PPPPP....--|.|......S..........S.|--.....PPPP.PPPPPPP.......P -PPPP..........PPPPP.....|.S.|......-----------|S|.|......PPPPPP.PPP.......PP -PPPPPP......PPPPPP......|.|.|......|...|......|.|.|.....PPPPPP...PP.......PP -PPPPPPPPPPPPPPPPPPP.....+.|.|......S.\.S......|.|.+......PPPPPP.PPPP.......P -PPP...PPPPP...PPPP......|.|.|......|...|......|.|.|.......PPPPPPPPPPP.....PP -PP.....PPP.....PPP......|.|S|-----------......|.S.|......PPPPPPPPPPPPPPPPPPP -PPP..PPPPP...PPPP.......--|.S..........S......|.|--.....PPPPPPPPP....PPPPPPP -PPPPPPPPPPPPPPPP..........-----------------------..........PPPPP..........PP -PPPPPPPPPPPPPPPPP........................................PPPPPP............P -PPP.............PPPP...................................PPP..PPPP..........PP -PP...............PPPPP................................PPPP...PPPP........PPP -PPP.............PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP....PPPPPP -PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP -ENDMAP - -REPLACE_TERRAIN:(01,01,74,18), 'P', '.', 10% - -# Dungeon Description -REGION:(00,00,75,19),lit,"ordinary" -# Stairs -STAIR:(37,9),down -# Portal arrival point -BRANCH:(04,12,04,12),(0,0,0,0) -# altar for the Temple -ALTAR:(32,09),neutral,altar -# Doors -DOOR:locked,(24,10) -DOOR:closed,(26,08) -DOOR:closed,(27,12) -DOOR:locked,(28,13) -DOOR:closed,(35,07) -DOOR:locked,(35,10) -DOOR:locked,(39,10) -DOOR:closed,(39,13) -DOOR:locked,(46,07) -DOOR:closed,(47,08) -DOOR:closed,(48,12) -DOOR:locked,(50,10) -# Hippocrates -MONSTER:('@',"Hippocrates"),(37,10) -# The treasure of Hippocrates -OBJECT:('(',"chest"),(37,10) -# intern guards for the audience chamber -MONSTER:('@',"attendant"),(29,08) -MONSTER:('@',"attendant"),(29,09) -MONSTER:('@',"attendant"),(29,10) -MONSTER:('@',"attendant"),(29,11) -MONSTER:('@',"attendant"),(40,09) -MONSTER:('@',"attendant"),(40,10) -MONSTER:('@',"attendant"),(40,11) -MONSTER:('@',"attendant"),(40,13) -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Monsters on siege duty. -MONSTER: ('r',"rabid rat"),random -MONSTER: ('r',"rabid rat"),random -MONSTER: ('r',"rabid rat"),random -MONSTER: ('r',"rabid rat"),random -MONSTER: ('r',"rabid rat"),random -MONSTER: ('r',"rabid rat"),random -MONSTER: ('r',"rabid rat"),random -MONSTER: ('r',"rabid rat"),random -MONSTER: ('r',"rabid rat"),random -MONSTER: ('r',"rabid rat"),random -MONSTER: (';',"giant eel"),random -MONSTER: (';',"shark"),random -MONSTER: ';', random -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -# -# The "locate" level for the quest. -# -# Here you have to find the Temple of Coeus to go -# further towards your assigned quest. -# - -MAZE: "Hea-loca",' ' -FLAGS: hardfloor -# -INIT_MAP: mines, '.' , 'P', true , true , lit , false -GEOMETRY:center,center -MAP -PPPPPPPPPPPPP.......PPPPPPPPPPP -PPPPPPPP...............PPPPPPPP -PPPP.....-------------...PPPPPP -PPPPP....|.S.........|....PPPPP -PPP......+.|.........|...PPPPPP -PPP......+.|.........|..PPPPPPP -PPPP.....|.S.........|..PPPPPPP -PPPPP....-------------....PPPPP -PPPPPPPP...............PPPPPPPP -PPPPPPPPPPP........PPPPPPPPPPPP -ENDMAP -# Dungeon Description -REGION:(00,00,30,09),lit,"ordinary" -REGION:(12,03,20,06),lit,"temple" -# Doors -DOOR:closed,(09,04) -DOOR:closed,(09,05) -DOOR:locked,(11,03) -DOOR:locked,(11,06) -# Stairs -STAIR:(04,04),up -STAIR:(20,06),down -# Non diggable walls -NON_DIGGABLE:(11,02,21,07) -# Altar in the temple. -ALTAR:(13,05), chaos, shrine -# Objects -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('r',"rabid rat"),random -MONSTER:('r',"rabid rat"),random -MONSTER:('r',"rabid rat"),random -MONSTER:('r',"rabid rat"),random -MONSTER:('r',"rabid rat"),random -MONSTER:('r',"rabid rat"),random -MONSTER:('r',"rabid rat"),random -MONSTER:('r',"rabid rat"),random -MONSTER:'r',random,hostile -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"electric eel"),random -MONSTER:(';',"electric eel"),random -MONSTER:(';',"kraken"),random -MONSTER:(';',"shark"),random -MONSTER:(';',"shark"),random -MONSTER:';', random,hostile -MONSTER:';', random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile - -# -# The "goal" level for the quest. -# -# Here you meet Cyclops your nemesis monster. You have to -# defeat Cyclops in combat to gain the artifact you have -# been assigned to retrieve. -# - -MAZE: "Hea-goal", 'P' -# -INIT_MAP: mines, '.' , 'P' , false , true , lit , false -GEOMETRY:center,center -MAP -.P....................................PP. -PP.......PPPPPPP....PPPPPPP....PPPP...PP. -...PPPPPPP....PPPPPPP.....PPPPPP..PPP...P -...PP..............................PPP... -..PP..............................PP..... -..PP..............................PPP.... -..PPP..............................PP.... -.PPP..............................PPPP... -...PP............................PPP...PP -..PPPP...PPPPP..PPPP...PPPPP.....PP...PP. -P....PPPPP...PPPP..PPPPP...PPPPPPP...PP.. -PPP..................................PPP. -ENDMAP -# Dungeon Description -REGION:(00,00,40,11),lit,"ordinary" -# Stairs -STAIR:(39,10),up -# Non diggable walls -NON_DIGGABLE:(00,00,40,11) -# Objects -OBJECT:(')',"quarterstaff"),(20,06),blessed,0,name:"The Staff of Aesculapius" -OBJECT:('/',"lightning"),(20,06) -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('H',"Cyclops"),(20,06),hostile -MONSTER:('r',"rabid rat"),random -MONSTER:('r',"rabid rat"),random -MONSTER:('r',"rabid rat"),random -MONSTER:'r',random,hostile -MONSTER:'r',random,hostile -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"electric eel"),random -MONSTER:(';',"electric eel"),random -MONSTER:(';',"shark"),random -MONSTER:(';',"shark"),random -MONSTER:';',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile - -# -# The "fill" levels for the quest. -# -# These levels are used to fill out any levels not occupied by specific -# levels as defined above. "filla" is the upper filler, between the -# start and locate levels, and "fillb" the lower between the locate -# and goal levels. -# - -MAZE: "Hea-fila" , 'P' -INIT_MAP: mines, '.' , 'P' , false , true , lit , false -NOMAP -# -STAIR: random, up -STAIR: random, down -# -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -# -MONSTER: ('r', "rabid rat"), random -MONSTER: 'r', random,hostile -MONSTER: 'r', random,hostile -MONSTER: (';', "giant eel"), random -MONSTER: (';', "giant eel"), random -MONSTER: (';', "electric eel"), random -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -# -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random - -MAZE: "Hea-filb" , 'P' -INIT_MAP: mines, '.' , 'P' , false , true , lit , false -NOMAP -# -STAIR: random, up -STAIR: random, down -# -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -# -MONSTER: ('r', "rabid rat"), random -MONSTER: ('r', "rabid rat"), random -MONSTER: 'r', random,hostile -MONSTER: 'r', random,hostile -MONSTER: (';', "giant eel"), random -MONSTER: (';', "giant eel"), random -MONSTER: (';', "giant eel"), random -MONSTER: (';', "giant eel"), random -MONSTER: (';', "giant eel"), random -MONSTER: (';', "electric eel"), random -MONSTER: (';', "electric eel"), random -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'D',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -MONSTER: 'S',random,hostile -# -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random diff --git a/dat/Kni-fila.lua b/dat/Kni-fila.lua new file mode 100644 index 000000000..08bc089cf --- /dev/null +++ b/dat/Kni-fila.lua @@ -0,0 +1,35 @@ +-- NetHack 3.6 Knight.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991,92 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = "." }); + +des.level_flags("mazelevel"); + +des.level_init({ style="mines", fg=".", bg="P", smoothed=false, joined=true, lit=1, walled=false }) + +-- +des.stair("up") +des.stair("down") +-- +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ class = "i", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +-- +des.trap() +des.trap() +des.trap() +des.trap() diff --git a/dat/Kni-filb.lua b/dat/Kni-filb.lua new file mode 100644 index 000000000..98a324b37 --- /dev/null +++ b/dat/Kni-filb.lua @@ -0,0 +1,40 @@ +-- NetHack 3.6 Knight.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991,92 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = "." }); + +des.level_flags("mazelevel"); + +des.level_init({ style="mines", fg=".", bg="P", smoothed=false, joined=true, lit=1, walled=false }) + +-- +des.stair("up") +des.stair("down") +-- +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ class = "i", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +-- +des.trap() +des.trap() +des.trap() +des.trap() diff --git a/dat/Kni-goal.lua b/dat/Kni-goal.lua new file mode 100644 index 000000000..577355937 --- /dev/null +++ b/dat/Kni-goal.lua @@ -0,0 +1,99 @@ +-- NetHack 3.6 Knight.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991,92 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.map([[ +....PPPP..PPP.. +.PPPPP...PP.. .......... ................................. +..PPPPP...P.. ........... ................................... +..PPP....... ........... ...................................... +...PPP....... ......... ............... ..................... +........... ............ ............ ...................... +............ ............. ....... ..................... +.............................. ......................... +............................... .................................. +............................. .................................... +......... ...................................................... +.....PP... ..................................................... +.....PPP.... .................................................... +......PPP.... .............. .................................... +.......PPP.... ............. ..................................... +........PP... ............ ...................................... +...PPP........ .......... .................................. +..PPPPP........ .......... .............................. +....PPPPP...... ......... .......................... +.......PPPP... +]]); +-- Dungeon Description +des.region(selection.area(00,00,14,19), "lit") +des.region(selection.area(15,00,75,19), "unlit") +-- Stairs +des.stair("up", 03,08) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- Objects +des.object({ id = "mirror", x=50,y=06, buc="blessed", spe=0, name="The Magic Mirror of Merlin" }) +des.object({ coord = { 33, 01 } }) +des.object({ coord = { 33, 02 } }) +des.object({ coord = { 33, 03 } }) +des.object({ coord = { 33, 04 } }) +des.object({ coord = { 33, 05 } }) +des.object({ coord = { 34, 01 } }) +des.object({ coord = { 34, 02 } }) +des.object({ coord = { 34, 03 } }) +des.object({ coord = { 34, 04 } }) +des.object({ coord = { 34, 05 } }) +des.object({ coord = { 35, 01 } }) +des.object({ coord = { 35, 02 } }) +des.object({ coord = { 35, 03 } }) +des.object({ coord = { 35, 04 } }) +des.object({ coord = { 35, 05 } }) +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap("spiked pit",13,07) +des.trap("spiked pit",12,08) +des.trap("spiked pit",12,09) +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Random monsters. +des.monster({ id = "Ixoth", x=50, y=06, peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ class = "i", peaceful=0 }) +des.monster({ class = "i", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +des.monster({ class = "j", peaceful=0 }) diff --git a/dat/Kni-loca.lua b/dat/Kni-loca.lua new file mode 100644 index 000000000..20aed41f5 --- /dev/null +++ b/dat/Kni-loca.lua @@ -0,0 +1,137 @@ +-- NetHack 3.6 Knight.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991,92 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "hardfloor") + +des.level_init({ style="mines", fg=".", bg="P", smoothed=false, joined=true, lit=1, walled=false }) + +des.map([[ +xxxxxxxxx......xxxx...........xxxxxxxxxx +xxxxxxx.........xxx.............xxxxxxxx +xxxx..............................xxxxxx +xx.................................xxxxx +....................................xxxx +.......................................x +........................................ +xx...................................xxx +xxxx..............................xxxxxx +xxxxxx..........................xxxxxxxx +xxxxxxxx.........xx..........xxxxxxxxxxx +xxxxxxxxx.......xxxxxx.....xxxxxxxxxxxxx +]]); +-- Dungeon Description +-- The Isle of Glass is a Tor rising out of the swamps surrounding it. +des.region(selection.area(00,00,39,11), "lit") +-- The top area of the Tor is a holy site. +des.region({ region={09,02, 27,09}, lit=1, type="temple" }) +-- Stairs +des.stair("up", 38,0) +des.stair("down", 18,05) +-- The altar atop the Tor and its attendant (creating altar makes the priest). +des.altar({ x=17, y=05, align="neutral", type="shrine" }) +-- Objects +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +-- All of the avenues are guarded by magic except for the East. +-- South +des.trap("magic",08,11) +des.trap("magic",09,11) +des.trap("magic",10,11) +des.trap("magic",11,11) +des.trap("magic",12,11) +des.trap("magic",13,11) +des.trap("magic",14,11) +des.trap("magic",15,11) +des.trap("magic",16,11) +des.trap("magic",20,11) +des.trap("magic",21,11) +des.trap("magic",22,11) +des.trap("magic",23,11) +des.trap("magic",24,11) +des.trap("magic",25,11) +des.trap("magic",26,11) +des.trap("magic",27,11) +des.trap("magic",28,11) +-- West +des.trap("magic",00,03) +des.trap("magic",00,04) +des.trap("magic",00,05) +des.trap("magic",00,06) +-- North +des.trap("magic",06,00) +des.trap("magic",07,00) +des.trap("magic",08,00) +des.trap("magic",09,00) +des.trap("magic",10,00) +des.trap("magic",11,00) +des.trap("magic",12,00) +des.trap("magic",13,00) +des.trap("magic",14,00) +des.trap("magic",19,00) +des.trap("magic",20,00) +des.trap("magic",21,00) +des.trap("magic",22,00) +des.trap("magic",23,00) +des.trap("magic",24,00) +des.trap("magic",25,00) +des.trap("magic",26,00) +des.trap("magic",27,00) +des.trap("magic",28,00) +des.trap("magic",29,00) +des.trap("magic",30,00) +des.trap("magic",31,00) +des.trap("magic",32,00) +-- Even so, there are magic "sinkholes" around. +des.trap("anti magic") +des.trap("anti magic") +des.trap("anti magic") +des.trap("anti magic") +des.trap("anti magic") +des.trap("anti magic") +des.trap("anti magic") +-- Random monsters. +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ id = "quasit", peaceful=0 }) +des.monster({ class = "i", peaceful=0 }) +des.monster({ class = "j", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +des.monster({ id = "ochre jelly", peaceful=0 }) +des.monster({ class = "j", peaceful=0 }) diff --git a/dat/Kni-strt.lua b/dat/Kni-strt.lua new file mode 100644 index 000000000..8feba3489 --- /dev/null +++ b/dat/Kni-strt.lua @@ -0,0 +1,102 @@ +-- NetHack 3.6 Knight.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991,92 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- The "start" level for the quest. +-- +-- Here you meet your (besieged) class leader, King Arthur +-- and receive your quest assignment. +-- +des.level_init({ style = "solidfill", fg = "." }); + +des.level_flags("mazelevel", "noteleport", "hardfloor") +-- This is a kludge to init the level as a lit field. +des.level_init({ style="mines", fg=".", bg=".", smoothed=false, joined=false, lit=1, walled=false }) + +des.map([[ +.................................................. +.-----......................................-----. +.|...|......................................|...|. +.--|+-------------------++-------------------+|--. +...|...................+..+...................|... +...|.|-----------------|++|-----------------|.|... +...|.|.................|..|.........|.......|.|... +...|.|...\.............+..+.........|.......|.|... +...|.|.................+..+.........+.......|.|... +...|.|.................|..|.........|.......|.|... +...|.|--------------------------------------|.|... +...|..........................................|... +.--|+----------------------------------------+|--. +.|...|......................................|...|. +.-----......................................-----. +.................................................. +]]); +-- Dungeon Description +des.region(selection.area(00,00,49,15), "lit") +des.region(selection.area(04,04,45,11), "unlit") +des.region({ region={06,06,22,09}, lit=1, type="throne", prefilled=1 }) +des.region(selection.area(27,06,43,09), "lit") +-- Portal arrival point +des.levregion({ region = {20,14,20,14}, type="branch" }) +-- Stairs +des.stair("down", 40,7) +-- Doors +-- Outside Doors +des.door("locked",24,03) +des.door("locked",25,03) +-- Inside Doors +des.door("closed",23,04) +des.door("closed",26,04) +des.door("locked",24,05) +des.door("locked",25,05) +des.door("closed",23,07) +des.door("closed",26,07) +des.door("closed",23,08) +des.door("closed",26,08) +des.door("closed",36,08) +-- Watchroom Doors +des.door("closed",04,03) +des.door("closed",45,03) +des.door("closed",04,12) +des.door("closed",45,12) +-- King Arthur +des.monster("King Arthur", 09, 07) +-- The treasure of King Arthur +des.object("chest", 09, 07) +-- knight guards for the watchrooms +des.monster({ id = "knight", x=04, y=02, peaceful = 1 }) +des.monster({ id = "knight", x=04, y=13, peaceful = 1 }) +des.monster({ id = "knight", x=45, y=02, peaceful = 1 }) +des.monster({ id = "knight", x=45, y=13, peaceful = 1 }) +-- page guards for the audience chamber +des.monster("page", 16, 06) +des.monster("page", 18, 06) +des.monster("page", 20, 06) +des.monster("page", 16, 09) +des.monster("page", 18, 09) +des.monster("page", 20, 09) +-- Non diggable walls +des.non_diggable(selection.area(00,00,49,15)) +-- Random traps +des.trap("sleep gas",24,04) +des.trap("sleep gas",25,04) +des.trap() +des.trap() +des.trap() +des.trap() +-- Monsters on siege duty. +des.monster({ id = "quasit", x=14, y=00, peaceful=0 }) +des.monster({ id = "quasit", x=16, y=00, peaceful=0 }) +des.monster({ id = "quasit", x=18, y=00, peaceful=0 }) +des.monster({ id = "quasit", x=20, y=00, peaceful=0 }) +des.monster({ id = "quasit", x=22, y=00, peaceful=0 }) +des.monster({ id = "quasit", x=24, y=00, peaceful=0 }) +des.monster({ id = "quasit", x=26, y=00, peaceful=0 }) +des.monster({ id = "quasit", x=28, y=00, peaceful=0 }) +des.monster({ id = "quasit", x=30, y=00, peaceful=0 }) +des.monster({ id = "quasit", x=32, y=00, peaceful=0 }) +des.monster({ id = "quasit", x=34, y=00, peaceful=0 }) +des.monster({ id = "quasit", x=36, y=00, peaceful=0 }) + diff --git a/dat/Knight.des b/dat/Knight.des deleted file mode 100644 index d5db2e01c..000000000 --- a/dat/Knight.des +++ /dev/null @@ -1,408 +0,0 @@ -# NetHack 3.6 Knight.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# Copyright (c) 1991,92 by M. Stephenson -# NetHack may be freely redistributed. See license for details. -# -# The "start" level for the quest. -# -# Here you meet your (besieged) class leader, King Arthur -# and receive your quest assignment. -# -MAZE: "Kni-strt",'.' -FLAGS: noteleport,hardfloor -# This is a kludge to init the level as a lit field. -INIT_MAP: mines, '.' , '.' , false , false , lit , false -GEOMETRY:center,center -MAP -.................................................. -.-----......................................-----. -.|...|......................................|...|. -.--|+-------------------++-------------------+|--. -...|...................+..+...................|... -...|.|-----------------|++|-----------------|.|... -...|.|.................|..|.........|.......|.|... -...|.|...\.............+..+.........|.......|.|... -...|.|.................+..+.........+.......|.|... -...|.|.................|..|.........|.......|.|... -...|.|--------------------------------------|.|... -...|..........................................|... -.--|+----------------------------------------+|--. -.|...|......................................|...|. -.-----......................................-----. -.................................................. -ENDMAP -# Dungeon Description -REGION:(00,00,49,15),lit,"ordinary" -REGION:(04,04,45,11),unlit,"ordinary" -REGION:(06,06,22,09),lit,"throne" , unfilled -REGION:(27,06,43,09),lit,"ordinary" -# Portal arrival point -BRANCH:(20,14,20,14),(0,0,0,0) -# Stairs -STAIR:(40,7),down -# Doors -# Outside Doors -DOOR:locked,(24,03) -DOOR:locked,(25,03) -# Inside Doors -DOOR:closed,(23,04) -DOOR:closed,(26,04) -DOOR:locked,(24,05) -DOOR:locked,(25,05) -DOOR:closed,(23,07) -DOOR:closed,(26,07) -DOOR:closed,(23,08) -DOOR:closed,(26,08) -DOOR:closed,(36,08) -# Watchroom Doors -DOOR:closed,(04,03) -DOOR:closed,(45,03) -DOOR:closed,(04,12) -DOOR:closed,(45,12) -# King Arthur -MONSTER:('@',"King Arthur"),(09,07) -# The treasure of King Arthur -OBJECT:('(',"chest"),(09,07) -# knight guards for the watchrooms -MONSTER:('@',"knight"),(04,02),peaceful -MONSTER:('@',"knight"),(04,13),peaceful -MONSTER:('@',"knight"),(45,02),peaceful -MONSTER:('@',"knight"),(45,13),peaceful -# page guards for the audience chamber -MONSTER:('@',"page"),(16,06) -MONSTER:('@',"page"),(18,06) -MONSTER:('@',"page"),(20,06) -MONSTER:('@',"page"),(16,09) -MONSTER:('@',"page"),(18,09) -MONSTER:('@',"page"),(20,09) -# Non diggable walls -NON_DIGGABLE:(00,00,49,15) -# Random traps -TRAP:"sleep gas",(24,04) -TRAP:"sleep gas",(25,04) -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Monsters on siege duty. -MONSTER: ('i',"quasit"),(14,00),hostile -MONSTER: ('i',"quasit"),(16,00),hostile -MONSTER: ('i',"quasit"),(18,00),hostile -MONSTER: ('i',"quasit"),(20,00),hostile -MONSTER: ('i',"quasit"),(22,00),hostile -MONSTER: ('i',"quasit"),(24,00),hostile -MONSTER: ('i',"quasit"),(26,00),hostile -MONSTER: ('i',"quasit"),(28,00),hostile -MONSTER: ('i',"quasit"),(30,00),hostile -MONSTER: ('i',"quasit"),(32,00),hostile -MONSTER: ('i',"quasit"),(34,00),hostile -MONSTER: ('i',"quasit"),(36,00),hostile - -# -# The "locate" level for the quest. -# -# Here you have to find your way to the Isle of Glass to go -# further towards your assigned quest. -# - -MAZE: "Kni-loca",' ' -FLAGS: hardfloor -INIT_MAP: mines, '.' , 'P' , false , true , lit , false -GEOMETRY:center,center -MAP -xxxxxxxxx......xxxx...........xxxxxxxxxx -xxxxxxx.........xxx.............xxxxxxxx -xxxx..............................xxxxxx -xx.................................xxxxx -....................................xxxx -.......................................x -........................................ -xx...................................xxx -xxxx..............................xxxxxx -xxxxxx..........................xxxxxxxx -xxxxxxxx.........xx..........xxxxxxxxxxx -xxxxxxxxx.......xxxxxx.....xxxxxxxxxxxxx -ENDMAP -# Dungeon Description -# The Isle of Glass is a Tor rising out of the swamps surrounding it. -REGION:(00,00,39,11),lit,"ordinary" -# The top area of the Tor is a holy site. -REGION:(09,02,27,09),lit,"temple" -# Stairs -STAIR:(38,0),up -STAIR:(18,05),down -# The altar atop the Tor and its attendant (creating altar makes the priest). -ALTAR:(17,05),neutral,shrine -# Objects -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -# All of the avenues are guarded by magic except for the East. -# South -TRAP:"magic",(08,11) -TRAP:"magic",(09,11) -TRAP:"magic",(10,11) -TRAP:"magic",(11,11) -TRAP:"magic",(12,11) -TRAP:"magic",(13,11) -TRAP:"magic",(14,11) -TRAP:"magic",(15,11) -TRAP:"magic",(16,11) -TRAP:"magic",(20,11) -TRAP:"magic",(21,11) -TRAP:"magic",(22,11) -TRAP:"magic",(23,11) -TRAP:"magic",(24,11) -TRAP:"magic",(25,11) -TRAP:"magic",(26,11) -TRAP:"magic",(27,11) -TRAP:"magic",(28,11) -# West -TRAP:"magic",(00,03) -TRAP:"magic",(00,04) -TRAP:"magic",(00,05) -TRAP:"magic",(00,06) -# North -TRAP:"magic",(06,00) -TRAP:"magic",(07,00) -TRAP:"magic",(08,00) -TRAP:"magic",(09,00) -TRAP:"magic",(10,00) -TRAP:"magic",(11,00) -TRAP:"magic",(12,00) -TRAP:"magic",(13,00) -TRAP:"magic",(14,00) -TRAP:"magic",(19,00) -TRAP:"magic",(20,00) -TRAP:"magic",(21,00) -TRAP:"magic",(22,00) -TRAP:"magic",(23,00) -TRAP:"magic",(24,00) -TRAP:"magic",(25,00) -TRAP:"magic",(26,00) -TRAP:"magic",(27,00) -TRAP:"magic",(28,00) -TRAP:"magic",(29,00) -TRAP:"magic",(30,00) -TRAP:"magic",(31,00) -TRAP:"magic",(32,00) -# Even so, there are magic "sinkholes" around. -TRAP:"anti magic",random -TRAP:"anti magic",random -TRAP:"anti magic",random -TRAP:"anti magic",random -TRAP:"anti magic",random -TRAP:"anti magic",random -TRAP:"anti magic",random -# Random monsters. -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:'i',random,hostile -MONSTER:'j',random,hostile -MONSTER:('j',"ochre jelly"),random,hostile -MONSTER:('j',"ochre jelly"),random,hostile -MONSTER:('j',"ochre jelly"),random,hostile -MONSTER:('j',"ochre jelly"),random,hostile -MONSTER:('j',"ochre jelly"),random,hostile -MONSTER:('j',"ochre jelly"),random,hostile -MONSTER:('j',"ochre jelly"),random,hostile -MONSTER:'j',random,hostile - -# -# The "goal" level for the quest. -# -# Here you meet Ixoth your nemesis monster. You have to -# defeat Ixoth in combat to gain the artifact you have -# been assigned to retrieve. -# - -MAZE: "Kni-goal", ' ' -GEOMETRY:center,center -MAP -....PPPP..PPP.. -.PPPPP...PP.. .......... ................................. -..PPPPP...P.. ........... ................................... -..PPP....... ........... ...................................... -...PPP....... ......... ............... ..................... -........... ............ ............ ...................... -............ ............. ....... ..................... -.............................. ......................... -............................... .................................. -............................. .................................... -......... ...................................................... -.....PP... ..................................................... -.....PPP.... .................................................... -......PPP.... .............. .................................... -.......PPP.... ............. ..................................... -........PP... ............ ...................................... -...PPP........ .......... .................................. -..PPPPP........ .......... .............................. -....PPPPP...... ......... .......................... -.......PPPP... -ENDMAP -# Dungeon Description -REGION:(00,00,14,19),lit,"ordinary" -REGION:(15,00,75,19),unlit,"ordinary" -# Stairs -STAIR:(03,08),up -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# Objects -OBJECT:('(',"mirror"),(50,06),blessed,0,name:"The Magic Mirror of Merlin" -OBJECT:random,(33,01) -OBJECT:random,(33,02) -OBJECT:random,(33,03) -OBJECT:random,(33,04) -OBJECT:random,(33,05) -OBJECT:random,(34,01) -OBJECT:random,(34,02) -OBJECT:random,(34,03) -OBJECT:random,(34,04) -OBJECT:random,(34,05) -OBJECT:random,(35,01) -OBJECT:random,(35,02) -OBJECT:random,(35,03) -OBJECT:random,(35,04) -OBJECT:random,(35,05) -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:"spiked pit",(13,07) -TRAP:"spiked pit",(12,08) -TRAP:"spiked pit",(12,09) -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('D',"Ixoth"),(50,06),hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:('i',"quasit"),random,hostile -MONSTER:'i',random,hostile -MONSTER:'i',random,hostile -MONSTER:('j',"ochre jelly"),random,hostile -MONSTER:('j',"ochre jelly"),random,hostile -MONSTER:('j',"ochre jelly"),random,hostile -MONSTER:('j',"ochre jelly"),random,hostile -MONSTER:('j',"ochre jelly"),random,hostile -MONSTER:('j',"ochre jelly"),random,hostile -MONSTER:('j',"ochre jelly"),random,hostile -MONSTER:('j',"ochre jelly"),random,hostile -MONSTER:'j',random,hostile - -# -# The "fill" levels for the quest. -# -# These levels are used to fill out any levels not occupied by specific -# levels as defined above. "filla" is the upper filler, between the -# start and locate levels, and "fillb" the lower between the locate -# and goal levels. -# - -MAZE: "Kni-fila" , '.' -INIT_MAP: mines, '.' , 'P' , false , true , lit , false -NOMAP -# -STAIR: random, up -STAIR: random, down -# -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -# -MONSTER: ('i', "quasit"), random, hostile -MONSTER: ('i', "quasit"), random, hostile -MONSTER: ('i', "quasit"), random, hostile -MONSTER: ('i', "quasit"), random, hostile -MONSTER: 'i', random, hostile -MONSTER: ('j', "ochre jelly"), random, hostile -# -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random - -MAZE: "Kni-filb" , '.' -INIT_MAP: mines, '.' , 'P' , false , true , lit , false -NOMAP -# -STAIR: random, up -STAIR: random, down -# -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -# -MONSTER: ('i', "quasit"), random, hostile -MONSTER: ('i', "quasit"), random, hostile -MONSTER: ('i', "quasit"), random, hostile -MONSTER: ('i', "quasit"), random, hostile -MONSTER: 'i', random, hostile -MONSTER: ('j', "ochre jelly"), random, hostile -MONSTER: ('j', "ochre jelly"), random, hostile -MONSTER: ('j', "ochre jelly"), random, hostile -# -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random diff --git a/dat/Mon-fila.lua b/dat/Mon-fila.lua new file mode 100644 index 000000000..d0e36ad2c --- /dev/null +++ b/dat/Mon-fila.lua @@ -0,0 +1,61 @@ +-- NetHack 3.6 Monk.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-2 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- + +-- +des.room({ type = "ordinary", + contents = function() + des.stair("up") + des.object() + des.monster({ class = "E", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.monster({ class = "E", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.object() + des.monster("xorn") + des.monster("earth elemental") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.stair("down") + des.object() + des.trap() + des.monster({ class = "E", peaceful=0 }) + des.monster("earth elemental") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.trap() + des.monster({ class = "X", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.monster("earth elemental") + end +}) + +des.random_corridors() diff --git a/dat/Mon-filb.lua b/dat/Mon-filb.lua new file mode 100644 index 000000000..a6fbdd5b1 --- /dev/null +++ b/dat/Mon-filb.lua @@ -0,0 +1,60 @@ +-- NetHack 3.6 Monk.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-2 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- + +-- +des.room({ type = "ordinary", + contents = function() + des.stair("up") + des.object() + des.monster({ class = "X", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.monster({ class = "X", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.object() + des.monster({ class = "E", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.stair("down") + des.object() + des.trap() + des.monster({ class = "E", peaceful=0 }) + des.monster("earth elemental") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.trap() + des.monster({ class = "X", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.monster("earth elemental") + end +}) + +des.random_corridors() diff --git a/dat/Mon-goal.lua b/dat/Mon-goal.lua new file mode 100644 index 000000000..d339e323d --- /dev/null +++ b/dat/Mon-goal.lua @@ -0,0 +1,75 @@ +-- NetHack 3.6 Monk.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-2 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.level_init({ style="mines", fg="L", bg=".", smoothed=false, joined=false, lit=0, walled=false }) + +des.map([[ +xxxxxx..xxxxxx...xxxxxxxxx +xxxx......xx......xxxxxxxx +xx.xx.............xxxxxxxx +x....................xxxxx +......................xxxx +......................xxxx +xx........................ +xxx......................x +xxx................xxxxxxx +xxxx.....x.xx.......xxxxxx +xxxxx...xxxxxx....xxxxxxxx +]]); +-- Dungeon Description +local place = { {14,04},{13,07} } +local placeidx = math.random(1, #place); + +des.region(selection.area(00,00,25,10), "unlit") +-- Stairs +des.stair("up", 20,05) +-- Objects +des.object({ id = "lenses", coord = place[placeidx], buc="blessed", spe=0, name="The Eyes of the Overworld" }) +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap() +des.trap() +-- Random monsters. +des.monster("Master Kaen",place[placeidx]) +des.altar({ coord = place[placeidx], align="noalign", type="altar" }) +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("xorn") +des.monster("xorn") +des.monster("xorn") +des.monster("xorn") +des.monster("xorn") +des.monster("xorn") +des.monster("xorn") +des.monster("xorn") +des.monster("xorn") diff --git a/dat/Mon-loca.lua b/dat/Mon-loca.lua new file mode 100644 index 000000000..2436a33da --- /dev/null +++ b/dat/Mon-loca.lua @@ -0,0 +1,90 @@ +-- NetHack 3.6 Monk.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-2 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +-- 1 2 3 4 5 6 7 +--123456789012345678901234567890123456789012345678901234567890123456789012345 +des.map([[ + ---------------------------------------------------- -------- + ---.................................................- --.....| + ---...--------........------........................--- ---...| + ---.....- --.......- ----..................---- --.-- + ---.....---- --------- --..................-- --..| + ---...----- ----.----.....----.....--- --..|| +----..---- -----..--- |...--- |.......--- --...| +|...--- ----....--- |.--- |.........-- --...|| +|...- ----.....--- ---- |..........---....| +|...---- ----......--- | |...|.......-....|| +|......----- ---.........- | -----...|............| +|..........----- ----...........--- -------......||...........|| +|..............-----................--- |............|||..........| +|-S----...............................--- |...........|| |.........|| +|.....|..............------.............-----..........|| ||........| +|.....|.............-- ---.........................|| |.......|| +|.....|.............- ---.....................--| ||......| +|---S--------.......---- --.................---- |.....|| +|...........|..........--------..............----- ||....| +|...........|............................----- |....| +------------------------------------------ ------ +]]); +-- Random Monsters + +-- Dungeon Description +des.region(selection.area(00,00,75,20), "lit") +-- Stairs +des.stair("up") +des.stair("down") +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,20)) +-- Objects +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Random monsters. +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("earth elemental") +des.monster("xorn") +des.monster("xorn") +des.monster("xorn") +des.monster("xorn") +des.monster("xorn") +des.monster("xorn") +des.monster("xorn") +des.monster("xorn") +des.monster("xorn") diff --git a/dat/Mon-strt.lua b/dat/Mon-strt.lua new file mode 100644 index 000000000..1add47ab6 --- /dev/null +++ b/dat/Mon-strt.lua @@ -0,0 +1,104 @@ +-- NetHack 3.6 Monk.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-2 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- The "start" level for the quest. +-- +-- Here you meet your (besieged) class leader, the Grand Master +-- and receive your quest assignment. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor") + +des.map([[ +............................................................................ +............................................................................ +............................................................................ +....................------------------------------------.................... +....................|................|.....|.....|.....|.................... +....................|..------------..|--+-----+-----+--|.................... +....................|..|..........|..|.................|.................... +....................|..|..........|..|+---+---+-----+--|.................... +..................---..|..........|......|...|...|.....|.................... +..................+....|..........+......|...|...|.....|.................... +..................+....|..........+......|...|...|.....|.................... +..................---..|..........|......|...|...|.....|.................... +....................|..|..........|..|+-----+---+---+--|.................... +....................|..|..........|..|.................|.................... +....................|..------------..|--+-----+-----+--|.................... +....................|................|.....|.....|.....|.................... +....................------------------------------------.................... +............................................................................ +............................................................................ +............................................................................ +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,19), "lit") +des.region({ region={24,06, 33,13}, lit=1, type="temple" }) + +des.replace_terrain({ region={00,00, 10,19}, fromterrain=".", toterrain="T", chance=10 }) +des.replace_terrain({ region={65,00, 75,19}, fromterrain=".", toterrain="T", chance=10 }) + +-- Portal arrival point +des.terrain({05,04}, ".") +des.levregion({ region = {05,04,05,04}, type="branch" }) +-- Stairs +des.stair("down", 52,09) +-- Doors +des.door("locked",18,09) +des.door("locked",18,10) +des.door("closed",34,09) +des.door("closed",34,10) +des.door("closed",40,05) +des.door("closed",46,05) +des.door("closed",52,05) +des.door("locked",38,07) +des.door("closed",42,07) +des.door("closed",46,07) +des.door("closed",52,07) +des.door("locked",38,12) +des.door("closed",44,12) +des.door("closed",48,12) +des.door("closed",52,12) +des.door("closed",40,14) +des.door("closed",46,14) +des.door("closed",52,14) +-- Unattended Altar - unaligned due to conflict - player must align it. +des.altar({ x=28,y=09, align="noalign", type="altar" }) +-- The Grand Master +des.monster("Grand Master", 28, 10) +-- No treasure chest! +-- guards for the audience chamber +des.monster("abbot", 32, 07) +des.monster("abbot", 32, 08) +des.monster("abbot", 32, 11) +des.monster("abbot", 32, 12) +des.monster("abbot", 33, 07) +des.monster("abbot", 33, 08) +des.monster("abbot", 33, 11) +des.monster("abbot", 33, 12) +-- Non diggable walls +des.non_diggable(selection.area(18,03,55,16)) +-- Random traps +des.trap("dart",20,09) +des.trap("dart",20,10) +des.trap() +des.trap() +des.trap() +des.trap() +-- Monsters on siege duty. +des.monster("earth elemental", 37, 01) +des.monster("earth elemental", 37, 18) +des.monster("earth elemental", 03, 03) +des.monster("earth elemental", 65, 04) +des.monster("earth elemental", 12, 11) +des.monster("earth elemental", 60, 12) +des.monster("earth elemental", 14, 08) +des.monster("earth elemental", 55, 00) +des.monster("xorn", 18, 18) +des.monster("xorn", 59, 10) +des.monster("xorn", 13, 09) +des.monster("xorn", 01, 17) diff --git a/dat/Monk.des b/dat/Monk.des deleted file mode 100644 index 5b1ba7caa..000000000 --- a/dat/Monk.des +++ /dev/null @@ -1,378 +0,0 @@ -# NetHack 3.6 Monk.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# Copyright (c) 1991-2 by M. Stephenson -# NetHack may be freely redistributed. See license for details. -# -# The "start" level for the quest. -# -# Here you meet your (besieged) class leader, the Grand Master -# and receive your quest assignment. -# -MAZE: "Mon-strt",' ' -FLAGS: noteleport,hardfloor -GEOMETRY:center,center -MAP -............................................................................ -............................................................................ -............................................................................ -....................------------------------------------.................... -....................|................|.....|.....|.....|.................... -....................|..------------..|--+-----+-----+--|.................... -....................|..|..........|..|.................|.................... -....................|..|..........|..|+---+---+-----+--|.................... -..................---..|..........|......|...|...|.....|.................... -..................+....|..........+......|...|...|.....|.................... -..................+....|..........+......|...|...|.....|.................... -..................---..|..........|......|...|...|.....|.................... -....................|..|..........|..|+-----+---+---+--|.................... -....................|..|..........|..|.................|.................... -....................|..------------..|--+-----+-----+--|.................... -....................|................|.....|.....|.....|.................... -....................------------------------------------.................... -............................................................................ -............................................................................ -............................................................................ -ENDMAP -# Dungeon Description -REGION:(00,00,75,19),lit,"ordinary" -REGION:(24,06,33,13),lit,"temple" - -REPLACE_TERRAIN:(0,0,10,19),'.','T',10% -REPLACE_TERRAIN:(65,0,75,19),'.','T',10% - -# Portal arrival point -TERRAIN:(05,04),'.' -BRANCH:(05,04,05,04),(0,0,0,0) -# Stairs -STAIR:(52,09),down -# Doors -DOOR:locked,(18,09) -DOOR:locked,(18,10) -DOOR:closed,(34,09) -DOOR:closed,(34,10) -DOOR:closed,(40,05) -DOOR:closed,(46,05) -DOOR:closed,(52,05) -DOOR:locked,(38,07) -DOOR:closed,(42,07) -DOOR:closed,(46,07) -DOOR:closed,(52,07) -DOOR:locked,(38,12) -DOOR:closed,(44,12) -DOOR:closed,(48,12) -DOOR:closed,(52,12) -DOOR:closed,(40,14) -DOOR:closed,(46,14) -DOOR:closed,(52,14) -# Unattended Altar - unaligned due to conflict - player must align it. -ALTAR:(28,09),noalign,altar -# The Grand Master -MONSTER:('@',"Grand Master"),(28,10) -# No treasure chest! -# guards for the audience chamber -MONSTER:('@',"abbot"),(32,07) -MONSTER:('@',"abbot"),(32,08) -MONSTER:('@',"abbot"),(32,11) -MONSTER:('@',"abbot"),(32,12) -MONSTER:('@',"abbot"),(33,07) -MONSTER:('@',"abbot"),(33,08) -MONSTER:('@',"abbot"),(33,11) -MONSTER:('@',"abbot"),(33,12) -# Non diggable walls -NON_DIGGABLE:(18,03,55,16) -# Random traps -TRAP:"dart",(20,09) -TRAP:"dart",(20,10) -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Monsters on siege duty. -MONSTER: ('E',"earth elemental"),(37,01) -MONSTER: ('E',"earth elemental"),(37,18) -MONSTER: ('E',"earth elemental"),(03,03) -MONSTER: ('E',"earth elemental"),(65,04) -MONSTER: ('E',"earth elemental"),(12,11) -MONSTER: ('E',"earth elemental"),(60,12) -MONSTER: ('E',"earth elemental"),(14,08) -MONSTER: ('E',"earth elemental"),(55,00) -MONSTER: ('X',"xorn"),(18,18) -MONSTER: ('X',"xorn"),(59,10) -MONSTER: ('X',"xorn"),(13,09) -MONSTER: ('X',"xorn"),(01,17) - -# -# The "locate" level for the quest. -# -# Here you have to locate the Monastery of the Earth-Lord to -# go further towards your assigned quest. -# - -MAZE: "Mon-loca",' ' -GEOMETRY:center,center -# 1 2 3 4 5 6 7 -#123456789012345678901234567890123456789012345678901234567890123456789012345 -MAP - ---------------------------------------------------- -------- - ---.................................................- --.....| - ---...--------........------........................--- ---...| - ---.....- --.......- ----..................---- --.-- - ---.....---- --------- --..................-- --..| - ---...----- ----.----.....----.....--- --..|| -----..---- -----..--- |...--- |.......--- --...| -|...--- ----....--- |.--- |.........-- --...|| -|...- ----.....--- ---- |..........---....| -|...---- ----......--- | |...|.......-....|| -|......----- ---.........- | -----...|............| -|..........----- ----...........--- -------......||...........|| -|..............-----................--- |............|||..........| -|-S----...............................--- |...........|| |.........|| -|.....|..............------.............-----..........|| ||........| -|.....|.............-- ---.........................|| |.......|| -|.....|.............- ---.....................--| ||......| -|---S--------.......---- --.................---- |.....|| -|...........|..........--------..............----- ||....| -|...........|............................----- |....| ------------------------------------------- ------ -ENDMAP -# Random Monsters -$monster = monster: { 'E', 'X' } -SHUFFLE: $monster - -# Dungeon Description -REGION:(00,00,75,20),lit,"ordinary" -# Stairs -STAIR:random,up -STAIR:random,down -# Non diggable walls -NON_DIGGABLE:(00,00,75,20) -# Objects -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('X',"xorn"),random -MONSTER: ('X',"xorn"),random -MONSTER: ('X',"xorn"),random -MONSTER: ('X',"xorn"),random -MONSTER: ('X',"xorn"),random -MONSTER: ('X',"xorn"),random -MONSTER: ('X',"xorn"),random -MONSTER: ('X',"xorn"),random -MONSTER: ('X',"xorn"),random - -# -# The "goal" level for the quest. -# -# Here you meet Master Kaen, your nemesis monster. You have to -# defeat Master Kaen in combat to gain the artifact you have -# been assigned to retrieve. -# - -MAZE: "Mon-goal", ' ' -INIT_MAP: mines, 'L' , '.' , false , false , unlit , false -GEOMETRY:center,center -MAP -xxxxxx..xxxxxx...xxxxxxxxx -xxxx......xx......xxxxxxxx -xx.xx.............xxxxxxxx -x....................xxxxx -......................xxxx -......................xxxx -xx........................ -xxx......................x -xxx................xxxxxxx -xxxx.....x.xx.......xxxxxx -xxxxx...xxxxxx....xxxxxxxx -ENDMAP -# Dungeon Description -$place = { (14,04),(13,07) } -SHUFFLE: $place - -REGION:(00,00,25,10),unlit,"ordinary" -# Stairs -STAIR:(20,05),up -# Objects -OBJECT:('(',"lenses"),$place[0],blessed,0,name:"The Eyes of the Overworld" -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('@',"Master Kaen"),$place[0] -ALTAR:$place[0],noalign,altar -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('E',"earth elemental"),random -MONSTER: ('X',"xorn"),random -MONSTER: ('X',"xorn"),random -MONSTER: ('X',"xorn"),random -MONSTER: ('X',"xorn"),random -MONSTER: ('X',"xorn"),random -MONSTER: ('X',"xorn"),random -MONSTER: ('X',"xorn"),random -MONSTER: ('X',"xorn"),random -MONSTER: ('X',"xorn"),random - -# -# The "fill" levels for the quest. -# -# These levels are used to fill out any levels not occupied by specific -# levels as defined above. "fila" is the upper filler, between the -# start and locate levels, and "filb" the lower between the locate -# and goal levels. -# - -LEVEL: "Mon-fila" -# Random Monsters -$monster = monster: { 'E', 'X' } -SHUFFLE: $monster - -# -ROOM: "ordinary" , random, random, random, random { - STAIR: random, up - OBJECT: random,random - MONSTER: 'E', random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random,random - MONSTER: 'E', random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - OBJECT: random,random - MONSTER: ('X', "xorn"), random - MONSTER: ('E', "earth elemental"), random -} - -ROOM: "ordinary" , random, random, random, random { - STAIR: random, down - OBJECT: random, random - TRAP: random, random - MONSTER: 'E', random, hostile - MONSTER: ('E', "earth elemental"), random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random, random - TRAP: random, random - MONSTER: 'X', random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - MONSTER: ('E', "earth elemental"), random -} - -RANDOM_CORRIDORS - -LEVEL: "Mon-filb" -# Random Monsters -$monster = monster: { 'E', 'X' } -SHUFFLE: $monster - -# -ROOM: "ordinary" , random, random, random, random { - STAIR: random, up - OBJECT: random,random - MONSTER: 'X', random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random,random - MONSTER: 'X', random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - OBJECT: random,random - MONSTER: 'E', random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - STAIR: random, down - OBJECT: random, random - TRAP: random, random - MONSTER: 'E', random, hostile - MONSTER: ('E', "earth elemental"), random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random, random - TRAP: random, random - MONSTER: 'X', random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - MONSTER: ('E', "earth elemental"), random -} - -RANDOM_CORRIDORS - diff --git a/dat/Pri-fila.lua b/dat/Pri-fila.lua new file mode 100644 index 000000000..6df964f60 --- /dev/null +++ b/dat/Pri-fila.lua @@ -0,0 +1,55 @@ +-- NetHack 3.6 Priest.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-2 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- +des.room({ type = "ordinary", + contents = function() + des.stair("up") + des.object() + des.monster("human zombie") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.object() + des.monster("human zombie") + end +}) + +des.room({ type = "morgue", + contents = function() + des.stair("down") + des.object() + des.trap() + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.trap() + des.monster("wraith") + end +}) + +des.room({ type = "morgue", + contents = function() + des.object() + des.trap() + end +}) + +des.random_corridors() diff --git a/dat/Pri-filb.lua b/dat/Pri-filb.lua new file mode 100644 index 000000000..060afd246 --- /dev/null +++ b/dat/Pri-filb.lua @@ -0,0 +1,62 @@ +-- NetHack 3.6 Priest.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-2 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- + +des.room({ type = "ordinary", + contents = function() + des.stair("up") + des.object() + des.monster("human zombie") + des.monster("wraith") + end +}) + +des.room({ type = "morgue", + contents = function() + des.object() + des.object() + des.object() + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.object() + des.monster("human zombie") + des.monster("wraith") + end +}) + +des.room({ type = "morgue", + contents = function() + des.stair("down") + des.object() + des.object() + des.trap() + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.trap() + des.monster("human zombie") + des.monster("wraith") + end +}) + + +des.room({ type = "morgue", + contents = function() + des.object() + des.trap() + end +}) + +des.random_corridors() diff --git a/dat/Pri-goal.lua b/dat/Pri-goal.lua new file mode 100644 index 000000000..5de237d20 --- /dev/null +++ b/dat/Pri-goal.lua @@ -0,0 +1,83 @@ +-- NetHack 3.6 Priest.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-2 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.level_init({ style="mines", fg="L", bg=".", smoothed=false, joined=false, lit=0, walled=false }) + +des.map([[ +xxxxxx..xxxxxx...xxxxxxxxx +xxxx......xx......xxxxxxxx +xx.xx.............xxxxxxxx +x....................xxxxx +......................xxxx +......................xxxx +xx........................ +xxx......................x +xxx................xxxxxxx +xxxx.....x.xx.......xxxxxx +xxxxx...xxxxxx....xxxxxxxx +]]); +-- Dungeon Description +local place = { {14,04}, {13,07} } +local placeidx = math.random(1, #place); + +des.region(selection.area(00,00,25,10), "unlit") +-- Stairs +des.stair("up", 20,05) +-- Objects +des.object({ id = "helm of brilliance", coord = place[placeidx], buc="blessed", spe=0, name="The Mitre of Holiness" }) +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap() +des.trap() +-- Random monsters. +des.monster("Nalzok",place[placeidx]) +des.monster("human zombie") +des.monster("human zombie") +des.monster("human zombie") +des.monster("human zombie") +des.monster("human zombie") +des.monster("human zombie") +des.monster("human zombie") +des.monster("human zombie") +des.monster("human zombie") +des.monster("human zombie") +des.monster("human zombie") +des.monster("human zombie") +des.monster("human zombie") +des.monster("human zombie") +des.monster("human zombie") +des.monster("human zombie") +des.monster("Z") +des.monster("Z") +des.monster("wraith") +des.monster("wraith") +des.monster("wraith") +des.monster("wraith") +des.monster("wraith") +des.monster("wraith") +des.monster("wraith") +des.monster("wraith") +des.monster("W") diff --git a/dat/Pri-loca.lua b/dat/Pri-loca.lua new file mode 100644 index 000000000..16f5bdb85 --- /dev/null +++ b/dat/Pri-loca.lua @@ -0,0 +1,73 @@ +-- NetHack 3.6 Priest.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-2 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "hardfloor") +-- This is a kludge to init the level as a lit field. +des.level_init({ style="mines", fg=".", bg=".", smoothed=false, joined=false, lit=1, walled=false }) + +des.map([[ +........................................ +........................................ +..........----------+----------......... +..........|........|.|........|......... +..........|........|.|........|......... +..........|----.----.----.----|......... +..........+...................+......... +..........+...................+......... +..........|----.----.----.----|......... +..........|........|.|........|......... +..........|........|.|........|......... +..........----------+----------......... +........................................ +........................................ +]]); +-- Dungeon Description +des.region({ region={00,00, 09,13}, lit=0, type="morgue", prefilled=0 }) +des.region({ region={09,00, 30,01}, lit=0, type="morgue", prefilled=0 }) +des.region({ region={09,12, 30,13}, lit=0, type="morgue", prefilled=0 }) +des.region({ region={31,00, 39,13}, lit=0, type="morgue", prefilled=0 }) +des.region({ region={11,03, 29,10}, lit=1, type="temple", prefilled=0, irregular=1 }) +-- The altar inside the temple +des.altar({ x=20,y=07, align="noalign", type="shrine" }) +des.monster({ id = "aligned priest", x=20, y=07, align="noalign", peaceful = 0 }) +-- Doors +des.door("locked",10,06) +des.door("locked",10,07) +des.door("locked",20,02) +des.door("locked",20,11) +des.door("locked",30,06) +des.door("locked",30,07) +-- Stairs +-- Note: The up stairs are *intentionally* off of the map. +des.stair("up", 43,05) +des.stair("down", 20,06) +-- Non diggable walls +des.non_diggable(selection.area(10,02,30,13)) +-- Objects (inside the antechambers). +des.object({ coord = { 14, 03 } }) +des.object({ coord = { 15, 03 } }) +des.object({ coord = { 16, 03 } }) +des.object({ coord = { 14, 10 } }) +des.object({ coord = { 15, 10 } }) +des.object({ coord = { 16, 10 } }) +des.object({ coord = { 17, 10 } }) +des.object({ coord = { 24, 03 } }) +des.object({ coord = { 25, 03 } }) +des.object({ coord = { 26, 03 } }) +des.object({ coord = { 27, 03 } }) +des.object({ coord = { 24, 10 } }) +des.object({ coord = { 25, 10 } }) +des.object({ coord = { 26, 10 } }) +des.object({ coord = { 27, 10 } }) +-- Random traps +des.trap({ coord = { 15,04 } }) +des.trap({ coord = { 25,04 } }) +des.trap({ coord = { 15,09 } }) +des.trap({ coord = { 25,09 } }) +des.trap() +des.trap() +-- No random monsters - the morgue generation will put them in. diff --git a/dat/Pri-strt.lua b/dat/Pri-strt.lua new file mode 100644 index 000000000..691a4b8ad --- /dev/null +++ b/dat/Pri-strt.lua @@ -0,0 +1,105 @@ +-- NetHack 3.6 Priest.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-2 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- The "start" level for the quest. +-- +-- Here you meet your (besieged) class leader, High Priest +-- and receive your quest assignment. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor") + +des.map([[ +............................................................................ +............................................................................ +............................................................................ +....................------------------------------------.................... +....................|................|.....|.....|.....|.................... +....................|..------------..|--+-----+-----+--|.................... +....................|..|..........|..|.................|.................... +....................|..|..........|..|+---+---+-----+--|.................... +..................---..|..........|......|...|...|.....|.................... +..................+....|..........+......|...|...|.....|.................... +..................+....|..........+......|...|...|.....|.................... +..................---..|..........|......|...|...|.....|.................... +....................|..|..........|..|+-----+---+---+--|.................... +....................|..|..........|..|.................|.................... +....................|..------------..|--+-----+-----+--|.................... +....................|................|.....|.....|.....|.................... +....................------------------------------------.................... +............................................................................ +............................................................................ +............................................................................ +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,19), "lit") +des.region({ region={24,06, 33,13}, lit=1, type="temple" }) + +des.replace_terrain({ region={00,00, 10,19}, fromterrain=".", toterrain="T", chance=10 }) +des.replace_terrain({ region={65,00, 75,19}, fromterrain=".", toterrain="T", chance=10 }) +des.terrain({05,04}, ".") + +-- Portal arrival point +des.levregion({ region = {05,04,05,04}, type="branch" }) +-- Stairs +des.stair("down", 52,09) +-- Doors +des.door("locked",18,09) +des.door("locked",18,10) +des.door("closed",34,09) +des.door("closed",34,10) +des.door("closed",40,05) +des.door("closed",46,05) +des.door("closed",52,05) +des.door("locked",38,07) +des.door("closed",42,07) +des.door("closed",46,07) +des.door("closed",52,07) +des.door("locked",38,12) +des.door("closed",44,12) +des.door("closed",48,12) +des.door("closed",52,12) +des.door("closed",40,14) +des.door("closed",46,14) +des.door("closed",52,14) +-- Unattended Altar - unaligned due to conflict - player must align it. +des.altar({ x=28, y=09, align="noalign", type="altar" }) +-- High Priest +des.monster("Arch Priest", 28, 10) +-- The treasure of High Priest +des.object("chest", 27, 10) +-- knight guards for the audience chamber +des.monster("acolyte", 32, 07) +des.monster("acolyte", 32, 08) +des.monster("acolyte", 32, 11) +des.monster("acolyte", 32, 12) +des.monster("acolyte", 33, 07) +des.monster("acolyte", 33, 08) +des.monster("acolyte", 33, 11) +des.monster("acolyte", 33, 12) +-- Non diggable walls +des.non_diggable(selection.area(18,03,55,16)) +-- Random traps +des.trap("dart",20,09) +des.trap("dart",20,10) +des.trap() +des.trap() +des.trap() +des.trap() +-- Monsters on siege duty. +des.monster("human zombie", 37, 01) +des.monster("human zombie", 37, 18) +des.monster("human zombie", 03, 03) +des.monster("human zombie", 65, 04) +des.monster("human zombie", 12, 11) +des.monster("human zombie", 60, 12) +des.monster("human zombie", 14, 08) +des.monster("human zombie", 55, 00) +des.monster("human zombie", 18, 18) +des.monster("human zombie", 59, 10) +des.monster("human zombie", 13, 09) +des.monster("human zombie", 01, 17) diff --git a/dat/Priest.des b/dat/Priest.des deleted file mode 100644 index d6cfdcef5..000000000 --- a/dat/Priest.des +++ /dev/null @@ -1,356 +0,0 @@ -# NetHack 3.6 Priest.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# Copyright (c) 1991-2 by M. Stephenson -# NetHack may be freely redistributed. See license for details. -# -# The "start" level for the quest. -# -# Here you meet your (besieged) class leader, High Priest -# and receive your quest assignment. -# -MAZE: "Pri-strt",' ' -FLAGS: noteleport,hardfloor -GEOMETRY:center,center -MAP -............................................................................ -............................................................................ -............................................................................ -....................------------------------------------.................... -....................|................|.....|.....|.....|.................... -....................|..------------..|--+-----+-----+--|.................... -....................|..|..........|..|.................|.................... -....................|..|..........|..|+---+---+-----+--|.................... -..................---..|..........|......|...|...|.....|.................... -..................+....|..........+......|...|...|.....|.................... -..................+....|..........+......|...|...|.....|.................... -..................---..|..........|......|...|...|.....|.................... -....................|..|..........|..|+-----+---+---+--|.................... -....................|..|..........|..|.................|.................... -....................|..------------..|--+-----+-----+--|.................... -....................|................|.....|.....|.....|.................... -....................------------------------------------.................... -............................................................................ -............................................................................ -............................................................................ -ENDMAP -# Dungeon Description -REGION:(00,00,75,19),lit,"ordinary" -REGION:(24,06,33,13),lit,"temple" - -REPLACE_TERRAIN:(0,0,10,19),'.','T',10% -REPLACE_TERRAIN:(65,0,75,19),'.','T',10% -TERRAIN:(05,04),'.' - -# Portal arrival point -BRANCH:(05,04,05,04),(0,0,0,0) -# Stairs -STAIR:(52,09),down -# Doors -DOOR:locked,(18,09) -DOOR:locked,(18,10) -DOOR:closed,(34,09) -DOOR:closed,(34,10) -DOOR:closed,(40,05) -DOOR:closed,(46,05) -DOOR:closed,(52,05) -DOOR:locked,(38,07) -DOOR:closed,(42,07) -DOOR:closed,(46,07) -DOOR:closed,(52,07) -DOOR:locked,(38,12) -DOOR:closed,(44,12) -DOOR:closed,(48,12) -DOOR:closed,(52,12) -DOOR:closed,(40,14) -DOOR:closed,(46,14) -DOOR:closed,(52,14) -# Unattended Altar - unaligned due to conflict - player must align it. -ALTAR:(28,09),noalign,altar -# High Priest -MONSTER:('@',"Arch Priest"),(28,10) -# The treasure of High Priest -OBJECT:('(',"chest"),(27,10) -# knight guards for the audience chamber -MONSTER:('@',"acolyte"),(32,07) -MONSTER:('@',"acolyte"),(32,08) -MONSTER:('@',"acolyte"),(32,11) -MONSTER:('@',"acolyte"),(32,12) -MONSTER:('@',"acolyte"),(33,07) -MONSTER:('@',"acolyte"),(33,08) -MONSTER:('@',"acolyte"),(33,11) -MONSTER:('@',"acolyte"),(33,12) -# Non diggable walls -NON_DIGGABLE:(18,03,55,16) -# Random traps -TRAP:"dart",(20,09) -TRAP:"dart",(20,10) -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Monsters on siege duty. -MONSTER: ('Z',"human zombie"),(37,01) -MONSTER: ('Z',"human zombie"),(37,18) -MONSTER: ('Z',"human zombie"),(03,03) -MONSTER: ('Z',"human zombie"),(65,04) -MONSTER: ('Z',"human zombie"),(12,11) -MONSTER: ('Z',"human zombie"),(60,12) -MONSTER: ('Z',"human zombie"),(14,08) -MONSTER: ('Z',"human zombie"),(55,00) -MONSTER: ('Z',"human zombie"),(18,18) -MONSTER: ('Z',"human zombie"),(59,10) -MONSTER: ('Z',"human zombie"),(13,09) -MONSTER: ('Z',"human zombie"),(01,17) - -# -# The "locate" level for the quest. -# -# Here you have to locate the Temple of Nalzok to go -# further towards your assigned quest. -# - -MAZE: "Pri-loca",' ' -FLAGS: hardfloor -# This is a kludge to init the level as a lit field. -INIT_MAP: mines, '.' , '.' , false , false , lit , false -GEOMETRY:center,center -MAP -........................................ -........................................ -..........----------+----------......... -..........|........|.|........|......... -..........|........|.|........|......... -..........|----.----.----.----|......... -..........+...................+......... -..........+...................+......... -..........|----.----.----.----|......... -..........|........|.|........|......... -..........|........|.|........|......... -..........----------+----------......... -........................................ -........................................ -ENDMAP -# Dungeon Description -REGION:(00,00,09,13),unlit,"morgue" -REGION:(09,00,30,01),unlit,"morgue" -REGION:(09,12,30,13),unlit,"morgue" -REGION:(31,00,39,13),unlit,"morgue" -REGION:(11,03,29,10),lit,"temple",filled,irregular -# The altar inside the temple -ALTAR:(20,07),noalign,shrine -MONSTER:('@',"aligned priest"),(20,07),noalign,hostile -# Doors -DOOR:locked,(10,06) -DOOR:locked,(10,07) -DOOR:locked,(20,02) -DOOR:locked,(20,11) -DOOR:locked,(30,06) -DOOR:locked,(30,07) -# Stairs -# Note: The up stairs are *intentionally* off of the map. -STAIR:(43,05),up -STAIR:(20,06),down -# Non diggable walls -NON_DIGGABLE:(10,02,30,13) -# Objects (inside the antechambers). -OBJECT:random,(14,03) -OBJECT:random,(15,03) -OBJECT:random,(16,03) -OBJECT:random,(14,10) -OBJECT:random,(15,10) -OBJECT:random,(16,10) -OBJECT:random,(17,10) -OBJECT:random,(24,03) -OBJECT:random,(25,03) -OBJECT:random,(26,03) -OBJECT:random,(27,03) -OBJECT:random,(24,10) -OBJECT:random,(25,10) -OBJECT:random,(26,10) -OBJECT:random,(27,10) -# Random traps -TRAP:random,(15,04) -TRAP:random,(25,04) -TRAP:random,(15,09) -TRAP:random,(25,09) -TRAP:random,random -TRAP:random,random -# No random monsters - the morgue generation will put them in. - -# -# The "goal" level for the quest. -# -# Here you meet Nalzok your nemesis monster. You have to -# defeat Nalzok in combat to gain the artifact you have -# been assigned to retrieve. -# - -MAZE: "Pri-goal", ' ' -INIT_MAP: mines, 'L' , '.' , false , false , unlit , false -GEOMETRY:center,center -MAP -xxxxxx..xxxxxx...xxxxxxxxx -xxxx......xx......xxxxxxxx -xx.xx.............xxxxxxxx -x....................xxxxx -......................xxxx -......................xxxx -xx........................ -xxx......................x -xxx................xxxxxxx -xxxx.....x.xx.......xxxxxx -xxxxx...xxxxxx....xxxxxxxx -ENDMAP -# Dungeon Description -$place = { (14,04),(13,07) } -SHUFFLE: $place - -REGION:(00,00,25,10),unlit,"ordinary" -# Stairs -STAIR:(20,05),up -# Objects -OBJECT:('[',"helm of brilliance"),$place[0],blessed,0,name:"The Mitre of Holiness" -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('&',"Nalzok"),$place[0] -MONSTER:('Z',"human zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:'Z',random -MONSTER:'Z',random -MONSTER:('W',"wraith"),random -MONSTER:('W',"wraith"),random -MONSTER:('W',"wraith"),random -MONSTER:('W',"wraith"),random -MONSTER:('W',"wraith"),random -MONSTER:('W',"wraith"),random -MONSTER:('W',"wraith"),random -MONSTER:('W',"wraith"),random -MONSTER:'W',random - -# -# The "fill" levels for the quest. -# -# These levels are used to fill out any levels not occupied by specific -# levels as defined above. "filla" is the upper filler, between the -# start and locate levels, and "fillb" the lower between the locate -# and goal levels. -# - -LEVEL: "Pri-fila" -# -ROOM: "ordinary" , random, random, random, random { - STAIR: random, up - OBJECT: random,random - MONSTER: ('Z', "human zombie"), random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random,random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - OBJECT: random,random - MONSTER: ('Z', "human zombie"), random -} - -ROOM: "morgue" , random, random, random, random { - STAIR: random, down - OBJECT: random, random - TRAP: random, random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random, random - TRAP: random, random - MONSTER: ('W', "wraith"), random -} - -ROOM: "morgue" , random, random, random, random { - OBJECT: random, random - TRAP: random, random -} - -RANDOM_CORRIDORS - -LEVEL: "Pri-filb" -# -ROOM: "ordinary" , random, random, random, random { - STAIR: random, up - OBJECT: random,random - MONSTER: ('Z', "human zombie"), random - MONSTER: ('W', "wraith"), random -} - -ROOM: "morgue" , random, random, random, random { - OBJECT: random, random - OBJECT: random, random - OBJECT: random,random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - OBJECT: random,random - MONSTER: ('Z', "human zombie"), random - MONSTER: ('W', "wraith"), random -} - -ROOM: "morgue" , random, random, random, random { - STAIR: random, down - OBJECT: random, random - OBJECT: random, random - TRAP: random, random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random, random - TRAP: random, random - MONSTER: ('Z', "human zombie"), random - MONSTER: ('W', "wraith"), random -} - -ROOM: "morgue" , random, random, random, random { - OBJECT: random, random - TRAP: random, random -} - -RANDOM_CORRIDORS diff --git a/dat/Ran-fila.lua b/dat/Ran-fila.lua new file mode 100644 index 000000000..321a9bc55 --- /dev/null +++ b/dat/Ran-fila.lua @@ -0,0 +1,35 @@ +-- NetHack 3.6 Ranger.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.level_init({ style="mines", fg=".", bg="T", smoothed=true, joined=true, walled=true }) + +-- +des.stair("up") +des.stair("down") +-- +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- +des.trap() +des.trap() +des.trap() +des.trap() +-- +des.monster({ id = "mountain centaur", peaceful=0 }) +des.monster({ id = "mountain centaur", peaceful=0 }) +des.monster({ id = "forest centaur", peaceful=0 }) +des.monster({ id = "forest centaur", peaceful=0 }) +des.monster({ id = "forest centaur", peaceful=0 }) +des.monster({ class = "C", peaceful=0 }) +des.monster({ id = "scorpion", peaceful=0 }) diff --git a/dat/Ran-filb.lua b/dat/Ran-filb.lua new file mode 100644 index 000000000..e7109541f --- /dev/null +++ b/dat/Ran-filb.lua @@ -0,0 +1,39 @@ +-- NetHack 3.6 Ranger.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.level_init({ style="mines", fg=".", bg=" ", smoothed=true, joined=true, walled=true }) + +-- +des.stair("up") +des.stair("down") +-- +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- +des.trap() +des.trap() +des.trap() +des.trap() +-- +des.monster({ id = "mountain centaur", peaceful=0 }) +des.monster({ id = "mountain centaur", peaceful=0 }) +des.monster({ id = "mountain centaur", peaceful=0 }) +des.monster({ id = "mountain centaur", peaceful=0 }) +des.monster({ class = "C", peaceful=0 }) +des.monster({ id = "scorpion", peaceful=0 }) +des.monster({ id = "scorpion", peaceful=0 }) diff --git a/dat/Ran-goal.lua b/dat/Ran-goal.lua new file mode 100644 index 000000000..b32c5add4 --- /dev/null +++ b/dat/Ran-goal.lua @@ -0,0 +1,106 @@ +-- NetHack 3.6 Ranger.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.map([[ + + ... ... + .......................................................................... + ... + ... + . ............ ....... . ....... . + . ............................. . ........ .........S.. . + . ............ . ...... . . . ....... .. . + . ......... . .... + . ... . .. . + . S . ......... .S. .S............... . + . ... . ... . ......... . . + . ........ .....S.+.......+....\....+........+. . + . ... ... S ......... .. ..... . + . .. ......... .. ...... . + . ....... ... + .... .... .......... . + . .............. .. . ...... .. ............. . + . ............. . .......... ...... . + ... + ... + .......................................................................... + ... ... + +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,19), "lit") +-- Stairs +des.stair("up", 19,10) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- Objects +des.object({ id = "bow", x=37, y=10, buc="blessed", spe=0, name="The Longbow of Diana" }) +des.object("chest", 37, 10) +des.object({ coord = { 36, 09 } }) +des.object({ coord = { 36, 10 } }) +des.object({ coord = { 36, 11 } }) +des.object({ coord = { 37, 09 } }) +des.object({ coord = { 37, 11 } }) +des.object({ coord = { 38, 09 } }) +des.object({ coord = { 38, 10 } }) +des.object({ coord = { 38, 11 } }) +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- doors +des.door("locked",12,08) +des.door("closed",22,10) +des.door("locked",24,10) +des.door("closed",25,11) +des.door("closed",32,10) +des.door("closed",37,03) +des.door("closed",37,07) +des.door("closed",37,13) +des.door("closed",37,16) +des.door("closed",42,10) +des.door("locked",46,08) +des.door("closed",51,10) +des.door("locked",53,08) +des.door("closed",65,05) +-- Random monsters. +des.monster({ id = "Scorpius", x=37, y=10, peaceful=0 }) +des.monster({ id = "forest centaur", x=36, y=09, peaceful=0 }) +des.monster({ id = "forest centaur", x=36, y=10, peaceful=0 }) +des.monster({ id = "forest centaur", x=36, y=11, peaceful=0 }) +des.monster({ id = "forest centaur", x=37, y=09, peaceful=0 }) +des.monster({ id = "forest centaur", x=37, y=11, peaceful=0 }) +des.monster({ id = "forest centaur", x=38, y=09, peaceful=0 }) +des.monster({ id = "mountain centaur", x=38, y=10, peaceful=0 }) +des.monster({ id = "mountain centaur", x=38, y=11, peaceful=0 }) +des.monster({ id = "mountain centaur", x=02, y=02, peaceful=0 }) +des.monster({ id = "mountain centaur", x=71, y=02, peaceful=0 }) +des.monster({ id = "mountain centaur", x=02, y=16, peaceful=0 }) +des.monster({ id = "mountain centaur", x=71, y=16, peaceful=0 }) +des.monster({ id = "forest centaur", peaceful=0 }) +des.monster({ id = "forest centaur", peaceful=0 }) +des.monster({ id = "mountain centaur", peaceful=0 }) +des.monster({ id = "mountain centaur", peaceful=0 }) +des.monster({ class = "C", peaceful=0 }) +des.monster({ class = "C", peaceful=0 }) +des.monster({ id = "scorpion", x=03, y=02, peaceful=0 }) +des.monster({ id = "scorpion", x=72, y=02, peaceful=0 }) +des.monster({ id = "scorpion", x=03, y=17, peaceful=0 }) +des.monster({ id = "scorpion", x=72, y=17, peaceful=0 }) +des.monster({ id = "scorpion", x=41, y=10, peaceful=0 }) +des.monster({ id = "scorpion", x=33, y=09, peaceful=0 }) +des.monster({ id = "scorpion", peaceful=0 }) +des.monster({ id = "scorpion", peaceful=0 }) +des.monster({ class = "s", peaceful=0 }) + +des.wallify() diff --git a/dat/Ran-loca.lua b/dat/Ran-loca.lua new file mode 100644 index 000000000..c9af3f1f3 --- /dev/null +++ b/dat/Ran-loca.lua @@ -0,0 +1,79 @@ +-- NetHack 3.6 Ranger.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "hardfloor") +--1234567890123456789012345678901234567890123456789012345678901234567890 +des.map([[ + ....... ......... ....... + ................... ................... + .... ....... ....... .... +... ..... . ..... . ..... ... +. .......... ..... ........... ..... .......... . +. .. ..... .......... ..... .......... ..... .. . +. . . ..... . ..... . . . +. . ..... ............. ..... . . +. . ................ ....... ................ . . +. . ..... ....... ..... . . +. . . ...... ...... . . . +. . ........... ......... ........... . . +. . .......... .......... . . +. .. ..... . ..... . ..... .. . +. .......... ..... ........... ..... .......... . +. ..... .......... ..... .......... ..... . +. . ..... . ..... . . +... ....... ....... ....... ... + .............. ............. .............. + ....... ....... ....... ....... ....... +]]); +-- Dungeon Description +des.region(selection.area(00,00,54,19), "lit") +-- Stairs +des.stair("up", 25,05) +des.stair("down", 27,18) +-- Non diggable walls +des.non_diggable(selection.area(00,00,54,19)) +-- Objects +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap("spiked pit") +des.trap("spiked pit") +des.trap("teleport") +des.trap("teleport") +des.trap("arrow") +des.trap("arrow") +-- Random monsters. +des.monster({ id = "wumpus", x=27, y=18, peaceful=0, asleep=1 }) +des.monster({ id = "giant bat", peaceful=0 }) +des.monster({ id = "giant bat", peaceful=0 }) +des.monster({ id = "giant bat", peaceful=0 }) +des.monster({ id = "giant bat", peaceful=0 }) +des.monster({ id = "forest centaur", peaceful=0 }) +des.monster({ id = "forest centaur", peaceful=0 }) +des.monster({ id = "forest centaur", peaceful=0 }) +des.monster({ id = "forest centaur", peaceful=0 }) +des.monster({ id = "mountain centaur", peaceful=0 }) +des.monster({ id = "mountain centaur", peaceful=0 }) +des.monster({ id = "mountain centaur", peaceful=0 }) +des.monster({ id = "mountain centaur", peaceful=0 }) +des.monster({ id = "mountain centaur", peaceful=0 }) +des.monster({ id = "mountain centaur", peaceful=0 }) +des.monster({ id = "mountain centaur", peaceful=0 }) +des.monster({ id = "mountain centaur", peaceful=0 }) +des.monster({ id = "scorpion", peaceful=0 }) +des.monster({ id = "scorpion", peaceful=0 }) +des.monster({ id = "scorpion", peaceful=0 }) +des.monster({ id = "scorpion", peaceful=0 }) +des.monster({ class = "s", peaceful=0 }) +des.monster({ class = "s", peaceful=0 }) + diff --git a/dat/Ran-strt.lua b/dat/Ran-strt.lua new file mode 100644 index 000000000..66ea5028a --- /dev/null +++ b/dat/Ran-strt.lua @@ -0,0 +1,97 @@ +-- NetHack 3.6 Ranger.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- The "start" level for the quest. +-- +-- Here you meet your (besieged) class leader, Orion, +-- and receive your quest assignment. +-- +des.level_init({ style = "solidfill", fg = "." }); + +des.level_flags("mazelevel", "noteleport", "hardfloor", "arboreal") + +des.level_init({ style="mines", fg=".", bg=".", smoothed=true, joined=true, lit=1, walled=false }) +des.replace_terrain({ region={00,00, 76,19}, fromterrain=".", toterrain="T", chance=5 }) +--1234567890123456789012345678901234567890123456789012345678901234567890 +des.map({ halign = "left", valign = "center", map = [[ + xx + ................................... x + .. .. + .. ...............F............... .. + . .. .F. .. . + . .. .............F............. .. . + . . .. .. . . + . . .. ....................... .. ... + . . . .. .. . + ... . .. .|..................... ...... + FFF . . ..S.................. + ... . .. .|................. .... ... + . . . .. .. . . . + . . .. ....................... .. . . + . . .. .. . . + . .. .............F............. .. . + . .. .F. .. . + .. ...............F............... .. + .. .. + ................................... x + xx +]] }); +-- Dungeon Description +des.region(selection.area(00,00,40,20), "lit") +-- Stairs +des.stair("down", 10,10) +-- Portal arrival point; just about anywhere on the right hand side of the map +des.levregion({ region = {51,2,77,18}, region_islev = 1, type="branch" }) +-- Orion +des.monster("Orion", 20, 10) +-- The treasure of Orion +des.object("chest", 20, 10) +-- Guards for the audience chamber +des.monster("hunter", 19, 09) +des.monster("hunter", 20, 09) +des.monster("hunter", 21, 09) +des.monster("hunter", 19, 10) +des.monster("hunter", 21, 10) +des.monster("hunter", 19, 11) +des.monster("hunter", 20, 11) +des.monster("hunter", 21, 11) +-- Non diggable walls +des.non_diggable(selection.area(00,00,40,20)) +-- Traps +des.trap("arrow",30,09) +des.trap("arrow",30,10) +des.trap("pit",40,09) +des.trap("spiked pit") +des.trap("bear") +des.trap("bear") +-- Monsters on siege duty. +des.monster({ id = "minotaur", x=33, y=09, peaceful=0, asleep=1 }) +des.monster({ id = "forest centaur", x=19, y=03, peaceful=0 }) +des.monster({ id = "forest centaur", x=19, y=04, peaceful=0 }) +des.monster({ id = "forest centaur", x=19, y=05, peaceful=0 }) +des.monster({ id = "forest centaur", x=21, y=03, peaceful=0 }) +des.monster({ id = "forest centaur", x=21, y=04, peaceful=0 }) +des.monster({ id = "forest centaur", x=21, y=05, peaceful=0 }) +des.monster({ id = "forest centaur", x=01, y=09, peaceful=0 }) +des.monster({ id = "forest centaur", x=02, y=09, peaceful=0 }) +des.monster({ id = "forest centaur", x=03, y=09, peaceful=0 }) +des.monster({ id = "forest centaur", x=01, y=11, peaceful=0 }) +des.monster({ id = "forest centaur", x=02, y=11, peaceful=0 }) +des.monster({ id = "forest centaur", x=03, y=11, peaceful=0 }) +des.monster({ id = "forest centaur", x=19, y=15, peaceful=0 }) +des.monster({ id = "forest centaur", x=19, y=16, peaceful=0 }) +des.monster({ id = "forest centaur", x=19, y=17, peaceful=0 }) +des.monster({ id = "forest centaur", x=21, y=15, peaceful=0 }) +des.monster({ id = "forest centaur", x=21, y=16, peaceful=0 }) +des.monster({ id = "forest centaur", x=21, y=17, peaceful=0 }) +des.monster({ id = "plains centaur", peaceful=0 }) +des.monster({ id = "plains centaur", peaceful=0 }) +des.monster({ id = "plains centaur", peaceful=0 }) +des.monster({ id = "plains centaur", peaceful=0 }) +des.monster({ id = "plains centaur", peaceful=0 }) +des.monster({ id = "plains centaur", peaceful=0 }) +des.monster({ id = "scorpion", peaceful=0 }) +des.monster({ id = "scorpion", peaceful=0 }) diff --git a/dat/Ranger.des b/dat/Ranger.des deleted file mode 100644 index aa081cfe8..000000000 --- a/dat/Ranger.des +++ /dev/null @@ -1,356 +0,0 @@ -# NetHack 3.6 Ranger.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# Copyright (c) 1991 by M. Stephenson -# NetHack may be freely redistributed. See license for details. -# -# The "start" level for the quest. -# -# Here you meet your (besieged) class leader, Orion, -# and receive your quest assignment. -# -MAZE: "Ran-strt",'.' -FLAGS: noteleport,hardfloor,arboreal -INIT_MAP:mines,'.','.',true,true,lit,false -REPLACE_TERRAIN:(0,0,76,19),'.', 'T', 5% -GEOMETRY:left,center -#1234567890123456789012345678901234567890123456789012345678901234567890 -MAP - xx - ................................... x - .. .. - .. ...............F............... .. - . .. .F. .. . - . .. .............F............. .. . - . . .. .. . . - . . .. ....................... .. ... - . . . .. .. . - ... . .. .|..................... ...... - FFF . . ..S.................. - ... . .. .|................. .... ... - . . . .. .. . . . - . . .. ....................... .. . . - . . .. .. . . - . .. .............F............. .. . - . .. .F. .. . - .. ...............F............... .. - .. .. - ................................... x - xx -ENDMAP -# Dungeon Description -REGION:(00,00,40,20),lit,"ordinary" -# Stairs -STAIR:(10,10),down -# Portal arrival point; just about anywhere on the right hand side of the map -BRANCH:levregion(51,2,77,18),(0,0,40,20) -# Orion -MONSTER:('@',"Orion"),(20,10) -# The treasure of Orion -OBJECT:('(',"chest"),(20,10) -# Guards for the audience chamber -MONSTER:('@',"hunter"),(19,09) -MONSTER:('@',"hunter"),(20,09) -MONSTER:('@',"hunter"),(21,09) -MONSTER:('@',"hunter"),(19,10) -MONSTER:('@',"hunter"),(21,10) -MONSTER:('@',"hunter"),(19,11) -MONSTER:('@',"hunter"),(20,11) -MONSTER:('@',"hunter"),(21,11) -# Non diggable walls -NON_DIGGABLE:(00,00,40,20) -# Traps -TRAP:"arrow",(30,09) -TRAP:"arrow",(30,10) -TRAP:"pit",(40,09) -TRAP:"spiked pit",random -TRAP:"bear",random -TRAP:"bear",random -# Monsters on siege duty. -MONSTER: ('H',"minotaur"),(33,09),hostile,asleep -MONSTER: ('C',"forest centaur"),(19,03),hostile -MONSTER: ('C',"forest centaur"),(19,04),hostile -MONSTER: ('C',"forest centaur"),(19,05),hostile -MONSTER: ('C',"forest centaur"),(21,03),hostile -MONSTER: ('C',"forest centaur"),(21,04),hostile -MONSTER: ('C',"forest centaur"),(21,05),hostile -MONSTER: ('C',"forest centaur"),(01,09),hostile -MONSTER: ('C',"forest centaur"),(02,09),hostile -MONSTER: ('C',"forest centaur"),(03,09),hostile -MONSTER: ('C',"forest centaur"),(01,11),hostile -MONSTER: ('C',"forest centaur"),(02,11),hostile -MONSTER: ('C',"forest centaur"),(03,11),hostile -MONSTER: ('C',"forest centaur"),(19,15),hostile -MONSTER: ('C',"forest centaur"),(19,16),hostile -MONSTER: ('C',"forest centaur"),(19,17),hostile -MONSTER: ('C',"forest centaur"),(21,15),hostile -MONSTER: ('C',"forest centaur"),(21,16),hostile -MONSTER: ('C',"forest centaur"),(21,17),hostile -MONSTER: ('C',"plains centaur"),random,hostile -MONSTER: ('C',"plains centaur"),random,hostile -MONSTER: ('C',"plains centaur"),random,hostile -MONSTER: ('C',"plains centaur"),random,hostile -MONSTER: ('C',"plains centaur"),random,hostile -MONSTER: ('C',"plains centaur"),random,hostile -MONSTER: ('s',"scorpion"),random,hostile -MONSTER: ('s',"scorpion"),random,hostile - - -# -# The "locate" level for the quest. -# -# Here you have to infiltrate the Cave of the Wumpus to go -# further towards your assigned quest. -# - -MAZE: "Ran-loca",' ' -FLAGS: hardfloor -GEOMETRY:center,center -#1234567890123456789012345678901234567890123456789012345678901234567890 -MAP - ....... ......... ....... - ................... ................... - .... ....... ....... .... -... ..... . ..... . ..... ... -. .......... ..... ........... ..... .......... . -. .. ..... .......... ..... .......... ..... .. . -. . . ..... . ..... . . . -. . ..... ............. ..... . . -. . ................ ....... ................ . . -. . ..... ....... ..... . . -. . . ...... ...... . . . -. . ........... ......... ........... . . -. . .......... .......... . . -. .. ..... . ..... . ..... .. . -. .......... ..... ........... ..... .......... . -. ..... .......... ..... .......... ..... . -. . ..... . ..... . . -... ....... ....... ....... ... - .............. ............. .............. - ....... ....... ....... ....... ....... -ENDMAP -# Dungeon Description -REGION:(00,00,54,19),lit,"ordinary" -# Stairs -STAIR:(25,05),up -STAIR:(27,18),down -# Non diggable walls -NON_DIGGABLE:(00,00,54,19) -# Objects -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:"spiked pit",random -TRAP:"spiked pit",random -TRAP:"teleport",random -TRAP:"teleport",random -TRAP:"arrow",random -TRAP:"arrow",random -# Random monsters. -MONSTER:('q',"wumpus"),(27,18),hostile,asleep -MONSTER:('B',"giant bat"),random,hostile -MONSTER:('B',"giant bat"),random,hostile -MONSTER:('B',"giant bat"),random,hostile -MONSTER:('B',"giant bat"),random,hostile -MONSTER:('C',"forest centaur"),random,hostile -MONSTER:('C',"forest centaur"),random,hostile -MONSTER:('C',"forest centaur"),random,hostile -MONSTER:('C',"forest centaur"),random,hostile -MONSTER:('C',"mountain centaur"),random,hostile -MONSTER:('C',"mountain centaur"),random,hostile -MONSTER:('C',"mountain centaur"),random,hostile -MONSTER:('C',"mountain centaur"),random,hostile -MONSTER:('C',"mountain centaur"),random,hostile -MONSTER:('C',"mountain centaur"),random,hostile -MONSTER:('C',"mountain centaur"),random,hostile -MONSTER:('C',"mountain centaur"),random,hostile -MONSTER:('s',"scorpion"),random,hostile -MONSTER:('s',"scorpion"),random,hostile -MONSTER:('s',"scorpion"),random,hostile -MONSTER:('s',"scorpion"),random,hostile -MONSTER:'s',random,hostile -MONSTER:'s',random,hostile - - -# -# The "goal" level for the quest. -# -# Here you meet Scorpius, your nemesis monster. You have to -# defeat Scorpius in combat to gain the artifact you have -# been assigned to retrieve. -# - -MAZE: "Ran-goal", ' ' -GEOMETRY:center,center -MAP - - ... ... - .......................................................................... - ... + ... - . ............ ....... . ....... . - . ............................. . ........ .........S.. . - . ............ . ...... . . . ....... .. . - . ......... . .... + . ... . .. . - . S . ......... .S. .S............... . - . ... . ... . ......... . . - . ........ .....S.+.......+....\....+........+. . - . ... ... S ......... .. ..... . - . .. ......... .. ...... . - . ....... ... + .... .... .......... . - . .............. .. . ...... .. ............. . - . ............. . .......... ...... . - ... + ... - .......................................................................... - ... ... - -ENDMAP -# Dungeon Description -REGION:(00,00,75,19),lit,"ordinary" -# Stairs -STAIR:(19,10),up -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# Objects -OBJECT:(')',"bow"),(37,10),blessed,0,name:"The Longbow of Diana" -OBJECT:('(',"chest"),(37,10) -OBJECT:random,(36,09) -OBJECT:random,(36,10) -OBJECT:random,(36,11) -OBJECT:random,(37,09) -OBJECT:random,(37,11) -OBJECT:random,(38,09) -OBJECT:random,(38,10) -OBJECT:random,(38,11) -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# doors -DOOR:locked,(12,08) -DOOR:closed,(22,10) -DOOR:locked,(24,10) -DOOR:closed,(25,11) -DOOR:closed,(32,10) -DOOR:closed,(37,03) -DOOR:closed,(37,07) -DOOR:closed,(37,13) -DOOR:closed,(37,16) -DOOR:closed,(42,10) -DOOR:locked,(46,08) -DOOR:closed,(51,10) -DOOR:locked,(53,08) -DOOR:closed,(65,05) -# Random monsters. -MONSTER:('s',"Scorpius"),(37,10),hostile -MONSTER:('C',"forest centaur"),(36,09),hostile -MONSTER:('C',"forest centaur"),(36,10),hostile -MONSTER:('C',"forest centaur"),(36,11),hostile -MONSTER:('C',"forest centaur"),(37,09),hostile -MONSTER:('C',"forest centaur"),(37,11),hostile -MONSTER:('C',"forest centaur"),(38,09),hostile -MONSTER:('C',"mountain centaur"),(38,10),hostile -MONSTER:('C',"mountain centaur"),(38,11),hostile -MONSTER:('C',"mountain centaur"),(02,02),hostile -MONSTER:('C',"mountain centaur"),(71,02),hostile -MONSTER:('C',"mountain centaur"),(02,16),hostile -MONSTER:('C',"mountain centaur"),(71,16),hostile -MONSTER:('C',"forest centaur"),random,hostile -MONSTER:('C',"forest centaur"),random,hostile -MONSTER:('C',"mountain centaur"),random,hostile -MONSTER:('C',"mountain centaur"),random,hostile -MONSTER:'C',random,hostile -MONSTER:'C',random,hostile -MONSTER:('s',"scorpion"),(03,02),hostile -MONSTER:('s',"scorpion"),(72,02),hostile -MONSTER:('s',"scorpion"),(03,17),hostile -MONSTER:('s',"scorpion"),(72,17),hostile -MONSTER:('s',"scorpion"),(41,10),hostile -MONSTER:('s',"scorpion"),(33,09),hostile -MONSTER:('s',"scorpion"),random,hostile -MONSTER:('s',"scorpion"),random,hostile -MONSTER:'s',random,hostile - -WALLIFY - -# -# The "fill" levels for the quest. -# -# These levels are used to fill out any levels not occupied by specific -# levels as defined above. "fila" is the upper filler, between the -# start and locate levels, and "filb" the lower between the locate -# and goal levels. -# - -MAZE: "Ran-fila" , ' ' -INIT_MAP: mines, '.' , 'T', true, true, random, true -NOMAP -# -STAIR: random, up -STAIR: random, down -# -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -# -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random -# -MONSTER: ('C', "mountain centaur"), random, hostile -MONSTER: ('C', "mountain centaur"), random, hostile -MONSTER: ('C', "forest centaur"), random, hostile -MONSTER: ('C', "forest centaur"), random, hostile -MONSTER: ('C', "forest centaur"), random, hostile -MONSTER: 'C', random, hostile -MONSTER: ('s', "scorpion"), random, hostile - -MAZE: "Ran-filb" , ' ' -INIT_MAP: mines, '.' , ' ', true, true, random, true -NOMAP -# -STAIR: random, up -STAIR: random, down -# -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -# -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random -# -MONSTER: ('C', "mountain centaur"), random, hostile -MONSTER: ('C', "mountain centaur"), random, hostile -MONSTER: ('C', "mountain centaur"), random, hostile -MONSTER: ('C', "mountain centaur"), random, hostile -MONSTER: 'C', random, hostile -MONSTER: ('s', "scorpion"), random, hostile -MONSTER: ('s', "scorpion"), random, hostile - diff --git a/dat/Rog-fila.lua b/dat/Rog-fila.lua new file mode 100644 index 000000000..b21be7db9 --- /dev/null +++ b/dat/Rog-fila.lua @@ -0,0 +1,64 @@ +-- NetHack 3.6 Rogue.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1992 by Dean Luick +-- NetHack may be freely redistributed. See license for details. +-- +-- +des.room({ type = "ordinary", + contents = function() + des.stair("up") + des.object() + des.monster({ id = "leprechaun", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.monster({ id = "leprechaun", peaceful=0 }) + des.monster({ id = "guardian naga", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.trap() + des.object() + des.monster({ id = "water nymph", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.stair("down") + des.object() + des.trap() + des.trap() + des.monster({ class = "l", peaceful=0 }) + des.monster({ id = "guardian naga", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.trap() + des.trap() + des.monster({ id = "leprechaun", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.trap() + des.monster({ id = "leprechaun", peaceful=0 }) + des.monster({ id = "water nymph", peaceful=0 }) + end +}) + +des.random_corridors() diff --git a/dat/Rog-filb.lua b/dat/Rog-filb.lua new file mode 100644 index 000000000..b21be7db9 --- /dev/null +++ b/dat/Rog-filb.lua @@ -0,0 +1,64 @@ +-- NetHack 3.6 Rogue.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1992 by Dean Luick +-- NetHack may be freely redistributed. See license for details. +-- +-- +des.room({ type = "ordinary", + contents = function() + des.stair("up") + des.object() + des.monster({ id = "leprechaun", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.monster({ id = "leprechaun", peaceful=0 }) + des.monster({ id = "guardian naga", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.trap() + des.object() + des.monster({ id = "water nymph", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.stair("down") + des.object() + des.trap() + des.trap() + des.monster({ class = "l", peaceful=0 }) + des.monster({ id = "guardian naga", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.trap() + des.trap() + des.monster({ id = "leprechaun", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.trap() + des.monster({ id = "leprechaun", peaceful=0 }) + des.monster({ id = "water nymph", peaceful=0 }) + end +}) + +des.random_corridors() diff --git a/dat/Rog-goal.lua b/dat/Rog-goal.lua new file mode 100644 index 000000000..3fa505c25 --- /dev/null +++ b/dat/Rog-goal.lua @@ -0,0 +1,110 @@ +-- NetHack 3.6 Rogue.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1992 by Dean Luick +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport") + +-- 1 2 3 4 5 6 7 +--123456789012345678901234567890123456789012345678901234567890123456789012345 +des.map([[ +----- -------.......................................|-----------------| +|...| -----.....|.......................................|.................| +|...----...|.....|.......................................|....---------....| +|.---......---..--.................................------------.......|....| +|...............|..................................|..|...|...----........-| +|.....-----....--.................................|-..--..-|.....----S----| +|--S---...|....|.................................|-........-|....|........| +|.........---------.............................|-....}}....-|...|...|....| +|....|.....S......|............................|-.....}}.....-|..--.------| +|-----.....--.....|...........................|-...}}}}}}}}...-|....|.....-- +|...........--....------S-----...............|-....}}}}}}}}....-|..........| +|............--........|...| |..............--.....}}.}}........----------S- +|.............|........|...| |..............|......}}}}}}}}......|...|.....| +|S-.---.---.---.---.---|...| ------------...--........}}.}}.....--..---....| +|.---.---.---.---.-S-..----- |....|.....|....|-....}}}}}}}}....---..S.|--..| +|...|.......|..........|...---....---...S.....|-...}}}}}}}}...-|.S..|...|..| +|...|..|....|..........|............|..--..----|-.....}}.....-|..----...-S-- +|...|---....----.......|----- ......|...---| |-....}}....-|...|..--.--..| +-----.....---.....--.---....--...--------..| |-........-|....|.........| + |.............|..........|.............S... |S-------|.....|..-----..| + ---------------------------------------- ...... ---------- ---- +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,20), "lit") +-- Stairs +des.levregion({ region={01,00,15,20}, region_islev=1, exclude={01,18,04,20}, type="stair-up" }); +-- Doors +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,20)) +-- One trap to keep the gnomes at bay. +des.trap("spiked pit",37,07) +-- Objects +des.object({ id = "skeleton key", x=38, y=10, buc="blessed", spe=0, name="The Master Key of Thievery" }) +des.object({ id = "tin", x=26, y=12, montype="chameleon" }) +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Random monsters. +des.monster({ id = "Master Assassin", x=38, y=10, peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ class = "l", peaceful=0 }) +des.monster({ class = "l", peaceful=0 }) +des.monster({ id = "guardian naga", peaceful=0 }) +des.monster({ id = "guardian naga", peaceful=0 }) +des.monster({ id = "guardian naga", peaceful=0 }) +des.monster({ id = "guardian naga", peaceful=0 }) +des.monster({ id = "guardian naga", peaceful=0 }) +des.monster({ id = "guardian naga", peaceful=0 }) +des.monster({ id = "guardian naga", peaceful=0 }) +des.monster({ id = "guardian naga", peaceful=0 }) +des.monster({ class = "N", peaceful=0 }) +des.monster({ class = "N", peaceful=0 }) +des.monster({ class = "N", peaceful=0 }) +des.monster({ id = "chameleon", peaceful=0 }) +des.monster({ id = "chameleon", peaceful=0 }) +des.monster({ id = "chameleon", peaceful=0 }) +des.monster({ id = "chameleon", peaceful=0 }) +des.monster({ id = "chameleon", peaceful=0 }) +des.monster({ id = "shark", x=51, y=14, peaceful=0 }) +des.monster({ id = "shark", x=53, y=09, peaceful=0 }) +des.monster({ id = "shark", x=55, y=15, peaceful=0 }) +des.monster({ id = "shark", x=58, y=10, peaceful=0 }) diff --git a/dat/Rog-loca.lua b/dat/Rog-loca.lua new file mode 100644 index 000000000..ef5b399ea --- /dev/null +++ b/dat/Rog-loca.lua @@ -0,0 +1,99 @@ +-- NetHack 3.6 Rogue.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1992 by Dean Luick +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +-- 1 2 3 4 5 6 7 +--123456789012345678901234567890123456789012345678901234567890123456789012345 +des.map([[ + ---------------------------------------------------- -------- + ---.................................................- --.....| + ---...--------........-------.......................--- ---...| + ---.....- ---......- ---..................---- --.-- + ---.....---- -------- --..................-- --..| + ---...----- ----.----.....----.....--- --..|| +----..---- -----..--- |...--- |.......--- --...| +|...--- ----....--- |.--- |.........-- --...|| +|...- ----.....--- ---- |..........---....| +|...---- ----......--- | |...|.......-....|| +|......----- ---.........- | -----...|............| +|..........----- ----...........--- -------......||...........|| +|..............-----................--- |............|||..........| +|------...............................--- |...........|| |.........|| +|.....|..............------.............-----..........|| ||........| +|.....|.............-- ---.........................|| |.......|| +|.....|.............- ---.....................--| ||......| +|-S----------.......---- --.................---- |.....|| +|...........|..........--------..............----- ||....| +|...........|............................----- |....| +------------------------------------------ ------ +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,20), "lit") +-- Doors +--DOOR:locked|closed|open,(xx,yy) +-- Stairs +des.stair("up") +des.stair("down") +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,20)) +-- Objects +des.object({ id = "teleportation", x=11, y=18, buc="cursed", spe=0 }) +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Random monsters. +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ id = "leprechaun", peaceful=0 }) +des.monster({ class = "l", peaceful=0 }) +des.monster({ id = "guardian naga", peaceful=0 }) +des.monster({ id = "guardian naga", peaceful=0 }) +des.monster({ id = "guardian naga", peaceful=0 }) +des.monster({ id = "guardian naga", peaceful=0 }) +des.monster({ id = "guardian naga", peaceful=0 }) +des.monster({ id = "guardian naga", peaceful=0 }) +des.monster({ id = "guardian naga", peaceful=0 }) +des.monster({ class = "N", peaceful=0 }) +des.monster({ class = "N", peaceful=0 }) +des.monster({ class = "N", peaceful=0 }) +des.monster({ id = "chameleon", peaceful=0 }) +des.monster({ id = "chameleon", peaceful=0 }) +des.monster({ id = "chameleon", peaceful=0 }) +des.monster({ id = "chameleon", peaceful=0 }) +des.monster({ id = "chameleon", peaceful=0 }) diff --git a/dat/Rog-strt.lua b/dat/Rog-strt.lua new file mode 100644 index 000000000..769cb517f --- /dev/null +++ b/dat/Rog-strt.lua @@ -0,0 +1,163 @@ +-- NetHack 3.6 Rogue.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1992 by Dean Luick +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- The "start" level for the quest. +-- +-- Here you meet your (besieged) class leader, Master of Thieves +-- and receive your quest assignment. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor", "nommap") + +-- 1 2 3 4 5 6 7 +--123456789012345678901234567890123456789012345678901234567890123456789012345 +des.map([[ +---------------------------------.------------------------------------------ +|.....|.||..........|....|......|.|.........|.......+............---.......| +|.....|..+..........+....---....S.|...-S-----.-----.|............+.+.......| +|.....+.||........---......|....|.|...|.....|.|...|.---.....------.--------| +|-----|.-------|..|........------.-----.....|.--..|...-------..............| +|.....|........------+------..........+.....|..--S---.........------.-----.. +|.....|.------...............-----.}}.--------.|....-------.---....|.+...--| +|..-+--.|....|-----.--------.|...|.....+.....|.|....|.....+.+......|.--....| +|..|....|....|....+.|......|.|...-----.|.....|.--...|.....|.|......|..|....| +|..|.-----S----...|.+....-----...|...|.----..|..|.---....--.---S-----.|----| +|..|.|........|...------.|.S.....|...|....-----.+.|......|..|.......|.|....| +|---.-------..|...|....|.|.|.....|...----.|...|.|---.....|.|-.......|.---..| +...........|..S...|....---.----S----..|...|...+.|..-------.---+-....|...--+| +|---------.---------...|......|....S..|.---...|.|..|...........----.---....| +|........|.........|...+.------....|---.---...|.--+-.----.----....|.+...--+| +|........|.---+---.|----.--........|......-----......|..|..|.--+-.|.-S-.|..| +|........|.|.....|........----------.----.......---.--..|-.|....|.-----.|..| +|----....+.|.....----+---............|..|--------.+.|...SS.|....|.......|..| +|...--+-----.....|......|.------------............---...||.------+--+----..| +|..........S.....|......|.|..........S............|.....||...|.....|....|..| +-------------------------.-------------------------------------------------- +]]); +-- Dungeon Description +--REGION:(00,00,75,20),lit,"ordinary" + +local streets = selection.floodfill(selection.new(), 0,12) + + +-- The down stairs is at one of the 4 "exits". The others are mimics, +-- mimicing stairwells. +local place = { {33,0}, {0,12}, {25,20}, {75,05} } +shuffle(place) + +des.stair({ dir = "down", coord = place[1] }) +des.monster({ id = "giant mimic", coord = place[2], appear_as = "ter:staircase down" }) +des.monster({ id = "large mimic", coord = place[3], appear_as = "ter:staircase down" }) +des.monster({ id = "small mimic", coord = place[4], appear_as = "ter:staircase down" }) +-- Portal arrival point +des.levregion({ region = {19,09,19,09}, type="branch" }) +-- Doors (secret) +--DOOR:locked|closed|open,(xx,yy) +des.door("locked", 32, 2) +des.door("locked", 63, 9) +des.door("locked", 27,10) +des.door("locked", 31,12) +des.door("locked", 35,13) +des.door("locked", 69,15) +des.door("locked", 56,17) +des.door("locked", 57,17) +des.door("locked", 11,19) +des.door("locked", 37,19) +des.door("locked", 39, 2) +des.door("locked", 49, 5) +des.door("locked", 10, 9) +des.door("locked", 14,12) +-- Doors (regular) +des.door("closed", 52, 1) +des.door("closed", 9, 2) +des.door("closed", 20, 2) +des.door("closed", 65, 2) +des.door("closed", 67, 2) +des.door("closed", 6, 3) +des.door("closed", 21, 5) +des.door("closed", 38, 5) +des.door("closed", 69, 6) +des.door("closed", 4, 7) +des.door("closed", 39, 7) +des.door("closed", 58, 7) +des.door("closed", 60, 7) +des.door("closed", 18, 8) +des.door("closed", 20, 9) +des.door("closed", 48,10) +des.door("closed", 46,12) +des.door("closed", 62,12) +des.door("closed", 74,12) +des.door("closed", 23,14) +des.door("closed", 23,14) +des.door("closed", 50,14) +des.door("closed", 68,14) +des.door("closed", 74,14) +des.door("closed", 14,15) +des.door("closed", 63,15) +des.door("closed", 9,17) +des.door("closed", 21,17) +des.door("closed", 50,17) +des.door("closed", 6,18) +des.door("closed", 65,18) +des.door("closed", 68,18) +-- Master of Thieves +des.monster("Master of Thieves", 36, 11) +-- The treasure of Master of Thieves +des.object("chest", 36, 11) +-- thug guards, room #1 +des.monster("thug", 28, 10) +des.monster("thug", 29, 11) +des.monster("thug", 30, 09) +des.monster("thug", 31, 07) +-- thug guards, room #2 +des.monster("thug", 31, 13) +des.monster("thug", 33, 14) +des.monster("thug", 30, 15) +--thug guards, room #3 +des.monster("thug", 35, 09) +des.monster("thug", 36, 13) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,20)) +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- +-- Monsters to get in the way. +-- +-- West exit +des.monster({ id = "leprechaun", x=01, y=12, peaceful=0 }) +des.monster({ id = "water nymph", x=02, y=12, peaceful=0 }) +-- North exit +des.monster({ id = "water nymph", x=33, y=01, peaceful=0 }) +des.monster({ id = "leprechaun", x=33, y=02, peaceful=0 }) +-- East exit +des.monster({ id = "water nymph", x=74, y=05, peaceful=0 }) +des.monster({ id = "leprechaun", x=74, y=04, peaceful=0 }) +-- South exit +des.monster({ id = "leprechaun", x=25, y=19, peaceful=0 }) +des.monster({ id = "water nymph", x=25, y=18, peaceful=0 }) +-- Wandering the streets. +for i=1,4 + math.random(1 - 1,1*3) do + des.monster({ id = "water nymph", coord = {streets:rndcoord(1)}, peaceful=0 }) + des.monster({ id = "leprechaun", coord = {streets:rndcoord(1)}, peaceful=0 }) +end +for i=1,7 + math.random(1 - 1,1*3) do + des.monster({ id = "chameleon", coord = {streets:rndcoord(1)}, peaceful=0 }) +end diff --git a/dat/Rogue.des b/dat/Rogue.des deleted file mode 100644 index 1f0c4eb6c..000000000 --- a/dat/Rogue.des +++ /dev/null @@ -1,485 +0,0 @@ -# NetHack 3.6 Rogue.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ -# Copyright (c) 1992 by Dean Luick -# NetHack may be freely redistributed. See license for details. -# -# The "start" level for the quest. -# -# Here you meet your (besieged) class leader, Master of Thieves -# and receive your quest assignment. -# -MAZE: "Rog-strt",' ' -FLAGS: noteleport, hardfloor, nommap -GEOMETRY:center,center -# 1 2 3 4 5 6 7 -#123456789012345678901234567890123456789012345678901234567890123456789012345 -MAP ----------------------------------.------------------------------------------ -|.....|.||..........|....|......|.|.........|.......+............---.......| -|.....|..+..........+....---....S.|...-S-----.-----.|............+.+.......| -|.....+.||........---......|....|.|...|.....|.|...|.---.....------.--------| -|-----|.-------|..|........------.-----.....|.--..|...-------..............| -|.....|........------+------..........+.....|..--S---.........------.-----.. -|.....|.------...............-----.}}.--------.|....-------.---....|.+...--| -|..-+--.|....|-----.--------.|...|.....+.....|.|....|.....+.+......|.--....| -|..|....|....|....+.|......|.|...-----.|.....|.--...|.....|.|......|..|....| -|..|.-----S----...|.+....-----...|...|.----..|..|.---....--.---S-----.|----| -|..|.|........|...------.|.S.....|...|....-----.+.|......|..|.......|.|....| -|---.-------..|...|....|.|.|.....|...----.|...|.|---.....|.|-.......|.---..| -...........|..S...|....---.----S----..|...|...+.|..-------.---+-....|...--+| -|---------.---------...|......|....S..|.---...|.|..|...........----.---....| -|........|.........|...+.------....|---.---...|.--+-.----.----....|.+...--+| -|........|.---+---.|----.--........|......-----......|..|..|.--+-.|.-S-.|..| -|........|.|.....|........----------.----.......---.--..|-.|....|.-----.|..| -|----....+.|.....----+---............|..|--------.+.|...SS.|....|.......|..| -|...--+-----.....|......|.------------............---...||.------+--+----..| -|..........S.....|......|.|..........S............|.....||...|.....|....|..| --------------------------.-------------------------------------------------- -ENDMAP -# Dungeon Description -#REGION:(00,00,75,20),lit,"ordinary" - -$streets = selection: floodfill(0,12) - - -# The down stairs is at one of the 4 "exits". The others are mimics, -# mimicing stairwells. -$place = { (33,0), (0,12), (25,20), (75,05) } -SHUFFLE: $place - -STAIR:$place[0],down -MONSTER:('m',"giant mimic"), $place[1], m_feature "staircase down" -MONSTER:('m',"large mimic"), $place[2], m_feature "staircase down" -MONSTER:('m',"small mimic"), $place[3], m_feature "staircase down" -# Portal arrival point -BRANCH:(19,09,19,09),(0,0,0,0) -# Doors (secret) -#DOOR:locked|closed|open,(xx,yy) -DOOR: locked, (32, 2) -DOOR: locked, (63, 9) -DOOR: locked, (27,10) -DOOR: locked, (31,12) -DOOR: locked, (35,13) -DOOR: locked, (69,15) -DOOR: locked, (56,17) -DOOR: locked, (57,17) -DOOR: locked, (11,19) -DOOR: locked, (37,19) -DOOR: locked, (39, 2) -DOOR: locked, (49, 5) -DOOR: locked, (10, 9) -DOOR: locked, (14,12) -# Doors (regular) -DOOR: closed, (52, 1) -DOOR: closed, ( 9, 2) -DOOR: closed, (20, 2) -DOOR: closed, (65, 2) -DOOR: closed, (67, 2) -DOOR: closed, ( 6, 3) -DOOR: closed, (21, 5) -DOOR: closed, (38, 5) -DOOR: closed, (69, 6) -DOOR: closed, ( 4, 7) -DOOR: closed, (39, 7) -DOOR: closed, (58, 7) -DOOR: closed, (60, 7) -DOOR: closed, (18, 8) -DOOR: closed, (20, 9) -DOOR: closed, (48,10) -DOOR: closed, (46,12) -DOOR: closed, (62,12) -DOOR: closed, (74,12) -DOOR: closed, (23,14) -DOOR: closed, (23,14) -DOOR: closed, (50,14) -DOOR: closed, (68,14) -DOOR: closed, (74,14) -DOOR: closed, (14,15) -DOOR: closed, (63,15) -DOOR: closed, ( 9,17) -DOOR: closed, (21,17) -DOOR: closed, (50,17) -DOOR: closed, ( 6,18) -DOOR: closed, (65,18) -DOOR: closed, (68,18) -# Master of Thieves -MONSTER:('@',"Master of Thieves"),(36,11) -# The treasure of Master of Thieves -OBJECT:('(',"chest"),(36,11) -# thug guards, room #1 -MONSTER:('@',"thug"),(28,10) -MONSTER:('@',"thug"),(29,11) -MONSTER:('@',"thug"),(30,09) -MONSTER:('@',"thug"),(31,07) -# thug guards, room #2 -MONSTER:('@',"thug"),(31,13) -MONSTER:('@',"thug"),(33,14) -MONSTER:('@',"thug"),(30,15) -#thug guards, room #3 -MONSTER:('@',"thug"),(35,09) -MONSTER:('@',"thug"),(36,13) -# Non diggable walls -NON_DIGGABLE:(00,00,75,20) -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# -# Monsters to get in the way. -# -# West exit -MONSTER: ('l',"leprechaun"),(01,12),hostile -MONSTER: ('n',"water nymph"),(02,12),hostile -# North exit -MONSTER: ('n',"water nymph"),(33,01),hostile -MONSTER: ('l',"leprechaun"),(33,02),hostile -# East exit -MONSTER: ('n',"water nymph"),(74,05),hostile -MONSTER: ('l',"leprechaun"),(74,04),hostile -# South exit -MONSTER: ('l',"leprechaun"),(25,19),hostile -MONSTER: ('n',"water nymph"),(25,18),hostile -# Wandering the streets. -LOOP [ 4 + 1d3 ] { - MONSTER: ('n',"water nymph"),rndcoord($streets),hostile - MONSTER: ('l',"leprechaun"),rndcoord($streets),hostile -} -LOOP [ 7 + 1d3 ] { - MONSTER: (':',"chameleon"),rndcoord($streets),hostile -} - -# -# The "locate" level for the quest. -# -# Here you have to find the entrance to the Assassins' Guild to go -# further towards your assigned quest. -# - -MAZE: "Rog-loca",' ' -GEOMETRY:center,center -# 1 2 3 4 5 6 7 -#123456789012345678901234567890123456789012345678901234567890123456789012345 -MAP - ---------------------------------------------------- -------- - ---.................................................- --.....| - ---...--------........-------.......................--- ---...| - ---.....- ---......- ---..................---- --.-- - ---.....---- -------- --..................-- --..| - ---...----- ----.----.....----.....--- --..|| -----..---- -----..--- |...--- |.......--- --...| -|...--- ----....--- |.--- |.........-- --...|| -|...- ----.....--- ---- |..........---....| -|...---- ----......--- | |...|.......-....|| -|......----- ---.........- | -----...|............| -|..........----- ----...........--- -------......||...........|| -|..............-----................--- |............|||..........| -|------...............................--- |...........|| |.........|| -|.....|..............------.............-----..........|| ||........| -|.....|.............-- ---.........................|| |.......|| -|.....|.............- ---.....................--| ||......| -|-S----------.......---- --.................---- |.....|| -|...........|..........--------..............----- ||....| -|...........|............................----- |....| ------------------------------------------- ------ -ENDMAP -# Dungeon Description -REGION:(00,00,75,20),lit,"ordinary" -# Doors -#DOOR:locked|closed|open,(xx,yy) -# Stairs -STAIR:random,up -STAIR:random,down -# Non diggable walls -NON_DIGGABLE:(00,00,75,20) -# Objects -OBJECT:('?',"teleportation"),(11,18),cursed,0 -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:'l',random,hostile -MONSTER:('N',"guardian naga"),random,hostile -MONSTER:('N',"guardian naga"),random,hostile -MONSTER:('N',"guardian naga"),random,hostile -MONSTER:('N',"guardian naga"),random,hostile -MONSTER:('N',"guardian naga"),random,hostile -MONSTER:('N',"guardian naga"),random,hostile -MONSTER:('N',"guardian naga"),random,hostile -MONSTER:'N',random,hostile -MONSTER:'N',random,hostile -MONSTER:'N',random,hostile -MONSTER: (':',"chameleon"),random,hostile -MONSTER: (':',"chameleon"),random,hostile -MONSTER: (':',"chameleon"),random,hostile -MONSTER: (':',"chameleon"),random,hostile -MONSTER: (':',"chameleon"),random,hostile - -# -# The "goal" level for the quest. Teleportation and digging are -# disallowed. -# -# You have to reach The Master Assassin via some means other than -# simple searching or digging since there is no path between your -# arrival point and his location. -# -MAZE: "Rog-goal", ' ' -FLAGS: noteleport -GEOMETRY:center,center -# 1 2 3 4 5 6 7 -#123456789012345678901234567890123456789012345678901234567890123456789012345 -MAP ------ -------.......................................|-----------------| -|...| -----.....|.......................................|.................| -|...----...|.....|.......................................|....---------....| -|.---......---..--.................................------------.......|....| -|...............|..................................|..|...|...----........-| -|.....-----....--.................................|-..--..-|.....----S----| -|--S---...|....|.................................|-........-|....|........| -|.........---------.............................|-....}}....-|...|...|....| -|....|.....S......|............................|-.....}}.....-|..--.------| -|-----.....--.....|...........................|-...}}}}}}}}...-|....|.....-- -|...........--....------S-----...............|-....}}}}}}}}....-|..........| -|............--........|...| |..............--.....}}.}}........----------S- -|.............|........|...| |..............|......}}}}}}}}......|...|.....| -|S-.---.---.---.---.---|...| ------------...--........}}.}}.....--..---....| -|.---.---.---.---.-S-..----- |....|.....|....|-....}}}}}}}}....---..S.|--..| -|...|.......|..........|...---....---...S.....|-...}}}}}}}}...-|.S..|...|..| -|...|..|....|..........|............|..--..----|-.....}}.....-|..----...-S-- -|...|---....----.......|----- ......|...---| |-....}}....-|...|..--.--..| ------.....---.....--.---....--...--------..| |-........-|....|.........| - |.............|..........|.............S... |S-------|.....|..-----..| - ---------------------------------------- ...... ---------- ---- -ENDMAP -# Dungeon Description -REGION:(00,00,75,20),lit,"ordinary" -# Stairs -STAIR:levregion(01,00,15,20),(01,18,04,20),up -# Doors -# Non diggable walls -NON_DIGGABLE:(00,00,75,20) -# One trap to keep the gnomes at bay. -TRAP:"spiked pit",(37,07) -# Objects -OBJECT:('(',"skeleton key"),(38,10),blessed,0,name:"The Master Key of Thievery" -OBJECT:('%',"tin"),(26,12),montype:"chameleon" -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('@',"Master Assassin"),(38,10),hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:('l',"leprechaun"),random,hostile -MONSTER:'l',random,hostile -MONSTER:'l',random,hostile -MONSTER:('N',"guardian naga"),random,hostile -MONSTER:('N',"guardian naga"),random,hostile -MONSTER:('N',"guardian naga"),random,hostile -MONSTER:('N',"guardian naga"),random,hostile -MONSTER:('N',"guardian naga"),random,hostile -MONSTER:('N',"guardian naga"),random,hostile -MONSTER:('N',"guardian naga"),random,hostile -MONSTER:('N',"guardian naga"),random,hostile -MONSTER:'N',random,hostile -MONSTER:'N',random,hostile -MONSTER:'N',random,hostile -MONSTER: (':',"chameleon"),random,hostile -MONSTER: (':',"chameleon"),random,hostile -MONSTER: (':',"chameleon"),random,hostile -MONSTER: (':',"chameleon"),random,hostile -MONSTER: (':',"chameleon"),random,hostile -MONSTER:(';',"shark"),(51,14),hostile -MONSTER:(';',"shark"),(53,09),hostile -MONSTER:(';',"shark"),(55,15),hostile -MONSTER:(';',"shark"),(58,10),hostile - -# -# The "fill" level for the quest. -# -# This level is used to fill out any levels not occupied by specific -# levels as defined above. -# -LEVEL: "Rog-fila" -# -ROOM: "ordinary" , random, random, random, random { - STAIR: random, up - OBJECT: random,random - MONSTER: ('l', "leprechaun"), random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random,random - MONSTER: ('l', "leprechaun"), random, hostile - MONSTER: ('N', "guardian naga"), random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - TRAP: random, random - OBJECT: random,random - MONSTER: ('n', "water nymph"), random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - STAIR: random, down - OBJECT: random, random - TRAP: random, random - TRAP: random, random - MONSTER: 'l', random, hostile - MONSTER: ('N', "guardian naga"), random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random, random - TRAP: random, random - TRAP: random, random - MONSTER: ('l', "leprechaun"), random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - TRAP: random, random - MONSTER: ('l', "leprechaun"), random, hostile - MONSTER: ('n', "water nymph"), random, hostile -} - -RANDOM_CORRIDORS - -# -# currently a & b are the same. -# -LEVEL: "Rog-filb" -# -ROOM: "ordinary" , random, random, random, random { - STAIR: random, up - OBJECT: random,random - MONSTER: ('l', "leprechaun"), random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random,random - MONSTER: ('l', "leprechaun"), random, hostile - MONSTER: ('N', "guardian naga"), random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - TRAP: random, random - OBJECT: random,random - MONSTER: ('n', "water nymph"), random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - STAIR: random, down - OBJECT: random, random - TRAP: random, random - TRAP: random, random - MONSTER: 'l', random, hostile - MONSTER: ('N', "guardian naga"), random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random, random - TRAP: random, random - TRAP: random, random - MONSTER: ('l', "leprechaun"), random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - TRAP: random, random - MONSTER: ('l', "leprechaun"), random, hostile - MONSTER: ('n', "water nymph"), random, hostile -} - -RANDOM_CORRIDORS diff --git a/dat/Sam-fila.lua b/dat/Sam-fila.lua new file mode 100644 index 000000000..84a885d98 --- /dev/null +++ b/dat/Sam-fila.lua @@ -0,0 +1,37 @@ +-- NetHack 3.6 Samurai.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-92 by M. Stephenson, P. Winner +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.level_init({ style="mines", fg=".", bg="P", smoothed=true, joined=true, walled=true }) + +-- +des.stair("up") +des.stair("down") +-- +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- +des.monster("d") +des.monster("wolf") +des.monster("wolf") +des.monster("wolf") +des.monster("wolf") +des.monster("wolf") +des.monster("stalker") +-- +des.trap() +des.trap() +des.trap() +des.trap() diff --git a/dat/Sam-filb.lua b/dat/Sam-filb.lua new file mode 100644 index 000000000..640f4b17b --- /dev/null +++ b/dat/Sam-filb.lua @@ -0,0 +1,60 @@ +-- NetHack 3.6 Samurai.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-92 by M. Stephenson, P. Winner +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.map([[ +------------- ------------- +|...........| |...........| +|...-----...|----------------------------------|...-----...| +|...| |...|..................................|...| |...| +|...-----..........................................-----...| +|...........|--S----------------------------S--|...........| +----...--------.|..........................|.--------...---- + |...|........+..........................+........|...| + |...|........+..........................+........|...| +----...--------.|..........................|.--------...---- +|...........|--S----------------------------S--|...........| +|...-----..........................................-----...| +|...| |...|..................................|...| |...| +|...-----...|----------------------------------|...-----...| +|...........| |...........| +------------- ------------- +]]); +des.region(selection.area(00,00,59,15), "unlit") +-- Doors +des.door("closed",16,07) +des.door("closed",16,08) +des.door("closed",43,07) +des.door("closed",43,08) +-- +des.stair("up") +des.stair("down") +-- +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- +des.monster("d") +des.monster("wolf") +des.monster("wolf") +des.monster("wolf") +des.monster("wolf") +des.monster("stalker") +des.monster("stalker") +des.monster("stalker") +-- +des.trap() +des.trap() +des.trap() +des.trap() \ No newline at end of file diff --git a/dat/Sam-goal.lua b/dat/Sam-goal.lua new file mode 100644 index 000000000..ce7215a0a --- /dev/null +++ b/dat/Sam-goal.lua @@ -0,0 +1,111 @@ +-- NetHack 3.6 Samurai.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-92 by M. Stephenson, P. Winner +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport"); + +des.map([[ + + ....................... + ......-------------------...... + ......----.................----...... + ....----.....-------------.....----.... + ....--.....----...........----.....--.... + ...||....---....---------....---....||... + ...|....--....---.......---....--....|... + ....|...||...---...--+--...---...||...|.... + ....|...|....|....|-...-|....|....|...|.... + ....|...|....|....+.....+....|....|...|.... + ....|...|....|....|-...-|....|....|...|.... + ....|...||...---...--+--...---...||...|.... + ...|....--....---.......---....--....|... + ...||....---....---------....---....||... + ....--.....----...........----.....--.... + ....----.....-------------.....----.... + ......----.................----...... + ......-------------------...... + ....................... +]]); +-- Dungeon Description +local place = { {02,11},{42,09} } +local placeidx = math.random(1, #place); + +des.region(selection.area(00,00,44,19), "unlit") +-- Doors +des.door("closed",19,10) +des.door("closed",22,08) +des.door("closed",22,12) +des.door("closed",25,10) +-- Stairs +des.stair({ dir = "up", coord = place[placeidx] }) + +-- Holes in the concentric ring walls +local place = { {22,14},{30,10},{22, 6},{14,10} } +local placeidx = math.random(1, #place); +des.terrain(place[placeidx], ".") +local place = { {22, 4},{35,10},{22,16},{ 9,10} } +local placeidx = math.random(1, #place); +des.terrain(place[placeidx], ".") +local place = { {22, 2},{22,18} } +local placeidx = math.random(1, #place); +des.terrain(place[placeidx], ".") + +-- Non diggable walls +des.non_diggable(selection.area(00,00,44,19)) +-- Objects +des.object({ id = "tsurugi", x=22, y=10, buc="blessed", spe=0, name="The Tsurugi of Muramasa" }) +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- +des.trap("board",22,09) +des.trap("board",24,10) +des.trap("board",22,11) +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Random monsters. +des.monster("Ashikaga Takauji", 22, 10) +des.monster({ id = "samurai", peaceful=0 }) +des.monster({ id = "samurai", peaceful=0 }) +des.monster({ id = "samurai", peaceful=0 }) +des.monster({ id = "samurai", peaceful=0 }) +des.monster({ id = "samurai", peaceful=0 }) +des.monster({ id = "ninja", peaceful=0 }) +des.monster({ id = "ninja", peaceful=0 }) +des.monster({ id = "ninja", peaceful=0 }) +des.monster({ id = "ninja", peaceful=0 }) +des.monster({ id = "ninja", peaceful=0 }) +des.monster("wolf") +des.monster("wolf") +des.monster("wolf") +des.monster("wolf") +des.monster("d") +des.monster("d") +des.monster("stalker") +des.monster("stalker") +des.monster("stalker") +des.monster("stalker") +des.monster("stalker") +des.monster("stalker") +des.monster("stalker") +des.monster("stalker") +des.monster("stalker") diff --git a/dat/Sam-loca.lua b/dat/Sam-loca.lua new file mode 100644 index 000000000..ccad8e260 --- /dev/null +++ b/dat/Sam-loca.lua @@ -0,0 +1,141 @@ +-- NetHack 3.6 Samurai.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-92 by M. Stephenson, P. Winner +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "hardfloor"); + +des.map([[ +............................................................................ +............................................................................ +........-----..................................................-----........ +........|...|..................................................|...|........ +........|...---..}..--+------------------------------+--..}..---...|........ +........|-|...|.....|...|....|....|....|....|....|.|...|.....|...|-|........ +..........|...-------...|....|....|....|....|....S.|...-------...|.......... +..........|-|.........------+----+-+-------+-+--------.........|-|.......... +............|..--------.|}........................}|.--------..|............ +............|..+........+..........................+........+..|............ +............|..+........+..........................+........+..|............ +............|..--------.|}........................}|.--------..|............ +..........|-|.........--------+-+-------+-+----+------.........|-|.......... +..........|...-------...|.S....|....|....|....|....|...-------...|.......... +........|-|...|.....|...|.|....|....|....|....|....|...|.....|...|-|........ +........|...---..}..--+------------------------------+--..}..---...|........ +........|...|..................................................|...|........ +........-----..................................................-----........ +............................................................................ +............................................................................ +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,19), "lit") +-- Doors +des.door("locked",22,04) +des.door("locked",22,15) +des.door("locked",53,04) +des.door("locked",53,15) +des.door("locked",49,06) +des.door("locked",26,13) +des.door("locked",28,07) +des.door("locked",30,12) +des.door("locked",33,07) +des.door("locked",32,12) +des.door("locked",35,07) +des.door("locked",40,12) +des.door("locked",43,07) +des.door("locked",42,12) +des.door("locked",45,07) +des.door("locked",47,12) +des.door("closed",15,09) +des.door("closed",15,10) +des.door("closed",24,09) +des.door("closed",24,10) +des.door("closed",51,09) +des.door("closed",51,10) +des.door("closed",60,09) +des.door("closed",60,10) +-- Stairs +des.stair("up", 10,10) +des.stair("down", 25,14) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- Objects +des.object("*", 25, 05) +des.object("*", 26, 05) +des.object("*", 27, 05) +des.object("*", 28, 05) +des.object("*", 25, 06) +des.object("*", 26, 06) +des.object("*", 27, 06) +des.object("*", 28, 06) +-- +des.object("[", 40, 05) +des.object("[", 41, 05) +des.object("[", 42, 05) +des.object("[", 43, 05) +des.object("[", 40, 06) +des.object("[", 41, 06) +des.object("[", 42, 06) +des.object("[", 43, 06) +-- +des.object(")", 27, 13) +des.object(")", 28, 13) +des.object(")", 29, 13) +des.object(")", 30, 13) +des.object(")", 27, 14) +des.object(")", 28, 14) +des.object(")", 29, 14) +des.object(")", 30, 14) +-- +des.object("(", 37, 13) +des.object("(", 38, 13) +des.object("(", 39, 13) +des.object("(", 40, 13) +des.object("(", 37, 14) +des.object("(", 38, 14) +des.object("(", 39, 14) +des.object("(", 40, 14) +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Random monsters. +des.monster({ id = "ninja", x=15, y=05, peaceful=0 }) +des.monster({ id = "ninja", x=16, y=05, peaceful=0 }) +des.monster("wolf", 17, 05) +des.monster("wolf", 18, 05) +des.monster({ id = "ninja", x=19, y=05, peaceful=0 }) +des.monster("wolf", 15, 14) +des.monster("wolf", 16, 14) +des.monster({ id = "ninja", x=17, y=14, peaceful=0 }) +des.monster({ id = "ninja", x=18, y=14, peaceful=0 }) +des.monster("wolf", 56, 05) +des.monster({ id = "ninja", x=57, y=05, peaceful=0 }) +des.monster("wolf", 58, 05) +des.monster("wolf", 59, 05) +des.monster({ id = "ninja", x=56, y=14, peaceful=0 }) +des.monster("wolf", 57, 14) +des.monster({ id = "ninja", x=58, y=14, peaceful=0 }) +des.monster("d", 59, 14) +des.monster("wolf", 60, 14) +des.monster("stalker") +des.monster("stalker") +des.monster("stalker") +des.monster("stalker") +des.monster("stalker") +des.monster("stalker") +des.monster("stalker") +des.monster("stalker") +des.monster("stalker") +-- "guards" for the central courtyard. +des.monster({ id = "samurai", x=30, y=05, peaceful=0 }) +des.monster({ id = "samurai", x=31, y=05, peaceful=0 }) +des.monster({ id = "samurai", x=32, y=05, peaceful=0 }) +des.monster({ id = "samurai", x=32, y=14, peaceful=0 }) +des.monster({ id = "samurai", x=33, y=14, peaceful=0 }) +des.monster({ id = "samurai", x=34, y=14, peaceful=0 }) diff --git a/dat/Sam-strt.lua b/dat/Sam-strt.lua new file mode 100644 index 000000000..108f28f61 --- /dev/null +++ b/dat/Sam-strt.lua @@ -0,0 +1,91 @@ +-- NetHack 3.6 Samurai.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-92 by M. Stephenson, P. Winner +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- The "start" level for the quest. +-- +-- Here you meet your (besieged) class leader, Lord Sato +-- and receive your quest assignment. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor") + +des.map([[ +..............................................................PP............ +...............................................................PP........... +..........---------------------------------------------------...PPP......... +..........|......|.........|...|..............|...|.........|....PPPPP...... +......... |......|.........S...|..............|...S.........|.....PPPP...... +..........|......|.........|---|..............|---|.........|.....PPP....... +..........+......|.........+...-------++-------...+.........|......PP....... +..........+......|.........|......................|.........|......PP....... +......... |......---------------------++--------------------|........PP..... +..........|.................................................|.........PP.... +..........|.................................................|...........PP.. +..........----------------------------------------...-------|............PP. +..........................................|.................|.............PP +.............. ................. .........|.................|..............P +............. } ............... } ........|.................|............... +.............. ........PP....... .........|.................|............... +.....................PPP..................|.................|............... +......................PP..................-------------------............... +............................................................................ +............................................................................ +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,19), "lit") +des.region({ region={18,03, 26,07}, lit=1, type="throne", prefilled=1 }) +-- Portal arrival zone +des.levregion({ region = {62,12,70,17}, type="branch" }) +-- Stairs +des.stair("down", 29,04) +-- Doors +des.door("locked",10,06) +des.door("locked",10,07) +des.door("closed",27,04) +des.door("closed",27,06) +des.door("closed",38,06) +des.door("locked",38,08) +des.door("closed",39,06) +des.door("locked",39,08) +des.door("closed",50,04) +des.door("closed",50,06) +-- Lord Sato +des.monster("Lord Sato", 20, 04) +-- The treasure of Lord Sato +des.object("chest", 20, 04) +-- roshi guards for the audience chamber +des.monster("roshi", 18, 04) +des.monster("roshi", 18, 05) +des.monster("roshi", 18, 06) +des.monster("roshi", 18, 07) +des.monster("roshi", 26, 04) +des.monster("roshi", 26, 05) +des.monster("roshi", 26, 06) +des.monster("roshi", 26, 07) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Monsters on siege duty. +des.monster({ id = "ninja", x=64, y=00, peaceful=0 }) +des.monster("wolf", 65, 01) +des.monster({ id = "ninja", x=67, y=02, peaceful=0 }) +des.monster({ id = "ninja", x=69, y=05, peaceful=0 }) +des.monster({ id = "ninja", x=69, y=06, peaceful=0 }) +des.monster("wolf", 69, 07) +des.monster({ id = "ninja", x=70, y=06, peaceful=0 }) +des.monster({ id = "ninja", x=70, y=07, peaceful=0 }) +des.monster({ id = "ninja", x=72, y=01, peaceful=0 }) +des.monster("wolf", 75, 09) +des.monster({ id = "ninja", x=73, y=05, peaceful=0 }) +des.monster({ id = "ninja", x=68, y=02, peaceful=0 }) +des.monster("stalker") diff --git a/dat/Samurai.des b/dat/Samurai.des deleted file mode 100644 index 1b3fa8785..000000000 --- a/dat/Samurai.des +++ /dev/null @@ -1,440 +0,0 @@ -# NetHack 3.6 Samurai.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# Copyright (c) 1991-92 by M. Stephenson, P. Winner -# NetHack may be freely redistributed. See license for details. -# -# The "start" level for the quest. -# -# Here you meet your (besieged) class leader, Lord Sato -# and receive your quest assignment. -# -MAZE: "Sam-strt",' ' -FLAGS: noteleport,hardfloor -GEOMETRY:center,center -MAP -..............................................................PP............ -...............................................................PP........... -..........---------------------------------------------------...PPP......... -..........|......|.........|...|..............|...|.........|....PPPPP...... -......... |......|.........S...|..............|...S.........|.....PPPP...... -..........|......|.........|---|..............|---|.........|.....PPP....... -..........+......|.........+...-------++-------...+.........|......PP....... -..........+......|.........|......................|.........|......PP....... -......... |......---------------------++--------------------|........PP..... -..........|.................................................|.........PP.... -..........|.................................................|...........PP.. -..........----------------------------------------...-------|............PP. -..........................................|.................|.............PP -.............. ................. .........|.................|..............P -............. } ............... } ........|.................|............... -.............. ........PP....... .........|.................|............... -.....................PPP..................|.................|............... -......................PP..................-------------------............... -............................................................................ -............................................................................ -ENDMAP -# Dungeon Description -REGION:(00,00,75,19),lit,"ordinary" -REGION:(18,03,26,07),lit,"throne",unfilled -# Portal arrival zone -BRANCH:(62,12,70,17),(0,0,0,0) -# Stairs -STAIR:(29,04),down -# Doors -DOOR:locked,(10,06) -DOOR:locked,(10,07) -DOOR:closed,(27,04) -DOOR:closed,(27,06) -DOOR:closed,(38,06) -DOOR:locked,(38,08) -DOOR:closed,(39,06) -DOOR:locked,(39,08) -DOOR:closed,(50,04) -DOOR:closed,(50,06) -# Lord Sato -MONSTER:('@',"Lord Sato"),(20,04) -# The treasure of Lord Sato -OBJECT:('(',"chest"),(20,04) -# roshi guards for the audience chamber -MONSTER:('@',"roshi"),(18,04) -MONSTER:('@',"roshi"),(18,05) -MONSTER:('@',"roshi"),(18,06) -MONSTER:('@',"roshi"),(18,07) -MONSTER:('@',"roshi"),(26,04) -MONSTER:('@',"roshi"),(26,05) -MONSTER:('@',"roshi"),(26,06) -MONSTER:('@',"roshi"),(26,07) -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Monsters on siege duty. -MONSTER: ('@',"ninja"),(64,00),hostile -MONSTER: ('d',"wolf"),(65,01) -MONSTER: ('@',"ninja"),(67,02),hostile -MONSTER: ('@',"ninja"),(69,05),hostile -MONSTER: ('@',"ninja"),(69,06),hostile -MONSTER: ('d',"wolf"),(69,07) -MONSTER: ('@',"ninja"),(70,06),hostile -MONSTER: ('@',"ninja"),(70,07),hostile -MONSTER: ('@',"ninja"),(72,01),hostile -MONSTER: ('d',"wolf"),(75,09) -MONSTER: ('@',"ninja"),(73,05),hostile -MONSTER: ('@',"ninja"),(68,02),hostile -MONSTER:('E',"stalker"),random - -# -# The "locate" level for the quest. -# -# Here you have to invade the Shogun's Castle to go -# further towards your assigned quest. -# - -MAZE: "Sam-loca",' ' -FLAGS: hardfloor -GEOMETRY:center,center -MAP -............................................................................ -............................................................................ -........-----..................................................-----........ -........|...|..................................................|...|........ -........|...---..}..--+------------------------------+--..}..---...|........ -........|-|...|.....|...|....|....|....|....|....|.|...|.....|...|-|........ -..........|...-------...|....|....|....|....|....S.|...-------...|.......... -..........|-|.........------+----+-+-------+-+--------.........|-|.......... -............|..--------.|}........................}|.--------..|............ -............|..+........+..........................+........+..|............ -............|..+........+..........................+........+..|............ -............|..--------.|}........................}|.--------..|............ -..........|-|.........--------+-+-------+-+----+------.........|-|.......... -..........|...-------...|.S....|....|....|....|....|...-------...|.......... -........|-|...|.....|...|.|....|....|....|....|....|...|.....|...|-|........ -........|...---..}..--+------------------------------+--..}..---...|........ -........|...|..................................................|...|........ -........-----..................................................-----........ -............................................................................ -............................................................................ -ENDMAP -# Dungeon Description -REGION:(00,00,75,19),lit,"ordinary" -# Doors -DOOR:locked,(22,04) -DOOR:locked,(22,15) -DOOR:locked,(53,04) -DOOR:locked,(53,15) -DOOR:locked,(49,06) -DOOR:locked,(26,13) -DOOR:locked,(28,07) -DOOR:locked,(30,12) -DOOR:locked,(33,07) -DOOR:locked,(32,12) -DOOR:locked,(35,07) -DOOR:locked,(40,12) -DOOR:locked,(43,07) -DOOR:locked,(42,12) -DOOR:locked,(45,07) -DOOR:locked,(47,12) -DOOR:closed,(15,09) -DOOR:closed,(15,10) -DOOR:closed,(24,09) -DOOR:closed,(24,10) -DOOR:closed,(51,09) -DOOR:closed,(51,10) -DOOR:closed,(60,09) -DOOR:closed,(60,10) -# Stairs -STAIR:(10,10),up -STAIR:(25,14),down -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# Objects -OBJECT:'*',(25,05) -OBJECT:'*',(26,05) -OBJECT:'*',(27,05) -OBJECT:'*',(28,05) -OBJECT:'*',(25,06) -OBJECT:'*',(26,06) -OBJECT:'*',(27,06) -OBJECT:'*',(28,06) -# -OBJECT:'[',(40,05) -OBJECT:'[',(41,05) -OBJECT:'[',(42,05) -OBJECT:'[',(43,05) -OBJECT:'[',(40,06) -OBJECT:'[',(41,06) -OBJECT:'[',(42,06) -OBJECT:'[',(43,06) -# -OBJECT:')',(27,13) -OBJECT:')',(28,13) -OBJECT:')',(29,13) -OBJECT:')',(30,13) -OBJECT:')',(27,14) -OBJECT:')',(28,14) -OBJECT:')',(29,14) -OBJECT:')',(30,14) -# -OBJECT:'(',(37,13) -OBJECT:'(',(38,13) -OBJECT:'(',(39,13) -OBJECT:'(',(40,13) -OBJECT:'(',(37,14) -OBJECT:'(',(38,14) -OBJECT:'(',(39,14) -OBJECT:'(',(40,14) -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('@',"ninja"),(15,05),hostile -MONSTER:('@',"ninja"),(16,05),hostile -MONSTER:('d',"wolf"),(17,05) -MONSTER:('d',"wolf"),(18,05) -MONSTER:('@',"ninja"),(19,05),hostile -MONSTER:('d',"wolf"),(15,14) -MONSTER:('d',"wolf"),(16,14) -MONSTER:('@',"ninja"),(17,14),hostile -MONSTER:('@',"ninja"),(18,14),hostile -MONSTER:('d',"wolf"),(56,05) -MONSTER:('@',"ninja"),(57,05),hostile -MONSTER:('d',"wolf"),(58,05) -MONSTER:('d',"wolf"),(59,05) -MONSTER:('@',"ninja"),(56,14),hostile -MONSTER:('d',"wolf"),(57,14) -MONSTER:('@',"ninja"),(58,14),hostile -MONSTER:'d',(59,14) -MONSTER:('d',"wolf"),(60,14) -MONSTER:('E',"stalker"),random -MONSTER:('E',"stalker"),random -MONSTER:('E',"stalker"),random -MONSTER:('E',"stalker"),random -MONSTER:('E',"stalker"),random -MONSTER:('E',"stalker"),random -MONSTER:('E',"stalker"),random -MONSTER:('E',"stalker"),random -MONSTER:('E',"stalker"),random -# "guards" for the central courtyard. -MONSTER:('@',"samurai"),(30,05),hostile -MONSTER:('@',"samurai"),(31,05),hostile -MONSTER:('@',"samurai"),(32,05),hostile -MONSTER:('@',"samurai"),(32,14),hostile -MONSTER:('@',"samurai"),(33,14),hostile -MONSTER:('@',"samurai"),(34,14),hostile - -# -# The "goal" level for the quest. -# -# Here you meet Takauji, your nemesis monster. You have to -# defeat him in combat to gain the artifact you have been -# assigned to retrieve. -# - -MAZE: "Sam-goal", ' ' -FLAGS: noteleport -GEOMETRY:center,center -MAP - - ....................... - ......-------------------...... - ......----.................----...... - ....----.....-------------.....----.... - ....--.....----...........----.....--.... - ...||....---....---------....---....||... - ...|....--....---.......---....--....|... - ....|...||...---...--+--...---...||...|.... - ....|...|....|....|-...-|....|....|...|.... - ....|...|....|....+.....+....|....|...|.... - ....|...|....|....|-...-|....|....|...|.... - ....|...||...---...--+--...---...||...|.... - ...|....--....---.......---....--....|... - ...||....---....---------....---....||... - ....--.....----...........----.....--.... - ....----.....-------------.....----.... - ......----.................----...... - ......-------------------...... - ....................... -ENDMAP -# Dungeon Description -$place = { (02,11),(42,09) } -SHUFFLE: $place - -REGION:(00,00,44,19),unlit,"ordinary" -# Doors -DOOR:closed,(19,10) -DOOR:closed,(22,08) -DOOR:closed,(22,12) -DOOR:closed,(25,10) -# Stairs -STAIR:$place[0],up - -# Holes in the concentric ring walls -$place = { (22,14),(30,10),(22, 6),(14,10) } -SHUFFLE:$place -TERRAIN:$place[0],'.' -$place = { (22, 4),(35,10),(22,16),( 9,10) } -SHUFFLE:$place -TERRAIN:$place[0],'.' -$place = { (22, 2),(22,18) } -SHUFFLE:$place -TERRAIN:$place[0],'.' - -# Non diggable walls -NON_DIGGABLE:(00,00,44,19) -# Objects -OBJECT:(')',"tsurugi"),(22,10),blessed,0,name:"The Tsurugi of Muramasa" -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# -TRAP:"board",(22,09) -TRAP:"board",(24,10) -TRAP:"board",(22,11) -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('@',"Ashikaga Takauji"),(22,10) -MONSTER:('@',"samurai"),random,hostile -MONSTER:('@',"samurai"),random,hostile -MONSTER:('@',"samurai"),random,hostile -MONSTER:('@',"samurai"),random,hostile -MONSTER:('@',"samurai"),random,hostile -MONSTER:('@',"ninja"),random,hostile -MONSTER:('@',"ninja"),random,hostile -MONSTER:('@',"ninja"),random,hostile -MONSTER:('@',"ninja"),random,hostile -MONSTER:('@',"ninja"),random,hostile -MONSTER:('d',"wolf"),random -MONSTER:('d',"wolf"),random -MONSTER:('d',"wolf"),random -MONSTER:('d',"wolf"),random -MONSTER:'d',random -MONSTER:'d',random -MONSTER:('E',"stalker"),random -MONSTER:('E',"stalker"),random -MONSTER:('E',"stalker"),random -MONSTER:('E',"stalker"),random -MONSTER:('E',"stalker"),random -MONSTER:('E',"stalker"),random -MONSTER:('E',"stalker"),random -MONSTER:('E',"stalker"),random -MONSTER:('E',"stalker"),random - - -# -# The "fill" levels for the quest. -# -# These levels are used to fill out any levels not occupied by specific -# levels as defined above. "filla" is the upper filler, between the -# start and locate levels, and "fillb" the lower between the locate -# and goal levels. -# - -MAZE: "Sam-fila", ' ' -INIT_MAP: mines, '.' , 'P', true, true, random, true -NOMAP -# -STAIR: random, up -STAIR: random, down -# -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -# -MONSTER: 'd', random -MONSTER: ('d', "wolf"), random -MONSTER: ('d', "wolf"), random -MONSTER: ('d', "wolf"), random -MONSTER: ('d', "wolf"), random -MONSTER: ('d', "wolf"), random -MONSTER: ('E', "stalker"), random -# -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random - -MAZE: "Sam-filb", ' ' -GEOMETRY:center,center -MAP -------------- ------------- -|...........| |...........| -|...-----...|----------------------------------|...-----...| -|...| |...|..................................|...| |...| -|...-----..........................................-----...| -|...........|--S----------------------------S--|...........| -----...--------.|..........................|.--------...---- - |...|........+..........................+........|...| - |...|........+..........................+........|...| -----...--------.|..........................|.--------...---- -|...........|--S----------------------------S--|...........| -|...-----..........................................-----...| -|...| |...|..................................|...| |...| -|...-----...|----------------------------------|...-----...| -|...........| |...........| -------------- ------------- -ENDMAP -REGION:(00,00,59,15),unlit,"ordinary" -# Doors -DOOR:closed,(16,07) -DOOR:closed,(16,08) -DOOR:closed,(43,07) -DOOR:closed,(43,08) -# -STAIR: random, up -STAIR: random, down -# -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -# -MONSTER: 'd', random -MONSTER: ('d', "wolf"), random -MONSTER: ('d', "wolf"), random -MONSTER: ('d', "wolf"), random -MONSTER: ('d', "wolf"), random -MONSTER: ('E', "stalker"), random -MONSTER: ('E', "stalker"), random -MONSTER: ('E', "stalker"), random -# -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random diff --git a/dat/Tou-fila.lua b/dat/Tou-fila.lua new file mode 100644 index 000000000..0a84f8a2e --- /dev/null +++ b/dat/Tou-fila.lua @@ -0,0 +1,35 @@ +-- NetHack 3.6 Tourist.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991,92 by M. Stephenson, P. Winner +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.level_init({ style="mines", fg=".", bg=" ", smoothed=true, joined=true, walled=true }) + +-- +des.stair("up") +des.stair("down") +-- +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- +des.trap() +des.trap() +des.trap() +des.trap() +-- +des.monster({ id = "soldier", peaceful = 0 }) +des.monster({ id = "soldier", peaceful = 0 }) +des.monster({ id = "soldier", peaceful = 0 }) +des.monster({ id = "soldier", peaceful = 0 }) +des.monster({ id = "soldier", peaceful = 0 }) +des.monster({ class = "H", peaceful = 0 }) +des.monster({ class = "C", peaceful = 0 }) diff --git a/dat/Tou-filb.lua b/dat/Tou-filb.lua new file mode 100644 index 000000000..9b748a4cd --- /dev/null +++ b/dat/Tou-filb.lua @@ -0,0 +1,39 @@ +-- NetHack 3.6 Tourist.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991,92 by M. Stephenson, P. Winner +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.level_init({ style="mines", fg=".", bg=" ", smoothed=true, joined=true, walled=true }) + +-- +des.stair("up") +des.stair("down") +-- +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- +des.trap() +des.trap() +des.trap() +des.trap() +-- +des.monster({ id = "soldier", peaceful = 0 }) +des.monster({ id = "captain", peaceful = 0 }) +des.monster({ id = "captain", peaceful = 0 }) +des.monster({ class = "H", peaceful = 0 }) +des.monster({ class = "H", peaceful = 0 }) +des.monster({ class = "C", peaceful = 0 }) +des.monster("s") diff --git a/dat/Tou-goal.lua b/dat/Tou-goal.lua new file mode 100644 index 000000000..b1fb941ed --- /dev/null +++ b/dat/Tou-goal.lua @@ -0,0 +1,160 @@ +-- NetHack 3.6 Tourist.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991,92 by M. Stephenson, P. Winner +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.map([[ +---------------------------------------------------------------------------- +|.........|.........|..........|..| |.................|........|........|..| +|.........|.........|..........|..| |....--------.....|........|........|..| +|------S--|--+-----------+------..| |....|......|.....|........|........|..| +|.........|.......................| |....|......+.....--+-------------+--..| +|.........|.......................| |....|......|..........................| +|-S-----S-|......----------.......| |....|......|..........................| +|..|..|...|......|........|.......| |....-----------.........----..........| +|..+..+...|......|........|.......| |....|.........|.........|}}|..........| +|..|..|...|......+........|.......| |....|.........+.........|}}|..........| +|..|..|...|......|........|.......S.S....|.........|.........----..........| +|---..----|......|........|.......| |....|.........|.......................| +|.........+......|+F-+F-+F|.......| |....-----------.......................| +|---..----|......|..|..|..|.......| |......................--------------..| +|..|..|...|......--F-F--F--.......| |......................+............|..| +|..+..+...|.......................| |--.---...-----+-----..|............|..| +|--|..----|--+-----------+------..| |.....|...|.........|..|------------|..| +|..+..+...|.........|..........|..| |.....|...|.........|..+............|..| +|..|..|...|.........|..........|..| |.....|...|.........|..|............|..| +---------------------------------------------------------------------------- +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,19), "lit") +-- The Inn +des.region(selection.area(01,01,09,02), "lit") +des.region({ region = {01,04,09,05}, lit=1, type = "barracks" }) +des.region(selection.area(01,07,02,10), "unlit") +des.region(selection.area(07,07,09,10), "unlit") +des.region(selection.area(01,14,02,15), "unlit") +des.region(selection.area(07,14,09,15), "unlit") +des.region(selection.area(01,17,02,18), "unlit") +des.region(selection.area(07,17,09,18), "unlit") +-- +des.region({ region = {11,01,19,02}, lit = 0, type = "barracks" }) +des.region(selection.area(21,01,30,02), "unlit") +des.region({ region = {11,17,19,18}, lit = 0, type = "barracks" }) +des.region(selection.area(21,17,30,18), "unlit") +-- Police Station +des.region(selection.area(18,07,25,11), "lit") +des.region(selection.area(18,13,19,13), "unlit") +des.region(selection.area(21,13,22,13), "unlit") +des.region(selection.area(24,13,25,13), "unlit") +-- The town itself +des.region(selection.area(42,03,47,06), "unlit") +des.region(selection.area(42,08,50,11), "unlit") +des.region({ region = {37,16,41,18}, lit = 0, type = "morgue" }) +des.region(selection.area(47,16,55,18), "unlit") +des.region(selection.area(55,01,62,03), "unlit") +des.region(selection.area(64,01,71,03), "unlit") +des.region({ region = {60,14,71,15}, lit = 1, type = "shop" }) +des.region({ region = {60,17,71,18}, lit = 1, type = "shop" }) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- Stairs +des.stair("up", 70,08) +-- Doors +des.door("locked",07,03) +des.door("locked",02,06) +des.door("locked",08,06) +des.door("closed",03,08) +des.door("closed",06,08) +des.door("open",10,12) +des.door("closed",03,15) +des.door("closed",06,15) +des.door("closed",03,17) +des.door("closed",06,17) +des.door("closed",13,03) +des.door("random",25,03) +des.door("closed",13,16) +des.door("random",25,16) +des.door("locked",17,09) +des.door("locked",18,12) +des.door("locked",21,12) +des.door("locked",24,12) +des.door("locked",34,10) +des.door("locked",36,10) +des.door("random",48,04) +des.door("random",56,04) +des.door("random",70,04) +des.door("random",51,09) +des.door("random",51,15) +des.door("open",59,14) +des.door("open",59,17) +-- Objects +des.object({ id = "credit card", x=04, y=01, buc="blessed", spe=0, name="The Platinum Yendorian Express Card" }) +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Random monsters. +des.monster({ id = "Master of Thieves", x=04, y=01, peaceful = 0 }) +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("s") +des.monster("s") +-- ladies of the evening +des.monster("succubus", 02, 08) +des.monster("succubus", 08, 08) +des.monster("incubus", 02, 14) +des.monster("incubus", 08, 14) +des.monster("incubus", 02, 17) +des.monster("incubus", 08, 17) +-- Police station (with drunken prisoners) +des.monster({ id = "Kop Kaptain", x=24, y=09, peaceful = 0 }) +des.monster({ id = "Kop Lieutenant", x=20, y=09, peaceful = 0 }) +des.monster({ id = "Kop Lieutenant", x=22, y=11, peaceful = 0 }) +des.monster({ id = "Kop Lieutenant", x=22, y=07, peaceful = 0 }) +des.monster({ id = "Keystone Kop", x=19, y=07, peaceful = 0 }) +des.monster({ id = "Keystone Kop", x=19, y=08, peaceful = 0 }) +des.monster({ id = "Keystone Kop", x=22, y=09, peaceful = 0 }) +des.monster({ id = "Keystone Kop", x=24, y=11, peaceful = 0 }) +des.monster({ id = "Keystone Kop", x=19, y=11, peaceful = 0 }) +des.monster("prisoner", 19, 13) +des.monster("prisoner", 21, 13) +des.monster("prisoner", 24, 13) +-- +des.monster({ id = "watchman", x=33, y=10, peaceful = 0 }) + +des.wallify() diff --git a/dat/Tou-loca.lua b/dat/Tou-loca.lua new file mode 100644 index 000000000..f82f5072f --- /dev/null +++ b/dat/Tou-loca.lua @@ -0,0 +1,157 @@ +-- NetHack 3.6 Tourist.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991,92 by M. Stephenson, P. Winner +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "hardfloor") +des.map([[ +---------------------------------------------------------------------------- +|....|......|..........|......|......|...|....|.....|......|...............| +|....|......|.|------|.|......|......|.|.|....|..}..|......|.|----------|..| +|....|--+----.|......|.|-S---+|+-----|.|.S....|.....|---+--|.|..........+..| +|....|........|......|.|...|.........|.|------|..............|..........|-+| +|....+...}}...+......|.|...|.|-----|.|..............|--+----------------|..| +|----|........|------|.|---|.|.....|......|-----+-|.|.......|...........|--| +|............................|.....|.|--+-|.......|.|.......|...........|..| +|----|.....|-------------|...|--+--|.|....|.......|.|-----------+-------|..| +|....+.....+.........S...|...........|....|-------|........................| +|....|.....|.........|...|.|---------|....|.........|-------|.|----------|.| +|....|.....|---------|---|.|......|..+....|-------|.|.......|.+......S.\.|.| +|....|.....+.........S...|.|......|..|....|.......|.|.......|.|......|...|.| +|-------|..|.........|---|.|+-------------------+-|.|.......+.|----------|.| +|.......+..|---------|.........|.........|..........|.......|.|..........|.| +|.......|..............|--+--|.|.........|.|----+-----------|.|..........|.| +|---------+-|--+-----|-|.....|.|.........|.|........|.|.....+.|..........+.| +|...........|........|.S.....|.|----+----|.|--------|.|.....|.|----------|.| +|...........|........|.|.....|........................|.....|..............| +---------------------------------------------------------------------------- +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,19), "lit") +des.non_diggable(selection.area(00,00,75,19)) +-- +des.region({ region={01,01, 04,05}, lit=0, type="morgue", prefilled = 0 }) +des.region({ region={15,03, 20,05}, lit=1, type="shop", prefilled = 0 }) +des.region({ region={62,03, 71,04}, lit=1, type="shop", prefilled = 0 }) +des.region({ region={01,17, 11,18}, lit=1, type="barracks", prefilled = 0 }) +des.region({ region={12,09, 20,10}, lit=1, type="barracks", prefilled = 0 }) +des.region({ region={53,11, 59,14}, lit=1, type="zoo", prefilled = 0 }) +des.region({ region={63,14, 72,16}, lit=1, type="barracks", prefilled = 0 }) +des.region({ region={32,14, 40,16}, lit=1, type="temple", prefilled = 0 }) +-- +des.region({ region = {06,01,11,02}, type = "ordinary" }) +des.region({ region = {24,01,29,02}, type = "ordinary" }) +des.region({ region = {31,01,36,02}, type = "ordinary" }) +des.region({ region = {42,01,45,03}, type = "ordinary" }) +des.region({ region = {53,01,58,02}, type = "ordinary" }) +des.region({ region = {24,04,26,05}, type = "ordinary" }) +des.region({ region = {30,06,34,07}, type = "ordinary" }) +des.region(selection.area(73,05,74,05), "unlit") +des.region({ region = {01,09,04,12}, type = "ordinary" }) +des.region({ region = {01,14,07,15}, type = "ordinary" }) +des.region({ region = {12,12,20,13}, type = "ordinary" }) +des.region({ region = {13,17,20,18}, type = "ordinary" }) +des.region({ region = {22,09,24,10}, type = "ordinary" }) +des.region({ region = {22,12,24,12}, type = "ordinary" }) +des.region({ region = {24,16,28,18}, type = "ordinary" }) +des.region({ region = {28,11,33,12}, type = "ordinary" }) +des.region(selection.area(35,11,36,12), "lit") +des.region({ region = {38,08,41,12}, type = "ordinary" }) +des.region({ region = {43,07,49,08}, type = "ordinary" }) +des.region({ region = {43,12,49,12}, type = "ordinary" }) +des.region({ region = {44,16,51,16}, type = "ordinary" }) +des.region({ region = {53,06,59,07}, type = "ordinary" }) +des.region({ region = {61,06,71,07}, type = "ordinary" }) +des.region({ region = {55,16,59,18}, type = "ordinary" }) +des.region({ region = {63,11,68,12}, type = "ordinary" }) +des.region({ region = {70,11,72,12}, type = "ordinary" }) +-- Stairs +des.stair("up", 10,04) +des.stair("down", 73,05) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +des.door("closed",05,05) +des.door("closed",05,09) +des.door("closed",08,14) +des.door("closed",08,03) +des.door("closed",11,09) +des.door("closed",11,12) +des.door("closed",10,16) +des.door("closed",14,05) +des.door("closed",15,16) +des.door("locked",21,09) +des.door("locked",21,12) +des.door("closed",23,17) +des.door("closed",25,03) +des.door("closed",26,15) +des.door("closed",29,03) +des.door("closed",28,13) +des.door("closed",31,03) +des.door("closed",32,08) +des.door("closed",37,11) +des.door("closed",36,17) +des.door("locked",41,03) +des.door("closed",40,07) +des.door("closed",48,06) +des.door("closed",48,13) +des.door("closed",48,15) +des.door("closed",56,03) +des.door("closed",55,05) +des.door("closed",72,03) +des.door("locked",74,04) +des.door("closed",64,08) +des.door("closed",62,11) +des.door("closed",69,11) +des.door("closed",60,13) +des.door("closed",60,16) +des.door("closed",73,16) + +-- Objects +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Toilet paper +des.object("blank paper", 71, 12) +des.object("blank paper", 71, 12) +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Random monsters. +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("s") +des.monster("s") diff --git a/dat/Tou-strt.lua b/dat/Tou-strt.lua new file mode 100644 index 000000000..8ca3f6a76 --- /dev/null +++ b/dat/Tou-strt.lua @@ -0,0 +1,131 @@ +-- NetHack 3.6 Tourist.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991,92 by M. Stephenson, P. Winner +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- The "start" level for the quest. +-- +-- Here you meet your (besieged) class leader, Twoflower +-- and receive your quest assignment. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor") +des.map([[ +.......}}....---------..-------------------------------------------------... +........}}...|.......|..|.-------------------------------------------...|... +.........}}..|.......|..|.|......|......|.............|......|......|...|... +..........}}.|.......|..|.|......+......+.............+......+..\...|...|... +...........}}}..........|.|......|......|.............|......|......|...|... +.............}}.........|.|----S-|--S---|S----------S-|---S--|------|...|... +..............}}}.......|...............................................|... +................}}}.....----S------++--S----------S----------S-----------... +..................}}........... .. ................................... +......-------......}}}}........}}}}..}}}}..}}}}..}}}}....................... +......|.....|.......}}}}}}..}}}} .. }}}}..}}}}..}}}..................... +......|.....+...........}}}}}}........................}}}..}}}}..}}}..}}}... +......|.....|...........................................}}}}..}}}..}}}}.}}}} +......-------............................................................... +............................................................................ +...-------......-------..................................................... +...|.....|......|.....|..................................................... +...|.....+......+.....|..................................................... +...|.....|......|.....|..................................................... +...-------......-------..................................................... +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,19), "lit") +des.region({ region={14,01, 20,03}, lit=0, type="morgue", prefilled=0 }) +des.region(selection.area(07,10,11,12), "unlit") +des.region(selection.area(04,16,08,18), "unlit") +des.region(selection.area(17,16,21,18), "unlit") +des.region(selection.area(27,02,32,04), "unlit") +des.region(selection.area(34,02,39,04), "unlit") +des.region(selection.area(41,02,53,04), "unlit") +des.region(selection.area(55,02,60,04), "unlit") +des.region(selection.area(62,02,67,04), "lit") +-- Stairs +des.stair("down", 66,03) +-- Portal arrival point +des.levregion({ region = {68,14,68,14}, type="branch" }) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- Doors +des.door("locked",31,05) +des.door("locked",36,05) +des.door("locked",41,05) +des.door("locked",52,05) +des.door("locked",58,05) +des.door("locked",28,07) +des.door("locked",39,07) +des.door("locked",50,07) +des.door("locked",61,07) +des.door("closed",33,03) +des.door("closed",40,03) +des.door("closed",54,03) +des.door("closed",61,03) +des.door("open",12,11) +des.door("open",09,17) +des.door("open",16,17) +des.door("locked",35,07) +des.door("locked",36,07) +-- Monsters on siege duty. +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("giant spider") +des.monster("s") +des.monster("s") +des.monster("forest centaur") +des.monster("forest centaur") +des.monster("forest centaur") +des.monster("forest centaur") +des.monster("forest centaur") +des.monster("forest centaur") +des.monster("forest centaur") +des.monster("forest centaur") +des.monster("C") +-- Twoflower +des.monster("Twoflower", 64, 03) +-- The treasure of Twoflower +des.object("chest", 64, 03) +-- guides for the audience chamber +des.monster("guide", 29, 03) +des.monster("guide", 32, 04) +des.monster("guide", 35, 02) +des.monster("guide", 38, 03) +des.monster("guide", 45, 03) +des.monster("guide", 48, 02) +des.monster("guide", 49, 04) +des.monster("guide", 51, 03) +des.monster("guide", 57, 03) +des.monster("guide", 62, 04) +des.monster("guide", 66, 04) +-- path guards +des.monster("watchman", 35, 08) +des.monster("watchman", 36, 08) +-- river monsters +des.monster("giant eel", 62, 12) +des.monster("piranha", 47, 10) +des.monster("piranha", 29, 11) +des.monster("kraken", 34, 09) +des.monster("kraken", 37, 09) +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() diff --git a/dat/Tourist.des b/dat/Tourist.des deleted file mode 100644 index c88372fd5..000000000 --- a/dat/Tourist.des +++ /dev/null @@ -1,519 +0,0 @@ -# NetHack 3.6 Tourist.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# Copyright (c) 1991,92 by M. Stephenson, P. Winner -# NetHack may be freely redistributed. See license for details. -# -# The "start" level for the quest. -# -# Here you meet your (besieged) class leader, Twoflower -# and receive your quest assignment. -# -MAZE: "Tou-strt",' ' -FLAGS: noteleport,hardfloor -GEOMETRY:center,center -MAP -.......}}....---------..-------------------------------------------------... -........}}...|.......|..|.-------------------------------------------...|... -.........}}..|.......|..|.|......|......|.............|......|......|...|... -..........}}.|.......|..|.|......+......+.............+......+..\...|...|... -...........}}}..........|.|......|......|.............|......|......|...|... -.............}}.........|.|----S-|--S---|S----------S-|---S--|------|...|... -..............}}}.......|...............................................|... -................}}}.....----S------++--S----------S----------S-----------... -..................}}........... .. ................................... -......-------......}}}}........}}}}..}}}}..}}}}..}}}}....................... -......|.....|.......}}}}}}..}}}} .. }}}}..}}}}..}}}..................... -......|.....+...........}}}}}}........................}}}..}}}}..}}}..}}}... -......|.....|...........................................}}}}..}}}..}}}}.}}}} -......-------............................................................... -............................................................................ -...-------......-------..................................................... -...|.....|......|.....|..................................................... -...|.....+......+.....|..................................................... -...|.....|......|.....|..................................................... -...-------......-------..................................................... -ENDMAP -# Dungeon Description -REGION:(00,00,75,19),lit,"ordinary" -REGION:(14,01,20,03),unlit,"morgue" -REGION:(07,10,11,12),unlit,"ordinary" -REGION:(04,16,08,18),unlit,"ordinary" -REGION:(17,16,21,18),unlit,"ordinary" -REGION:(27,02,32,04),unlit,"ordinary" -REGION:(34,02,39,04),unlit,"ordinary" -REGION:(41,02,53,04),unlit,"ordinary" -REGION:(55,02,60,04),unlit,"ordinary" -REGION:(62,02,67,04),lit,"ordinary" -# Stairs -STAIR:(66,03),down -# Portal arrival point -BRANCH:(68,14,68,14),(0,0,0,0) -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# Doors -DOOR:locked,(31,05) -DOOR:locked,(36,05) -DOOR:locked,(41,05) -DOOR:locked,(52,05) -DOOR:locked,(58,05) -DOOR:locked,(28,07) -DOOR:locked,(39,07) -DOOR:locked,(50,07) -DOOR:locked,(61,07) -DOOR:closed,(33,03) -DOOR:closed,(40,03) -DOOR:closed,(54,03) -DOOR:closed,(61,03) -DOOR:open,(12,11) -DOOR:open,(09,17) -DOOR:open,(16,17) -DOOR:locked,(35,07) -DOOR:locked,(36,07) -# Monsters on siege duty. -MONSTER: ('s',"giant spider"),random -MONSTER: ('s',"giant spider"),random -MONSTER: ('s',"giant spider"),random -MONSTER: ('s',"giant spider"),random -MONSTER: ('s',"giant spider"),random -MONSTER: ('s',"giant spider"),random -MONSTER: ('s',"giant spider"),random -MONSTER: ('s',"giant spider"),random -MONSTER: ('s',"giant spider"),random -MONSTER: ('s',"giant spider"),random -MONSTER: ('s',"giant spider"),random -MONSTER: ('s',"giant spider"),random -MONSTER: 's',random -MONSTER: 's',random -MONSTER: ('C',"forest centaur"),random -MONSTER: ('C',"forest centaur"),random -MONSTER: ('C',"forest centaur"),random -MONSTER: ('C',"forest centaur"),random -MONSTER: ('C',"forest centaur"),random -MONSTER: ('C',"forest centaur"),random -MONSTER: ('C',"forest centaur"),random -MONSTER: ('C',"forest centaur"),random -MONSTER: 'C',random -# Twoflower -MONSTER:('@',"Twoflower"),(64,03) -# The treasure of Twoflower -OBJECT:('(',"chest"),(64,03) -# guides for the audience chamber -MONSTER:('@',"guide"),(29,03) -MONSTER:('@',"guide"),(32,04) -MONSTER:('@',"guide"),(35,02) -MONSTER:('@',"guide"),(38,03) -MONSTER:('@',"guide"),(45,03) -MONSTER:('@',"guide"),(48,02) -MONSTER:('@',"guide"),(49,04) -MONSTER:('@',"guide"),(51,03) -MONSTER:('@',"guide"),(57,03) -MONSTER:('@',"guide"),(62,04) -MONSTER:('@',"guide"),(66,04) -# path guards -MONSTER:('@',"watchman"),(35,08) -MONSTER:('@',"watchman"),(36,08) -# river monsters -MONSTER:(';',"giant eel"),(62,12) -MONSTER:(';',"piranha"),(47,10) -MONSTER:(';',"piranha"),(29,11) -MONSTER:(';',"kraken"),(34,09) -MONSTER:(';',"kraken"),(37,09) -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random - -# -# The "locate" level for the quest. -# -# Here you have to find the Thieves' Guild Hall to go -# further towards your assigned quest. -# - -MAZE: "Tou-loca",' ' -FLAGS: hardfloor -GEOMETRY:center,center -MAP ----------------------------------------------------------------------------- -|....|......|..........|......|......|...|....|.....|......|...............| -|....|......|.|------|.|......|......|.|.|....|..}..|......|.|----------|..| -|....|--+----.|......|.|-S---+|+-----|.|.S....|.....|---+--|.|..........+..| -|....|........|......|.|...|.........|.|------|..............|..........|-+| -|....+...}}...+......|.|...|.|-----|.|..............|--+----------------|..| -|----|........|------|.|---|.|.....|......|-----+-|.|.......|...........|--| -|............................|.....|.|--+-|.......|.|.......|...........|..| -|----|.....|-------------|...|--+--|.|....|.......|.|-----------+-------|..| -|....+.....+.........S...|...........|....|-------|........................| -|....|.....|.........|...|.|---------|....|.........|-------|.|----------|.| -|....|.....|---------|---|.|......|..+....|-------|.|.......|.+......S.\.|.| -|....|.....+.........S...|.|......|..|....|.......|.|.......|.|......|...|.| -|-------|..|.........|---|.|+-------------------+-|.|.......+.|----------|.| -|.......+..|---------|.........|.........|..........|.......|.|..........|.| -|.......|..............|--+--|.|.........|.|----+-----------|.|..........|.| -|---------+-|--+-----|-|.....|.|.........|.|........|.|.....+.|..........+.| -|...........|........|.S.....|.|----+----|.|--------|.|.....|.|----------|.| -|...........|........|.|.....|........................|.....|..............| ----------------------------------------------------------------------------- -ENDMAP -# Dungeon Description -REGION:(00,00,75,19),lit,"ordinary" -NON_DIGGABLE:(00,00,75,19) -# -REGION:(01,01,04,05),unlit,"morgue" -REGION:(15,03,20,05),lit,"shop" -REGION:(62,03,71,04),lit,"shop" -REGION:(01,17,11,18),lit,"barracks" -REGION:(12,09,20,10),lit,"barracks" -REGION:(53,11,59,14),lit,"zoo" -REGION:(63,14,72,16),lit,"barracks" -REGION:(32,14,40,16),lit,"temple" -# -REGION:(06,01,11,02),random,"ordinary" -REGION:(24,01,29,02),random,"ordinary" -REGION:(31,01,36,02),random,"ordinary" -REGION:(42,01,45,03),random,"ordinary" -REGION:(53,01,58,02),random,"ordinary" -REGION:(24,04,26,05),random,"ordinary" -REGION:(30,06,34,07),random,"ordinary" -REGION:(73,05,74,05),unlit,"ordinary" -REGION:(01,09,04,12),random,"ordinary" -REGION:(01,14,07,15),random,"ordinary" -REGION:(12,12,20,13),random,"ordinary" -REGION:(13,17,20,18),random,"ordinary" -REGION:(22,09,24,10),random,"ordinary" -REGION:(22,12,24,12),random,"ordinary" -REGION:(24,16,28,18),random,"ordinary" -REGION:(28,11,33,12),random,"ordinary" -REGION:(35,11,36,12),lit,"ordinary" -REGION:(38,08,41,12),random,"ordinary" -REGION:(43,07,49,08),random,"ordinary" -REGION:(43,12,49,12),random,"ordinary" -REGION:(44,16,51,16),random,"ordinary" -REGION:(53,06,59,07),random,"ordinary" -REGION:(61,06,71,07),random,"ordinary" -REGION:(55,16,59,18),random,"ordinary" -REGION:(63,11,68,12),random,"ordinary" -REGION:(70,11,72,12),random,"ordinary" -# Stairs -STAIR:(10,04),up -STAIR:(73,05),down -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -DOOR:closed,(05,05) -DOOR:closed,(05,09) -DOOR:closed,(08,14) -DOOR:closed,(08,03) -DOOR:closed,(11,09) -DOOR:closed,(11,12) -DOOR:closed,(10,16) -DOOR:closed,(14,05) -DOOR:closed,(15,16) -DOOR:locked,(21,09) -DOOR:locked,(21,12) -DOOR:closed,(23,17) -DOOR:closed,(25,03) -DOOR:closed,(26,15) -DOOR:closed,(29,03) -DOOR:closed,(28,13) -DOOR:closed,(31,03) -DOOR:closed,(32,08) -DOOR:closed,(37,11) -DOOR:closed,(36,17) -DOOR:locked,(41,03) -DOOR:closed,(40,07) -DOOR:closed,(48,06) -DOOR:closed,(48,13) -DOOR:closed,(48,15) -DOOR:closed,(56,03) -DOOR:closed,(55,05) -DOOR:closed,(72,03) -DOOR:locked,(74,04) -DOOR:closed,(64,08) -DOOR:closed,(62,11) -DOOR:closed,(69,11) -DOOR:closed,(60,13) -DOOR:closed,(60,16) -DOOR:closed,(73,16) - -# Objects -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Toilet paper -OBJECT:('?',"blank paper"),(71,12) -OBJECT:('?',"blank paper"),(71,12) -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:'s',random -MONSTER:'s',random - -# -# The "goal" level for the quest. -# -# Here you meet the Master of Thieves your nemesis monster. You have to -# defeat the Master of Thieves in combat to gain the artifact you have -# been assigned to retrieve. -# - -MAZE: "Tou-goal", ' ' -GEOMETRY:center,center -MAP ----------------------------------------------------------------------------- -|.........|.........|..........|..| |.................|........|........|..| -|.........|.........|..........|..| |....--------.....|........|........|..| -|------S--|--+-----------+------..| |....|......|.....|........|........|..| -|.........|.......................| |....|......+.....--+-------------+--..| -|.........|.......................| |....|......|..........................| -|-S-----S-|......----------.......| |....|......|..........................| -|..|..|...|......|........|.......| |....-----------.........----..........| -|..+..+...|......|........|.......| |....|.........|.........|}}|..........| -|..|..|...|......+........|.......| |....|.........+.........|}}|..........| -|..|..|...|......|........|.......S.S....|.........|.........----..........| -|---..----|......|........|.......| |....|.........|.......................| -|.........+......|+F-+F-+F|.......| |....-----------.......................| -|---..----|......|..|..|..|.......| |......................--------------..| -|..|..|...|......--F-F--F--.......| |......................+............|..| -|..+..+...|.......................| |--.---...-----+-----..|............|..| -|--|..----|--+-----------+------..| |.....|...|.........|..|------------|..| -|..+..+...|.........|..........|..| |.....|...|.........|..+............|..| -|..|..|...|.........|..........|..| |.....|...|.........|..|............|..| ----------------------------------------------------------------------------- -ENDMAP -# Dungeon Description -REGION:(00,00,75,19),lit,"ordinary" -# The Inn -REGION:(01,01,09,02),lit,"ordinary" -REGION:(01,04,09,05),lit,"barracks" -REGION:(01,07,02,10),unlit,"ordinary" -REGION:(07,07,09,10),unlit,"ordinary" -REGION:(01,14,02,15),unlit,"ordinary" -REGION:(07,14,09,15),unlit,"ordinary" -REGION:(01,17,02,18),unlit,"ordinary" -REGION:(07,17,09,18),unlit,"ordinary" -# -REGION:(11,01,19,02),unlit,"barracks" -REGION:(21,01,30,02),unlit,"ordinary" -REGION:(11,17,19,18),unlit,"barracks" -REGION:(21,17,30,18),unlit,"ordinary" -# Police Station -REGION:(18,07,25,11),lit,"ordinary" -REGION:(18,13,19,13),unlit,"ordinary" -REGION:(21,13,22,13),unlit,"ordinary" -REGION:(24,13,25,13),unlit,"ordinary" -# The town itself -REGION:(42,03,47,06),unlit,"ordinary" -REGION:(42,08,50,11),unlit,"ordinary" -REGION:(37,16,41,18),unlit,"morgue" -REGION:(47,16,55,18),unlit,"ordinary" -REGION:(55,01,62,03),unlit,"ordinary" -REGION:(64,01,71,03),unlit,"ordinary" -REGION:(60,14,71,15),lit,"shop" -REGION:(60,17,71,18),lit,"shop" -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# Stairs -STAIR:(70,08),up -# Doors -DOOR:locked,(07,03) -DOOR:locked,(02,06) -DOOR:locked,(08,06) -DOOR:closed,(03,08) -DOOR:closed,(06,08) -DOOR:open,(10,12) -DOOR:closed,(03,15) -DOOR:closed,(06,15) -DOOR:closed,(03,17) -DOOR:closed,(06,17) -DOOR:closed,(13,03) -DOOR:random,(25,03) -DOOR:closed,(13,16) -DOOR:random,(25,16) -DOOR:locked,(17,09) -DOOR:locked,(18,12) -DOOR:locked,(21,12) -DOOR:locked,(24,12) -DOOR:locked,(34,10) -DOOR:locked,(36,10) -DOOR:random,(48,04) -DOOR:random,(56,04) -DOOR:random,(70,04) -DOOR:random,(51,09) -DOOR:random,(51,15) -DOOR:open,(59,14) -DOOR:open,(59,17) -# Objects -OBJECT:('(',"credit card"),(04,01),blessed,0,name:"The Platinum Yendorian Express Card" -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('@',"Master of Thieves"),(04,01),hostile -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:('s',"giant spider"),random -MONSTER:'s',random -MONSTER:'s',random -# ladies of the evening -MONSTER:('&',"succubus"),(02,08) -MONSTER:('&',"succubus"),(08,08) -MONSTER:('&',"incubus"),(02,14) -MONSTER:('&',"incubus"),(08,14) -MONSTER:('&',"incubus"),(02,17) -MONSTER:('&',"incubus"),(08,17) -# Police station (with drunken prisoners) -MONSTER:('K',"Kop Kaptain"),(24,09),hostile -MONSTER:('K',"Kop Lieutenant"),(20,09),hostile -MONSTER:('K',"Kop Lieutenant"),(22,11),hostile -MONSTER:('K',"Kop Lieutenant"),(22,07),hostile -MONSTER:('K',"Keystone Kop"),(19,07),hostile -MONSTER:('K',"Keystone Kop"),(19,08),hostile -MONSTER:('K',"Keystone Kop"),(22,09),hostile -MONSTER:('K',"Keystone Kop"),(24,11),hostile -MONSTER:('K',"Keystone Kop"),(19,11),hostile -MONSTER:('@',"prisoner"),(19,13) -MONSTER:('@',"prisoner"),(21,13) -MONSTER:('@',"prisoner"),(24,13) -# -MONSTER:('@',"watchman"),(33,10),hostile - -WALLIFY - -# -# The "fill" level for the quest. -# -# This level is used to fill out any levels not occupied by specific -# levels as defined above. -# - -MAZE: "Tou-fila" , ' ' -INIT_MAP: mines, '.' , ' ', true, true, random, true -NOMAP -# -STAIR: random, up -STAIR: random, down -# -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -# -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random -# -MONSTER: ('@', "soldier"), random, hostile -MONSTER: ('@', "soldier"), random, hostile -MONSTER: ('@', "soldier"), random, hostile -MONSTER: ('@', "soldier"), random, hostile -MONSTER: ('@', "soldier"), random, hostile -MONSTER: 'H', random, hostile -MONSTER: 'C', random, hostile - -MAZE: "Tou-filb" , ' ' -INIT_MAP: mines, '.' , ' ', true, true, random, true -NOMAP -# -STAIR: random, up -STAIR: random, down -# -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -# -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random -# -MONSTER: ('@', "soldier"), random, hostile -MONSTER: ('@', "captain"), random, hostile -MONSTER: ('@', "captain"), random, hostile -MONSTER: 'H', random, hostile -MONSTER: 'H', random, hostile -MONSTER: 'C', random, hostile -MONSTER: 's', random diff --git a/dat/Val-fila.lua b/dat/Val-fila.lua new file mode 100644 index 000000000..caacf0bd3 --- /dev/null +++ b/dat/Val-fila.lua @@ -0,0 +1,40 @@ +-- NetHack 3.6 Valkyrie.des $NHDT-Date: 1553807172 2019/03/28 21:06:12 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.15 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-2 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = "I" }); + +des.level_flags("mazelevel", "icedpools") + +des.level_init({ style="mines", fg=".", bg="I", smoothed=true, joined=true, lit=1, walled=false }) + +-- +des.stair("up") +des.stair("down") +-- +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("a") +des.monster({ id = "fire giant", peaceful = 0 }) +-- +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() diff --git a/dat/Val-filb.lua b/dat/Val-filb.lua new file mode 100644 index 000000000..ee6f6027c --- /dev/null +++ b/dat/Val-filb.lua @@ -0,0 +1,42 @@ +-- NetHack 3.6 Valkyrie.des $NHDT-Date: 1553807172 2019/03/28 21:06:12 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.15 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-2 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = "L" }); + +des.level_flags("mazelevel", "icedpools") + +des.level_init({ style="mines", fg=".", bg="L", smoothed=true, joined=true, lit=1, walled=false }) + +-- +des.stair("up") +des.stair("down") +-- +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("a") +des.monster({ id = "fire giant", peaceful = 0 }) +des.monster({ id = "fire giant", peaceful = 0 }) +des.monster({ id = "fire giant", peaceful = 0 }) +-- +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap() +des.trap() diff --git a/dat/Val-goal.lua b/dat/Val-goal.lua new file mode 100644 index 000000000..9d5fe7a47 --- /dev/null +++ b/dat/Val-goal.lua @@ -0,0 +1,102 @@ +-- NetHack 3.6 Valkyrie.des $NHDT-Date: 1553807172 2019/03/28 21:06:12 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.15 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-2 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = "L" }); + +des.level_flags("mazelevel", "icedpools") + +des.level_init({ style="mines", fg=".", bg="L", smoothed=true, joined=true, lit=1, walled=false }) + +des.map([[ +xxxxxx.....................xxxxxxxx +xxxxx.......LLLLL.LLLLL......xxxxxx +xxxx......LLLLLLLLLLLLLLL......xxxx +xxxx.....LLL|---------|LLL.....xxxx +xxxx....LL|--.........--|LL.....xxx +x......LL|-...LLLLLLL...-|LL.....xx +.......LL|...LL.....LL...|LL......x +......LL|-..LL.......LL..-|LL...... +......LL|.................|LL...... +......LL|-..LL.......LL..-|LL...... +.......LL|...LL.....LL...|LL....... +xx.....LL|-...LLLLLLL...-|LL......x +xxx.....LL|--.........--|LL.....xxx +xxxx.....LLL|---------|LLL...xxxxxx +xxxxx.....LLLLLLLLLLLLLLL...xxxxxxx +xxxxxx......LLLLL.LLLLL.....xxxxxxx +xxxxxxxxx..................xxxxxxxx +]]); +-- Dungeon Description +des.region(selection.area(00,00,34,16), "lit") +-- Stairs +-- Note: The up stairs are *intentionally* off of the map. +des.stair("up", 45,10) +-- Non diggable walls +des.non_diggable(selection.area(00,00,34,16)) +-- Drawbridges; northern one opens from the south (portcullis) to further +-- north (lowered span), southern one from the north to further south +des.drawbridge({ x=17, y=02, dir="south", state="random" }) +if math.random(0, 99) < 75 then + des.drawbridge({ x=17, y=14, dir="north", state="open" }) +else + des.drawbridge({ x=17, y=14, dir="north", state="random" }) +end +-- Objects +des.object({ id = "crystal ball", x=17, y=08, buc="blessed", spe=5, name="The Orb of Fate" }) +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Traps +des.trap("board",13,08) +des.trap("board",21,08) +-- Random traps +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("board") +des.trap() +des.trap() +-- Random monsters. +des.monster("Lord Surtur", 17, 08) +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("a") +des.monster("a") +des.monster({ id = "fire giant", x=10, y=06, peaceful = 0 }) +des.monster({ id = "fire giant", x=10, y=07, peaceful = 0 }) +des.monster({ id = "fire giant", x=10, y=08, peaceful = 0 }) +des.monster({ id = "fire giant", x=10, y=09, peaceful = 0 }) +des.monster({ id = "fire giant", x=10, y=10, peaceful = 0 }) +des.monster({ id = "fire giant", x=24, y=06, peaceful = 0 }) +des.monster({ id = "fire giant", x=24, y=07, peaceful = 0 }) +des.monster({ id = "fire giant", x=24, y=08, peaceful = 0 }) +des.monster({ id = "fire giant", x=24, y=09, peaceful = 0 }) +des.monster({ id = "fire giant", x=24, y=10, peaceful = 0 }) +des.monster({ id = "fire giant", peaceful = 0 }) +des.monster({ id = "fire giant", peaceful = 0 }) +des.monster({ class = "H", peaceful = 0 }) + +-- +-- The "fill" levels for the quest. +-- +-- These levels are used to fill out any levels not occupied by specific +-- levels as defined above. "filla" is the upper filler, between the +-- start and locate levels, and "fillb" the lower between the locate +-- and goal levels. +-- diff --git a/dat/Val-loca.lua b/dat/Val-loca.lua new file mode 100644 index 000000000..2dc7ad6d8 --- /dev/null +++ b/dat/Val-loca.lua @@ -0,0 +1,85 @@ +-- NetHack 3.6 Valkyrie.des $NHDT-Date: 1553807172 2019/03/28 21:06:12 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.15 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-2 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "hardfloor", "icedpools") + +des.level_init({ style="mines", fg=".", bg="I", smoothed=true, joined=false, lit=1, walled=false }) + +des.map([[ +PPPPxxxx xxxxPPPPPx +PLPxxx xPPLLLPP +PPP ....................... PPPLLP +xx ............................ PPPP +x ............................... xxxx + ................................. xx +.................................... x + ................................... +x .................................. x +xx .............................. PP +xPPP .......................... PLP +xPLLP xxPLLP +xPPPPxx xxxxPPPP +]]); +-- Dungeon Description +des.region(selection.area(00,00,39,12), "lit") +-- Stairs +des.stair("up", 48,14) +des.stair("down", 20,06) +-- Non diggable walls +des.non_diggable(selection.area(00,00,39,12)) +-- Objects +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap() +des.trap() +-- Random monsters. +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("fire ant") +des.monster("a") +des.monster({ class = "H", peaceful = 0 }) +des.monster({ id = "fire giant", peaceful = 0 }) +des.monster({ id = "fire giant", peaceful = 0 }) +des.monster({ id = "fire giant", peaceful = 0 }) +des.monster({ id = "fire giant", peaceful = 0 }) +des.monster({ id = "fire giant", peaceful = 0 }) +des.monster({ id = "fire giant", peaceful = 0 }) +des.monster({ id = "fire giant", peaceful = 0 }) +des.monster({ class = "H", peaceful = 0 }) + diff --git a/dat/Val-strt.lua b/dat/Val-strt.lua new file mode 100644 index 000000000..5bb9fce57 --- /dev/null +++ b/dat/Val-strt.lua @@ -0,0 +1,98 @@ +-- NetHack 3.6 Valkyrie.des $NHDT-Date: 1553807172 2019/03/28 21:06:12 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.15 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1991-2 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- The "start" level for the quest. +-- +-- Here you meet your (besieged) class leader, the Norn, +-- and receive your quest assignment. +-- + +des.level_flags("mazelevel", "noteleport", "hardfloor", "icedpools") +des.level_init({ style = "solidfill", fg = "I" }) + +local pools = selection.new() +-- random locations +for i = 1,13 do + pools:set(); +end +-- some bigger ones +pools = pools | selection.grow(selection.set(selection.new()), "west") +pools = pools | selection.grow(selection.set(selection.new()), "north") +pools = pools | selection.grow(selection.set(selection.new()), "random") + +-- Lava pools surrounded by water +des.terrain(pools:clone():grow("all"), "P") +des.terrain(pools, "L") + +des.map([[ +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...xxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx..{..xxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.....xxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxx +xxxxxxxx.....xxxxxxxxxxxxx|----------------|xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxx +xxxxxxx..xxx...xxxxxxxxxxx|................|xxxxxxxxxx..xxxxxxxxxxxxxxxxxxxx +xxxxxx..xxxxxx......xxxxx.|................|.xxxxxxxxx.xxxxxxxxxxxxxxxxxxxxx +xxxxx..xxxxxxxxxxxx.......+................+...xxxxxxx.xxxxxxxxxxxxxxxxxxxxx +xxxx..xxxxxxxxx.....xxxxx.|................|.x...xxxxx.xxxxxxxxxxxxxxxxxxxxx +xxx..xxxxxxxxx..xxxxxxxxxx|................|xxxx.......xxxxxxxxxxxxxxxxxxxxx +xxxx..xxxxxxx..xxxxxxxxxxx|----------------|xxxxxxxxxx...xxxxxxxxxxxxxxxxxxx +xxxxxx..xxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...xxxxxxxxxxxxxxxxx +xxxxxxx......xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...xxxxxxxxxxxxxxx +xxxxxxxxx...xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...x......xxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.........xxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.......xxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +]]); +-- Dungeon Description +des.region(selection.area(00,00,75,19), "lit") +des.region(selection.area(27,08,42,12), "lit") +-- Portal arrival point +des.levregion({ region = {66,17,66,17}, type="branch" }) +-- Stairs +des.stair("down", 18,01) +des.feature("fountain", 53,02) +-- Doors +des.door("locked",26,10) +des.door("locked",43,10) +-- Norn +des.monster("Norn", 35, 10) +-- The treasure of the Norn +des.object("chest", 36, 10) +-- valkyrie guards for the audience chamber +des.monster("warrior", 27, 08) +des.monster("warrior", 27, 09) +des.monster("warrior", 27, 11) +des.monster("warrior", 27, 12) +des.monster("warrior", 42, 08) +des.monster("warrior", 42, 09) +des.monster("warrior", 42, 11) +des.monster("warrior", 42, 12) +-- Non diggable walls +des.non_diggable(selection.area(26,07,43,13)) +-- Random traps +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +-- Monsters on siege duty. +des.monster("fire ant", 04, 12) +des.monster("fire ant", 08, 08) +des.monster("fire ant", 14, 04) +des.monster("fire ant", 17, 11) +des.monster("fire ant", 24, 10) +des.monster("fire ant", 45, 10) +des.monster("fire ant", 54, 02) +des.monster("fire ant", 55, 07) +des.monster("fire ant", 58, 14) +des.monster("fire ant", 63, 17) +des.monster({ id = "fire giant", x=18, y=01, peaceful = 0 }) +des.monster({ id = "fire giant", x=10, y=16, peaceful = 0 }) + diff --git a/dat/Valkyrie.des b/dat/Valkyrie.des deleted file mode 100644 index 252c6ce82..000000000 --- a/dat/Valkyrie.des +++ /dev/null @@ -1,353 +0,0 @@ -# NetHack 3.6 Valkyrie.des $NHDT-Date: 1553807172 2019/03/28 21:06:12 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.15 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# Copyright (c) 1991-2 by M. Stephenson -# NetHack may be freely redistributed. See license for details. -# -# The "start" level for the quest. -# -# Here you meet your (besieged) class leader, the Norn, -# and receive your quest assignment. -# -MAZE: "Val-strt",' ' -FLAGS: noteleport,hardfloor,icedpools -INIT_MAP:solidfill,'I' - -$pools = selection: random & random & random & random & random & - random & random & random & random & random & random & - random & random & - grow(west, random) & - grow(north, random) & - grow(random & random) -# This works because the random coordinates in $pools are evaluated once, -# when the variable is initialized. -TERRAIN:grow($pools), 'P' -TERRAIN:$pools, 'L' - -GEOMETRY:center,center -MAP -xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...xxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx..{..xxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.....xxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxx -xxxxxxxx.....xxxxxxxxxxxxx|----------------|xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxx -xxxxxxx..xxx...xxxxxxxxxxx|................|xxxxxxxxxx..xxxxxxxxxxxxxxxxxxxx -xxxxxx..xxxxxx......xxxxx.|................|.xxxxxxxxx.xxxxxxxxxxxxxxxxxxxxx -xxxxx..xxxxxxxxxxxx.......+................+...xxxxxxx.xxxxxxxxxxxxxxxxxxxxx -xxxx..xxxxxxxxx.....xxxxx.|................|.x...xxxxx.xxxxxxxxxxxxxxxxxxxxx -xxx..xxxxxxxxx..xxxxxxxxxx|................|xxxx.......xxxxxxxxxxxxxxxxxxxxx -xxxx..xxxxxxx..xxxxxxxxxxx|----------------|xxxxxxxxxx...xxxxxxxxxxxxxxxxxxx -xxxxxx..xxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...xxxxxxxxxxxxxxxxx -xxxxxxx......xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...xxxxxxxxxxxxxxx -xxxxxxxxx...xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...x......xxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.........xxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.......xxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -ENDMAP -# Dungeon Description -REGION:(00,00,75,19),lit,"ordinary" -REGION:(27,08,42,12),lit,"ordinary" -# Portal arrival point -BRANCH:(66,17,66,17),(0,0,0,0) -# Stairs -STAIR:(18,01),down -FOUNTAIN:(53,02) -# Doors -DOOR:locked,(26,10) -DOOR:locked,(43,10) -# Norn -MONSTER:('@',"Norn"),(35,10) -# The treasure of the Norn -OBJECT:('(',"chest"),(36,10) -# valkyrie guards for the audience chamber -MONSTER:('@',"warrior"),(27,08) -MONSTER:('@',"warrior"),(27,09) -MONSTER:('@',"warrior"),(27,11) -MONSTER:('@',"warrior"),(27,12) -MONSTER:('@',"warrior"),(42,08) -MONSTER:('@',"warrior"),(42,09) -MONSTER:('@',"warrior"),(42,11) -MONSTER:('@',"warrior"),(42,12) -# Non diggable walls -NON_DIGGABLE:(26,07,43,13) -# Random traps -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -# Monsters on siege duty. -MONSTER: ('a',"fire ant"),(04,12) -MONSTER: ('a',"fire ant"),(08,08) -MONSTER: ('a',"fire ant"),(14,04) -MONSTER: ('a',"fire ant"),(17,11) -MONSTER: ('a',"fire ant"),(24,10) -MONSTER: ('a',"fire ant"),(45,10) -MONSTER: ('a',"fire ant"),(54,02) -MONSTER: ('a',"fire ant"),(55,07) -MONSTER: ('a',"fire ant"),(58,14) -MONSTER: ('a',"fire ant"),(63,17) -MONSTER: ('H',"fire giant"),(18,01),hostile -MONSTER: ('H',"fire giant"),(10,16),hostile - -# -# The "locate" level for the quest. -# -# Here you have to find the cave of Surtur to go -# further towards your assigned quest. -# - -MAZE: "Val-loca",' ' -FLAGS: hardfloor,icedpools -INIT_MAP: mines, '.', 'I', true, true, lit, false -GEOMETRY:center,center -MAP -PPPPxxxx xxxxPPPPPx -PLPxxx xPPLLLPP -PPP ....................... PPPLLP -xx ............................ PPPP -x ............................... xxxx - ................................. xx -.................................... x - ................................... -x .................................. x -xx .............................. PP -xPPP .......................... PLP -xPLLP xxPLLP -xPPPPxx xxxxPPPP -ENDMAP -# Dungeon Description -REGION:(00,00,39,12),lit,"ordinary" -# Stairs -STAIR:(48,14),up -STAIR:(20,06),down -# Non diggable walls -NON_DIGGABLE:(00,00,39,12) -# Objects -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:'a',random -MONSTER:'H',random,hostile -MONSTER:('H',"fire giant"),random,hostile -MONSTER:('H',"fire giant"),random,hostile -MONSTER:('H',"fire giant"),random,hostile -MONSTER:('H',"fire giant"),random,hostile -MONSTER:('H',"fire giant"),random,hostile -MONSTER:('H',"fire giant"),random,hostile -MONSTER:('H',"fire giant"),random,hostile -MONSTER:'H',random,hostile - -# -# The "goal" level for the quest. -# -# Here you meet Lord Surtur your nemesis monster. You have to -# defeat Lord Surtur in combat to gain the artifact you have -# been assigned to retrieve. -# - -MAZE: "Val-goal", 'L' -FLAGS: icedpools -INIT_MAP: mines, '.', 'L', true, true, lit, false -GEOMETRY:center,center -MAP -xxxxxx.....................xxxxxxxx -xxxxx.......LLLLL.LLLLL......xxxxxx -xxxx......LLLLLLLLLLLLLLL......xxxx -xxxx.....LLL|---------|LLL.....xxxx -xxxx....LL|--.........--|LL.....xxx -x......LL|-...LLLLLLL...-|LL.....xx -.......LL|...LL.....LL...|LL......x -......LL|-..LL.......LL..-|LL...... -......LL|.................|LL...... -......LL|-..LL.......LL..-|LL...... -.......LL|...LL.....LL...|LL....... -xx.....LL|-...LLLLLLL...-|LL......x -xxx.....LL|--.........--|LL.....xxx -xxxx.....LLL|---------|LLL...xxxxxx -xxxxx.....LLLLLLLLLLLLLLL...xxxxxxx -xxxxxx......LLLLL.LLLLL.....xxxxxxx -xxxxxxxxx..................xxxxxxxx -ENDMAP -# Dungeon Description -REGION:(00,00,34,16),lit,"ordinary" -# Stairs -# Note: The up stairs are *intentionally* off of the map. -STAIR:(45,10),up -# Non diggable walls -NON_DIGGABLE:(00,00,34,16) -# Drawbridges; northern one opens from the south (portcullis) to further -# north (lowered span), southern one from the north to further south -DRAWBRIDGE:(17,02),south,random -IF [75%] { - DRAWBRIDGE:(17,14),north,open -} ELSE { - DRAWBRIDGE:(17,14),north,random -} -# Objects -OBJECT:('(',"crystal ball"),(17,08),blessed,5,name:"The Orb of Fate" -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Traps -TRAP:"board",(13,08) -TRAP:"board",(21,08) -# Random traps -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"board",random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('H',"Lord Surtur"),(17,08) -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:('a',"fire ant"),random -MONSTER:'a',random -MONSTER:'a',random -MONSTER:('H',"fire giant"),(10,06),hostile -MONSTER:('H',"fire giant"),(10,07),hostile -MONSTER:('H',"fire giant"),(10,08),hostile -MONSTER:('H',"fire giant"),(10,09),hostile -MONSTER:('H',"fire giant"),(10,10),hostile -MONSTER:('H',"fire giant"),(24,06),hostile -MONSTER:('H',"fire giant"),(24,07),hostile -MONSTER:('H',"fire giant"),(24,08),hostile -MONSTER:('H',"fire giant"),(24,09),hostile -MONSTER:('H',"fire giant"),(24,10),hostile -MONSTER:('H',"fire giant"),random,hostile -MONSTER:('H',"fire giant"),random,hostile -MONSTER:'H',random,hostile - -# -# The "fill" levels for the quest. -# -# These levels are used to fill out any levels not occupied by specific -# levels as defined above. "filla" is the upper filler, between the -# start and locate levels, and "fillb" the lower between the locate -# and goal levels. -# - -MAZE: "Val-fila" , 'I' -FLAGS: icedpools -INIT_MAP: mines, '.', 'I', true, true, lit, false -NOMAP -# -STAIR: random, up -STAIR: random, down -# -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -# -MONSTER: ('a', "fire ant"), random -MONSTER: ('a', "fire ant"), random -MONSTER: ('a', "fire ant"), random -MONSTER: ('a', "fire ant"), random -MONSTER: ('a', "fire ant"), random -MONSTER: 'a', random -MONSTER: ('H', "fire giant"), random, hostile -# -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random - -MAZE: "Val-filb" , 'L' -FLAGS: icedpools -INIT_MAP: mines, '.', 'L', true, true, lit, false -NOMAP -# -STAIR: random, up -STAIR: random, down -# -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -# -MONSTER: ('a', "fire ant"), random -MONSTER: ('a', "fire ant"), random -MONSTER: ('a', "fire ant"), random -MONSTER: 'a', random -MONSTER: ('H', "fire giant"), random, hostile -MONSTER: ('H', "fire giant"), random, hostile -MONSTER: ('H', "fire giant"), random, hostile -# -TRAP: "fire", random -TRAP: "fire", random -TRAP: "fire", random -TRAP: "fire", random -TRAP: "fire", random -TRAP: random, random -TRAP: random, random diff --git a/dat/Wiz-fila.lua b/dat/Wiz-fila.lua new file mode 100644 index 000000000..61c78d75b --- /dev/null +++ b/dat/Wiz-fila.lua @@ -0,0 +1,59 @@ +-- NetHack 3.6 Wizard.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1992 by David Cohrs +-- NetHack may be freely redistributed. See license for details. +-- +-- +des.room({ type = "ordinary", + contents = function() + des.stair("up") + des.object() + des.monster({ class = "i", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.monster({ class = "i", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.object() + des.monster("vampire bat") + des.monster("vampire bat") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.stair("down") + des.object() + des.trap() + des.monster({ class = "i", peaceful=0 }) + des.monster("vampire bat") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.trap() + des.monster({ class = "i", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.monster("vampire bat") + end +}) + +des.random_corridors() diff --git a/dat/Wiz-filb.lua b/dat/Wiz-filb.lua new file mode 100644 index 000000000..41eae6c47 --- /dev/null +++ b/dat/Wiz-filb.lua @@ -0,0 +1,58 @@ +-- NetHack 3.6 Wizard.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1992 by David Cohrs +-- NetHack may be freely redistributed. See license for details. +-- +-- +des.room({ type = "ordinary", + contents = function() + des.stair("up") + des.object() + des.monster({ class = "X", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.monster({ class = "i", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.object() + des.monster({ class = "X", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.stair("down") + des.object() + des.trap() + des.monster({ class = "i", peaceful=0 }) + des.monster("vampire bat") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.object() + des.trap() + des.monster({ class = "i", peaceful=0 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.object() + des.trap() + des.monster("vampire bat") + end +}) + +des.random_corridors() diff --git a/dat/Wiz-goal.lua b/dat/Wiz-goal.lua new file mode 100644 index 000000000..5673410c6 --- /dev/null +++ b/dat/Wiz-goal.lua @@ -0,0 +1,132 @@ +-- NetHack 3.6 Wizard.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1992 by David Cohrs +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.map([[ + + + + ------------- ------------- + |...........| |...........| + -------|...........-------------------...........| + |......S...........|..|..|..|..|..|..|...........| + |......|...........|..|..|..|..|..|..|...........| + |......|...........-F+-F+-F+-F+-F+-F+-...........| + --S----|...........S.................+...........| + |......|...........-F+-F+-F+-F+-F+-F+-...........| + |......|...........|..|..|..|..|..|..|...........| + |......|...........|..|..|..|..|..|..|...........| + -------|...........-------------------...........| + |...........| |...........| + ------------- ------------- + + + + +]]); +-- Dungeon Description +des.region({ region={13,10,18,12}, lit=0, type="temple" }) +des.region(selection.area(13,06,18,08), "lit") +des.region(selection.area(20,04,30,14), "unlit") +des.region(selection.area(32,06,33,07), "unlit") +des.region(selection.area(35,06,36,07), "unlit") +des.region(selection.area(38,06,39,07), "unlit") +des.region(selection.area(41,06,42,07), "unlit") +des.region(selection.area(44,06,45,07), "unlit") +des.region(selection.area(47,06,48,07), "unlit") +des.region(selection.area(32,09,48,09), "unlit") +des.region(selection.area(32,11,33,12), "unlit") +des.region(selection.area(35,11,36,12), "unlit") +des.region(selection.area(38,11,39,12), "unlit") +des.region(selection.area(41,11,42,12), "unlit") +des.region(selection.area(44,11,45,12), "unlit") +des.region(selection.area(47,11,48,12), "unlit") +des.region(selection.area(50,04,60,14), "lit") +-- Doors +des.door("locked",19,06) +des.door("locked",14,09) +des.door("locked",31,09) +des.door("locked",33,08) +des.door("locked",36,08) +des.door("locked",39,08) +des.door("locked",42,08) +des.door("locked",45,08) +des.door("locked",48,08) +des.door("locked",33,10) +des.door("locked",36,10) +des.door("locked",39,10) +des.door("locked",42,10) +des.door("locked",45,10) +des.door("locked",48,10) +des.door("locked",49,09) +-- Stairs +des.stair("up", 55,05) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- The altar. This is not a shrine. +des.altar({ coord={16,11}, aligned="noncoaligned", type="altar" }) +-- Objects +des.object({ id = "amulet of ESP", x=16, y=11, buc="blessed", spe=0, name="The Eye of the Aethiopica" }) +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Random monsters. +des.monster("Dark One", 16, 11) +des.monster({ class = "B",random, peaceful = 0 }) +des.monster({ class = "B",random, peaceful = 0 }) +des.monster({ class = "B",random, peaceful = 0 }) +des.monster({ class = "B",random, peaceful = 0 }) +des.monster({ class = "B",random, peaceful = 0 }) +des.monster({ class = "B",random, peaceful = 0 }) +des.monster({ class = "B",random, peaceful = 0 }) +des.monster({ class = "B",random, peaceful = 0 }) +des.monster({ class = "B",random, peaceful = 0 }) +des.monster({ class = "B",random, peaceful = 0 }) +des.monster({ class = "B",random, peaceful = 0 }) +des.monster({ class = "i",random, peaceful = 0 }) +des.monster({ class = "i",random, peaceful = 0 }) +des.monster({ class = "i",random, peaceful = 0 }) +des.monster({ class = "i",random, peaceful = 0 }) +des.monster({ class = "i",random, peaceful = 0 }) +des.monster({ class = "i",random, peaceful = 0 }) +des.monster({ class = "i",random, peaceful = 0 }) +des.monster("vampire bat") +des.monster("vampire bat") +des.monster("vampire bat") +des.monster("vampire bat") +des.monster("vampire bat") +des.monster("vampire bat") +des.monster("vampire bat") +des.monster("vampire bat") +des.monster({ class = "i",random, peaceful = 0 }) +-- Captive Monsters in the dungeon +des.monster({ id = "rogue", x=35, y=06, peaceful=1, name="Pug" }) +des.monster({ id = "owlbear", x=47, y=06, peaceful=1, asleep=1 }) +des.monster({ id = "wizard", x=32, y=11, peaceful=1, asleep=1, name="Newt" }) +des.monster({ id = "Grey-elf", x=44, y=11, peaceful=1 }) +des.monster({ id = "hill giant", x=47, y=11, peaceful=1, asleep=1 }) +des.monster({ id = "gnomish wizard", x=38, y=06, peaceful=1 }) +des.monster({ id = "prisoner", x=35, y=11, peaceful=1 }) +des.monster({ id = "prisoner", x=41, y=11, peaceful=1, asleep=1 }) diff --git a/dat/Wiz-loca.lua b/dat/Wiz-loca.lua new file mode 100644 index 000000000..288660ca7 --- /dev/null +++ b/dat/Wiz-loca.lua @@ -0,0 +1,151 @@ +-- NetHack 3.6 Wizard.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1992 by David Cohrs +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "hardfloor") + +des.map([[ +............. ....................................................... +.............. .............}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}....... +.............. ..............}.................................}....... +.............. ..............}.-------------------------------.}....... +............... .........C....}.|.............................|.}....... +............... ..........C....}.|.---------------------------.|.}....... +............... .........CCC...}.|.|.........................|.|.}....... +................ ....C....CCC...}.|.|.-----------------------.|.|.}....... +.......C..C..... .....C....CCC...}.|.|.|......+.......+......|.|.|.}....... +.............C..CC.....C....CCC...}.|.|.|......|-------|......|.|.|.}....... +................ ....C....CCC...}.|.|.|......|.......|......|.|.|.}....... +......C..C..... ....C....CCC...}.|.|.|......|-------|......|.|.|.}....... +............C.. ...C....CCC...}.|.|.|......+.......+......|.|.|.}....... +........C...... ....C....CCC...}.|.|.-----------------------.|.|.}....... +....C......C... ........CCC...}.|.|.........................|.|.}....... +......C..C.... .........C....}.|.---------------------------.|.}....... +.............. .........C....}.|.............................|.}....... +............. ..............}.-------------------------------.}....... +............. .............}.................................}....... +............. .............}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}....... +............. ....................................................... +]]); + +des.replace_terrain({ region = { 0, 0,30,20}, fromterrain=".", toterrain="C", chance=15 }) +des.replace_terrain({ region = {68, 0,75,20}, fromterrain=".", toterrain="}", chance=25 }) +des.replace_terrain({ region = {34, 1,68,19}, fromterrain="}", toterrain=".", chance=2 }) + +-- Dungeon Description +des.region(selection.area(00,00,75,20), "lit") +des.region({ region={37,04,65,16}, lit=0, type="ordinary", prefilled=1, irregular=1, + contents = function() + des.door({ state="secret", wall="random" }) + end +}) +des.region({ region={39,06,63,14}, lit=0, type="ordinary", prefilled=1, irregular=1, + contents = function() + des.door({ state="secret", wall="random" }) + end +}) + +des.region({ region={41,08,46,12}, lit=1, type="ordinary", prefilled=1, irregular=1, + contents = function() + local walls = { "north", "south", "west" } + local widx = math.random(1, #walls) + des.door({ state="secret", wall=walls[widx] }) + end +}) + +des.region({ region={56,08,61,12}, lit=1, type="ordinary", prefilled=1, irregular=1, + contents = function() + local walls = { "north", "south", "east" } + local widx = math.random(1, #walls) + des.door({ state="secret", wall=walls[widx] }) + end +}) + +des.region(selection.area(48,08,54,08), "unlit") +des.region(selection.area(48,12,54,12), "unlit") + +des.region({ region={48,10,54,10}, lit=0, type="ordinary", prefilled=1, irregular=1, + contents = function() + des.door({ state="secret", wall="random" }) + end +}) + +-- Doors +des.door("locked",55,08) +des.door("locked",55,12) +des.door("locked",47,08) +des.door("locked",47,12) +-- Stairs +des.terrain({03,17}, ".") +des.stair("up", 03,17) +des.stair("down", 48,10) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,20)) +-- Objects +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap("spiked pit",24,02) +des.trap("spiked pit",07,10) +des.trap("spiked pit",23,05) +des.trap("spiked pit",26,19) +des.trap("spiked pit",72,02) +des.trap("spiked pit",72,12) +des.trap("falling rock",45,16) +des.trap("falling rock",65,13) +des.trap("falling rock",55,06) +des.trap("falling rock",39,11) +des.trap("falling rock",57,09) +des.trap("magic") +des.trap("statue") +des.trap("statue") +des.trap("polymorph") +des.trap("anti magic",53,10) +des.trap("sleep gas") +des.trap("sleep gas") +des.trap("dart") +des.trap("dart") +des.trap("dart") +-- Random monsters. +des.monster({ class = "B", peaceful = 0 }) +des.monster({ class = "B", peaceful = 0 }) +des.monster({ class = "B", peaceful = 0 }) +des.monster({ class = "B", peaceful = 0 }) +des.monster({ class = "B", peaceful = 0 }) +des.monster({ class = "B", peaceful = 0 }) +des.monster({ class = "B", peaceful = 0 }) +des.monster({ class = "B", peaceful = 0 }) +des.monster({ class = "B", peaceful = 0 }) +des.monster({ class = "B", peaceful = 0 }) +des.monster({ class = "B", peaceful = 0 }) +des.monster({ class = "B", peaceful = 0 }) +des.monster({ class = "i", peaceful = 0 }) +des.monster({ class = "i", peaceful = 0 }) +des.monster({ class = "i", peaceful = 0 }) +des.monster({ class = "i", peaceful = 0 }) +des.monster({ class = "i", peaceful = 0 }) +des.monster({ class = "i", peaceful = 0 }) +des.monster({ class = "i", peaceful = 0 }) +des.monster("vampire bat") +des.monster("vampire bat") +des.monster("vampire bat") +des.monster("vampire bat") +des.monster("vampire bat") +des.monster("vampire bat") +des.monster("vampire bat") +des.monster({ class = "i", peaceful = 0 }) diff --git a/dat/Wiz-strt.lua b/dat/Wiz-strt.lua new file mode 100644 index 000000000..19478b249 --- /dev/null +++ b/dat/Wiz-strt.lua @@ -0,0 +1,104 @@ +-- NetHack 3.6 Wizard.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1992 by David Cohrs +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- The "start" level for the quest. +-- +-- Here you meet your (besieged) class leader, Neferet the Green +-- and receive your quest assignment. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor") + +des.map([[ +............................................................................ +.....................C....CC.C........................C..................... +..........CCC.....................CCC....................................... +........CC........-----------.......C.C...C...C....C........................ +.......C.....---------------------...C..C..C..C............................. +......C..C...------....\....------....C.....C............................... +........C...||....|.........|....||......................................... +.......C....||....|.........+....||......................................... +.......C...||---+--.........|....|||........................................ +......C....||...............|--S--||........................................ +...........||--+--|++----|---|..|.SS..........C......C...................... +........C..||.....|..|...|...|--|.||..CC..C.....C..........C................ +.......C...||.....|..|.--|.|.|....||.................C..C................... +.....C......||....|..|.....|.|.--||..C..C..........C...........}}}.......... +......C.C...||....|..-----.|.....||...C.C.C..............C....}}}}}}........ +.........C...------........|------....C..C.....C..CC.C......}}}}}}}}}}}..... +.........CC..---------------------...C.C..C.....CCCCC.C.......}}}}}}}}...... +.........C........-----------..........C.C.......CCC.........}}}}}}}}}...... +..........C.C.........................C............C...........}}}}}........ +......................CCC.C................................................. +]]); + +-- first do cloud everywhere +des.replace_terrain({ region={0,0, 75,19}, fromterrain=".", toterrain="C", chance=10 }) +-- then replace clouds inside the tower back to floor +des.replace_terrain({ region={13,5, 33,15}, fromterrain="C", toterrain=".", chance=100 }) + +-- Dungeon Description +des.region(selection.area(00,00,75,19), "lit") +des.region(selection.area(35,00,49,03), "unlit") +des.region(selection.area(43,12,49,16), "unlit") +des.region({ region={19,11,33,15}, lit=0, type="ordinary", prefilled=0, irregular=1 }) +des.region(selection.area(30,10,31,10), "unlit") +-- Stairs +des.stair("down", 30,10) +-- Portal arrival point +des.terrain({63,06}, ".") +des.levregion({ region = {63,06,63,06}, type="branch" }) +-- Doors +des.door("closed",31,09) +des.door("closed",16,08) +des.door("closed",28,07) +des.door("locked",34,10) +des.door("locked",35,10) +des.door("closed",15,10) +des.door("locked",19,10) +des.door("locked",20,10) +-- Neferet the Green, the quest leader +des.monster("Neferet the Green", 23, 05) +-- The treasure of the quest leader +des.object("chest", 24, 05) +-- apprentice guards for the audience chamber +des.monster("apprentice", 30, 07) +des.monster("apprentice", 24, 06) +des.monster("apprentice", 15, 06) +des.monster("apprentice", 15, 12) +des.monster("apprentice", 26, 11) +des.monster("apprentice", 27, 11) +des.monster("apprentice", 19, 09) +des.monster("apprentice", 20, 09) +-- Eels in the pond +des.monster("giant eel", 62, 14) +des.monster("giant eel", 69, 15) +des.monster("giant eel", 67, 17) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Monsters on siege duty. +des.monster({ class = "B", x=60, y=09, peaceful = 0 }) +des.monster({ class = "W", x=60, y=10, peaceful = 0 }) +des.monster({ class = "B", x=60, y=11, peaceful = 0 }) +des.monster({ class = "B", x=60, y=12, peaceful = 0 }) +des.monster({ class = "i", x=60, y=13, peaceful = 0 }) +des.monster({ class = "B", x=61, y=10, peaceful = 0 }) +des.monster({ class = "B", x=61, y=11, peaceful = 0 }) +des.monster({ class = "B", x=61, y=12, peaceful = 0 }) +des.monster({ class = "B", x=35, y=03, peaceful = 0 }) +des.monster({ class = "i", x=35, y=17, peaceful = 0 }) +des.monster({ class = "B", x=36, y=17, peaceful = 0 }) +des.monster({ class = "B", x=34, y=16, peaceful = 0 }) +des.monster({ class = "i", x=34, y=17, peaceful = 0 }) +des.monster({ class = "W", x=67, y=02, peaceful = 0 }) +des.monster({ class = "B", x=10, y=19, peaceful = 0 }) diff --git a/dat/Wizard.des b/dat/Wizard.des deleted file mode 100644 index f27f47680..000000000 --- a/dat/Wizard.des +++ /dev/null @@ -1,472 +0,0 @@ -# NetHack 3.6 Wizard.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ -# Copyright (c) 1992 by David Cohrs -# NetHack may be freely redistributed. See license for details. -# -# The "start" level for the quest. -# -# Here you meet your (besieged) class leader, Neferet the Green -# and receive your quest assignment. -# -MAZE: "Wiz-strt",' ' -FLAGS: noteleport,hardfloor -GEOMETRY:center,center -MAP -............................................................................ -.....................C....CC.C........................C..................... -..........CCC.....................CCC....................................... -........CC........-----------.......C.C...C...C....C........................ -.......C.....---------------------...C..C..C..C............................. -......C..C...------....\....------....C.....C............................... -........C...||....|.........|....||......................................... -.......C....||....|.........+....||......................................... -.......C...||---+--.........|....|||........................................ -......C....||...............|--S--||........................................ -...........||--+--|++----|---|..|.SS..........C......C...................... -........C..||.....|..|...|...|--|.||..CC..C.....C..........C................ -.......C...||.....|..|.--|.|.|....||.................C..C................... -.....C......||....|..|.....|.|.--||..C..C..........C...........}}}.......... -......C.C...||....|..-----.|.....||...C.C.C..............C....}}}}}}........ -.........C...------........|------....C..C.....C..CC.C......}}}}}}}}}}}..... -.........CC..---------------------...C.C..C.....CCCCC.C.......}}}}}}}}...... -.........C........-----------..........C.C.......CCC.........}}}}}}}}}...... -..........C.C.........................C............C...........}}}}}........ -......................CCC.C................................................. -ENDMAP - -# first do cloud everywhere -REPLACE_TERRAIN:(0,0, 75,19), '.', 'C', 10% -# then replace clouds inside the tower back to floor -REPLACE_TERRAIN:(13,5, 33,15), 'C', '.', 100% - -# Dungeon Description -REGION:(00,00,75,19),lit,"ordinary" -REGION:(35,00,49,03),unlit,"ordinary" -REGION:(43,12,49,16),unlit,"ordinary" -REGION:(19,11,33,15),unlit,"ordinary",unfilled,irregular -REGION:(30,10,31,10),unlit,"ordinary" -# Stairs -STAIR:(30,10),down -# Portal arrival point -TERRAIN:(63,06),'.' -BRANCH:(63,06,63,06),(0,0,0,0) -# Doors -DOOR:closed,(31,09) -DOOR:closed,(16,08) -DOOR:closed,(28,07) -DOOR:locked,(34,10) -DOOR:locked,(35,10) -DOOR:closed,(15,10) -DOOR:locked,(19,10) -DOOR:locked,(20,10) -# Neferet the Green, the quest leader -MONSTER:('@',"Neferet the Green"),(23,05) -# The treasure of the quest leader -OBJECT:('(',"chest"),(24,05) -# apprentice guards for the audience chamber -MONSTER:('@',"apprentice"),(30,07) -MONSTER:('@',"apprentice"),(24,06) -MONSTER:('@',"apprentice"),(15,06) -MONSTER:('@',"apprentice"),(15,12) -MONSTER:('@',"apprentice"),(26,11) -MONSTER:('@',"apprentice"),(27,11) -MONSTER:('@',"apprentice"),(19,09) -MONSTER:('@',"apprentice"),(20,09) -# Eels in the pond -MONSTER:(';',"giant eel"),(62,14) -MONSTER:(';',"giant eel"),(69,15) -MONSTER:(';',"giant eel"),(67,17) -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Monsters on siege duty. -MONSTER: 'B',(60,09),hostile -MONSTER: 'W',(60,10),hostile -MONSTER: 'B',(60,11),hostile -MONSTER: 'B',(60,12),hostile -MONSTER: 'i',(60,13),hostile -MONSTER: 'B',(61,10),hostile -MONSTER: 'B',(61,11),hostile -MONSTER: 'B',(61,12),hostile -MONSTER: 'B',(35,03),hostile -MONSTER: 'i',(35,17),hostile -MONSTER: 'B',(36,17),hostile -MONSTER: 'B',(34,16),hostile -MONSTER: 'i',(34,17),hostile -MONSTER: 'W',(67,02),hostile -MONSTER: 'B',(10,19),hostile - -# -# The "locate" level for the quest. -# -# Here you have to find the Entrance to the Tower of Darkness to go -# further towards your assigned quest. -# - -MAZE: "Wiz-loca",' ' -FLAGS: hardfloor -GEOMETRY:center,center -MAP -............. ....................................................... -.............. .............}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}....... -.............. ..............}.................................}....... -.............. ..............}.-------------------------------.}....... -............... .........C....}.|.............................|.}....... -............... ..........C....}.|.---------------------------.|.}....... -............... .........CCC...}.|.|.........................|.|.}....... -................ ....C....CCC...}.|.|.-----------------------.|.|.}....... -.......C..C..... .....C....CCC...}.|.|.|......+.......+......|.|.|.}....... -.............C..CC.....C....CCC...}.|.|.|......|-------|......|.|.|.}....... -................ ....C....CCC...}.|.|.|......|.......|......|.|.|.}....... -......C..C..... ....C....CCC...}.|.|.|......|-------|......|.|.|.}....... -............C.. ...C....CCC...}.|.|.|......+.......+......|.|.|.}....... -........C...... ....C....CCC...}.|.|.-----------------------.|.|.}....... -....C......C... ........CCC...}.|.|.........................|.|.}....... -......C..C.... .........C....}.|.---------------------------.|.}....... -.............. .........C....}.|.............................|.}....... -............. ..............}.-------------------------------.}....... -............. .............}.................................}....... -............. .............}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}....... -............. ....................................................... -ENDMAP - -REPLACE_TERRAIN:(0,0,30,20), '.', 'C', 15% -REPLACE_TERRAIN:(68,0,75,20), '.', '}', 25% -REPLACE_TERRAIN:(34,1,68,19), '}', '.', 2% - -# Dungeon Description -REGION:(00,00,75,20),lit,"ordinary" -REGION:(37,04,65,16),unlit,"ordinary",filled,irregular { - ROOMDOOR:true,closed,north|south|west|east,random -} -REGION:(39,06,63,14),unlit,"ordinary",filled,irregular { - ROOMDOOR:true,closed,north|south|west|east,random -} - -REGION:(41,08,46,12),lit,"ordinary",filled,irregular { - ROOMDOOR:true,closed,north|south|west,random -} -REGION:(56,08,61,12),lit,"ordinary",filled,irregular { - ROOMDOOR:true,closed,north|south|east,random -} -REGION:(48,08,54,08),unlit,"ordinary" -REGION:(48,12,54,12),unlit,"ordinary" -REGION:(48,10,54,10),unlit,"ordinary",filled,irregular { - ROOMDOOR:true,closed,north|south|west|east,random -} - -# Doors -DOOR:locked,(55,08) -DOOR:locked,(55,12) -DOOR:locked,(47,08) -DOOR:locked,(47,12) -# Stairs -TERRAIN:(03,17),'.' -STAIR:(03,17),up -STAIR:(48,10),down -# Non diggable walls -NON_DIGGABLE:(00,00,75,20) -# Objects -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:"spiked pit",(24,02) -TRAP:"spiked pit",(07,10) -TRAP:"spiked pit",(23,05) -TRAP:"spiked pit",(26,19) -TRAP:"spiked pit",(72,02) -TRAP:"spiked pit",(72,12) -TRAP:"falling rock",(45,16) -TRAP:"falling rock",(65,13) -TRAP:"falling rock",(55,06) -TRAP:"falling rock",(39,11) -TRAP:"falling rock",(57,09) -TRAP:"magic",random -TRAP:"statue",random -TRAP:"statue",random -TRAP:"polymorph",random -TRAP:"anti magic",(53,10) -TRAP:"sleep gas",random -TRAP:"sleep gas",random -TRAP:"dart",random -TRAP:"dart",random -TRAP:"dart",random -# Random monsters. -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'i',random,hostile -MONSTER:'i',random,hostile -MONSTER:'i',random,hostile -MONSTER:'i',random,hostile -MONSTER:'i',random,hostile -MONSTER:'i',random,hostile -MONSTER:'i',random,hostile -MONSTER:('B',"vampire bat"),random -MONSTER:('B',"vampire bat"),random -MONSTER:('B',"vampire bat"),random -MONSTER:('B',"vampire bat"),random -MONSTER:('B',"vampire bat"),random -MONSTER:('B',"vampire bat"),random -MONSTER:('B',"vampire bat"),random -MONSTER:'i',random,hostile - -# -# The "goal" level for the quest. -# -# Here you meet the Dark One, your nemesis monster. You have to -# defeat the Dark One in combat to gain the artifact you have -# been assigned to retrieve. -# - -MAZE: "Wiz-goal", ' ' -GEOMETRY:center,center -MAP - - - - ------------- ------------- - |...........| |...........| - -------|...........-------------------...........| - |......S...........|..|..|..|..|..|..|...........| - |......|...........|..|..|..|..|..|..|...........| - |......|...........-F+-F+-F+-F+-F+-F+-...........| - --S----|...........S.................+...........| - |......|...........-F+-F+-F+-F+-F+-F+-...........| - |......|...........|..|..|..|..|..|..|...........| - |......|...........|..|..|..|..|..|..|...........| - -------|...........-------------------...........| - |...........| |...........| - ------------- ------------- - - - - -ENDMAP -# Dungeon Description -REGION:(13,10,18,12),unlit,"temple" -REGION:(13,06,18,08),lit,"ordinary" -REGION:(20,04,30,14),unlit,"ordinary" -REGION:(32,06,33,07),unlit,"ordinary" -REGION:(35,06,36,07),unlit,"ordinary" -REGION:(38,06,39,07),unlit,"ordinary" -REGION:(41,06,42,07),unlit,"ordinary" -REGION:(44,06,45,07),unlit,"ordinary" -REGION:(47,06,48,07),unlit,"ordinary" -REGION:(32,09,48,09),unlit,"ordinary" -REGION:(32,11,33,12),unlit,"ordinary" -REGION:(35,11,36,12),unlit,"ordinary" -REGION:(38,11,39,12),unlit,"ordinary" -REGION:(41,11,42,12),unlit,"ordinary" -REGION:(44,11,45,12),unlit,"ordinary" -REGION:(47,11,48,12),unlit,"ordinary" -REGION:(50,04,60,14),lit,"ordinary" -# Doors -DOOR:locked,(19,06) -DOOR:locked,(14,09) -DOOR:locked,(31,09) -DOOR:locked,(33,08) -DOOR:locked,(36,08) -DOOR:locked,(39,08) -DOOR:locked,(42,08) -DOOR:locked,(45,08) -DOOR:locked,(48,08) -DOOR:locked,(33,10) -DOOR:locked,(36,10) -DOOR:locked,(39,10) -DOOR:locked,(42,10) -DOOR:locked,(45,10) -DOOR:locked,(48,10) -DOOR:locked,(49,09) -# Stairs -STAIR:(55,05),up -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# The altar. This is not a shrine. -ALTAR:(16,11),noncoaligned,altar -# Objects -OBJECT:('"',"amulet of ESP"),(16,11),blessed,0,name:"The Eye of the Aethiopica" -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('@',"Dark One"),(16,11) -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'B',random,hostile -MONSTER:'i',random,hostile -MONSTER:'i',random,hostile -MONSTER:'i',random,hostile -MONSTER:'i',random,hostile -MONSTER:'i',random,hostile -MONSTER:'i',random,hostile -MONSTER:'i',random,hostile -MONSTER:('B',"vampire bat"),random -MONSTER:('B',"vampire bat"),random -MONSTER:('B',"vampire bat"),random -MONSTER:('B',"vampire bat"),random -MONSTER:('B',"vampire bat"),random -MONSTER:('B',"vampire bat"),random -MONSTER:('B',"vampire bat"),random -MONSTER:('B',"vampire bat"),random -MONSTER:'i',random,hostile -# Captive Monsters in the dungeon -MONSTER:('@',"rogue"),(35,06),peaceful,"Pug" -MONSTER:('Y',"owlbear"),(47,06),peaceful,asleep -MONSTER:('@',"wizard"),(32,11),peaceful,asleep,"Newt" -MONSTER:('@',"Grey-elf"),(44,11),peaceful -MONSTER:('H',"hill giant"),(47,11),peaceful,asleep -MONSTER:('G',"gnomish wizard"),(38,06),peaceful -MONSTER:('@',"prisoner"),(35,11),peaceful -MONSTER:('@',"prisoner"),(41,11),peaceful,asleep - -# -# The "fill" levels for the quest. -# -# These levels are used to fill out any levels not occupied by specific -# levels as defined above. "filla" is the upper filler, between the -# start and locate levels, and "fillb" the lower between the locate -# and goal levels. -# - -LEVEL: "Wiz-fila" -# -ROOM: "ordinary" , random, random, random, random { - STAIR: random, up - OBJECT: random,random - MONSTER: 'i', random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random,random - MONSTER: 'i', random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - OBJECT: random,random - MONSTER: ('B', "vampire bat"), random - MONSTER: ('B', "vampire bat"), random -} - -ROOM: "ordinary" , random, random, random, random { - STAIR: random, down - OBJECT: random, random - TRAP: random, random - MONSTER: 'i', random, hostile - MONSTER: ('B', "vampire bat"), random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random, random - TRAP: random, random - MONSTER: 'i', random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - MONSTER: ('B', "vampire bat"), random -} - -RANDOM_CORRIDORS - -LEVEL: "Wiz-filb" -# -ROOM: "ordinary" , random, random, random, random { - STAIR: random, up - OBJECT: random,random - MONSTER: 'X', random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random,random - MONSTER: 'i', random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - OBJECT: random,random - MONSTER: 'X', random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - STAIR: random, down - OBJECT: random, random - TRAP: random, random - MONSTER: 'i', random, hostile - MONSTER: ('B', "vampire bat"), random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random, random - TRAP: random, random - MONSTER: 'i', random, hostile -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - MONSTER: ('B', "vampire bat"), random -} - -RANDOM_CORRIDORS diff --git a/dat/air.lua b/dat/air.lua new file mode 100644 index 000000000..ba925c86a --- /dev/null +++ b/dat/air.lua @@ -0,0 +1,108 @@ +-- NetHack 3.6 endgame.des $NHDT-Date: 1546303680 2019/01/01 00:48:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.14 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1992,1993 by Izchak Miller, David Cohrs, +-- and Timo Hakulinen +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor", "shortsighted") +-- The following messages are somewhat obtuse, to make then +-- equally meaningful if the player can see or not. +des.message("What a strange feeling!") +des.message("You notice that there is no gravity here.") +-- The player lands, upon arrival, in the +-- lower-left area. The location of the +-- portal to the next level is randomly chosen. +-- This map has no visible outer boundary, and +-- is all "air". +des.map([[ +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +]]); +-- Use up and down regions to partition the level into three parts; +-- teleportation can't cross from one part into another. +-- The up region is where you'll arrive after activating the portal from +-- the preceding level; the exit portal is placed inside the down region. +des.teleport_region({ region = {01,00,24,20}, region_islev = 1, exclude = {25,00,79,20}, exclude_islev=1, dir="up" }) +des.teleport_region({ region = {56,00,79,20}, region_islev = 1, exclude = {01,00,55,20}, exclude_islev=1, dir="down" }) + +-- des.portal(levregion(57,01,78,19),(0,0,0,0),"fire") +des.levregion({ region = {57,01,78,19}, region_islev=1, type="portal", name="fire" }); +des.region(selection.area(00,00,75,19),"lit") +des.monster({ id = "air elemental", peaceful = 0 }) +des.monster({ id = "air elemental", peaceful = 0 }) +des.monster({ id = "air elemental", peaceful = 0 }) +des.monster({ id = "air elemental", peaceful = 0 }) +des.monster({ id = "air elemental", peaceful = 0 }) +des.monster({ id = "air elemental", peaceful = 0 }) +des.monster({ id = "air elemental", peaceful = 0 }) +des.monster({ id = "air elemental", peaceful = 0 }) +des.monster({ id = "air elemental", peaceful = 0 }) +des.monster({ id = "air elemental", peaceful = 0 }) +des.monster({ id = "air elemental", peaceful = 0 }) + +des.monster({ id = "floating eye", peaceful = 0 }) +des.monster({ id = "floating eye", peaceful = 0 }) +des.monster({ id = "floating eye", peaceful = 0 }) + +des.monster({ id = "yellow light", peaceful = 0 }) +des.monster({ id = "yellow light", peaceful = 0 }) +des.monster({ id = "yellow light", peaceful = 0 }) + +des.monster("couatl") + +des.monster("D") +des.monster("D") +des.monster("D") +des.monster("D") +des.monster("D") + +des.monster("E") +des.monster("E") +des.monster("E") +des.monster("J") +des.monster("J") + +des.monster({ id = "djinni", peaceful = 0 }) +des.monster({ id = "djinni", peaceful = 0 }) +des.monster({ id = "djinni", peaceful = 0 }) + +des.monster({ id = "fog cloud", peaceful = 0 }) +des.monster({ id = "fog cloud", peaceful = 0 }) +des.monster({ id = "fog cloud", peaceful = 0 }) +des.monster({ id = "fog cloud", peaceful = 0 }) +des.monster({ id = "fog cloud", peaceful = 0 }) +des.monster({ id = "fog cloud", peaceful = 0 }) +des.monster({ id = "fog cloud", peaceful = 0 }) +des.monster({ id = "fog cloud", peaceful = 0 }) +des.monster({ id = "fog cloud", peaceful = 0 }) +des.monster({ id = "energy vortex", peaceful = 0 }) +des.monster({ id = "energy vortex", peaceful = 0 }) +des.monster({ id = "energy vortex", peaceful = 0 }) +des.monster({ id = "energy vortex", peaceful = 0 }) +des.monster({ id = "energy vortex", peaceful = 0 }) +des.monster({ id = "steam vortex", peaceful = 0 }) +des.monster({ id = "steam vortex", peaceful = 0 }) +des.monster({ id = "steam vortex", peaceful = 0 }) +des.monster({ id = "steam vortex", peaceful = 0 }) +des.monster({ id = "steam vortex", peaceful = 0 }) + diff --git a/dat/asmodeus.lua b/dat/asmodeus.lua new file mode 100644 index 000000000..7191f12cd --- /dev/null +++ b/dat/asmodeus.lua @@ -0,0 +1,88 @@ +-- NetHack 3.6 gehennom.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1992 by M. Stephenson and Izchak Miller +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style="mazegrid", bg ="-" }); + +des.level_flags("mazelevel", "noteleport") +-- First part +des.map({ halign = "half-left", valign = "center", map = [[ +--------------------- +|.............|.....| +|.............S.....| +|---+------------...| +|.....|.........|-+-- +|..---|.........|.... +|..|..S.........|.... +|..|..|.........|.... +|..|..|.........|-+-- +|..|..-----------...| +|..S..........|.....| +--------------------- +]] }); + +des.levregion({ region={01,00,6,20}, region_islev=1, exclude={6,1,70,16}, exclude_islev=1, type="stair-up" }); +-- des.stair(levregion(01,00,6,20),levregion(6,1,70,16),up) + +des.levregion({ region={01,00,6,20}, region_islev=1, exclude={6,1,70,16}, exclude_islev=1, type="branch" }); +-- des.branch(levregion(01,00,6,20),levregion(6,1,70,16)) +des.teleport_region({ region = {01,00,6,20}, region_islev=1, exclude={6,1,70,16}, exclude_islev=1 }) + +-- Doors +des.door("closed",04,03) +des.door("locked",18,04) +des.door("closed",18,08) +-- +des.stair("down", 13,07) +-- Non diggable walls +des.non_diggable(selection.area(00,00,20,11)) +-- Entire main area +des.region(selection.area(01,01,20,10),"unlit") +-- The fellow in residence +des.monster("Asmodeus",12,07) +-- Some random weapons and armor. +des.object("[") +des.object("[") +des.object(")") +des.object(")") +des.object("*") +des.object("!") +des.object("!") +des.object("?") +des.object("?") +des.object("?") +-- Some traps. +des.trap("spiked pit", 05,02) +des.trap("fire", 08,06) +des.trap("sleep gas") +des.trap("anti magic") +des.trap("fire") +des.trap("magic") +des.trap("magic") +-- Random monsters. +des.monster("ghost",11,07) +des.monster("horned devil",10,05) +des.monster("L") +-- Some Vampires for good measure +des.monster("V") +des.monster("V") +des.monster("V") +-- Second part +des.map({ halign = "half-right", valign = "center", map = [[ +--------------------------------- +................................| +................................+ +................................| +--------------------------------- +]] }); +des.mazewalk(32,02,"east") +-- Non diggable walls +des.non_diggable(selection.area(00,00,32,04)) +des.door("closed",32,02) +des.monster("&") +des.monster("&") +des.monster("&") +des.trap("anti magic") +des.trap("fire") +des.trap("magic") diff --git a/dat/astral.lua b/dat/astral.lua new file mode 100644 index 000000000..546022320 --- /dev/null +++ b/dat/astral.lua @@ -0,0 +1,187 @@ +-- NetHack 3.6 endgame.des $NHDT-Date: 1546303680 2019/01/01 00:48:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.14 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1992,1993 by Izchak Miller, David Cohrs, +-- and Timo Hakulinen +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor", "nommap", "shortsighted", "solidify") +des.message("You arrive on the Astral Plane!") +des.message("Here the High Temple of %d is located.") +des.message("You sense alarm, hostility, and excitement in the air!") +des.map([[ + --------------- + |.............| + |..---------..| + |..|.......|..| +--------------- |..|.......|..| --------------- +|.............| |..|.......|..| |.............| +|..---------..-| |-------| |..|.......|..| |-------| |-..---------..| +|..|.......|...-| |-.......-| |..|.......|..| |-.......-| |-...|.......|..| +|..|.......|....-|-.........-||..----+----..||-.........-|-....|.......|..| +|..|.......+.....+...........||.............||...........+.....+.......|..| +|..|.......|....-|-.........-|--|.........|--|-.........-|-....|.......|..| +|..|.......|...-| |-.......-| -|---+---|- |-.......-| |-...|.......|..| +|..---------..-| |---+---| |-.......-| |---+---| |-..---------..| +|.............| |...|-----|-.........-|-----|...| |.............| +--------------- |.........|...........|.........| --------------- + -------...|-.........-|...------- + |....|-.......-|....| + ---...|---+---|...--- + |...............| + ----------------- +]]); + +-- chance to alter above map and turn the wings of the bottom-center into +-- a pair of big (5x15) rooms +for i=1,2 do + -- 3.6.[01]: 75% chance that both sides opened up, 25% that neither did; + -- 3.6.2: 60% twice == 36% chance that both sides open up, 24% left side + -- only, 24% right side only, 16% that neither side opens up + local hall = selection.new() + if math.random(0, 99) < 60 then + if i == 1 then + des.terrain(selection.area(17,14, 30,18),".") + des.wallify() + -- temporarily close off the area to be filled so that it doesn't cover + -- the entire entry area + des.terrain(33,18, "|") + hall:floodfill(30,16) + -- re-connect the opened wing with the rest of the map + des.terrain(33,18, ".") + else + des.terrain(selection.area(44,14, 57,18),".") + des.wallify() + des.terrain(41,18, "|") + hall:floodfill(44,16) + des.terrain(41,18, ".") + end + -- extra monsters; was [6 + 3d4] when both wings were opened up at once + for i=1,3 + math.random(2 - 1,2*3) do + des.monster({ id="Angel", coord = { hall:rndcoord(1) }, align="noalign", peaceful=0 }) + if math.random(0,99) < 50 then + des.monster({ coord = { hall:rndcoord(1) }, peaceful=0 }) + end + end + end +end + +-- Rider locations +local place = selection.new(); +place:set(23,9); +place:set(37,14); +place:set(51,9); + +-- Where the player will land on arrival +des.teleport_region({ region = {29,15,45,15}, exclude = {30,15,44,15} }) +-- Lit courts +des.region({ region={01,05,16,14},lit=1,type="ordinary",prefilled=1,irregular=1 }) +des.region({ region={31,01,44,10},lit=1,type="ordinary",prefilled=1,irregular=1 }) +des.region({ region={61,05,74,14},lit=1,type="ordinary",prefilled=1,irregular=1 }) +-- A Sanctum for each alignment +-- The shrines' alignments are shuffled for +-- each game +des.region({ region={04,07,10,11},lit=1,type="temple" }) +des.region({ region={34,03,40,07},lit=1,type="temple" }) +des.region({ region={64,07,70,11},lit=1,type="temple" }) + +des.altar({ x=07, y=09, align=align[1],type="sanctum" }) +des.altar({ x=37, y=05, align=align[2],type="sanctum" }) +des.altar({ x=67, y=09, align=align[3],type="sanctum" }) +-- Doors +des.door("closed",11,09) +des.door("closed",17,09) +des.door("locked",23,12) +des.door("locked",37,08) +des.door("closed",37,11) +des.door("closed",37,17) +des.door("locked",51,12) +des.door("locked",57,09) +des.door("closed",63,09) +-- Non diggable and phazeable everywhere +des.non_diggable(selection.area(00,00,74,19)) +des.non_passwall(selection.area(00,00,74,19)) +-- Moloch's horde +-- West round room +des.monster({ id = "aligned priest",x=18,y=09,align="noalign", peaceful=0 }) +des.monster({ id = "aligned priest",x=19,y=08,align="noalign", peaceful=0 }) +des.monster({ id = "aligned priest",x=19,y=09,align="noalign", peaceful=0 }) +des.monster({ id = "aligned priest",x=19,y=10,align="noalign", peaceful=0 }) +des.monster({ id = "Angel",x=20,y=09,align="noalign", peaceful=0 }) +des.monster({ id = "Angel",x=20,y=10,align="noalign", peaceful=0 }) +des.monster({ id = "Pestilence", coord = { place:rndcoord(1) }, peaceful=0 }) +-- South-central round room +des.monster({ id = "aligned priest",x=36,y=12,align="noalign", peaceful=0 }) +des.monster({ id = "aligned priest",x=37,y=12,align="noalign", peaceful=0 }) +des.monster({ id = "aligned priest",x=38,y=12,align="noalign", peaceful=0 }) +des.monster({ id = "aligned priest",x=36,y=13,align="noalign", peaceful=0 }) +des.monster({ id = "Angel",x=38,y=13,align="noalign", peaceful=0 }) +des.monster({ id = "Angel",x=37,y=13,align="noalign", peaceful=0 }) +des.monster({ id = "Death", coord = { place:rndcoord(1) }, peaceful=0 }) +-- East round room +des.monster({ id = "aligned priest",x=56,y=09,align="noalign", peaceful=0 }) +des.monster({ id = "aligned priest",x=55,y=08,align="noalign", peaceful=0 }) +des.monster({ id = "aligned priest",x=55,y=09,align="noalign", peaceful=0 }) +des.monster({ id = "aligned priest",x=55,y=10,align="noalign", peaceful=0 }) +des.monster({ id = "Angel",x=54,y=09,align="noalign", peaceful=0 }) +des.monster({ id = "Angel",x=54,y=10,align="noalign", peaceful=0 }) +des.monster({ id = "Famine", coord = { place:rndcoord(1) }, peaceful=0 }) +-- +-- The aligned horde +-- +-- We do not know in advance the alignment of the +-- player. The mpeaceful bit will need resetting +-- when the level is created. The setting here is +-- but a place holder. +-- +-- West court +des.monster({ id = "aligned priest",x=12,y=07,align="chaos", peaceful=0 }) +des.monster({ id = "aligned priest",x=13,y=07,align="chaos",peaceful=1 }) +des.monster({ id = "aligned priest",x=14,y=07,align="law", peaceful=0 }) +des.monster({ id = "aligned priest",x=12,y=11,align="law",peaceful=1 }) +des.monster({ id = "aligned priest",x=13,y=11,align="neutral", peaceful=0 }) +des.monster({ id = "aligned priest",x=14,y=11,align="neutral",peaceful=1 }) +des.monster({ id = "Angel",x=11,y=05,align="chaos", peaceful=0 }) +des.monster({ id = "Angel",x=12,y=05,align="chaos",peaceful=1 }) +des.monster({ id = "Angel",x=13,y=05,align="law", peaceful=0 }) +des.monster({ id = "Angel",x=11,y=13,align="law",peaceful=1 }) +des.monster({ id = "Angel",x=12,y=13,align="neutral", peaceful=0 }) +des.monster({ id = "Angel",x=13,y=13,align="neutral",peaceful=1 }) +-- Central court +des.monster({ id = "aligned priest",x=32,y=09,align="chaos", peaceful=0 }) +des.monster({ id = "aligned priest",x=33,y=09,align="chaos",peaceful=1 }) +des.monster({ id = "aligned priest",x=34,y=09,align="law", peaceful=0 }) +des.monster({ id = "aligned priest",x=40,y=09,align="law",peaceful=1 }) +des.monster({ id = "aligned priest",x=41,y=09,align="neutral", peaceful=0 }) +des.monster({ id = "aligned priest",x=42,y=09,align="neutral",peaceful=1 }) +des.monster({ id = "Angel",x=31,y=08,align="chaos", peaceful=0 }) +des.monster({ id = "Angel",x=32,y=08,align="chaos",peaceful=1 }) +des.monster({ id = "Angel",x=31,y=09,align="law", peaceful=0 }) +des.monster({ id = "Angel",x=42,y=08,align="law",peaceful=1 }) +des.monster({ id = "Angel",x=43,y=08,align="neutral", peaceful=0 }) +des.monster({ id = "Angel",x=43,y=09,align="neutral",peaceful=1 }) +-- East court +des.monster({ id = "aligned priest",x=60,y=07,align="chaos", peaceful=0 }) +des.monster({ id = "aligned priest",x=61,y=07,align="chaos",peaceful=1 }) +des.monster({ id = "aligned priest",x=62,y=07,align="law", peaceful=0 }) +des.monster({ id = "aligned priest",x=60,y=11,align="law",peaceful=1 }) +des.monster({ id = "aligned priest",x=61,y=11,align="neutral", peaceful=0 }) +des.monster({ id = "aligned priest",x=62,y=11,align="neutral",peaceful=1 }) +des.monster({ id = "Angel",x=61,y=05,align="chaos", peaceful=0 }) +des.monster({ id = "Angel",x=62,y=05,align="chaos",peaceful=1 }) +des.monster({ id = "Angel",x=63,y=05,align="law", peaceful=0 }) +des.monster({ id = "Angel",x=61,y=13,align="law",peaceful=1 }) +des.monster({ id = "Angel",x=62,y=13,align="neutral", peaceful=0 }) +des.monster({ id = "Angel",x=63,y=13,align="neutral",peaceful=1 }) +-- +-- Assorted nasties +des.monster({ class = "L", peaceful=0 }) +des.monster({ class = "L", peaceful=0 }) +des.monster({ class = "L", peaceful=0 }) +des.monster({ class = "V", peaceful=0 }) +des.monster({ class = "V", peaceful=0 }) +des.monster({ class = "V", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) +des.monster({ class = "D", peaceful=0 }) diff --git a/dat/baalz.lua b/dat/baalz.lua new file mode 100644 index 000000000..04d6a4634 --- /dev/null +++ b/dat/baalz.lua @@ -0,0 +1,72 @@ +-- NetHack 3.6 gehennom.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1992 by M. Stephenson and Izchak Miller +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +-- TODO FIXME: see baalz_fixup - the legs get removed currently. + +des.level_flags("mazelevel", "noteleport", "corrmaze") +-- the two pools are fakes used to mark spots which need special wall fixups +-- the two iron bars are eyes and spots to their left will be made diggable +des.map({ halign = "right", valign = "center", map = [[ +------------------------------------------------- +| ---- ---- +| ---- | ----------- | +| ------ | ---------|.........|--P +| F....| -------|...........-------------- +---....|--|..................S............|---- ++...--....S..----------------|............S...| +---....|--|..................|............|---- +| F....| -------|...........-----S-------- +| ------ | ---------|.........|--P +| ---- | ----------- | +| ---- ---- +------------------------------------------------- +]] }); +des.levregion({ region = {01,00,15,20}, region_islev=1, exclude={15,1,70,16}, exclude_islev=1, type="stair-up" }) +des.levregion({ region = {01,00,15,20}, region_islev=1, exclude={15,1,70,16}, exclude_islev=1, type="branch" }) +des.teleport_region({region = {01,00,15,20}, region_islev=1, exclude = {15,1,70,16}, exclude_islev=1 }) +-- this actually leaves the farthest right column diggable +des.non_diggable(selection.area(00,00,47,12)) +des.mazewalk(00,06,"west") +des.stair("down", 44,06) +des.door("locked",00,06) +if math.random(0, 99) < 50 then + des.terrain(34,08,'-') + des.terrain(34,04,'S') + des.terrain(29,05,'|') + des.terrain(29,07,'S') +end +-- The fellow in residence +des.monster("Baalzebub",35,06) +-- Some random weapons and armor. +des.object("[") +des.object("[") +des.object(")") +des.object(")") +des.object("*") +des.object("!") +des.object("!") +des.object("?") +des.object("?") +des.object("?") +-- Some traps. +des.trap("spiked pit") +des.trap("fire") +des.trap("sleep gas") +des.trap("anti magic") +des.trap("fire") +des.trap("magic") +des.trap("magic") +-- Random monsters. +des.monster("ghost",37,07) +des.monster("horned devil",32,05) +des.monster("barbed devil",38,07) +des.monster("L") +-- Some Vampires for good measure +des.monster("V") +des.monster("V") +des.monster("V") + diff --git a/dat/bigrm-1.lua b/dat/bigrm-1.lua new file mode 100644 index 000000000..a644b129e --- /dev/null +++ b/dat/bigrm-1.lua @@ -0,0 +1,72 @@ + +des.level_init({ style = "solidfill", fg = " " }); +des.level_flags("mazelevel"); + +des.map([[ +--------------------------------------------------------------------------- +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +--------------------------------------------------------------------------- +]]); + + +if math.random(0,99) < 75 then + local terrains = { "-", "F", "L", "T", "C" }; + local tidx = math.random(1, #terrains); + local choice = math.random(0, 4); + if choice == 0 then + des.terrain(selection.line(10,8, 65,8), terrains[tidx]); + elseif choice == 1 then + local sel = selection.new(); + sel:line(15,4, 15, 13); + sel:line(59,4, 59, 13); + des.terrain(sel, terrains[tidx]); + elseif choice == 2 then + local sel = selection.new(); + sel:line(10,8, 38, 8); + sel:line(37,8, 65, 8); + sel:line(37,3, 37, 8); + sel:line(37,8, 37,14); + des.terrain(sel, terrains[tidx]); + elseif choice == 3 then + des.terrain(selection.rect(4,4, 70,13), terrains[tidx]); + local sel = selection.new(); + sel:line(25,4, 50,4); + sel:line(25,13, 50,13); + des.terrain(sel, '.'); + else + end +end + +des.region(selection.area(01,01, 73, 16), "lit"); + +des.stair("up"); +des.stair("down"); + +des.non_diggable(); + +for i = 1,15 do + des.object(); +end + +for i = 1,6 do + des.trap(); +end + +for i = 1,28 do + des.monster(); +end diff --git a/dat/bigrm-10.lua b/dat/bigrm-10.lua new file mode 100644 index 000000000..693697137 --- /dev/null +++ b/dat/bigrm-10.lua @@ -0,0 +1,58 @@ + + +des.level_init({ style = "solidfill", fg = " " }); +des.level_flags("mazelevel"); + +des.map([[ +....................................................................... +....................................................................... +....................................................................... +....................................................................... +...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C... +...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC... +...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C... +...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC... +...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C... +...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC... +...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C... +...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC... +...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C... +...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC... +...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C... +....................................................................... +....................................................................... +....................................................................... +....................................................................... +]]); + +if math.random(0,99) < 40 then + -- occasionally it's not a fog maze + local terrain = { "L", "}", "T", "-", "F" }; + local tidx = math.random(1, #terrain); + -- break it up a bit + des.replace_terrain({ region={0, 0, 70, 18}, fromterrain="C", toterrain=".", chance=5 }); + des.replace_terrain({ region={0, 0, 70, 18}, fromterrain="C", toterrain=terrain[tidx] }); +end; + +des.region(selection.area(00,00,70,18), "lit"); + +-- when falling down on this level, never end up in the fog maze +des.teleport_region({ region = {00,00,70,18}, exclude = {02,03,68,15}, dir = "down" }); + +for i = 1,15 do + des.object(); +end + +for i = 1,6 do + des.trap(); +end + +for i = 1,28 do + des.monster(); +end + +des.mazewalk({ x=4, y=2, dir="south", stocked=0 }); + +-- Stairs up, not in the fog maze +des.levregion({ region = {00,00,70,18}, exclude = {02,03,68,15}, type="stair-up"}); +des.stair("down"); diff --git a/dat/bigrm-2.lua b/dat/bigrm-2.lua new file mode 100644 index 000000000..5d7b3f987 --- /dev/null +++ b/dat/bigrm-2.lua @@ -0,0 +1,57 @@ + +des.level_init({ style = "solidfill", fg = " " }); +des.level_flags("mazelevel"); + +des.map([[ +--------------------------------------------------------------------------- +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +--------------------------------------------------------------------------- +]]); +-- Dungeon Description +des.region(selection.area(01,01,73,16),"lit"); + +local choice = math.random(0, 3) +if choice == 0 then + des.region(selection.area(01,07,22,09),"unlit"); + des.region(selection.area(24,01,50,05),"unlit"); + des.region(selection.area(24,11,50,16),"unlit"); + des.region(selection.area(52,07,73,09),"unlit"); +elseif choice == 1 then + des.region(selection.area(24,01,50,16),"unlit"); +elseif choice == 2 then + des.region(selection.area(01,01,22,16),"unlit"); + des.region(selection.area(52,01,73,16),"unlit"); +end + +-- Stairs +des.stair("up"); +des.stair("down"); +-- Non diggable walls +des.non_diggable(); +-- Objects +for i = 1,15 do + des.object(); +end +-- Random traps +for i = 1,6 do + des.trap(); +end +-- Random monsters. +for i = 1,28 do + des.monster(); +end diff --git a/dat/bigrm-3.lua b/dat/bigrm-3.lua new file mode 100644 index 000000000..2f36fc533 --- /dev/null +++ b/dat/bigrm-3.lua @@ -0,0 +1,71 @@ + +des.level_init({ style = "solidfill", fg = " " }); +des.level_flags("mazelevel"); + +des.map([[ +--------------------------------------------------------------------------- +|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|..............---.......................................---..............| +|...............|.........................................|...............| +|.....|.|.|.|.|---|.|.|.|.|...................|.|.|.|.|.|---|.|.|.|.|.....| +|.....|-------- --------|...................|---------- --------|.....| +|.....|.|.|.|.|---|.|.|.|.|...................|.|.|.|.|.|---|.|.|.|.|.....| +|...............|.........................................|...............| +|..............---.......................................---..............| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.........................................................................| +|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.| +--------------------------------------------------------------------------- +]]); + +-- Dungeon Description +des.region(selection.area(01,01,73,16), "lit"); + +-- Stairs +des.stair("up"); +des.stair("down"); + +-- Non diggable walls +des.non_diggable(); + +for i = 1,15 do + des.object(); +end + +for i = 1,6 do + des.trap(); +end + +des.monster({ x = 01, y = 01 }); +des.monster({ x = 13, y = 01 }); +des.monster({ x = 25, y = 01 }); +des.monster({ x = 37, y = 01 }); +des.monster({ x = 49, y = 01 }); +des.monster({ x = 61, y = 01 }); +des.monster({ x = 73, y = 01 }); +des.monster({ x = 07, y = 07 }); +des.monster({ x = 13, y = 07 }); +des.monster({ x = 25, y = 07 }); +des.monster({ x = 37, y = 07 }); +des.monster({ x = 49, y = 07 }); +des.monster({ x = 61, y = 07 }); +des.monster({ x = 67, y = 07 }); +des.monster({ x = 07, y = 09 }); +des.monster({ x = 13, y = 09 }); +des.monster({ x = 25, y = 09 }); +des.monster({ x = 37, y = 09 }); +des.monster({ x = 49, y = 09 }); +des.monster({ x = 61, y = 09 }); +des.monster({ x = 67, y = 09 }); +des.monster({ x = 01, y = 16 }); +des.monster({ x = 13, y = 16 }); +des.monster({ x = 25, y = 16 }); +des.monster({ x = 37, y = 16 }); +des.monster({ x = 49, y = 16 }); +des.monster({ x = 61, y = 16 }); +des.monster({ x = 73, y = 16 }); diff --git a/dat/bigrm-4.lua b/dat/bigrm-4.lua new file mode 100644 index 000000000..d86f46b48 --- /dev/null +++ b/dat/bigrm-4.lua @@ -0,0 +1,43 @@ + +des.level_init({ style = "solidfill", fg = " " }); +des.level_flags("mazelevel"); + +des.map([[ +----------- ----------- +|.........| |.........| +|.........|-----------| |-----------|.........| +|-|...................|----------| |----------|...................|-| + -|.............................|-------|.............................|- + -|.................................................................|- + -|...............................................................|- + -|.............................................................|- + -|...........................................................|- + -|...........................................................|- + -|.............................................................|- + -|...............................................................|- + -|.................................................................|- + -|.............................|-------|.............................|- +|-|...................|----------| |----------|...................|-| +|.........|-----------| |-----------|.........| +|.........| |.........| +----------- ----------- +]]); + +des.region(selection.area(01,01,73,16), "lit"); + +des.stair("up"); +des.stair("down"); + +des.non_diggable(); + +for i = 1,15 do + des.object(); +end + +for i = 1,6 do + des.trap(); +end + +for i = 1,28 do + des.monster(); +end diff --git a/dat/bigrm-5.lua b/dat/bigrm-5.lua new file mode 100644 index 000000000..c85f55e12 --- /dev/null +++ b/dat/bigrm-5.lua @@ -0,0 +1,44 @@ + +des.level_init({ style = "solidfill", fg = " " }); +des.level_flags("mazelevel"); + +des.map([[ + ------------------ + ---------................--------- + -------................................------- + ------............................................------ + ----......................................................---- + ---............................................................--- + ---................................................................--- +---....................................................................--- +|........................................................................| +|........................................................................| +|........................................................................| +---....................................................................--- + ---................................................................--- + ---............................................................--- + ----......................................................---- + ------............................................------ + -------................................------- + ---------................--------- + ------------------ +]]); + +des.region(selection.area(00,00,72,18), "lit"); + +des.stair("up"); +des.stair("down"); + +des.non_diggable(); + +for i = 1,15 do + des.object(); +end + +for i = 1,6 do + des.trap(); +end + +for i = 1,28 do + des.monster(); +end diff --git a/dat/bigrm-6.lua b/dat/bigrm-6.lua new file mode 100644 index 000000000..6138be67e --- /dev/null +++ b/dat/bigrm-6.lua @@ -0,0 +1,45 @@ + + +des.level_init({ style = "solidfill", fg = " " }); +des.level_flags("mazelevel"); + +des.map([[ + --------- --------- --------- --------- + ---.......--- ---.......--- ---.......--- ---.......--- + --...........-- --...........-- --...........-- --...........-- + --.............-- --.............-- --.............-- --.............-- + -...............- -...............- -...............- -...............- +|-...............---...............---...............---...............-- +|.................-.................-.................-.................| +|........T.................T.................T.................T........| +|.......................................................................| +|......T.{.....................................................{.T......| +|.......................................................................| +|........T.................T.................T.................T........| +|.................-.................-.................-.................| +--...............---...............---...............---...............-- + -...............- -...............- -...............- -...............- + --.............-- --.............-- --.............-- --.............-- + --...........-- --...........-- --...........-- --...........-- + ---.......--- ---.......--- ---.......--- ---.......--- + --------- --------- --------- --------- +]]); + +des.region(selection.area(01,01,72,17), "lit"); + +des.stair("up"); +des.stair("down"); + +des.non_diggable(); + +for i = 1,15 do + des.object(); +end + +for i = 1,6 do + des.trap(); +end + +for i = 1,28 do + des.monster(); +end diff --git a/dat/bigrm-7.lua b/dat/bigrm-7.lua new file mode 100644 index 000000000..e8fccc8cf --- /dev/null +++ b/dat/bigrm-7.lua @@ -0,0 +1,48 @@ + +des.level_init({ style = "solidfill", fg = " " }); +des.level_flags("mazelevel"); + +des.map([[ + ----- + ---------...--- + ---------.........L...--- + ---------.......................--- + ---------.................................--- + ---------...........................................--- + ---------.....................................................--- +|--------...............................................................--| +|.........................................................................| +|.L.....................................................................L.| +|.........................................................................| +|--...............................................................--------| + ---.....................................................--------- + ---...........................................--------- + ---.................................--------- + ---.......................--------- + ---...L.........--------- + ---...--------- + ----- +]]); + +local terrain = { "L", "T", "{", "." }; +local tidx = math.random(1, #terrain); +des.replace_terrain({ region={00,00, 74,18}, fromterrain="L", toterrain=terrain[tidx] }); + +des.region(selection.area(01,01,73,17), "lit"); + +des.stair("up"); +des.stair("down"); + +des.non_diggable(); + +for i = 1,15 do + des.object(); +end + +for i = 1,6 do + des.trap(); +end + +for i = 1,28 do + des.monster(); +end diff --git a/dat/bigrm-8.lua b/dat/bigrm-8.lua new file mode 100644 index 000000000..2851b780d --- /dev/null +++ b/dat/bigrm-8.lua @@ -0,0 +1,50 @@ + + +des.level_init({ style = "solidfill", fg = " " }); +des.level_flags("mazelevel"); + +des.map([[ +---------------------------------------------- +|............................................--- +--.............................................--- + ---......................................FF.....--- + ---...................................FF........--- + ---................................FF...........--- + ---.............................FF..............--- + ---..........................FF.................--- + ---.......................FF....................--- + ---....................FF.......................--- + ---.................FF..........................--- + ---..............FF.............................--- + ---...........FF................................---- + ---........FF...................................--- + ---.....FF......................................--- + ---.............................................-- + ---............................................| + ---------------------------------------------- +]]); + +if math.random(0,99) < 40 then + local terrain = { "L", "}", "T", ".", "-", "C" }; + local tidx = math.random(1, #terrain); + des.replace_terrain({ region={00,00, 74,17}, fromterrain="F", toterrain=terrain[tidx] }); +end; + +des.region(selection.area(01,01,73,16), "lit"); + +des.stair("up"); +des.stair("down"); + +des.non_diggable(); + +for i = 1,15 do + des.object(); +end + +for i = 1,6 do + des.trap(); +end + +for i = 1,28 do + des.monster(); +end diff --git a/dat/bigrm-9.lua b/dat/bigrm-9.lua new file mode 100644 index 000000000..a1fdcd05f --- /dev/null +++ b/dat/bigrm-9.lua @@ -0,0 +1,48 @@ + +des.level_init({ style = "solidfill", fg = " " }); +des.level_flags("mazelevel"); + +des.map([[ +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}................}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}................................}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}}............................................}}}}}}}}}}}}}}} +}}}}}}}}}}......................................................}}}}}}}}}} +}}}}}}}............................................................}}}}}}} +}}}}}.......................LLLLLLLLLLLLLLLLLL.......................}}}}} +}}}....................LLLLLLLLLLLLLLLLLLLLLLLLLLL.....................}}} +}....................LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL....................} +}....................LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL....................} +}....................LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL....................} +}}}....................LLLLLLLLLLLLLLLLLLLLLLLLLLL.....................}}} +}}}}}.......................LLLLLLLLLLLLLLLLLL.......................}}}}} +}}}}}}}............................................................}}}}}}} +}}}}}}}}}}......................................................}}}}}}}}}} +}}}}}}}}}}}}}}}............................................}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}................................}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}................}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +]]); + +-- Unlit, except 3 mapgrids around the "pupil" +des.region(selection.area(00,00,73,18),"unlit"); +des.region(selection.area(26,04,47,14),"lit"); +des.region(selection.area(21,05,51,13),"lit"); +des.region(selection.area(19,06,54,12),"lit"); + +des.stair("up"); +des.stair("down"); + +des.non_diggable(); + +for i = 1,15 do + des.object(); +end + +for i = 1,6 do + des.trap(); +end + +for i = 1,28 do + des.monster(); +end diff --git a/dat/bigroom.des b/dat/bigroom.des deleted file mode 100644 index dcec9854b..000000000 --- a/dat/bigroom.des +++ /dev/null @@ -1,723 +0,0 @@ -# NetHack 3.6 bigroom.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# Copyright (c) 1990 by M. Stephenson -# NetHack may be freely redistributed. See license for details. -# -# These are the bigroom levels: -# - -MAZE:"bigrm-1",' ' -GEOMETRY:center,center -MAP ---------------------------------------------------------------------------- -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| ---------------------------------------------------------------------------- -ENDMAP - -$terrains = TERRAIN:{'-', 'F', 'L', 'T', 'C'} -SHUFFLE:$terrains - -[50%]: SWITCH [ 4 ] { - CASE 0: - TERRAIN:line (10,8),(65, 8), $terrains[0] - BREAK - CASE 1: - TERRAIN:line (15,4),(15, 13), $terrains[0] - TERRAIN:line (59,4),(59, 13), $terrains[0] - BREAK - CASE 2: - TERRAIN:line (10,8),(38, 8), $terrains[0] - TERRAIN:line (37,8),(65, 8), $terrains[0] - TERRAIN:line (37,3),(37, 8), $terrains[0] - TERRAIN:line (37,8),(37,14), $terrains[0] - BREAK - CASE 3: - TERRAIN:rect (4,4,70,13), $terrains[0] - TERRAIN:line (25, 4),(50, 4), '.' - TERRAIN:line (25,13),(50,13), '.' - BREAK - DEFAULT: -} - -# Dungeon Description -REGION:(01,01,73,16),lit,"ordinary" -# Stairs -STAIR:random,up -STAIR:random,down -# Non diggable walls -NON_DIGGABLE:(00,00,74,17) -# Objects -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random - -# Here, just play with the lighting... - -MAZE:"bigrm-2",' ' -GEOMETRY:center,center -MAP ---------------------------------------------------------------------------- -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| ---------------------------------------------------------------------------- -ENDMAP -# Dungeon Description -REGION:(01,01,73,16),lit,"ordinary" -SWITCH [ 3 ] { - CASE 0: - REGION:(01,07,22,09),unlit,"ordinary" - REGION:(24,01,50,05),unlit,"ordinary" - REGION:(24,11,50,16),unlit,"ordinary" - REGION:(52,07,73,09),unlit,"ordinary" - BREAK - CASE 1: - REGION:(24,01,50,16),unlit,"ordinary" - BREAK - CASE 2: - REGION:(01,01,22,16),unlit,"ordinary" - REGION:(52,01,73,16),unlit,"ordinary" - BREAK -} -# Stairs -STAIR:random,up -STAIR:random,down -# Non diggable walls -NON_DIGGABLE:(00,00,74,17) -# Objects -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random - -# Now, let's get fancy... - -MAZE:"bigrm-3",' ' -GEOMETRY:center,center -MAP ---------------------------------------------------------------------------- -|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|..............---.......................................---..............| -|...............|.........................................|...............| -|.....|.|.|.|.|---|.|.|.|.|...................|.|.|.|.|.|---|.|.|.|.|.....| -|.....|-------- --------|...................|---------- --------|.....| -|.....|.|.|.|.|---|.|.|.|.|...................|.|.|.|.|.|---|.|.|.|.|.....| -|...............|.........................................|...............| -|..............---.......................................---..............| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.........................................................................| -|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.| ---------------------------------------------------------------------------- -ENDMAP -# Dungeon Description -REGION:(01,01,73,16),lit,"ordinary" -# Stairs -STAIR:random,up -STAIR:random,down -# Non diggable walls -NON_DIGGABLE:(00,00,74,17) -# Objects -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:random,(01,01) -MONSTER:random,(13,01) -MONSTER:random,(25,01) -MONSTER:random,(37,01) -MONSTER:random,(49,01) -MONSTER:random,(61,01) -MONSTER:random,(73,01) -MONSTER:random,(07,07) -MONSTER:random,(13,07) -MONSTER:random,(25,07) -MONSTER:random,(37,07) -MONSTER:random,(49,07) -MONSTER:random,(61,07) -MONSTER:random,(67,07) -MONSTER:random,(07,09) -MONSTER:random,(13,09) -MONSTER:random,(25,09) -MONSTER:random,(37,09) -MONSTER:random,(49,09) -MONSTER:random,(61,09) -MONSTER:random,(67,09) -MONSTER:random,(01,16) -MONSTER:random,(13,16) -MONSTER:random,(25,16) -MONSTER:random,(37,16) -MONSTER:random,(49,16) -MONSTER:random,(61,16) -MONSTER:random,(73,16) -MAZE:"bigrm-4",' ' -GEOMETRY:center,center -MAP ------------ ----------- -|.........| |.........| -|.........|-----------| |-----------|.........| -|-|...................|----------| |----------|...................|-| - -|.............................|-------|.............................|- - -|.................................................................|- - -|...............................................................|- - -|.............................................................|- - -|...........................................................|- - -|...........................................................|- - -|.............................................................|- - -|...............................................................|- - -|.................................................................|- - -|.............................|-------|.............................|- -|-|...................|----------| |----------|...................|-| -|.........|-----------| |-----------|.........| -|.........| |.........| ------------ ----------- -ENDMAP -# Dungeon Description -REGION:(01,01,73,16),lit,"ordinary" -# Stairs -STAIR:random,up -STAIR:random,down -# Non diggable walls -NON_DIGGABLE:(00,00,74,17) -# Fountains -FOUNTAIN:(05,02) -FOUNTAIN:(05,15) -FOUNTAIN:(69,02) -FOUNTAIN:(69,15) -# Objects -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random - -# Try an oval room... - -MAZE:"bigrm-5",' ' -GEOMETRY:center,center -MAP - ------------------ - ---------................--------- - -------................................------- - ------............................................------ - ----......................................................---- - ---............................................................--- - ---................................................................--- ----....................................................................--- -|........................................................................| -|........................................................................| -|........................................................................| ----....................................................................--- - ---................................................................--- - ---............................................................--- - ----......................................................---- - ------............................................------ - -------................................------- - ---------................--------- - ------------------ -ENDMAP -# Dungeon Description -REGION:(00,00,72,18),lit,"ordinary" -# Stairs -STAIR:random,up -STAIR:random,down -# Non diggable walls -NON_DIGGABLE:(00,00,72,18) -# Objects -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random - - -# The Four Circles - -LEVEL:"bigrm-6" -FLAGS:mazelevel -INIT_MAP:solidfill,' ' -GEOMETRY:center,center -MAP - --------- --------- --------- --------- - ---.......--- ---.......--- ---.......--- ---.......--- - --...........-- --...........-- --...........-- --...........-- - --.............-- --.............-- --.............-- --.............-- - -...............- -...............- -...............- -...............- -|-...............---...............---...............---...............-- -|.................-.................-.................-.................| -|........T.................T.................T.................T........| -|.......................................................................| -|......T.{.....................................................{.T......| -|.......................................................................| -|........T.................T.................T.................T........| -|.................-.................-.................-.................| ---...............---...............---...............---...............-- - -...............- -...............- -...............- -...............- - --.............-- --.............-- --.............-- --.............-- - --...........-- --...........-- --...........-- --...........-- - ---.......--- ---.......--- ---.......--- ---.......--- - --------- --------- --------- --------- -ENDMAP -REGION:(01,01,72,17),lit,"ordinary" - -STAIR:random,up -STAIR:random,down - -NON_DIGGABLE:(00,00,72,18) - -LOOP [15] { - OBJECT:random,random -} -LOOP [6] { - TRAP:random,random -} -LOOP [28] { - MONSTER:random,random -} - - - -# Let's tilt it a bit - -LEVEL:"bigrm-7" -FLAGS:mazelevel -INIT_MAP:solidfill,' ' -GEOMETRY:center,center -MAP - ----- - ---------...--- - ---------.........L...--- - ---------.......................--- - ---------.................................--- - ---------...........................................--- - ---------.....................................................--- -|--------...............................................................--| -|.........................................................................| -|.L.....................................................................L.| -|.........................................................................| -|--...............................................................--------| - ---.....................................................--------- - ---...........................................--------- - ---.................................--------- - ---.......................--------- - ---...L.........--------- - ---...--------- - ----- -ENDMAP - -$terrain = terrain:{ 'L', 'T', '{', '.' } -SHUFFLE:$terrain -REPLACE_TERRAIN:(00,00,74,18),'L',$terrain[0],100% - -REGION:(01,01,73,17),lit,"ordinary" - -STAIR:random,up -STAIR:random,down - -NON_DIGGABLE:(00,00,74,18) - -LOOP [15] { - OBJECT:random,random -} -LOOP [6] { - TRAP:random,random -} -LOOP [28] { - MONSTER:random,random -} - - -# Slanted - -LEVEL:"bigrm-8" -FLAGS:mazelevel -INIT_MAP:solidfill,' ' -GEOMETRY:center,center -MAP ----------------------------------------------- -|............................................--- ---.............................................--- - ---......................................FF.....--- - ---...................................FF........--- - ---................................FF...........--- - ---.............................FF..............--- - ---..........................FF.................--- - ---.......................FF....................--- - ---....................FF.......................--- - ---.................FF..........................--- - ---..............FF.............................--- - ---...........FF................................---- - ---........FF...................................--- - ---.....FF......................................--- - ---.............................................-- - ---............................................| - ---------------------------------------------- -ENDMAP - -IF [40%] { - $terrain = TERRAIN:{ 'L', '}', 'T', '.', '-', 'C' } - SHUFFLE:$terrain - REPLACE_TERRAIN:(0,0,74,17),'F', $terrain[0], 100% -} - -REGION:(01,01,73,16),lit,"ordinary" - -STAIR:random,up -STAIR:random,down - -NON_DIGGABLE:(00,00,74,17) - -LOOP [15] { - OBJECT:random,random -} -LOOP [6] { - TRAP:random,random -} -LOOP [28] { - MONSTER:random,random -} - - - -# The Eye - -LEVEL:"bigrm-9" -FLAGS:mazelevel -GEOMETRY:center,center -MAP -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}................}}}}}}}}}}}}}}}}}}}}}}}}}}}}} -}}}}}}}}}}}}}}}}}}}}}................................}}}}}}}}}}}}}}}}}}}}} -}}}}}}}}}}}}}}}............................................}}}}}}}}}}}}}}} -}}}}}}}}}}......................................................}}}}}}}}}} -}}}}}}}............................................................}}}}}}} -}}}}}.......................LLLLLLLLLLLLLLLLLL.......................}}}}} -}}}....................LLLLLLLLLLLLLLLLLLLLLLLLLLL.....................}}} -}....................LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL....................} -}....................LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL....................} -}....................LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL....................} -}}}....................LLLLLLLLLLLLLLLLLLLLLLLLLLL.....................}}} -}}}}}.......................LLLLLLLLLLLLLLLLLL.......................}}}}} -}}}}}}}............................................................}}}}}}} -}}}}}}}}}}......................................................}}}}}}}}}} -}}}}}}}}}}}}}}}............................................}}}}}}}}}}}}}}} -}}}}}}}}}}}}}}}}}}}}}................................}}}}}}}}}}}}}}}}}}}}} -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}................}}}}}}}}}}}}}}}}}}}}}}}}}}}}} -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} -ENDMAP - -# Unlit, except 3 mapgrids around the "pupil" -REGION:(00,00,73,18),unlit,"ordinary" -REGION:(26,04,47,14),lit,"ordinary" -REGION:(21,05,51,13),lit,"ordinary" -REGION:(19,06,54,12),lit,"ordinary" - -STAIR:random,up -STAIR:random,down - -LOOP [15] { - OBJECT:random,random -} -LOOP [6] { - TRAP:random,random -} -LOOP [28] { - MONSTER:random,random -} - - -# Fog Maze - -LEVEL:"bigrm-10" -FLAGS:mazelevel -GEOMETRY:center,center -MAP -....................................................................... -....................................................................... -....................................................................... -....................................................................... -...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C... -...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC... -...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C... -...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC... -...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C... -...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC... -...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C... -...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC... -...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C... -...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC... -...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C... -....................................................................... -....................................................................... -....................................................................... -....................................................................... -ENDMAP - -IF [33%] { - # occasionally it's not a fog maze - $terrain = TERRAIN:{ 'L', '}', 'T', '-', 'F' } - SHUFFLE:$terrain - # break it up a bit - REPLACE_TERRAIN:(0,0,70,18),'C', '.', 5% - REPLACE_TERRAIN:(0,0,70,18),'C', $terrain[0], 100% -} - -REGION:(00,00,70,18),lit,"ordinary" - -# when falling down on this level, never end up in the fog maze -TELEPORT_REGION:(00,00,70,18),(02,03,68,15),down - -LOOP [15] { - OBJECT:random,random -} -LOOP [6] { - TRAP:random,random -} -LOOP [28] { - MONSTER:random,random -} - -MAZEWALK:(4, 2), south, false - -# Stairs up, not in the fog maze -STAIR:(00,00,70,18),(02,03,68,15),up -STAIR:random,down - diff --git a/dat/bogusmon.txt b/dat/bogusmon.txt index 8f88d3f60..7179c8b11 100644 --- a/dat/bogusmon.txt +++ b/dat/bogusmon.txt @@ -1,4 +1,4 @@ -# NetHack 3.6 bogusmon.txt $NHDT-Date: 1524689579 2018/04/25 20:52:59 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.7 $ +# NetHack 3.6 bogusmon.txt $NHDT-Date: 1574387024 2019/11/22 01:43:44 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.8 $ # Copyright (c) 2016 by Pasi Kallinen # NetHack may be freely redistributed. See license for details. # @@ -80,6 +80,15 @@ tofurkey shrinking violet shallow one spherical cow +electric giraffe +steam dragon +omnibus +slinky +maxotaur +octahedron +dungeon core +quale +holloway # Quendor (Zork, &c.) grue @@ -189,6 +198,9 @@ Dalek microscopic space fleet Ravenous Bugblatter Beast of Traal +# The Tough Guide to Fantasyland +leathery-winged avian + # TMNT teenage mutant ninja turtle @@ -239,6 +251,7 @@ corpulent porpoise quokka potoo lemming +dhole # european cryptids wolpertinger @@ -275,6 +288,7 @@ netsplit wiki peer COBOL +wire shark # bugs bohrbug @@ -326,6 +340,7 @@ bold face boustrophedon ligature rebus +dinkus # Their actual character apostrophe golem @@ -336,6 +351,10 @@ voluptuous ampersand +Strong Bad +Magical Trevor +# Girl Genius +smakken +mimmoth + # KoL one-winged dewinged stab-bat @@ -424,6 +443,9 @@ womble # Fraggle Rock fraggle +# Harry Harrison +stainless steel rat + # Spoonerism mock role @@ -475,6 +497,7 @@ geriatric snake gnat ant giant bath grant beetle +greater snake grind bug giant mango glossy golem diff --git a/dat/castle.des b/dat/castle.des deleted file mode 100644 index dd63a1e40..000000000 --- a/dat/castle.des +++ /dev/null @@ -1,249 +0,0 @@ -# NetHack 3.6 castle.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# NetHack may be freely redistributed. See license for details. -# -# This is the stronghold level : -# there are several ways to enter it : -# - opening the drawbridge (wand of opening, knock spell, playing -# the appropriate tune) -# -# - enter via the back entry (this suppose a ring of levitation, boots -# of water walking, etc.) -# -# Note : If you don't play the right tune, you get indications like in the -# MasterMind game... -# -# To motivate the player : there are 4 storerooms (armors, weapons, food and -# gems) and a wand of wishing in one of the 4 towers... - -MAZE:"castle",random -FLAGS: noteleport -GEOMETRY:center,center -MAP -}}}}}}}}}.............................................}}}}}}}}} -}-------}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}-------} -}|.....|-----------------------------------------------|.....|} -}|.....+...............................................+.....|} -}-------------------------------+-----------------------------} -}}}}}}|........|..........+...........|.......S.S.......|}}}}}} -.....}|........|..........|...........|.......|.|.......|}..... -.....}|........------------...........---------S---------}..... -.....}|...{....+..........+.........\.S.................+...... -.....}|........------------...........---------S---------}..... -.....}|........|..........|...........|.......|.|.......|}..... -}}}}}}|........|..........+...........|.......S.S.......|}}}}}} -}-------------------------------+-----------------------------} -}|.....+...............................................+.....|} -}|.....|-----------------------------------------------|.....|} -}-------}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}-------} -}}}}}}}}}.............................................}}}}}}}}} -ENDMAP - -# Random registers initialisation -$object = object: { '[',')','*','%' } -SHUFFLE: $object - -$place = { (04,02),(58,02),(04,14),(58,14) } -SHUFFLE: $place - -$monster = monster: { 'L','N','E','H','M','O','R','T','X','Z' } -SHUFFLE: $monster - - -TELEPORT_REGION:levregion(01,00,10,20),(1,1,61,15),down -TELEPORT_REGION:levregion(69,00,79,20),(1,1,61,15),up -STAIR:levregion(01,00,10,20),(0,0,62,16),up -FOUNTAIN:(10,08) -# Doors -DOOR:closed,(07,03) -DOOR:closed,(55,03) -DOOR:locked,(32,04) -DOOR:locked,(26,05) -DOOR:locked,(46,05) -DOOR:locked,(48,05) -DOOR:locked,(47,07) -DOOR:closed,(15,08) -DOOR:closed,(26,08) -DOOR:locked,(38,08) -DOOR:locked,(56,08) -DOOR:locked,(47,09) -DOOR:locked,(26,11) -DOOR:locked,(46,11) -DOOR:locked,(48,11) -DOOR:locked,(32,12) -DOOR:closed,(07,13) -DOOR:closed,(55,13) -# The drawbridge -DRAWBRIDGE:(05,08),east,closed -# Storeroom number 1 -OBJECT:$object[0],(39,05) -OBJECT:$object[0],(40,05) -OBJECT:$object[0],(41,05) -OBJECT:$object[0],(42,05) -OBJECT:$object[0],(43,05) -OBJECT:$object[0],(44,05) -OBJECT:$object[0],(45,05) -OBJECT:$object[0],(39,06) -OBJECT:$object[0],(40,06) -OBJECT:$object[0],(41,06) -OBJECT:$object[0],(42,06) -OBJECT:$object[0],(43,06) -OBJECT:$object[0],(44,06) -OBJECT:$object[0],(45,06) -# Storeroom number 2 -OBJECT:$object[1],(49,05) -OBJECT:$object[1],(50,05) -OBJECT:$object[1],(51,05) -OBJECT:$object[1],(52,05) -OBJECT:$object[1],(53,05) -OBJECT:$object[1],(54,05) -OBJECT:$object[1],(55,05) -OBJECT:$object[1],(49,06) -OBJECT:$object[1],(50,06) -OBJECT:$object[1],(51,06) -OBJECT:$object[1],(52,06) -OBJECT:$object[1],(53,06) -OBJECT:$object[1],(54,06) -OBJECT:$object[1],(55,06) -# Storeroom number 3 -OBJECT:$object[2],(39,10) -OBJECT:$object[2],(40,10) -OBJECT:$object[2],(41,10) -OBJECT:$object[2],(42,10) -OBJECT:$object[2],(43,10) -OBJECT:$object[2],(44,10) -OBJECT:$object[2],(45,10) -OBJECT:$object[2],(39,11) -OBJECT:$object[2],(40,11) -OBJECT:$object[2],(41,11) -OBJECT:$object[2],(42,11) -OBJECT:$object[2],(43,11) -OBJECT:$object[2],(44,11) -OBJECT:$object[2],(45,11) -# Storeroom number 4 -OBJECT:$object[3],(49,10) -OBJECT:$object[3],(50,10) -OBJECT:$object[3],(51,10) -OBJECT:$object[3],(52,10) -OBJECT:$object[3],(53,10) -OBJECT:$object[3],(54,10) -OBJECT:$object[3],(55,10) -OBJECT:$object[3],(49,11) -OBJECT:$object[3],(50,11) -OBJECT:$object[3],(51,11) -OBJECT:$object[3],(52,11) -OBJECT:$object[3],(53,11) -OBJECT:$object[3],(54,11) -OBJECT:$object[3],(55,11) -# THE WAND OF WISHING in 1 of the 4 towers -CONTAINER:('(',"chest"),not_trapped,$place[0] { -OBJECT:('/',"wishing") -} -# Prevent monsters from eating it. (@'s never eat objects) -ENGRAVING:$place[0],burn,"Elbereth" -OBJECT:('?',"scare monster"),$place[0],cursed -# The treasure of the lord -OBJECT:('(',"chest"),(37,08) -# Traps -TRAP:"trap door",(40,08) -TRAP:"trap door",(44,08) -TRAP:"trap door",(48,08) -TRAP:"trap door",(52,08) -TRAP:"trap door",(55,08) -# Soldiers guarding the entry hall -MONSTER:('@',"soldier"),(08,06) -MONSTER:('@',"soldier"),(09,05) -MONSTER:('@',"soldier"),(11,05) -MONSTER:('@',"soldier"),(12,06) -MONSTER:('@',"soldier"),(08,10) -MONSTER:('@',"soldier"),(09,11) -MONSTER:('@',"soldier"),(11,11) -MONSTER:('@',"soldier"),(12,10) -MONSTER:('@',"lieutenant"),(09,08) -# Soldiers guarding the towers -MONSTER:('@',"soldier"),(03,02) -MONSTER:('@',"soldier"),(05,02) -MONSTER:('@',"soldier"),(57,02) -MONSTER:('@',"soldier"),(59,02) -MONSTER:('@',"soldier"),(03,14) -MONSTER:('@',"soldier"),(05,14) -MONSTER:('@',"soldier"),(57,14) -MONSTER:('@',"soldier"),(59,14) -# The four dragons that are guarding the storerooms -MONSTER:'D',(47,05) -MONSTER:'D',(47,06) -MONSTER:'D',(47,10) -MONSTER:'D',(47,11) -# Sea monsters in the moat -MONSTER:(';',"giant eel"),(05,07) -MONSTER:(';',"giant eel"),(05,09) -MONSTER:(';',"giant eel"),(57,07) -MONSTER:(';',"giant eel"),(57,09) -MONSTER:(';',"shark"),(05,00) -MONSTER:(';',"shark"),(05,16) -MONSTER:(';',"shark"),(57,00) -MONSTER:(';',"shark"),(57,16) -# The throne room and the court monsters -MONSTER:$monster[0],(27,05) -MONSTER:$monster[1],(30,05) -MONSTER:$monster[2],(33,05) -MONSTER:$monster[3],(36,05) -MONSTER:$monster[4],(28,06) -MONSTER:$monster[5],(31,06) -MONSTER:$monster[6],(34,06) -MONSTER:$monster[7],(37,06) -MONSTER:$monster[8],(27,07) -MONSTER:$monster[9],(30,07) -MONSTER:$monster[0],(33,07) -MONSTER:$monster[1],(36,07) -MONSTER:$monster[2],(28,08) -MONSTER:$monster[3],(31,08) -MONSTER:$monster[4],(34,08) -MONSTER:$monster[5],(27,09) -MONSTER:$monster[6],(30,09) -MONSTER:$monster[7],(33,09) -MONSTER:$monster[8],(36,09) -MONSTER:$monster[9],(28,10) -MONSTER:$monster[0],(31,10) -MONSTER:$monster[1],(34,10) -MONSTER:$monster[2],(37,10) -MONSTER:$monster[3],(27,11) -MONSTER:$monster[4],(30,11) -MONSTER:$monster[5],(33,11) -MONSTER:$monster[6],(36,11) -# MazeWalks -MAZEWALK:(00,10),west -MAZEWALK:(62,06),east -# Non diggable walls -NON_DIGGABLE:(00,00,62,16) -# Subrooms: -# Entire castle area -REGION:(00,00,62,16),unlit,"ordinary" -# Courtyards -REGION:(00,05,05,11),lit,"ordinary" -REGION:(57,05,62,11),lit,"ordinary" -# Throne room -REGION:(27,05,37,11),lit,"throne",unfilled -# Antechamber -REGION:(07,05,14,11),lit,"ordinary" -# Storerooms -REGION:(39,05,45,06),lit,"ordinary" -REGION:(39,10,45,11),lit,"ordinary" -REGION:(49,05,55,06),lit,"ordinary" -REGION:(49,10,55,11),lit,"ordinary" -# Corners -REGION:(02,02,06,03),lit,"ordinary" -REGION:(56,02,60,03),lit,"ordinary" -REGION:(02,13,06,14),lit,"ordinary" -REGION:(56,13,60,14),lit,"ordinary" -# Barracks -REGION:(16,05,25,06),lit,"barracks" -REGION:(16,10,25,11),lit,"barracks" -# Hallways -REGION:(08,03,54,03),unlit,"ordinary" -REGION:(08,13,54,13),unlit,"ordinary" -REGION:(16,08,25,08),unlit,"ordinary" -REGION:(39,08,55,08),unlit,"ordinary" -# Storeroom alcoves -REGION:(47,05,47,06),unlit,"ordinary" -REGION:(47,10,47,11),unlit,"ordinary" diff --git a/dat/castle.lua b/dat/castle.lua new file mode 100644 index 000000000..fcf3d25b6 --- /dev/null +++ b/dat/castle.lua @@ -0,0 +1,256 @@ +-- NetHack 3.6 castle.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- This is the stronghold level : +-- there are several ways to enter it : +-- - opening the drawbridge (wand of opening, knock spell, playing +-- the appropriate tune) +-- +-- - enter via the back entry (this suppose a ring of levitation, boots +-- of water walking, etc.) +-- +-- Note : If you don't play the right tune, you get indications like in the +-- MasterMind game... +-- +-- To motivate the player : there are 4 storerooms (armors, weapons, food and +-- gems) and a wand of wishing in one of the 4 towers... + +des.level_init({ style="mazegrid", bg ="-" }); + +des.level_flags("mazelevel", "noteleport") + +des.map([[ +}}}}}}}}}.............................................}}}}}}}}} +}-------}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}-------} +}|.....|-----------------------------------------------|.....|} +}|.....+...............................................+.....|} +}-------------------------------+-----------------------------} +}}}}}}|........|..........+...........|.......S.S.......|}}}}}} +.....}|........|..........|...........|.......|.|.......|}..... +.....}|........------------...........---------S---------}..... +.....}|...{....+..........+.........\.S.................+...... +.....}|........------------...........---------S---------}..... +.....}|........|..........|...........|.......|.|.......|}..... +}}}}}}|........|..........+...........|.......S.S.......|}}}}}} +}-------------------------------+-----------------------------} +}|.....+...............................................+.....|} +}|.....|-----------------------------------------------|.....|} +}-------}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}-------} +}}}}}}}}}.............................................}}}}}}}}} +]]); + +-- Random registers initialisation +local object = { "[", ")", "*", "%" }; +shuffle(object) + +local place = selection.new(); +place:set(04,02); +place:set(58,02); +place:set(04,14); +place:set(58,14); + +local monster = { "L", "N", "E", "H", "M", "O", "R", "T", "X", "Z" } +shuffle(monster) + +des.teleport_region({ region = {01,00,10,20}, region_islev=1, exclude={1,1,61,15}, dir="down" }) +des.teleport_region({ region = {69,00,79,20}, region_islev=1, exclude={1,1,61,15}, dir="up" }) +des.levregion({ region = {01,00,10,20}, region_islev=1, exclude={0,0,62,16}, type="stair-up" }) +des.feature("fountain", 10,08) +-- Doors +des.door("closed",07,03) +des.door("closed",55,03) +des.door("locked",32,04) +des.door("locked",26,05) +des.door("locked",46,05) +des.door("locked",48,05) +des.door("locked",47,07) +des.door("closed",15,08) +des.door("closed",26,08) +des.door("locked",38,08) +des.door("locked",56,08) +des.door("locked",47,09) +des.door("locked",26,11) +des.door("locked",46,11) +des.door("locked",48,11) +des.door("locked",32,12) +des.door("closed",07,13) +des.door("closed",55,13) +-- The drawbridge +des.drawbridge({ dir="east", state="closed", x=05,y=08}) +-- Storeroom number 1 +des.object(object[1],39,05) +des.object(object[1],40,05) +des.object(object[1],41,05) +des.object(object[1],42,05) +des.object(object[1],43,05) +des.object(object[1],44,05) +des.object(object[1],45,05) +des.object(object[1],39,06) +des.object(object[1],40,06) +des.object(object[1],41,06) +des.object(object[1],42,06) +des.object(object[1],43,06) +des.object(object[1],44,06) +des.object(object[1],45,06) +-- Storeroom number 2 +des.object(object[2],49,05) +des.object(object[2],50,05) +des.object(object[2],51,05) +des.object(object[2],52,05) +des.object(object[2],53,05) +des.object(object[2],54,05) +des.object(object[2],55,05) +des.object(object[2],49,06) +des.object(object[2],50,06) +des.object(object[2],51,06) +des.object(object[2],52,06) +des.object(object[2],53,06) +des.object(object[2],54,06) +des.object(object[2],55,06) +-- Storeroom number 3 +des.object(object[3],39,10) +des.object(object[3],40,10) +des.object(object[3],41,10) +des.object(object[3],42,10) +des.object(object[3],43,10) +des.object(object[3],44,10) +des.object(object[3],45,10) +des.object(object[3],39,11) +des.object(object[3],40,11) +des.object(object[3],41,11) +des.object(object[3],42,11) +des.object(object[3],43,11) +des.object(object[3],44,11) +des.object(object[3],45,11) +-- Storeroom number 4 +des.object(object[4],49,10) +des.object(object[4],50,10) +des.object(object[4],51,10) +des.object(object[4],52,10) +des.object(object[4],53,10) +des.object(object[4],54,10) +des.object(object[4],55,10) +des.object(object[4],49,11) +des.object(object[4],50,11) +des.object(object[4],51,11) +des.object(object[4],52,11) +des.object(object[4],53,11) +des.object(object[4],54,11) +des.object(object[4],55,11) +-- THE WAND OF WISHING in 1 of the 4 towers +local px, py = place:rndcoord(1); +des.object({ id = "chest", trapped = 0, x = px, y = py, + contents = function() + des.object("wishing"); + end +}); +-- Prevent monsters from eating it. (@'s never eat objects) +des.engraving({ x = px, y = py, type="burn", text="Elbereth" }) +des.object({ id = "scare monster", x = px, y = py, buc="cursed" }) +-- The treasure of the lord +des.object("chest",37,08) +-- Traps +des.trap("trap door",40,08) +des.trap("trap door",44,08) +des.trap("trap door",48,08) +des.trap("trap door",52,08) +des.trap("trap door",55,08) +-- Soldiers guarding the entry hall +des.monster("soldier",08,06) +des.monster("soldier",09,05) +des.monster("soldier",11,05) +des.monster("soldier",12,06) +des.monster("soldier",08,10) +des.monster("soldier",09,11) +des.monster("soldier",11,11) +des.monster("soldier",12,10) +des.monster("lieutenant",09,08) +-- Soldiers guarding the towers +des.monster("soldier",03,02) +des.monster("soldier",05,02) +des.monster("soldier",57,02) +des.monster("soldier",59,02) +des.monster("soldier",03,14) +des.monster("soldier",05,14) +des.monster("soldier",57,14) +des.monster("soldier",59,14) +-- The four dragons that are guarding the storerooms +des.monster("D",47,05) +des.monster("D",47,06) +des.monster("D",47,10) +des.monster("D",47,11) +-- Sea monsters in the moat +des.monster("giant eel",05,07) +des.monster("giant eel",05,09) +des.monster("giant eel",57,07) +des.monster("giant eel",57,09) +des.monster("shark",05,00) +des.monster("shark",05,16) +des.monster("shark",57,00) +des.monster("shark",57,16) +-- The throne room and the court monsters +des.monster(monster[10],27,05) +des.monster(monster[1],30,05) +des.monster(monster[2],33,05) +des.monster(monster[3],36,05) +des.monster(monster[4],28,06) +des.monster(monster[5],31,06) +des.monster(monster[6],34,06) +des.monster(monster[7],37,06) +des.monster(monster[8],27,07) +des.monster(monster[9],30,07) +des.monster(monster[10],33,07) +des.monster(monster[1],36,07) +des.monster(monster[2],28,08) +des.monster(monster[3],31,08) +des.monster(monster[4],34,08) +des.monster(monster[5],27,09) +des.monster(monster[6],30,09) +des.monster(monster[7],33,09) +des.monster(monster[8],36,09) +des.monster(monster[9],28,10) +des.monster(monster[10],31,10) +des.monster(monster[1],34,10) +des.monster(monster[2],37,10) +des.monster(monster[3],27,11) +des.monster(monster[4],30,11) +des.monster(monster[5],33,11) +des.monster(monster[6],36,11) +-- MazeWalks +des.mazewalk(00,10,"west") +des.mazewalk(62,06,"east") +-- Non diggable walls +des.non_diggable(selection.area(00,00,62,16)) +-- Subrooms: +-- Entire castle area +des.region(selection.area(00,00,62,16),"unlit") +-- Courtyards +des.region(selection.area(00,05,05,11),"lit") +des.region(selection.area(57,05,62,11),"lit") +-- Throne room +des.region({ region={27,05, 37,11},lit=1,type="throne", prefilled=1 }) +-- Antechamber +des.region(selection.area(07,05,14,11),"lit") +-- Storerooms +des.region(selection.area(39,05,45,06),"lit") +des.region(selection.area(39,10,45,11),"lit") +des.region(selection.area(49,05,55,06),"lit") +des.region(selection.area(49,10,55,11),"lit") +-- Corners +des.region(selection.area(02,02,06,03),"lit") +des.region(selection.area(56,02,60,03),"lit") +des.region(selection.area(02,13,06,14),"lit") +des.region(selection.area(56,13,60,14),"lit") +-- Barracks +des.region({ region={16,05, 25,06},lit=1,type="barracks", prefilled=0 }) +des.region({ region={16,10, 25,11},lit=1,type="barracks", prefilled=0 }) +-- Hallways +des.region(selection.area(08,03,54,03),"unlit") +des.region(selection.area(08,13,54,13),"unlit") +des.region(selection.area(16,08,25,08),"unlit") +des.region(selection.area(39,08,55,08),"unlit") +-- Storeroom alcoves +des.region(selection.area(47,05,47,06),"unlit") +des.region(selection.area(47,10,47,11),"unlit") diff --git a/dat/dungeon.def b/dat/dungeon.def deleted file mode 100644 index d4d61fbaf..000000000 --- a/dat/dungeon.def +++ /dev/null @@ -1,143 +0,0 @@ -# NetHack 3.6 dungeon.def $NHDT-Date: 1462486876 2016/05/05 22:21:16 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.14 $ -# Copyright (c) 1990-95 by M. Stephenson -# NetHack may be freely redistributed. See license for details. -# -# The dungeon description file for the "standard" 3.1 NetHack. -# -# Note: The order of the definition of dungeons in this file -# reflects in their order of creation in the real dungeon. -# The "Main" branch must *always* be first. -# Also note that the order of the dungeons in this file -# determines the order in which branch levels are assigned. -# If two dungeons have overlapping ranges for their entry -# points, then you should list the dungeon with the _least_ -# number of choices for its branch level _first_. -# - -DUNGEON: "The Dungeons of Doom" "D" (25, 5) -ALIGNMENT: unaligned -BRANCH: "The Gnomish Mines" @ (2, 3) -LEVEL: "rogue" "R" @ (15, 4) -LEVELDESC: roguelike -LEVEL: "oracle" "O" @ (5, 5) -LEVALIGN: neutral -CHAINBRANCH: "Sokoban" "oracle" + (1, 0) up -RNDLEVEL: "bigrm" "B" @ (10, 3) 40 10 -CHAINBRANCH: "The Quest" "oracle" + (6, 2) portal -BRANCH: "Fort Ludios" @ (18, 4) portal -RNDLEVEL: "medusa" "none" @ (-5, 4) 4 -LEVALIGN: chaotic -LEVEL: "castle" "none" @ (-1, 0) -CHAINBRANCH: "Gehennom" "castle" + (0, 0) no_down -BRANCH: "The Elemental Planes" @ (1, 0) no_down up - -# -# Gehennom -# -# Now re-worked for 3.1, hell is hopefully going to be a little -# less boring. Also, in 3.1, the tower is not considered as a -# part of hell, but is set up as a separate dungeon. -# -# Gehennom is no longer considered "hellish" as a complete dungeon. -# That is, fire resistance is no longer a condition for survival in -# it. However, Gehennom, and the special levels in it in particular, -# is abundant with fire traps. As a result, fire resistance is still -# a prudent survival strategy in Gehennom. -# -# Note: Gehennom *must* be the second dungeon defined so that -# monsters can properly migrate here under certain -# circumstances. -# -DUNGEON: "Gehennom" "G" (20, 5) -DESCRIPTION: mazelike -DESCRIPTION: hellish -ALIGNMENT: noalign -BRANCH: "Vlad's Tower" @ (9, 5) up -LEVEL: "valley" "V" @ (1, 0) -LEVEL: "sanctum" "none" @ (-1, 0) -LEVEL: "juiblex" "J" @ (4, 4) -LEVEL: "baalz" "B" @ (6, 4) -LEVEL: "asmodeus" "A" @ (2, 6) -LEVEL: "wizard1" "none" @ (11, 6) -CHAINLEVEL: "wizard2" "X" "wizard1" + (1, 0) -CHAINLEVEL: "wizard3" "Y" "wizard1" + (2, 0) -LEVEL: "orcus" "O" @ (10, 6) -LEVEL: "fakewiz1" "F" @ (-6,4) -LEVEL: "fakewiz2" "G" @ (-6,4) - -# -# The Mines of the Gnomes of Zurich. -# -DUNGEON: "The Gnomish Mines" "M" (8, 2) -ALIGNMENT: lawful -DESCRIPTION: mazelike -RNDLEVEL: "minetn" "T" @ (3, 2) 7 -LEVELDESC: town -RNDLEVEL: "minend" "E" @ (-1, 0) 3 - -# -# The Questdungeon -# -# This is a proto-dungeon. The level file names will be prepended with -# three letter role abbreviation during initialization, replacing "x". -# A special "x-fill" level must be defined in the levels description -# file. It will be used for all levels not defined explicitly below. -# -DUNGEON: "The Quest" "Q" (5, 2) -LEVEL: "x-strt" "none" @ (1, 1) -LEVEL: "x-loca" "L" @ (3, 1) -LEVEL: "x-goal" "none" @ (-1, 0) - -# -# Sokoban -# -DUNGEON: "Sokoban" "none" (4, 0) -DESCRIPTION: mazelike -ALIGNMENT: neutral -ENTRY: -1 -RNDLEVEL: "soko1" "none" @ (1, 0) 2 -RNDLEVEL: "soko2" "none" @ (2, 0) 2 -RNDLEVEL: "soko3" "none" @ (3, 0) 2 -RNDLEVEL: "soko4" "none" @ (4, 0) 2 - -# -# The Central Vault of Croesus. -# -DUNGEON: "Fort Ludios" "K" (1, 0) -DESCRIPTION: mazelike -ALIGNMENT: unaligned -LEVEL: "knox" "K" @ (-1, 0) -# -# Vlad's Tower -# -# It has been removed from Gehennom, and it is surrounded by stone. -# Must not allow bones files for its top level. -# -DUNGEON: "Vlad's Tower" "T" (3, 0) -PROTOFILE: "tower" -DESCRIPTION: mazelike -ALIGNMENT: chaotic -ENTRY: -1 -LEVEL: "tower1" "none" @ (1, 0) -# it isn't necessary to list these last two, but doing so makes them -# show up in ^O output and in the level teleport menu -LEVEL: "tower2" "none" @ (2, 0) -LEVEL: "tower3" "none" @ (3, 0) - -# -# The Endgame levels -# -# Enter on 2nd level from bottom; 1st (from bottom) is a -# placeholder for surface level, and should be unreachable. -# [Note: the name "dummy" is checked for in init_dungeons().] -# -DUNGEON: "The Elemental Planes" "E" (6, 0) -DESCRIPTION: mazelike -ALIGNMENT: unaligned -ENTRY: -2 -LEVEL: "astral" "none" @ (1, 0) -LEVEL: "water" "none" @ (2, 0) -LEVEL: "fire" "none" @ (3, 0) -LEVEL: "air" "none" @ (4, 0) -LEVEL: "earth" "none" @ (5, 0) -LEVEL: "dummy" "none" @ (6, 0) diff --git a/dat/dungeon.lua b/dat/dungeon.lua new file mode 100644 index 000000000..6112a25ad --- /dev/null +++ b/dat/dungeon.lua @@ -0,0 +1,310 @@ + +dungeon = { + { + name = "The Dungeons of Doom", + bonetag = "D", + base = 25, + range = 5, + alignment = "unaligned", + branches = { + { + name = "The Gnomish Mines", + base = 2, + range = 3 + }, + { + name = "Sokoban", + chainlevel = "oracle", + base = 1, + direction = "up" + }, + { + name = "The Quest", + chainlevel = "oracle", + base = 6, + range = 2, + branchtype = "portal" + }, + { + name = "Fort Ludios", + base = 18, + range = 4, + branchtype = "portal" + }, + { + name = "Gehennom", + chainlevel = "castle", + base = 0, + branchtype = "no_down" + }, + { + name = "The Elemental Planes", + base = 1, + branchtype = "no_down", + direction = "up" + } + }, + levels = { + { + name = "rogue", + bonetag = "R", + base = 15, + range = 4, + flags = "roguelike", + }, + { + name = "oracle", + bonetag = "O", + base = 5, + range = 5, + alignment = "neutral" + }, + { + name = "bigrm", + bonetag = "B", + base = 10, + range = 3, + chance = 40, + nlevels = 10 + }, + { + name = "medusa", + base = -5, + range = 4, + nlevels = 4, + alignment = "chaotic" + }, + { + name = "castle", + base = -1 + } + } + }, + { + name = "Gehennom", + bonetag = "G", + base = 20, + range = 5, + flags = { "mazelike", "hellish" }, + alignment = "noalign", + branches = { + { + name = "Vlad's Tower", + base = 9, + range = 5, + direction = "up" + } + }, + levels = { + { + name = "valley", + bonetag = "V", + base = 1 + }, + { + name = "sanctum", + base = -1 + }, + { + name = "juiblex", + bonetag = "J", + base = 4, + range = 4 + }, + { + name = "baalz", + bonetag = "B", + base = 6, + range = 4 + }, + { + name = "asmodeus", + bonetag = "A", + base = 2, + range = 6 + }, + { + name = "wizard1", + base = 11, + range = 6 + }, + { + name = "wizard2", + bonetag = "X", + chainlevel = "wizard1", + base = 1 + }, + { + name = "wizard3", + bonetag = "Y", + chainlevel = "wizard1", + base = 2 + }, + { + name = "orcus", + bonetag = "O", + base = 10, + range = 6 + }, + { + name = "fakewiz1", + bonetag = "F", + base = -6, + range = 4 + }, + { + name = "fakewiz2", + bonetag = "G", + base = -6, + range = 4 + }, + } + }, + { + name = "The Gnomish Mines", + bonetag = "M", + base = 8, + range = 2, + alignment = "lawful", + flags = { "mazelike" }, + levels = { + { + name = "minetn", + bonetag = "T", + base = 3, + range = 2, + nlevels = 7, + flags = "town" + }, + { + name = "minend", + bonetag = "E", + base = -1, + nlevels = 3 + }, + } + }, + { + name = "The Quest", + bonetag = "Q", + base = 5, + range = 2, + levels = { + { + name = "x-strt", + base = 1, + range = 1 + }, + { + name = "x-loca", + bonetag = "L", + base = 3, + range = 1 + }, + { + name = "x-goal", + base = -1 + }, + } + }, + { + name = "Sokoban", + base = 4, + alignment = "neutral", + flags = { "mazelike" }, + entry = -1, + levels = { + { + name = "soko1", + base = 1, + nlevels = 2 + }, + { + name = "soko2", + base = 2, + nlevels = 2 + }, + { + name = "soko3", + base = 3, + nlevels = 2 + }, + { + name = "soko4", + base = 4, + nlevels = 2 + }, + } + }, + { + name = "Fort Ludios", + base = 1, + bonetag = "K", + flags = { "mazelike" }, + alignment = "unaligned", + levels = { + { + name = "knox", + bonetag = "K", + base = -1 + } + } + }, + { + name = "Vlad's Tower", + base = 3, + bonetag = "T", + protofile = "tower", + alignment = "chaotic", + flags = { "mazelike" }, + entry = -1, + levels = { + { + name = "tower1", + base = 1 + }, + { + name = "tower2", + base = 2 + }, + { + name = "tower3", + base = 3 + }, + } + }, + { + name = "The Elemental Planes", + bonetag = "E", + base = 6, + alignment = "unaligned", + flags = { "mazelike" }, + entry = -2, + levels = { + { + name = "astral", + base = 1 + }, + { + name = "water", + base = 2 + }, + { + name = "fire", + base = 3 + }, + { + name = "air", + base = 4 + }, + { + name = "earth", + base = 5 + }, + { + name = "dummy", + base = 6 + }, + } + }, +} diff --git a/dat/earth.lua b/dat/earth.lua new file mode 100644 index 000000000..62cb6da32 --- /dev/null +++ b/dat/earth.lua @@ -0,0 +1,130 @@ +-- NetHack 3.6 endgame.des $NHDT-Date: 1546303680 2019/01/01 00:48:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.14 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1992,1993 by Izchak Miller, David Cohrs, +-- and Timo Hakulinen +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- These are the ENDGAME levels: earth, air, fire, water, and astral. +-- The top-most level, the Astral Level, has 3 temples and shrines. +-- Players are supposed to sacrifice the Amulet of Yendor on the appropriate +-- shrine. + +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor", "shortsighted") + +des.message("Well done, mortal!") +des.message("But now thou must face the final Test...") +des.message("Prove thyself worthy or perish!") + +-- The player lands, upon arrival, in the +-- lower-right cavern. The location of the +-- portal to the next level is randomly chosen. +-- This map has no visible outer boundary, and +-- is mostly diggable "rock". +des.map([[ + + ... + .... .. + ..... ... .. + .... .... ... + .... ... .... ... . + .. .. ....... . .. + .. ... . + . .. . ... + .. .. . .. . + .. ... . + ... ... + .. ... .. + .... .. + .. ... + .. ..... + ... ... + .... + .. + +]]); + +des.replace_terrain({ region={0,0, 75,19}, fromterrain=" ", toterrain=".", lit=0, chance=5 }) + +-- Since there are no stairs, this forces the hero's initial placement +des.teleport_region({region = {69,16,69,16} }) +des.levregion({ region = {0,0,75,19}, exclude = {65,13,75,19}, type="portal", name="air" }) +-- Some helpful monsters. Making sure a +-- pick axe and at least one wand of digging +-- are available. +des.monster("Elvenking", 67,16) +des.monster("minotaur", 67,14) +-- An assortment of earth-appropriate nasties +-- in each cavern. +des.monster({ id = "earth elemental", x = 52, y = 13, peaceful = 0 }) +des.monster({ id = "earth elemental", x = 53, y = 13, peaceful = 0 }) +des.monster("rock troll", 53,12) +des.monster("stone giant", 54,12) +-- +des.monster("pit viper", 70,05) +des.monster("barbed devil", 69,06) +des.monster("stone giant", 69,08) +des.monster("stone golem", 71,08) +des.monster("pit fiend", 70,09) +des.monster({ id = "earth elemental", x = 70, y = 08, peaceful = 0 }) +-- +des.monster({ id = "earth elemental", x = 60, y = 03, peaceful = 0 }) +des.monster("stone giant", 61,04) +des.monster({ id = "earth elemental", x = 62, y = 04, peaceful = 0 }) +des.monster({ id = "earth elemental", x = 61, y = 05, peaceful = 0 }) +des.monster("scorpion", 62,05) +des.monster("rock piercer", 63,05) +-- +des.monster("umber hulk", 40,05) +des.monster("dust vortex", 42,05) +des.monster("rock troll", 38,06) +des.monster({ id = "earth elemental", x = 39, y = 06, peaceful = 0 }) +des.monster({ id = "earth elemental", x = 41, y = 06, peaceful = 0 }) +des.monster({ id = "earth elemental", x = 38, y = 07, peaceful = 0 }) +des.monster("stone giant", 39,07) +des.monster({ id = "earth elemental", x = 43, y = 07, peaceful = 0 }) +des.monster("stone golem", 37,08) +des.monster("pit viper", 43,08) +des.monster("pit viper", 43,09) +des.monster("rock troll", 44,10) +-- +des.monster({ id = "earth elemental", x = 02, y = 01, peaceful = 0 }) +des.monster({ id = "earth elemental", x = 03, y = 01, peaceful = 0 }) +des.monster("stone golem", 01,02) +des.monster({ id = "earth elemental", x = 02, y = 02, peaceful = 0 }) +des.monster("rock troll", 04,03) +des.monster("rock troll", 03,03) +des.monster("pit fiend", 03,04) +des.monster({ id = "earth elemental", x = 04, y = 05, peaceful = 0 }) +des.monster("pit viper", 05,06) +-- +des.monster({ id = "earth elemental", x = 21, y = 02, peaceful = 0 }) +des.monster({ id = "earth elemental", x = 21, y = 03, peaceful = 0 }) +des.monster("minotaur", 21,04) +des.monster({ id = "earth elemental", x = 21, y = 05, peaceful = 0 }) +des.monster("rock troll", 22,05) +des.monster({ id = "earth elemental", x = 22, y = 06, peaceful = 0 }) +des.monster({ id = "earth elemental", x = 23, y = 06, peaceful = 0 }) +-- +des.monster("pit viper", 14,08) +des.monster("barbed devil", 14,09) +des.monster({ id = "earth elemental", x = 13, y = 10, peaceful = 0 }) +des.monster("rock troll", 12,11) +des.monster({ id = "earth elemental", x = 14, y = 12, peaceful = 0 }) +des.monster({ id = "earth elemental", x = 15, y = 13, peaceful = 0 }) +des.monster("stone giant", 17,13) +des.monster("stone golem", 18,13) +des.monster("pit fiend", 18,12) +des.monster({ id = "earth elemental", x = 18, y = 11, peaceful = 0 }) +des.monster({ id = "earth elemental", x = 18, y = 10, peaceful = 0 }) +-- +des.monster("barbed devil", 02,16) +des.monster({ id = "earth elemental", x = 03, y = 16, peaceful = 0 }) +des.monster("rock troll", 02,17) +des.monster({ id = "earth elemental", x = 04, y = 17, peaceful = 0 }) +des.monster({ id = "earth elemental", x = 04, y = 18, peaceful = 0 }) + +des.object("boulder") + diff --git a/dat/endgame.des b/dat/endgame.des deleted file mode 100644 index ebd9049bd..000000000 --- a/dat/endgame.des +++ /dev/null @@ -1,655 +0,0 @@ -# NetHack 3.6 endgame.des $NHDT-Date: 1546303680 2019/01/01 00:48:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.14 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# Copyright (c) 1992,1993 by Izchak Miller, David Cohrs, -# and Timo Hakulinen -# NetHack may be freely redistributed. See license for details. -# -# These are the ENDGAME levels: earth, air, fire, water, and astral. -# The top-most level, the Astral Level, has 3 temples and shrines. -# Players are supposed to sacrifice the Amulet of Yendor on the appropriate -# shrine. - -MAZE:"earth",' ' -FLAGS: noteleport,hardfloor,shortsighted -MESSAGE: "Well done, mortal!" -MESSAGE: "But now thou must face the final Test..." -MESSAGE: "Prove thyself worthy or perish!" - -GEOMETRY:center,center -# The player lands, upon arrival, in the -# lower-right cavern. The location of the -# portal to the next level is randomly chosen. -# This map has no visible outer boundary, and -# is mostly diggable "rock". -MAP - - ... - .... .. - ..... ... .. - .... .... ... - .... ... .... ... . - .. .. ....... . .. - .. ... . - . .. . ... - .. .. . .. . - .. ... . - ... ... - .. ... .. - .... .. - .. ... - .. ..... - ... ... - .... - .. - -ENDMAP - -REPLACE_TERRAIN:(0,0,75,19), ' ', ('.', unlit), 5% - -# Since there are no stairs, this forces the hero's initial placement -TELEPORT_REGION:(69,16,69,16),(0,0,0,0) -PORTAL:(0,0,75,19),(65,13,75,19),"air" -# Some helpful monsters. Making sure a -# pick axe and at least one wand of digging -# are available. -MONSTER:('@',"Elvenking"),(67,16) -MONSTER:('H',"minotaur"),(67,14) -# An assortment of earth-appropriate nasties -# in each cavern. -MONSTER:('E',"earth elemental"),(52,13),hostile -MONSTER:('E',"earth elemental"),(53,13),hostile -MONSTER:('T',"rock troll"),(53,12) -MONSTER:('H',"stone giant"),(54,12) -# -MONSTER:('S',"pit viper"),(70,05) -MONSTER:('&',"barbed devil"),(69,06) -MONSTER:('H',"stone giant"),(69,08) -MONSTER:(''',"stone golem"),(71,08) -MONSTER:('&',"pit fiend"),(70,09) -MONSTER:('E',"earth elemental"),(70,08),hostile -# -MONSTER:('E',"earth elemental"),(60,03),hostile -MONSTER:('H',"stone giant"),(61,04) -MONSTER:('E',"earth elemental"),(62,04),hostile -MONSTER:('E',"earth elemental"),(61,05),hostile -MONSTER:('s',"scorpion"),(62,05) -MONSTER:('p',"rock piercer"),(63,05) -# -MONSTER:('U',"umber hulk"),(40,05) -MONSTER:('v',"dust vortex"),(42,05) -MONSTER:('T',"rock troll"),(38,06) -MONSTER:('E',"earth elemental"),(39,06),hostile -MONSTER:('E',"earth elemental"),(41,06),hostile -MONSTER:('E',"earth elemental"),(38,07),hostile -MONSTER:('H',"stone giant"),(39,07) -MONSTER:('E',"earth elemental"),(43,07),hostile -MONSTER:(''',"stone golem"),(37,08) -MONSTER:('S',"pit viper"),(43,08) -MONSTER:('S',"pit viper"),(43,09) -MONSTER:('T',"rock troll"),(44,10) -# -MONSTER:('E',"earth elemental"),(02,01),hostile -MONSTER:('E',"earth elemental"),(03,01),hostile -MONSTER:(''',"stone golem"),(01,02) -MONSTER:('E',"earth elemental"),(02,02),hostile -MONSTER:('T',"rock troll"),(04,03) -MONSTER:('T',"rock troll"),(03,03) -MONSTER:('&',"pit fiend"),(03,04) -MONSTER:('E',"earth elemental"),(04,05),hostile -MONSTER:('S',"pit viper"),(05,06) -# -MONSTER:('E',"earth elemental"),(21,02),hostile -MONSTER:('E',"earth elemental"),(21,03),hostile -MONSTER:('H',"minotaur"),(21,04) -MONSTER:('E',"earth elemental"),(21,05),hostile -MONSTER:('T',"rock troll"),(22,05) -MONSTER:('E',"earth elemental"),(22,06),hostile -MONSTER:('E',"earth elemental"),(23,06),hostile -# -MONSTER:('S',"pit viper"),(14,08) -MONSTER:('&',"barbed devil"),(14,09) -MONSTER:('E',"earth elemental"),(13,10),hostile -MONSTER:('T',"rock troll"),(12,11) -MONSTER:('E',"earth elemental"),(14,12),hostile -MONSTER:('E',"earth elemental"),(15,13),hostile -MONSTER:('H',"stone giant"),(17,13) -MONSTER:(''',"stone golem"),(18,13) -MONSTER:('&',"pit fiend"),(18,12) -MONSTER:('E',"earth elemental"),(18,11),hostile -MONSTER:('E',"earth elemental"),(18,10),hostile -# -MONSTER:('&',"barbed devil"),(02,16) -MONSTER:('E',"earth elemental"),(03,16),hostile -MONSTER:('T',"rock troll"),(02,17) -MONSTER:('E',"earth elemental"),(04,17),hostile -MONSTER:('E',"earth elemental"),(04,18),hostile - -OBJECT:('`',"boulder"),random - - -MAZE:"air",' ' -FLAGS: noteleport,hardfloor,shortsighted -# The following messages are somewhat obtuse, to make then -# equally meaningful if the player can see or not. -MESSAGE: "What a strange feeling!" -MESSAGE: "You notice that there is no gravity here." -GEOMETRY:center,center -# The player lands, upon arrival, in the -# lower-left area. The location of the -# portal to the next level is randomly chosen. -# This map has no visible outer boundary, and -# is all "air". -MAP -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -ENDMAP -# Use up and down regions to partition the level into three parts; -# teleportation can't cross from one part into another. -# The up region is where you'll arrive after activating the portal from -# the preceding level; the exit portal is placed inside the down region. -TELEPORT_REGION:levregion(01,00,24,20),levregion(25,00,79,20),up -TELEPORT_REGION:levregion(56,00,79,20),levregion(01,00,55,20),down -PORTAL:levregion(57,01,78,19),(0,0,0,0),"fire" -REGION:(00,00,75,19),lit,"ordinary" -MONSTER:('E',"air elemental"),random,hostile -MONSTER:('E',"air elemental"),random,hostile -MONSTER:('E',"air elemental"),random,hostile -MONSTER:('E',"air elemental"),random,hostile -MONSTER:('E',"air elemental"),random,hostile -MONSTER:('E',"air elemental"),random,hostile -MONSTER:('E',"air elemental"),random,hostile -MONSTER:('E',"air elemental"),random,hostile -MONSTER:('E',"air elemental"),random,hostile -MONSTER:('E',"air elemental"),random,hostile -MONSTER:('E',"air elemental"),random,hostile - -MONSTER:('e',"floating eye"),random,hostile -MONSTER:('e',"floating eye"),random,hostile -MONSTER:('e',"floating eye"),random,hostile - -MONSTER:('y',"yellow light"),random,hostile -MONSTER:('y',"yellow light"),random,hostile -MONSTER:('y',"yellow light"),random,hostile - -MONSTER:('A',"couatl"),random - -MONSTER:'D',random -MONSTER:'D',random -MONSTER:'D',random -MONSTER:'D',random -MONSTER:'D',random - -MONSTER:'E',random -MONSTER:'E',random -MONSTER:'E',random -MONSTER:'J',random -MONSTER:'J',random - -MONSTER:('&',"djinni"),random,hostile -MONSTER:('&',"djinni"),random,hostile -MONSTER:('&',"djinni"),random,hostile - -MONSTER:('v',"fog cloud"),random,hostile -MONSTER:('v',"fog cloud"),random,hostile -MONSTER:('v',"fog cloud"),random,hostile -MONSTER:('v',"fog cloud"),random,hostile -MONSTER:('v',"fog cloud"),random,hostile -MONSTER:('v',"fog cloud"),random,hostile -MONSTER:('v',"fog cloud"),random,hostile -MONSTER:('v',"fog cloud"),random,hostile -MONSTER:('v',"fog cloud"),random,hostile -MONSTER:('v',"energy vortex"),random,hostile -MONSTER:('v',"energy vortex"),random,hostile -MONSTER:('v',"energy vortex"),random,hostile -MONSTER:('v',"energy vortex"),random,hostile -MONSTER:('v',"energy vortex"),random,hostile -MONSTER:('v',"steam vortex"),random,hostile -MONSTER:('v',"steam vortex"),random,hostile -MONSTER:('v',"steam vortex"),random,hostile -MONSTER:('v',"steam vortex"),random,hostile -MONSTER:('v',"steam vortex"),random,hostile - - -MAZE:"fire",' ' -FLAGS: noteleport,hardfloor,shortsighted -GEOMETRY:center,center -# The player lands, upon arrival, in the -# lower-right. The location of the -# portal to the next level is randomly chosen. -# This map has no visible outer boundary, and -# is mostly open area, with lava lakes and bunches of fire traps. -MAP -............................................................................ -....LLLLLLLL............L.......................LLL......................... -...LL...................L......................LLLL................LL....... -...L.............LLLL...LL....LL...............LLLLL.............LLL........ -.LLLL..............LL....L.....LLL..............LLLL..............LLLL...... -..........LLLL...LLLL...LLL....LLL......L........LLLL....LL........LLL...... -........LLLLLLL...LL.....L......L......LL.........LL......LL........LL...L.. -........LL..LLL..LL......LL......LLLL..L.........LL......LLL............LL.. -....L..LL....LLLLL.................LLLLLLL.......L......LL............LLLLLL -....L..L.....LL.LLLL.......L............L........LLLLL.LL......LL.........LL -....LL........L...LL......LL.............LLL.....L...LLL.......LLL.........L -.....LLLLLL........L.......LLL.............L....LL...L.LLL......LLLLLLL..... -..........LLLL............LL.L.............L....L...LL.........LLL..LLL..... -...........................LLLLL...........LL...L...L........LLLL..LLLLLL... -.....LLLL.............LL....LL.......LLL...LL.......L..LLL....LLLLLLL....... -.......LLL.........LLLLLLLLLLL......LLLLL...L...........LL...LL...LL........ -.........LL.......LL.........LL.......LLL....L..LLL....LL.........LL........ -..........LLLLLLLLL...........LL....LLL.......LLLLL.....LL........LL........ -.................L.............LLLLLL............LL...LLLL.........LL....... -.................................LL....................LL................... -ENDMAP -TELEPORT_REGION:(69,16,69,16),(0,0,0,0) -PORTAL:(0,0,75,19),(65,13,75,19),"water" - -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -TRAP:"fire",random -# An assortment of fire-appropriate nasties -MONSTER:('D',"red dragon"),random -MONSTER:('&',"balrog"),random -MONSTER:('E',"fire elemental"),random,hostile -MONSTER:('E',"fire elemental"),random,hostile -MONSTER:('v',"fire vortex"),random -MONSTER:('d',"hell hound"),random -# -MONSTER:('H',"fire giant"),random -MONSTER:('&',"barbed devil"),random -MONSTER:('d',"hell hound"),random -MONSTER:(''',"stone golem"),random -MONSTER:('&',"pit fiend"),random -MONSTER:('E',"fire elemental"),random,hostile -# -MONSTER:('E',"fire elemental"),random,hostile -MONSTER:('d',"hell hound"),random -MONSTER:('E',"fire elemental"),random,hostile -MONSTER:('E',"fire elemental"),random,hostile -MONSTER:('s',"scorpion"),random -MONSTER:('H',"fire giant"),random -# -MONSTER:('d',"hell hound"),random -MONSTER:('v',"dust vortex"),random -MONSTER:('v',"fire vortex"),random -MONSTER:('E',"fire elemental"),random,hostile -MONSTER:('E',"fire elemental"),random,hostile -MONSTER:('E',"fire elemental"),random,hostile -MONSTER:('d',"hell hound"),random -MONSTER:('E',"fire elemental"),random,hostile -MONSTER:(''',"stone golem"),random -MONSTER:('S',"pit viper"),random -MONSTER:('S',"pit viper"),random -MONSTER:('v',"fire vortex"),random -# -MONSTER:('E',"fire elemental"),random,hostile -MONSTER:('E',"fire elemental"),random,hostile -MONSTER:('H',"fire giant"),random -MONSTER:('E',"fire elemental"),random,hostile -MONSTER:('v',"fire vortex"),random -MONSTER:('v',"fire vortex"),random -MONSTER:('&',"pit fiend"),random -MONSTER:('E',"fire elemental"),random,hostile -MONSTER:('S',"pit viper"),random -# -MONSTER:(':',"salamander"),random,hostile -MONSTER:(':',"salamander"),random,hostile -MONSTER:('H',"minotaur"),random -MONSTER:(':',"salamander"),random,hostile -MONSTER:('v',"steam vortex"),random -MONSTER:(':',"salamander"),random,hostile -MONSTER:(':',"salamander"),random,hostile -# -MONSTER:('H',"fire giant"),random -MONSTER:('&',"barbed devil"),random -MONSTER:('E',"fire elemental"),random,hostile -MONSTER:('v',"fire vortex"),random -MONSTER:('E',"fire elemental"),random,hostile -MONSTER:('E',"fire elemental"),random,hostile -MONSTER:('d',"hell hound"),random -MONSTER:('H',"fire giant"),random -MONSTER:('&',"pit fiend"),random -MONSTER:('E',"fire elemental"),random,hostile -MONSTER:('E',"fire elemental"),random,hostile -# -MONSTER:('&',"barbed devil"),random -MONSTER:(':',"salamander"),random,hostile -MONSTER:('v',"steam vortex"),random -MONSTER:(':',"salamander"),random,hostile -MONSTER:(':',"salamander"),random,hostile - -OBJECT:('`',"boulder"),random -OBJECT:('`',"boulder"),random -OBJECT:('`',"boulder"),random -OBJECT:('`',"boulder"),random -OBJECT:('`',"boulder"),random - - -MAZE:"water",' ' -FLAGS: noteleport,hardfloor,shortsighted -MESSAGE: "You find yourself suspended in an air bubble surrounded by water." -GEOMETRY:center,center -# The player lands upon arrival to an air bubble -# within the leftmost third of the level. The -# portal to the next level is randomly located in an air -# bubble within the rightmost third of the level. -# Bubbles are generated by special code in mkmaze.c for now. -MAP -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -ENDMAP -TELEPORT_REGION:(0,0,25,19),(0,0,0,0) -PORTAL:(51,0,75,19),(0,0,0,0),"astral" -# A fisherman's dream... -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"electric eel"),random -MONSTER:(';',"electric eel"),random -MONSTER:(';',"electric eel"),random -MONSTER:(';',"electric eel"),random -MONSTER:(';',"electric eel"),random -MONSTER:(';',"electric eel"),random -MONSTER:(';',"electric eel"),random -MONSTER:(';',"electric eel"),random -MONSTER:(';',"kraken"),random -MONSTER:(';',"kraken"),random -MONSTER:(';',"kraken"),random -MONSTER:(';',"kraken"),random -MONSTER:(';',"kraken"),random -MONSTER:(';',"kraken"),random -MONSTER:(';',"kraken"),random -MONSTER:(';',"kraken"),random -MONSTER:(';',"kraken"),random -MONSTER:(';',"shark"),random -MONSTER:(';',"shark"),random -MONSTER:(';',"shark"),random -MONSTER:(';',"shark"),random -MONSTER:(';',"piranha"),random -MONSTER:(';',"piranha"),random -MONSTER:(';',"piranha"),random -MONSTER:(';',"piranha"),random -MONSTER:(';',"jellyfish"),random -MONSTER:(';',"jellyfish"),random -MONSTER:(';',"jellyfish"),random -MONSTER:(';',"jellyfish"),random -MONSTER:';',random -MONSTER:';',random -MONSTER:';',random -MONSTER:';',random -# These guys feel like home here -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile -MONSTER:('E',"water elemental"),random,hostile - - -MAZE:"astral",' ' -FLAGS: noteleport,hardfloor,nommap,shortsighted,solidify -MESSAGE: "You arrive on the Astral Plane!" -MESSAGE: "Here the High Temple of %d is located." -MESSAGE: "You sense alarm, hostility, and excitement in the air!" -GEOMETRY:center,center -MAP - --------------- - |.............| - |..---------..| - |..|.......|..| ---------------- |..|.......|..| --------------- -|.............| |..|.......|..| |.............| -|..---------..-| |-------| |..|.......|..| |-------| |-..---------..| -|..|.......|...-| |-.......-| |..|.......|..| |-.......-| |-...|.......|..| -|..|.......|....-|-.........-||..----+----..||-.........-|-....|.......|..| -|..|.......+.....+...........||.............||...........+.....+.......|..| -|..|.......|....-|-.........-|--|.........|--|-.........-|-....|.......|..| -|..|.......|...-| |-.......-| -|---+---|- |-.......-| |-...|.......|..| -|..---------..-| |---+---| |-.......-| |---+---| |-..---------..| -|.............| |...|-----|-.........-|-----|...| |.............| ---------------- |.........|...........|.........| --------------- - -------...|-.........-|...------- - |....|-.......-|....| - ---...|---+---|...--- - |...............| - ----------------- -ENDMAP - -# chance to alter above map and turn the wings of the bottom-center into -# a pair of big (5x15) rooms -$loopindx = 0 -LOOP [2] { - $loopindx = $loopindx + 1 -# 3.6.[01]: 75% chance that both sides opened up, 25% that neither did; -# 3.6.2: 60% twice == 36% chance that both sides open up, 24% left side -# only, 24% right side only, 16% that neither side opens up - IF [60%] { - IF [$loopindx == 1] { - TERRAIN:fillrect (17,14, 30,18),'.' - WALLIFY -# temporarily close off the area to be filled so that it doesn't cover -# the entire entry area - TERRAIN:(33,18), '|' - $hall = selection:floodfill(30,16) -# re-connect the opened wing with the rest of the map - TERRAIN:(33,18), '.' - } ELSE { - TERRAIN:fillrect (44,14, 57,18),'.' - WALLIFY - TERRAIN:(41,18), '|' - $hall = selection:floodfill(44,16) - TERRAIN:(41,18), '.' - } -# extra monsters; was [6 + 3d4] when both wings were opened up at once - LOOP [3 + 2d3] { - MONSTER:('A',"Angel"),rndcoord($hall),noalign,hostile - [50%]: MONSTER:random,rndcoord($hall),hostile - } - } -} - -# Rider locations -$place = { (23,9),(37,14),(51,9) } -SHUFFLE: $place - -# Where the player will land on arrival -TELEPORT_REGION:(29,15,45,15),(30,15,44,15) -# Lit courts -REGION:(01,05,16,14),lit,"ordinary",filled,irregular -REGION:(31,01,44,10),lit,"ordinary",filled,irregular -REGION:(61,05,74,14),lit,"ordinary",filled,irregular -# A Sanctum for each alignment -# The shrines' alignments are shuffled for -# each game -REGION:(04,07,10,11),lit,"temple" -REGION:(34,03,40,07),lit,"temple" -REGION:(64,07,70,11),lit,"temple" -ALTAR:(07,09),align[0],sanctum -ALTAR:(37,05),align[1],sanctum -ALTAR:(67,09),align[2],sanctum -# Doors -DOOR:closed,(11,09) -DOOR:closed,(17,09) -DOOR:locked,(23,12) -DOOR:locked,(37,08) -DOOR:closed,(37,11) -DOOR:closed,(37,17) -DOOR:locked,(51,12) -DOOR:locked,(57,09) -DOOR:closed,(63,09) -# Non diggable and phazeable everywhere -NON_DIGGABLE:(00,00,74,19) -NON_PASSWALL:(00,00,74,19) -# Moloch's horde -# West round room -MONSTER:('@',"aligned priest"),(18,09),noalign,hostile -MONSTER:('@',"aligned priest"),(19,08),noalign,hostile -MONSTER:('@',"aligned priest"),(19,09),noalign,hostile -MONSTER:('@',"aligned priest"),(19,10),noalign,hostile -MONSTER:('A',"Angel"),(20,09),noalign,hostile -MONSTER:('A',"Angel"),(20,10),noalign,hostile -MONSTER:('&',"Pestilence"),$place[0],hostile -# South-central round room -MONSTER:('@',"aligned priest"),(36,12),noalign,hostile -MONSTER:('@',"aligned priest"),(37,12),noalign,hostile -MONSTER:('@',"aligned priest"),(38,12),noalign,hostile -MONSTER:('@',"aligned priest"),(36,13),noalign,hostile -MONSTER:('A',"Angel"),(38,13),noalign,hostile -MONSTER:('A',"Angel"),(37,13),noalign,hostile -MONSTER:('&',"Death"),$place[1],hostile -# East round room -MONSTER:('@',"aligned priest"),(56,09),noalign,hostile -MONSTER:('@',"aligned priest"),(55,08),noalign,hostile -MONSTER:('@',"aligned priest"),(55,09),noalign,hostile -MONSTER:('@',"aligned priest"),(55,10),noalign,hostile -MONSTER:('A',"Angel"),(54,09),noalign,hostile -MONSTER:('A',"Angel"),(54,10),noalign,hostile -MONSTER:('&',"Famine"),$place[2],hostile -# -# The aligned horde -# -# We do not know in advance the alignment of the -# player. The mpeaceful bit will need resetting -# when the level is created. The setting here is -# but a place holder. -# -# West court -MONSTER:('@',"aligned priest"),(12,07),chaos,hostile -MONSTER:('@',"aligned priest"),(13,07),chaos,peaceful -MONSTER:('@',"aligned priest"),(14,07),law,hostile -MONSTER:('@',"aligned priest"),(12,11),law,peaceful -MONSTER:('@',"aligned priest"),(13,11),neutral,hostile -MONSTER:('@',"aligned priest"),(14,11),neutral,peaceful -MONSTER:('A',"Angel"),(11,05),chaos,hostile -MONSTER:('A',"Angel"),(12,05),chaos,peaceful -MONSTER:('A',"Angel"),(13,05),law,hostile -MONSTER:('A',"Angel"),(11,13),law,peaceful -MONSTER:('A',"Angel"),(12,13),neutral,hostile -MONSTER:('A',"Angel"),(13,13),neutral,peaceful -# Central court -MONSTER:('@',"aligned priest"),(32,09),chaos,hostile -MONSTER:('@',"aligned priest"),(33,09),chaos,peaceful -MONSTER:('@',"aligned priest"),(34,09),law,hostile -MONSTER:('@',"aligned priest"),(40,09),law,peaceful -MONSTER:('@',"aligned priest"),(41,09),neutral,hostile -MONSTER:('@',"aligned priest"),(42,09),neutral,peaceful -MONSTER:('A',"Angel"),(31,08),chaos,hostile -MONSTER:('A',"Angel"),(32,08),chaos,peaceful -MONSTER:('A',"Angel"),(31,09),law,hostile -MONSTER:('A',"Angel"),(42,08),law,peaceful -MONSTER:('A',"Angel"),(43,08),neutral,hostile -MONSTER:('A',"Angel"),(43,09),neutral,peaceful -# East court -MONSTER:('@',"aligned priest"),(60,07),chaos,hostile -MONSTER:('@',"aligned priest"),(61,07),chaos,peaceful -MONSTER:('@',"aligned priest"),(62,07),law,hostile -MONSTER:('@',"aligned priest"),(60,11),law,peaceful -MONSTER:('@',"aligned priest"),(61,11),neutral,hostile -MONSTER:('@',"aligned priest"),(62,11),neutral,peaceful -MONSTER:('A',"Angel"),(61,05),chaos,hostile -MONSTER:('A',"Angel"),(62,05),chaos,peaceful -MONSTER:('A',"Angel"),(63,05),law,hostile -MONSTER:('A',"Angel"),(61,13),law,peaceful -MONSTER:('A',"Angel"),(62,13),neutral,hostile -MONSTER:('A',"Angel"),(63,13),neutral,peaceful -# -# Assorted nasties -MONSTER:'L',random,hostile -MONSTER:'L',random,hostile -MONSTER:'L',random,hostile -MONSTER:'V',random,hostile -MONSTER:'V',random,hostile -MONSTER:'V',random,hostile -MONSTER:'D',random,hostile -MONSTER:'D',random,hostile -MONSTER:'D',random,hostile diff --git a/dat/fakewiz1.lua b/dat/fakewiz1.lua new file mode 100644 index 000000000..856ac3161 --- /dev/null +++ b/dat/fakewiz1.lua @@ -0,0 +1,35 @@ +-- NetHack 3.6 yendor.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1992 by M. Stephenson and Izchak Miller +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style="mazegrid", bg ="-" }); + +des.level_flags("mazelevel"); + +des.map([[ +......... +.}}}}}}}. +.}}---}}. +.}--.--}. +.}|...|}. +.}--.--}. +.}}---}}. +.}}}}}}}. +]]); +des.levregion({ region={01,00,79,20}, region_islev=1, exclude={0,0,8,7}, type="stair-up" }) +des.levregion({ region={01,00,79,20}, region_islev=1, exclude={0,0,8,7}, type="stair-down" }) +des.levregion({ region={01,00,79,20}, region_islev=1, exclude={0,0,8,7}, type="branch" }); +des.teleport_region({ region={01,00,79,20}, region_islev=1,exclude={2,2,6,6} }) +des.levregion({ region={4,4,4,4}, type="portal", name="wizard3" }) +des.mazewalk(08,05,"east") +des.region({ region={04,03,06,06},lit=0,type="ordinary",prefilled=0,irregular=1 }) +des.monster("L",04,04) +des.monster("vampire lord",03,04) +des.monster("kraken",06,06) +-- And to make things a little harder. +des.trap("board",04,03) +des.trap("board",04,05) +des.trap("board",03,04) +des.trap("board",05,04) + diff --git a/dat/fakewiz2.lua b/dat/fakewiz2.lua new file mode 100644 index 000000000..d8f73abb3 --- /dev/null +++ b/dat/fakewiz2.lua @@ -0,0 +1,35 @@ +-- NetHack 3.6 yendor.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1992 by M. Stephenson and Izchak Miller +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style="mazegrid", bg ="-" }); + +des.level_flags("mazelevel"); + +des.map([[ +......... +.}}}}}}}. +.}}---}}. +.}--.--}. +.}|...|}. +.}--.--}. +.}}---}}. +.}}}}}}}. +]]); +des.levregion({ region={01,00,79,20}, region_islev=1, exclude={0,0,8,7}, type="stair-up" }) +des.levregion({ region={01,00,79,20}, region_islev=1, exclude={0,0,8,7}, type="stair-down" }) +des.levregion({ region={01,00,79,20}, region_islev=1, exclude={0,0,8,7}, type="branch" }); +des.teleport_region({ region={01,00,79,20}, region_islev=1,exclude={2,2,6,6} }) +des.mazewalk(08,05,"east") +des.region({ region={04,03,06,06},lit=0,type="ordinary",prefilled=0,irregular=1 }) +des.monster("L",04,04) +des.monster("vampire lord",03,04) +des.monster("kraken",06,06) +-- And to make things a little harder. +des.trap("board",04,03) +des.trap("board",04,05) +des.trap("board",03,04) +des.trap("board",05,04) +-- treasures +des.object("\"",04,04) diff --git a/dat/fire.lua b/dat/fire.lua new file mode 100644 index 000000000..105ca0fd0 --- /dev/null +++ b/dat/fire.lua @@ -0,0 +1,156 @@ +-- NetHack 3.6 endgame.des $NHDT-Date: 1546303680 2019/01/01 00:48:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.14 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1992,1993 by Izchak Miller, David Cohrs, +-- and Timo Hakulinen +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor", "shortsighted") +-- The player lands, upon arrival, in the +-- lower-right. The location of the +-- portal to the next level is randomly chosen. +-- This map has no visible outer boundary, and +-- is mostly open area, with lava lakes and bunches of fire traps. +des.map([[ +............................................................................ +....LLLLLLLL............L.......................LLL......................... +...LL...................L......................LLLL................LL....... +...L.............LLLL...LL....LL...............LLLLL.............LLL........ +.LLLL..............LL....L.....LLL..............LLLL..............LLLL...... +..........LLLL...LLLL...LLL....LLL......L........LLLL....LL........LLL...... +........LLLLLLL...LL.....L......L......LL.........LL......LL........LL...L.. +........LL..LLL..LL......LL......LLLL..L.........LL......LLL............LL.. +....L..LL....LLLLL.................LLLLLLL.......L......LL............LLLLLL +....L..L.....LL.LLLL.......L............L........LLLLL.LL......LL.........LL +....LL........L...LL......LL.............LLL.....L...LLL.......LLL.........L +.....LLLLLL........L.......LLL.............L....LL...L.LLL......LLLLLLL..... +..........LLLL............LL.L.............L....L...LL.........LLL..LLL..... +...........................LLLLL...........LL...L...L........LLLL..LLLLLL... +.....LLLL.............LL....LL.......LLL...LL.......L..LLL....LLLLLLL....... +.......LLL.........LLLLLLLLLLL......LLLLL...L...........LL...LL...LL........ +.........LL.......LL.........LL.......LLL....L..LLL....LL.........LL........ +..........LLLLLLLLL...........LL....LLL.......LLLLL.....LL........LL........ +.................L.............LLLLLL............LL...LLLL.........LL....... +.................................LL....................LL................... +]]); +des.teleport_region({ region = {69,16,69,16} }) +des.levregion({ region = {0,0,75,19}, exclude = {65,13,75,19}, type="portal", name="water" }) + +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("fire") +-- An assortment of fire-appropriate nasties +des.monster("red dragon") +des.monster("balrog") +des.monster({ id = "fire elemental", peaceful = 0 }) +des.monster({ id = "fire elemental", peaceful = 0 }) +des.monster("fire vortex") +des.monster("hell hound") +-- +des.monster("fire giant") +des.monster("barbed devil") +des.monster("hell hound") +des.monster("stone golem") +des.monster("pit fiend") +des.monster({ id = "fire elemental", peaceful = 0 }) +-- +des.monster({ id = "fire elemental", peaceful = 0 }) +des.monster("hell hound") +des.monster({ id = "fire elemental", peaceful = 0 }) +des.monster({ id = "fire elemental", peaceful = 0 }) +des.monster("scorpion") +des.monster("fire giant") +-- +des.monster("hell hound") +des.monster("dust vortex") +des.monster("fire vortex") +des.monster({ id = "fire elemental", peaceful = 0 }) +des.monster({ id = "fire elemental", peaceful = 0 }) +des.monster({ id = "fire elemental", peaceful = 0 }) +des.monster("hell hound") +des.monster({ id = "fire elemental", peaceful = 0 }) +des.monster("stone golem") +des.monster("pit viper") +des.monster("pit viper") +des.monster("fire vortex") +-- +des.monster({ id = "fire elemental", peaceful = 0 }) +des.monster({ id = "fire elemental", peaceful = 0 }) +des.monster("fire giant") +des.monster({ id = "fire elemental", peaceful = 0 }) +des.monster("fire vortex") +des.monster("fire vortex") +des.monster("pit fiend") +des.monster({ id = "fire elemental", peaceful = 0 }) +des.monster("pit viper") +-- +des.monster({ id = "salamander", peaceful = 0 }) +des.monster({ id = "salamander", peaceful = 0 }) +des.monster("minotaur") +des.monster({ id = "salamander", peaceful = 0 }) +des.monster("steam vortex") +des.monster({ id = "salamander", peaceful = 0 }) +des.monster({ id = "salamander", peaceful = 0 }) +-- +des.monster("fire giant") +des.monster("barbed devil") +des.monster({ id = "fire elemental", peaceful = 0 }) +des.monster("fire vortex") +des.monster({ id = "fire elemental", peaceful = 0 }) +des.monster({ id = "fire elemental", peaceful = 0 }) +des.monster("hell hound") +des.monster("fire giant") +des.monster("pit fiend") +des.monster({ id = "fire elemental", peaceful = 0 }) +des.monster({ id = "fire elemental", peaceful = 0 }) +-- +des.monster("barbed devil") +des.monster({ id = "salamander", peaceful = 0 }) +des.monster("steam vortex") +des.monster({ id = "salamander", peaceful = 0 }) +des.monster({ id = "salamander", peaceful = 0 }) + +des.object("boulder") +des.object("boulder") +des.object("boulder") +des.object("boulder") +des.object("boulder") + diff --git a/dat/gehennom.des b/dat/gehennom.des deleted file mode 100644 index 65fab4e28..000000000 --- a/dat/gehennom.des +++ /dev/null @@ -1,713 +0,0 @@ -# NetHack 3.6 gehennom.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# Copyright (c) 1992 by M. Stephenson and Izchak Miller -# NetHack may be freely redistributed. See license for details. -# - -MAZE: "valley", ' ' -FLAGS: noteleport,hardfloor,nommap -GEOMETRY:center,center -MAP ----------------------------------------------------------------------------- -|...S.|..|.....| |.....-| |................| |...............| |...| -|---|.|.--.---.| |......--- ----..........-----.-----....---........---.-.| -| |.|.|..| |.| --........| |.............| |.......---| |-...........--| -| |...S..| |.| |.......-----.......------| |--------..---......------- | -|----------- |.| |-......| |....|...-- |...-----................---- | -|.....S....---.| |.......| |....|...| |..............----------- | -|.....|.|......| |.....--- |......--- |....---.......| | -|.....|.|------| |....-- --....-- |-------- ----....--------------- | -|.....|--......---BBB-| |...-- |.......| |..................| | -|..........||........-| --...| |.......| |...||.............| | -|.....|...-||-........------....| |.......---- |...||.............-- | -|.....|--......---...........--------..........| |.......---------...-- | -|.....| |------| |--.......--| |..B......----- -----....| |.| |....--- | -|.....| |......--| ------..| |----..B......| |.--------.-- |-.....---| -|------ |........| |.|....| |.....----BBBB---------...........---.........| -| |........| |...|..| |.....| |-.............--------...........---| -| --.....-----------.| |....-----.....---------- |.........---- | -| |..|..B...........| |.|..........|.| |.|........| | ----------------------------------------------------------------------------- -ENDMAP - -# Make the path somewhat unpredictable -# If you get "lucky", you may have to go through all three graveyards. -IF [50%] { - TERRAIN:line (50,8),(53,8), '-' - TERRAIN:line (40,8),(43,8), 'B' -} -IF [50%] { - TERRAIN:(27,12),'|' - TERRAIN:line (27,3),(29,3), 'B' - TERRAIN:(28,2), '-' -} -IF [50%] { - TERRAIN:line (16,10),(16,11),'|' - TERRAIN:line (9,13),(14,13), 'B' -} - - -# Dungeon Description -# The shrine to Moloch. -REGION:(01,06,05,14),lit,"temple" -# The Morgues -REGION:(19,01,24,08),unlit,"morgue",filled,irregular -REGION:(09,14,16,18),unlit,"morgue",filled,irregular -REGION:(37,09,43,14),unlit,"morgue",filled,irregular -# Stairs -STAIR:(01,01),down -# Branch location -BRANCH:(66,17,66,17),(0,0,0,0) -TELEPORT_REGION:(58,09,72,18),(0,0,0,0),down - -# Secret Doors -DOOR:locked,(04,01) -DOOR:locked,(08,04) -DOOR:locked,(06,06) - -# The altar of Moloch. -ALTAR:(03,10),noalign,shrine - -# Non diggable walls - everywhere! -NON_DIGGABLE:(00,00,75,19) - -# Objects -# **LOTS** of dead bodies (all human). -# note: no priest(esse)s or monks - maybe Moloch has a *special* -# fate reserved for members of *those* classes. -# -OBJECT:('%',"corpse"),random,montype:"archeologist" -OBJECT:('%',"corpse"),random,montype:"archeologist" -OBJECT:('%',"corpse"),random,montype:"barbarian" -OBJECT:('%',"corpse"),random,montype:"barbarian" -OBJECT:('%',"corpse"),random,montype:"caveman" -OBJECT:('%',"corpse"),random,montype:"cavewoman" -OBJECT:('%',"corpse"),random,montype:"healer" -OBJECT:('%',"corpse"),random,montype:"healer" -OBJECT:('%',"corpse"),random,montype:"knight" -OBJECT:('%',"corpse"),random,montype:"knight" -OBJECT:('%',"corpse"),random,montype:"ranger" -OBJECT:('%',"corpse"),random,montype:"ranger" -OBJECT:('%',"corpse"),random,montype:"rogue" -OBJECT:('%',"corpse"),random,montype:"rogue" -OBJECT:('%',"corpse"),random,montype:"samurai" -OBJECT:('%',"corpse"),random,montype:"samurai" -OBJECT:('%',"corpse"),random,montype:"tourist" -OBJECT:('%',"corpse"),random,montype:"tourist" -OBJECT:('%',"corpse"),random,montype:"valkyrie" -OBJECT:('%',"corpse"),random,montype:"valkyrie" -OBJECT:('%',"corpse"),random,montype:"wizard" -OBJECT:('%',"corpse"),random,montype:"wizard" -# -# Some random weapons and armor. -# -OBJECT:'[',random -OBJECT:'[',random -OBJECT:'[',random -OBJECT:'[',random -OBJECT:')',random -OBJECT:')',random -OBJECT:')',random -OBJECT:')',random -# -# Some random loot. -# -OBJECT:('*',"ruby"),random -OBJECT:'*',random -OBJECT:'*',random -OBJECT:'!',random -OBJECT:'!',random -OBJECT:'!',random -OBJECT:'?',random -OBJECT:'?',random -OBJECT:'?',random -OBJECT:'/',random -OBJECT:'/',random -OBJECT:'=',random -OBJECT:'=',random -OBJECT:'+',random -OBJECT:'+',random -OBJECT:'(',random -OBJECT:'(',random -OBJECT:'(',random - -# (Not so) Random traps. -TRAP:"spiked pit", (05,02) -TRAP:"spiked pit", (14,05) -TRAP:"sleep gas", (03,01) -TRAP:"board", (21,12) -TRAP:"board", random -TRAP:"dart", (60,01) -TRAP:"dart", (26,17) -TRAP:"anti magic", random -TRAP:"anti magic", random -TRAP:"magic", random -TRAP:"magic", random - -# Random monsters. -# The ghosts. -MONSTER:(' ',"ghost"),random -MONSTER:(' ',"ghost"),random -MONSTER:(' ',"ghost"),random -MONSTER:(' ',"ghost"),random -MONSTER:(' ',"ghost"),random -MONSTER:(' ',"ghost"),random -# Add a few bats for atmosphere. -MONSTER:('B',"vampire bat"),random -MONSTER:('B',"vampire bat"),random -MONSTER:('B',"vampire bat"),random -# And a lich for good measure. -MONSTER:'L',random -# Some undead nasties for good measure -MONSTER:'V',random -MONSTER:'V',random -MONSTER:'V',random -MONSTER:'Z',random -MONSTER:'Z',random -MONSTER:'Z',random -MONSTER:'Z',random -MONSTER:'M',random -MONSTER:'M',random -MONSTER:'M',random -MONSTER:'M',random -# -# The Juiblex level -# -MAZE:"juiblex",' ' -FLAGS:noteleport,shortsighted -INIT_MAP:mines,'.','}',true,true,unlit,false -# guarantee at least one open spot to ensure successful stair placement -GEOMETRY:left,bottom -MAP -xxxxxxxx -xx...xxx -xxx...xx -xxxx.xxx -xxxxxxxx -ENDMAP -OBJECT:('`',"boulder"),random -GEOMETRY:right,top -MAP -xxxxxxxx -xxxx.xxx -xxx...xx -xx...xxx -xxxxxxxx -ENDMAP -OBJECT:('`',"boulder"),random -# lair -GEOMETRY:center,center -MAP -xx}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}xx -x}}}.}}}}}..}}}..}}}}}..}}}..}}}}}..}}}..}}}}}.}}}x -}}}...}}..}}.}.}}.}}.}}}...}}}.}}}..}}}..}}}}...}}} -x}}}.}}.}}}.}}.}}.}}...}}.}}.....}}.....}....}.}}}x -xx}}}..}}}.}}.}}.}}..}}.....}}.}}}.}}.}}}}}}}}}}}xx -x}}}..}}}}}.}}.}}.}}...}}}}}.....}}.}}}}}}.....}}}x -}}}..}}...}}..}}.}}}.}}}...}}}.}}}.}.}}}}..P.P..}}} -}}.}}}}...}}}}}.}...}}}..P..}}}.}.}}}.}}}}.....}}}} -}.}}}}.}}.}..}.}}}}}}}..P.P..}}}.}}}.}}..}}...}}}}x -x}}}}.}}}}....}}}}}.}}}..P..}}}.}}}}.}}..}}...}}}.} -}}}}..}}.}}..}}}}...}}}}...}}}.}}}}}.}}}}.}}}}}}.}} -}}}...}}...}}}..}}}}}}}}}}}}.....}}}}.}}...}..}.}}} -x}}}..}}.}}}}....}}..}}}..}}.....}}}}.}}}.}....}}}x -xx}}}.}}}}..}}..}}..}}..}}..}}.}}}..}.}..}}}..}}}xx -x}}}.}}}}....}}}}..}}....}}}}}}}...}}}....}}}}.}}}x -}}}...}}}....}}}..}}}....}}}..}}...}}}....}}}...}}} -x}}}.}}}}}..}}}..}}}}}..}}}..}}}}}..}}}..}}}}}.}}}x -xx}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}xx -ENDMAP -# Random registers -$monster = monster: { 'j','b','P','F' } -SHUFFLE: $monster - -$place = { (04,02),(46,02),(04,15),(46,15) } -SHUFFLE: $place - -# Dungeon description -REGION:(00,00,50,17),unlit,"swamp" -MAZEWALK:(00,09),west -MAZEWALK:(50,08),east -STAIR:levregion(01,00,11,20),(0,0,50,17),down -STAIR:levregion(69,00,79,20),(0,0,50,17),up -BRANCH:levregion(01,00,11,20),(0,0,50,17) -TELEPORT_REGION:levregion(01,00,11,20),(0,0,50,17),up -TELEPORT_REGION:levregion(69,00,79,20),(0,0,50,17),down -FOUNTAIN:$place[0] -MONSTER:('m',"giant mimic"),$place[1],m_feature "fountain" -MONSTER:('m',"giant mimic"),$place[2],m_feature "fountain" -MONSTER:('m',"giant mimic"),$place[3],m_feature "fountain" -# The demon of the swamp -MONSTER:('&',"Juiblex"),(25,08) -# And a couple demons -MONSTER:('i',"lemure"),(43,08) -MONSTER:('i',"lemure"),(44,08) -MONSTER:('i',"lemure"),(45,08) -# Some liquids and gems -OBJECT:'*',(43,06) -OBJECT:'*',(45,06) -OBJECT:'!',(43,09) -OBJECT:'!',(44,09) -OBJECT:'!',(45,09) -# And lots of blobby monsters -MONSTER:$monster[0],(25,06) -MONSTER:$monster[1],(24,07) -MONSTER:$monster[2],(26,07) -MONSTER:$monster[3],(23,08) -MONSTER:$monster[3],(27,08) -MONSTER:$monster[2],(24,09) -MONSTER:$monster[1],(26,09) -MONSTER:$monster[0],(25,10) -MONSTER:'j',random -MONSTER:'j',random -MONSTER:'j',random -MONSTER:'j',random -MONSTER:'P',random -MONSTER:'P',random -MONSTER:'P',random -MONSTER:'P',random -MONSTER:'b',random -MONSTER:'b',random -MONSTER:'b',random -MONSTER:'F',random -MONSTER:'F',random -MONSTER:'F',random -MONSTER:'m',random -MONSTER:'m',random -MONSTER:(';',"jellyfish"),random -MONSTER:(';',"jellyfish"),random -# Some random objects -OBJECT:'!',random -OBJECT:'!',random -OBJECT:'!',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:('`',"boulder"),random -# Some traps -TRAP:"sleep gas",random -TRAP:"sleep gas",random -TRAP:"anti magic",random -TRAP:"anti magic",random -TRAP:"magic",random -TRAP:"magic",random -# -# The Orcus Level -# -MAZE:"orcus",random -FLAGS: noteleport,shortsighted -GEOMETRY:right,center -# A ghost town -MAP -.|....|....|....|..............|....|........ -.|....|....|....|..............|....|........ -.|....|....|....|--...-+-------|............. -.|....|....|....|..............+............. -.|.........|....|..............|....|........ -.--+-...-+----+--....-------...--------.-+--- -.....................|.....|................. -.....................|.....|................. -.--+----....-+---....|.....|...----------+--- -.|....|....|....|....---+---...|......|...... -.|.........|....|..............|......|...... -.----...---------.....-----....+......|...... -.|........................|....|......|...... -.----------+-...--+--|....|....----------+--- -.|....|..............|....+....|............. -.|....+.......|......|....|....|............. -.|....|.......|......|....|....|............. -ENDMAP -MAZEWALK:(00,06),west -# Entire main area -REGION:(01,00,44,16),unlit,"ordinary" -STAIR:(33,15),down -STAIR:levregion(01,00,12,20),levregion(20,01,70,20),up -BRANCH:levregion(01,00,12,20),levregion(20,01,70,20) -TELEPORT_REGION:levregion(01,00,12,20),levregion(20,01,70,20) -# Wall "ruins" -OBJECT:('`',"boulder"),(19,02) -OBJECT:('`',"boulder"),(20,02) -OBJECT:('`',"boulder"),(21,02) -OBJECT:('`',"boulder"),(36,02) -OBJECT:('`',"boulder"),(36,03) -OBJECT:('`',"boulder"),(06,04) -OBJECT:('`',"boulder"),(05,05) -OBJECT:('`',"boulder"),(06,05) -OBJECT:('`',"boulder"),(07,05) -OBJECT:('`',"boulder"),(39,05) -OBJECT:('`',"boulder"),(08,08) -OBJECT:('`',"boulder"),(09,08) -OBJECT:('`',"boulder"),(10,08) -OBJECT:('`',"boulder"),(11,08) -OBJECT:('`',"boulder"),(06,10) -OBJECT:('`',"boulder"),(05,11) -OBJECT:('`',"boulder"),(06,11) -OBJECT:('`',"boulder"),(07,11) -OBJECT:('`',"boulder"),(21,11) -OBJECT:('`',"boulder"),(21,12) -OBJECT:('`',"boulder"),(13,13) -OBJECT:('`',"boulder"),(14,13) -OBJECT:('`',"boulder"),(15,13) -OBJECT:('`',"boulder"),(14,14) -# Doors -DOOR:closed,(23,02) -DOOR:open,(31,03) -DOOR:nodoor,(03,05) -DOOR:closed,(09,05) -DOOR:closed,(14,05) -DOOR:closed,(41,05) -DOOR:open,(03,08) -DOOR:nodoor,(13,08) -DOOR:open,(41,08) -DOOR:closed,(24,09) -DOOR:closed,(31,11) -DOOR:open,(11,13) -DOOR:closed,(18,13) -DOOR:closed,(41,13) -DOOR:open,(26,14) -DOOR:closed,(06,15) -# Special rooms -ALTAR:(24,07),noalign,sanctum -REGION:(22,12,25,16),unlit,"morgue" -REGION:(32,09,37,12),lit,"shop" -REGION:(12,00,15,04),lit,"shop" -# Some traps. -TRAP:"spiked pit", random -TRAP:"sleep gas", random -TRAP:"anti magic", random -TRAP:"fire", random -TRAP:"fire", random -TRAP:"fire", random -TRAP:"magic", random -TRAP:"magic", random -# Some random objects -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# The resident nasty -MONSTER:('&',"Orcus"),(33,15) -# And its preferred companions -MONSTER:('Z',"human zombie"),(32,15) -MONSTER:(' ',"shade"),(32,14) -MONSTER:(' ',"shade"),(32,16) -MONSTER:('V',"vampire"),(35,16) -MONSTER:('V',"vampire"),(35,14) -MONSTER:('V',"vampire lord"),(36,14) -MONSTER:('V',"vampire lord"),(36,15) -# Randomly placed companions -MONSTER:('Z',"skeleton"),random -MONSTER:('Z',"skeleton"),random -MONSTER:('Z',"skeleton"),random -MONSTER:('Z',"skeleton"),random -MONSTER:('Z',"skeleton"),random -MONSTER:(' ',"shade"),random -MONSTER:(' ',"shade"),random -MONSTER:(' ',"shade"),random -MONSTER:(' ',"shade"),random -MONSTER:('Z',"giant zombie"),random -MONSTER:('Z',"giant zombie"),random -MONSTER:('Z',"giant zombie"),random -MONSTER:('Z',"ettin zombie"),random -MONSTER:('Z',"ettin zombie"),random -MONSTER:('Z',"ettin zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:('Z',"human zombie"),random -MONSTER:('V',"vampire"),random -MONSTER:('V',"vampire"),random -MONSTER:('V',"vampire"),random -MONSTER:('V',"vampire lord"),random -MONSTER:('V',"vampire lord"),random -# A few more for the party -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -# -# The Asmodeus Level -# -MAZE:"asmodeus",random -FLAGS: noteleport -# First part -GEOMETRY:half-left,center -MAP ---------------------- -|.............|.....| -|.............S.....| -|---+------------...| -|.....|.........|-+-- -|..---|.........|.... -|..|..S.........|.... -|..|..|.........|.... -|..|..|.........|-+-- -|..|..-----------...| -|..S..........|.....| ---------------------- -ENDMAP -STAIR:levregion(01,00,6,20),levregion(6,1,70,16),up -BRANCH:levregion(01,00,6,20),levregion(6,1,70,16) -TELEPORT_REGION:levregion(01,00,6,20),levregion(6,1,70,16) - -# Doors -DOOR:closed,(04,03) -DOOR:locked,(18,04) -DOOR:closed,(18,08) -# -STAIR:(13,07),down -# Non diggable walls -NON_DIGGABLE:(00,00,20,11) -# Entire main area -REGION:(01,01,20,10),unlit,"ordinary" -# The fellow in residence -MONSTER:('&',"Asmodeus"),(12,07) -# Some random weapons and armor. -OBJECT:'[',random -OBJECT:'[',random -OBJECT:')',random -OBJECT:')',random -OBJECT:'*',random -OBJECT:'!',random -OBJECT:'!',random -OBJECT:'?',random -OBJECT:'?',random -OBJECT:'?',random -# Some traps. -TRAP:"spiked pit", (05,02) -TRAP:"fire", (08,06) -TRAP:"sleep gas", random -TRAP:"anti magic", random -TRAP:"fire", random -TRAP:"magic", random -TRAP:"magic", random -# Random monsters. -MONSTER:(' ',"ghost"),(11,07) -MONSTER:('&',"horned devil"),(10,05) -MONSTER:'L',random -# Some Vampires for good measure -MONSTER:'V',random -MONSTER:'V',random -MONSTER:'V',random -# Second part -GEOMETRY:half-right,center -MAP ---------------------------------- -................................| -................................+ -................................| ---------------------------------- -ENDMAP -MAZEWALK:(32,02),east -# Non diggable walls -NON_DIGGABLE:(00,00,32,04) -DOOR:closed,(32,02) -MONSTER:'&',random -MONSTER:'&',random -MONSTER:'&',random -TRAP:"anti magic", random -TRAP:"fire", random -TRAP:"magic", random - -# -# The Baalzebub level -# -MAZE:"baalz",' ' -FLAGS: noteleport,corrmaze -GEOMETRY:right,center -# the two pools are fakes used to mark spots which need special wall fixups -# the two iron bars are eyes and spots to their left will be made diggable -MAP -------------------------------------------------- -| ---- ---- -| ---- | ----------- | -| ------ | ---------|.........|--P -| F....| -------|...........-------------- ----....|--|..................S............|---- -+...--....S..----------------|............S...| ----....|--|..................|............|---- -| F....| -------|...........-----S-------- -| ------ | ---------|.........|--P -| ---- | ----------- | -| ---- ---- -------------------------------------------------- -ENDMAP -STAIR:levregion(01,00,15,20),levregion(15,1,70,16),up -BRANCH:levregion(01,00,15,20),levregion(15,1,70,16) -TELEPORT_REGION:levregion(01,00,15,20),levregion(15,1,70,16) -# this actually leaves the farthest right column diggable -NON_DIGGABLE:(00,00,47,12) -MAZEWALK:(00,06),west -STAIR:(44,06),down -DOOR:locked,(00,06) -IF [50%] { - TERRAIN:(34,08),'-' - TERRAIN:(34,04),'S' - TERRAIN:(29,05),'|' - TERRAIN:(29,07),'S' -} -# The fellow in residence -MONSTER:('&',"Baalzebub"),(35,06) -# Some random weapons and armor. -OBJECT:'[',random -OBJECT:'[',random -OBJECT:')',random -OBJECT:')',random -OBJECT:'*',random -OBJECT:'!',random -OBJECT:'!',random -OBJECT:'?',random -OBJECT:'?',random -OBJECT:'?',random -# Some traps. -TRAP:"spiked pit", random -TRAP:"fire", random -TRAP:"sleep gas", random -TRAP:"anti magic", random -TRAP:"fire", random -TRAP:"magic", random -TRAP:"magic", random -# Random monsters. -MONSTER:(' ',"ghost"),(37,07) -MONSTER:('&',"horned devil"),(32,05) -MONSTER:('&',"barbed devil"),(38,07) -MONSTER:'L',random -# Some Vampires for good measure -MONSTER:'V',random -MONSTER:'V',random -MONSTER:'V',random -# -# The Sanctum Level -# -MAZE:"sanctum", ' ' -FLAGS: noteleport,hardfloor,nommap -# This is outside the main map, below, so we must do it before adding -# that map and anchoring coordinates to it. This extends the invisible -# barrier up to the top row, which falls outside the drawn map. -NON_PASSWALL:(39,00,41,00) -GEOMETRY:center,center -MAP ----------------------------------------------------------------------------- -| -------------- | -| |............| ------- | -| -------............----- |.....| | -| |......................| --.....| --------- | -| ----......................---------|......---- |.......| | -| |........---------..........|......+.........| ------+---..| | -| ---........|.......|..........--S----|.........| |........|..| | -| |..........|.......|.............| |.........-------..---------- | -| |..........|.......|..........---- |..........|....|..|......| | -| |..........|.......|..........| --.......----+---S---S--..| | -| |..........---------..........| |.......|.............|..| | -| ---...........................| -----+-------S---------S--- | -| |...........................| |...| |......| |....|-- | -| ----.....................---- |...---....--- ---......| | -| |.....................| |..........| |.....---- | -| -------...........----- --...------- |.....| | -| |...........| |...| |.....| | -| ------------- ----- ------- | ----------------------------------------------------------------------------- -ENDMAP -REGION:(15,07,21,10),lit,"temple" -ALTAR:(18,08),noalign,sanctum -REGION:(41,06,48,11),unlit,"morgue",filled,irregular -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# Invisible barrier separating the left & right halves of the level -NON_PASSWALL:(37,00,39,19) -# Doors -DOOR:closed,(40,06) -DOOR:locked,(62,06) -DOOR:closed,(46,12) -DOOR:closed,(53,10) -# Surround the temple with fire -TRAP:"fire",(13,05) -TRAP:"fire",(14,05) -TRAP:"fire",(15,05) -TRAP:"fire",(16,05) -TRAP:"fire",(17,05) -TRAP:"fire",(18,05) -TRAP:"fire",(19,05) -TRAP:"fire",(20,05) -TRAP:"fire",(21,05) -TRAP:"fire",(22,05) -TRAP:"fire",(23,05) -TRAP:"fire",(13,12) -TRAP:"fire",(14,12) -TRAP:"fire",(15,12) -TRAP:"fire",(16,12) -TRAP:"fire",(17,12) -TRAP:"fire",(18,12) -TRAP:"fire",(19,12) -TRAP:"fire",(20,12) -TRAP:"fire",(21,12) -TRAP:"fire",(22,12) -TRAP:"fire",(23,12) -TRAP:"fire",(13,06) -TRAP:"fire",(13,07) -TRAP:"fire",(13,08) -TRAP:"fire",(13,09) -TRAP:"fire",(13,10) -TRAP:"fire",(13,11) -TRAP:"fire",(23,06) -TRAP:"fire",(23,07) -TRAP:"fire",(23,08) -TRAP:"fire",(23,09) -TRAP:"fire",(23,10) -TRAP:"fire",(23,11) -# Some traps. -TRAP:"spiked pit", random -TRAP:"fire", random -TRAP:"sleep gas", random -TRAP:"anti magic", random -TRAP:"fire", random -TRAP:"magic", random -# Some random objects -OBJECT:'[',random -OBJECT:'[',random -OBJECT:'[',random -OBJECT:'[',random -OBJECT:')',random -OBJECT:')',random -OBJECT:'*',random -OBJECT:'!',random -OBJECT:'!',random -OBJECT:'!',random -OBJECT:'!',random -OBJECT:'?',random -OBJECT:'?',random -OBJECT:'?',random -OBJECT:'?',random -OBJECT:'?',random -# Some monsters. -MONSTER:('&',"horned devil"),(14,12),hostile -MONSTER:('&',"barbed devil"),(18,08),hostile -MONSTER:('&',"erinys"),(10,04),hostile -MONSTER:('&',"marilith"),(07,09),hostile -MONSTER:('&',"nalfeshnee"),(27,08),hostile -# Moloch's horde -MONSTER:('@',"aligned priest"),(20,03),noalign,hostile -MONSTER:('@',"aligned priest"),(15,04),noalign,hostile -MONSTER:('@',"aligned priest"),(11,05),noalign,hostile -MONSTER:('@',"aligned priest"),(11,07),noalign,hostile -MONSTER:('@',"aligned priest"),(11,09),noalign,hostile -MONSTER:('@',"aligned priest"),(11,12),noalign,hostile -MONSTER:('@',"aligned priest"),(15,13),noalign,hostile -MONSTER:('@',"aligned priest"),(17,13),noalign,hostile -MONSTER:('@',"aligned priest"),(21,13),noalign,hostile -# A few nasties -MONSTER:'L',random -MONSTER:'L',random -MONSTER:'V',random -MONSTER:'V',random -MONSTER:'V',random -STAIR:(63,15),up -# Teleporting to this level is allowed after the invocation creates its -# entrance. Force arrival in that case to be on rightmost third of level. -TELEPORT_REGION:levregion(54,1,79,18),(0,0,0,0),down diff --git a/dat/history b/dat/history index 70935071a..9e5979862 100644 --- a/dat/history +++ b/dat/history @@ -57,7 +57,7 @@ Spackman, Steve VanDevender, and Paul Winner, ported NetHack 3.1 to the PC. Jon W{tte and Hao-yang Wang, with help from Ross Brown, Mike Engber, David Hairston, Michael Hamel, Jonathan Handler, Johnny Lee, Tim Lennan, Rob Menke, and Andy Swanson developed NetHack 3.1 for the Macintosh, porting it for -MPW. Building on their development, Barton House added a Think C port. +MPW. Building on their development, Bart House added a Think C port. Timo Hakulinen ported NetHack 3.1 to OS/2. Eric Smith ported NetHack 3.1 to the Atari. Pat Rankin, with help from Joshua Delahunty, is responsible @@ -195,7 +195,7 @@ Unix flavors as well as maintaining the X11 interface. Ken Lorber, Haoyang Wang, Pat Rankin, and Dean Luick maintained the port of NetHack 3.6.1 for Mac OSX. -Michael Allison, David Cohrs, Barton House, Pasi Kallinen, Alex Kompel, +Michael Allison, David Cohrs, Bart House, Pasi Kallinen, Alex Kompel, Dion Nicolaas, Derek S. Ray and Yitzhak Sapir maintained the port of NetHack 3.6 for Microsoft Windows. @@ -217,6 +217,15 @@ Derek S. Ray, Alex Smith, Mike Stephenson, Janet Walz and Paul Winner. In early May 2019, another 320 bug fixes along with some enhancements and the adopted curses window port, were released as 3.6.2. +Bart House, who had contributed to the game as a porting team participant +for decades, joined the NetHack Development Team in late May 2019. + +NetHack 3.6.3 was released on December 5, 2019 containing over 190 bug +fixes to NetHack 3.6.2. + +NetHack 3.6.4 was released on December 18, 2019 containing a security +fix and a few bug fixes. + The official NetHack web site is maintained by Ken Lorber at http://www.nethack.org/. @@ -234,44 +243,45 @@ particularly intriguing modification to help out with the game. The NetHack Development Team sometimes makes note of the names of the worst of these miscreants in this, the list of Dungeoneers: - Adam Aronow Janet Walz Nathan Eady - Alex Kompel Janne Salmijarvi Norm Meluch - Alex Smith Jean-Christophe Collet Olaf Seibert - Andreas Dorn Jeff Bailey Pasi Kallinen - Andy Church Jochen Erwied Pat Rankin - Andy Swanson John Kallen Patric Mueller + Adam Aronow J. Ali Harlow Mikko Juola + Alex Kompel Janet Walz Nathan Eady + Alex Smith Janne Salmijarvi Norm Meluch + Andreas Dorn Jean-Christophe Collet Olaf Seibert + Andy Church Jeff Bailey Pasi Kallinen + Andy Swanson Jochen Erwied Pat Rankin + Andy Thomson John Kallen Patric Mueller Ari Huttunen John Rupley Paul Winner - Barton House John S. Bien Pierre Martineau + Bart House John S. Bien Pierre Martineau Benson I. Margulies Johnny Lee Ralf Brown Bill Dyer Jon W{tte Ray Chason Boudewijn Waijers Jonathan Handler Richard Addison Bruce Cox Joshua Delahunty Richard Beigel Bruce Holloway Karl Garrison Richard P. Hughey Bruce Mewborne Keizo Yamamoto Rob Menke - Carl Schelin Ken Arnold Robin Bandy - Chris Russo Ken Arromdee Robin Johnson - David Cohrs Ken Lorber Roderick Schertler - David Damerell Ken Washikita Roland McGrath - David Gentzel Kevin Darcy Ron Van Iwaarden - David Hairston Kevin Hugo Ronnen Miller - Dean Luick Kevin Sitze Ross Brown - Del Lamb Kevin Smolkowski Sascha Wostmann - Derek S. Ray Kevin Sweet Scott Bigham - Deron Meranda Lars Huttar Scott R. Turner - Dion Nicolaas Leon Arnott Sean Hunt - Dylan O'Donnell M. Drew Streib Stephen Spackman - Eric Backus Malcolm Ryan Stefan Thielscher - Eric Hendrickson Mark Gooderum Stephen White - Eric R. Smith Mark Modrall Steve Creps - Eric S. Raymond Marvin Bressler Steve Linhart - Erik Andersen Matthew Day Steve VanDevender - Frederick Roeber Merlyn LeRoy Teemu Suikki - Gil Neiger Michael Allison Tim Lennan - Greg Laskin Michael Feir Timo Hakulinen - Greg Olson Michael Hamel Tom Almy - Gregg Wonderly Michael Sokolov Tom West - Hao-yang Wang Mike Engber Warren Cheung - Helge Hafting Mike Gallop Warwick Allison - Irina Rempt-Drijfhout Mike Passaretti Yitzhak Sapir + Carl Schelin Keith Simpson Robin Bandy + Chris Russo Ken Arnold Robin Johnson + David Cohrs Ken Arromdee Roderick Schertler + David Damerell Ken Lorber Roland McGrath + David Gentzel Ken Washikita Ron Van Iwaarden + David Hairston Kevin Darcy Ronnen Miller + Dean Luick Kevin Hugo Ross Brown + Del Lamb Kevin Sitze Sascha Wostmann + Derek S. Ray Kevin Smolkowski Scott Bigham + Deron Meranda Kevin Sweet Scott R. Turner + Dion Nicolaas Lars Huttar Sean Hunt + Dylan O'Donnell Leon Arnott Stephen Spackman + Eric Backus M. Drew Streib Stefan Thielscher + Eric Hendrickson Malcolm Ryan Stephen White + Eric R. Smith Mark Gooderum Steve Creps + Eric S. Raymond Mark Modrall Steve Linhart + Erik Andersen Marvin Bressler Steve VanDevender + Fredrik Ljungdahl Matthew Day Teemu Suikki + Frederick Roeber Merlyn LeRoy Tim Lennan + Gil Neiger Michael Allison Timo Hakulinen + Greg Laskin Michael Feir Tom Almy + Greg Olson Michael Hamel Tom West + Gregg Wonderly Michael Sokolov Warren Cheung + Hao-yang Wang Mike Engber Warwick Allison + Helge Hafting Mike Gallop Yitzhak Sapir + Irina Rempt-Drijfhout Mike Passaretti Izchak Miller Mike Stephenson - J. Ali Harlow Mikko Juola diff --git a/dat/juiblex.lua b/dat/juiblex.lua new file mode 100644 index 000000000..19c95e884 --- /dev/null +++ b/dat/juiblex.lua @@ -0,0 +1,125 @@ +-- NetHack 3.6 gehennom.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1992 by M. Stephenson and Izchak Miller +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "shortsighted") +-- des.level_init(mines,'.','}',true,true,unlit,false) +des.level_init({ style = "mines", fg = ".", bg = "}", smoothed=1, joined=1, lit=0 }); +-- guarantee at least one open spot to ensure successful stair placement +des.map({ halign = "left", valign = "bottom", map = [[ +xxxxxxxx +xx...xxx +xxx...xx +xxxx.xxx +xxxxxxxx +]] }); +des.object("boulder") +des.map({ halign = "right", valign = "top", map = [[ +xxxxxxxx +xxxx.xxx +xxx...xx +xx...xxx +xxxxxxxx +]] }); +des.object("boulder") +-- lair +des.map([[ +xx}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}xx +x}}}.}}}}}..}}}..}}}}}..}}}..}}}}}..}}}..}}}}}.}}}x +}}}...}}..}}.}.}}.}}.}}}...}}}.}}}..}}}..}}}}...}}} +x}}}.}}.}}}.}}.}}.}}...}}.}}.....}}.....}....}.}}}x +xx}}}..}}}.}}.}}.}}..}}.....}}.}}}.}}.}}}}}}}}}}}xx +x}}}..}}}}}.}}.}}.}}...}}}}}.....}}.}}}}}}.....}}}x +}}}..}}...}}..}}.}}}.}}}...}}}.}}}.}.}}}}..P.P..}}} +}}.}}}}...}}}}}.}...}}}..P..}}}.}.}}}.}}}}.....}}}} +}.}}}}.}}.}..}.}}}}}}}..P.P..}}}.}}}.}}..}}...}}}}x +x}}}}.}}}}....}}}}}.}}}..P..}}}.}}}}.}}..}}...}}}.} +}}}}..}}.}}..}}}}...}}}}...}}}.}}}}}.}}}}.}}}}}}.}} +}}}...}}...}}}..}}}}}}}}}}}}.....}}}}.}}...}..}.}}} +x}}}..}}.}}}}....}}..}}}..}}.....}}}}.}}}.}....}}}x +xx}}}.}}}}..}}..}}..}}..}}..}}.}}}..}.}..}}}..}}}xx +x}}}.}}}}....}}}}..}}....}}}}}}}...}}}....}}}}.}}}x +}}}...}}}....}}}..}}}....}}}..}}...}}}....}}}...}}} +x}}}.}}}}}..}}}..}}}}}..}}}..}}}}}..}}}..}}}}}.}}}x +xx}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}xx +]]); +-- Random registers +local monster = { "j","b","P","F" } +shuffle(monster) + +local place = selection.new(); +place:set(04,02); +place:set(46,02); +place:set(04,15); +place:set(46,15); + +-- Dungeon description +des.region({ region={00,00,50,17}, lit=0, type="swamp" }) +des.mazewalk(00,09,"west") +des.mazewalk(50,08,"east") +des.levregion({ region = {01,00,11,20}, region_islev=1, exclude={0,0,50,17}, type="stair-down" }); +des.levregion({ region = {69,00,79,20}, region_islev=1, exclude={0,0,50,17}, type="stair-up" }); +des.levregion({ region = {01,00,11,20}, region_islev=1, exclude={0,0,50,17}, type="branch" }); +des.teleport_region({ region = {01,00,11,20}, region_islev=1, exclude={0,0,50,17},dir="up" }) +des.teleport_region({ region = {69,00,79,20}, region_islev=1, exclude={0,0,50,17},dir="down" }) +des.feature("fountain", place:rndcoord(1)) +des.monster({ id = "giant mimic", coord = { place:rndcoord(1) }, appear_as = "ter:fountain" }) +des.monster({ id = "giant mimic", coord = { place:rndcoord(1) }, appear_as = "ter:fountain" }) +des.monster({ id = "giant mimic", coord = { place:rndcoord(1) }, appear_as = "ter:fountain" }) +-- The demon of the swamp +des.monster("Juiblex",25,08) +-- And a couple demons +des.monster("lemure",43,08) +des.monster("lemure",44,08) +des.monster("lemure",45,08) +-- Some liquids and gems +des.object("*",43,06) +des.object("*",45,06) +des.object("!",43,09) +des.object("!",44,09) +des.object("!",45,09) +-- And lots of blobby monsters +des.monster(monster[4],25,06) +des.monster(monster[1],24,07) +des.monster(monster[2],26,07) +des.monster(monster[3],23,08) +des.monster(monster[3],27,08) +des.monster(monster[2],24,09) +des.monster(monster[1],26,09) +des.monster(monster[4],25,10) +des.monster("j") +des.monster("j") +des.monster("j") +des.monster("j") +des.monster("P") +des.monster("P") +des.monster("P") +des.monster("P") +des.monster("b") +des.monster("b") +des.monster("b") +des.monster("F") +des.monster("F") +des.monster("F") +des.monster("m") +des.monster("m") +des.monster("jellyfish") +des.monster("jellyfish") +-- Some random objects +des.object("!") +des.object("!") +des.object("!") +des.object("%") +des.object("%") +des.object("%") +des.object("boulder") +-- Some traps +des.trap("sleep gas") +des.trap("sleep gas") +des.trap("anti magic") +des.trap("anti magic") +des.trap("magic") +des.trap("magic") diff --git a/dat/knox.des b/dat/knox.des deleted file mode 100644 index 13a56035b..000000000 --- a/dat/knox.des +++ /dev/null @@ -1,153 +0,0 @@ -# NetHack 3.6 knox.des $NHDT-Date: 1547343821 2019/01/13 01:43:41 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.13 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# Copyright (c) 1992 by Izchak Miller -# NetHack may be freely redistributed. See license for details. -# -MAZE:"knox",' ' -FLAGS: noteleport -GEOMETRY:center,center -# Fort's entry is via a secret door rather than a drawbridge; -# the moat must be manually circumvented. -MAP ----------------------------------------------------------------------------- -| |........|...............................................................| -| |........|.................................................------------..| -| --S----S--.................................................|..........|..| -| # |........}}}}}}}....................}}}}}}}..........|..........|..| -| # |........}-----}....................}-----}..........--+--+--...|..| -| # ---........}|...|}}}}}}}}}}}}}}}}}}}}}}|...|}.................|...|..| -| # |..........}---S------------------------S---}.................|...|..| -| # |..........}}}|...............|..........|}}}.................+...|..| -| --S----..........}|...............S..........|}...................|...|..| -| |.....|..........}|...............|......\...S}...................|...|..| -| |.....+........}}}|...............|..........|}}}.................+...|..| -| |.....|........}---S------------------------S---}.................|...|..| -| |.....|........}|...|}}}}}}}}}}}}}}}}}}}}}}|...|}.................|...|..| -| |..-S----......}-----}....................}-----}..........--+--+--...|..| -| |..|....|......}}}}}}}....................}}}}}}}..........|..........|..| -| |..|....|..................................................|..........|..| -| -----------................................................------------..| -| |..............................................................| ----------------------------------------------------------------------------- -ENDMAP -# Non diggable walls -NON_DIGGABLE:(00,00,75,19) -# Portal arrival point -BRANCH:(08,16,08,16),(0,0,0,0) -# accessible via ^V in wizard mode; arrive near the portal -TELEPORT_REGION:(06,15,09,16),(0,0,0,0),up -TELEPORT_REGION:(06,15,09,16),(0,0,0,0),down -# Throne room, with Croesus on the throne -REGION:(37,08,46,11),lit,"throne" -# 50% chance each to move throne and/or fort's entry secret door up one row -IF [50%] { - MONSTER:('@',"Croesus"),(43,10),hostile -} ELSE { - MONSTER:('@',"Croesus"),(43,09),hostile - TERRAIN:(43,09), '\' - TERRAIN:(43,10), '.' -} -IF [50%] { - TERRAIN:(47,09), 'S' - TERRAIN:(47,10), '|' -} -# The Vault -# Using unfilled morgue for -# identification in mkmaze.c -REGION:(21,08,35,11),lit,"morgue",unfilled -# Vault entrance also varies -IF [50%] { - TERRAIN:(36,09), '|' - TERRAIN:(36,10), 'S' -} -# Corner towers -REGION:(19,06,21,06),lit,"ordinary" -REGION:(46,06,48,06),lit,"ordinary" -REGION:(19,13,21,13),lit,"ordinary" -REGION:(46,13,48,13),lit,"ordinary" -# A welcoming committee -REGION:(03,10,07,13),lit,"zoo",filled,irregular -# arrival chamber; needs to be a real room to control migrating monsters, -# and `unfilled' is a kludge to force an ordinary room to remain a room -REGION:(06,15,09,16),unlit,"ordinary",unfilled - -# 3.6.2: Entering level carrying a lit candle would show the whole entry -# chamber except for its top right corner even though some of the revealed -# spots are farther away than that is. This is because the lit treasure zoo -# is forcing the walls around it to be lit too (see light_region(sp_lev.c)), -# and lit walls show up when light reaches the spot next to them. The unlit -# corner is beyond candle range and isn't flagged as lit so it doesn't show -# up until light reaches it rather than when light gets next to it. -# -# Force left and top walls of the arrival chamber to be unlit in order to -# hide this lighting quirk. -REGION:(05,14,05,17),unlit,"ordinary" -REGION:(05,14,09,14),unlit,"ordinary" -# (Entering the treasure zoo while blind and then regaining sight might -# expose the new oddity of these walls not appearing when on the lit side -# but that's even less likely to occur than the rare instance of entering -# the level with a candle. They'll almost always be mapped from the arrival -# side before entering the treasure zoo. -# -# A prior workaround lit the top right corner wall and then jumped through -# hoops to suppress the extra light in the 3x3 lit area that produced. -# This is simpler and makes the short range candle light behave more like -# it is expected to work.) - -# Barracks -REGION:(62,03,71,04),lit,"barracks",filled,irregular -# Doors -DOOR:closed,(06,14) -DOOR:closed,(09,03) -DOOR:open,(63,05) -DOOR:open,(66,05) -DOOR:open,(68,08) -DOOR:locked,(08,11) -DOOR:open,(68,11) -DOOR:closed,(63,14) -DOOR:closed,(66,14) -DOOR:closed,(04,03) -DOOR:closed,(04,09) -# Soldiers guarding the fort -MONSTER:('@',"soldier"),(12,14) -MONSTER:('@',"soldier"),(12,13) -MONSTER:('@',"soldier"),(11,10) -MONSTER:('@',"soldier"),(13,02) -MONSTER:('@',"soldier"),(14,03) -MONSTER:('@',"soldier"),(20,02) -MONSTER:('@',"soldier"),(30,02) -MONSTER:('@',"soldier"),(40,02) -MONSTER:('@',"soldier"),(30,16) -MONSTER:('@',"soldier"),(32,16) -MONSTER:('@',"soldier"),(40,16) -MONSTER:('@',"soldier"),(54,16) -MONSTER:('@',"soldier"),(54,14) -MONSTER:('@',"soldier"),(54,13) -MONSTER:('@',"soldier"),(57,10) -MONSTER:('@',"soldier"),(57,09) -MONSTER:('@',"lieutenant"),(15,08) -# Possible source of a boulder -MONSTER:('H',"stone giant"),(03,01) -# Four dragons guarding each side -MONSTER:'D',(18,09) -MONSTER:'D',(49,10) -MONSTER:'D',(33,05) -MONSTER:'D',(33,14) -# Eels in the moat -MONSTER:(';',"giant eel"),(17,08) -MONSTER:(';',"giant eel"),(17,11) -MONSTER:(';',"giant eel"),(48,08) -MONSTER:(';',"giant eel"),(48,11) -# The corner rooms treasures -OBJECT:('*',"diamond"),(19,06) -OBJECT:('*',"diamond"),(20,06) -OBJECT:('*',"diamond"),(21,06) -OBJECT:('*',"emerald"),(19,13) -OBJECT:('*',"emerald"),(20,13) -OBJECT:('*',"emerald"),(21,13) -OBJECT:('*',"ruby"),(46,06) -OBJECT:('*',"ruby"),(47,06) -OBJECT:('*',"ruby"),(48,06) -OBJECT:('*',"amethyst"),(46,13) -OBJECT:('*',"amethyst"),(47,13) -OBJECT:('*',"amethyst"),(48,13) diff --git a/dat/knox.lua b/dat/knox.lua new file mode 100644 index 000000000..360edce13 --- /dev/null +++ b/dat/knox.lua @@ -0,0 +1,154 @@ +-- NetHack 3.6 knox.des $NHDT-Date: 1547343821 2019/01/13 01:43:41 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.13 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1992 by Izchak Miller +-- NetHack may be freely redistributed. See license for details. +-- +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport") +-- Fort's entry is via a secret door rather than a drawbridge; +-- the moat must be manually circumvented. +des.map([[ +---------------------------------------------------------------------------- +| |........|...............................................................| +| |........|.................................................------------..| +| --S----S--.................................................|..........|..| +| # |........}}}}}}}....................}}}}}}}..........|..........|..| +| # |........}-----}....................}-----}..........--+--+--...|..| +| # ---........}|...|}}}}}}}}}}}}}}}}}}}}}}|...|}.................|...|..| +| # |..........}---S------------------------S---}.................|...|..| +| # |..........}}}|...............|..........|}}}.................+...|..| +| --S----..........}|...............S..........|}...................|...|..| +| |.....|..........}|...............|......\...S}...................|...|..| +| |.....+........}}}|...............|..........|}}}.................+...|..| +| |.....|........}---S------------------------S---}.................|...|..| +| |.....|........}|...|}}}}}}}}}}}}}}}}}}}}}}|...|}.................|...|..| +| |..-S----......}-----}....................}-----}..........--+--+--...|..| +| |..|....|......}}}}}}}....................}}}}}}}..........|..........|..| +| |..|....|..................................................|..........|..| +| -----------................................................------------..| +| |..............................................................| +---------------------------------------------------------------------------- +]]); +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- Portal arrival point +des.levregion({ region = {08,16,08,16}, type="branch" }); +-- accessible via ^V in wizard mode; arrive near the portal +des.teleport_region({ region = {06,15,09,16}, dir="up" }) +des.teleport_region({ region = {06,15,09,16}, dir="down" }) +-- Throne room, with Croesus on the throne +des.region({ x1=37,y1=08,x2=46,y2=11, lit=1, type="throne", prefilled=0 }) +-- 50% chance each to move throne and/or fort's entry secret door up one row +if math.random(0, 99) < 50 then + des.monster({ id = "Croesus", x=43, y=10, peaceful = 0 }) +else + des.monster({ id = "Croesus", x=43, y=09, peaceful = 0 }) + des.terrain(43,09, "\\") + des.terrain(43,10, ".") +end +if math.random(0, 99) < 50 then + des.terrain(47,09, "S") + des.terrain(47,10, "|") +end +-- The Vault +-- Using unfilled morgue for +-- identification in mkmaze.c +des.region({ region={21,08,35,11}, lit=1, type="morgue", prefilled=1 }) +-- Vault entrance also varies +if math.random(0, 99) < 50 then + des.terrain(36,09, "|") + des.terrain(36,10, "S") +end +-- Corner towers +des.region(selection.area(19,06,21,06),"lit") +des.region(selection.area(46,06,48,06),"lit") +des.region(selection.area(19,13,21,13),"lit") +des.region(selection.area(46,13,48,13),"lit") +-- A welcoming committee +des.region({ region={03,10,07,13},lit=1,type="zoo",prefilled=0,irregular=1 }) +-- arrival chamber; needs to be a real room to control migrating monsters, +-- and `unfilled' is a kludge to force an ordinary room to remain a room +des.region({ region={06,15,09,16},lit=0,type="ordinary",prefilled=0 }) + +-- 3.6.2: Entering level carrying a lit candle would show the whole entry +-- chamber except for its top right corner even though some of the revealed +-- spots are farther away than that is. This is because the lit treasure zoo +-- is forcing the walls around it to be lit too (see light_region(sp_lev.c)), +-- and lit walls show up when light reaches the spot next to them. The unlit +-- corner is beyond candle range and isn't flagged as lit so it doesn't show +-- up until light reaches it rather than when light gets next to it. +-- +-- Force left and top walls of the arrival chamber to be unlit in order to +-- hide this lighting quirk. +des.region(selection.area(05,14,05,17),"unlit") +des.region(selection.area(05,14,09,14),"unlit") +-- (Entering the treasure zoo while blind and then regaining sight might +-- expose the new oddity of these walls not appearing when on the lit side +-- but that's even less likely to occur than the rare instance of entering +-- the level with a candle. They'll almost always be mapped from the arrival +-- side before entering the treasure zoo. +-- +-- A prior workaround lit the top right corner wall and then jumped through +-- hoops to suppress the extra light in the 3x3 lit area that produced. +-- This is simpler and makes the short range candle light behave more like +-- it is expected to work.) + +-- Barracks +des.region({ region={62,03,71,04},lit=1,type="barracks",prefilled=0,irregular=1 }) +-- Doors +des.door("closed",06,14) +des.door("closed",09,03) +des.door("open",63,05) +des.door("open",66,05) +des.door("open",68,08) +des.door("locked",08,11) +des.door("open",68,11) +des.door("closed",63,14) +des.door("closed",66,14) +des.door("closed",04,03) +des.door("closed",04,09) +-- Soldiers guarding the fort +des.monster("soldier",12,14) +des.monster("soldier",12,13) +des.monster("soldier",11,10) +des.monster("soldier",13,02) +des.monster("soldier",14,03) +des.monster("soldier",20,02) +des.monster("soldier",30,02) +des.monster("soldier",40,02) +des.monster("soldier",30,16) +des.monster("soldier",32,16) +des.monster("soldier",40,16) +des.monster("soldier",54,16) +des.monster("soldier",54,14) +des.monster("soldier",54,13) +des.monster("soldier",57,10) +des.monster("soldier",57,09) +des.monster("lieutenant",15,08) +-- Possible source of a boulder +des.monster("stone giant",03,01) +-- Four dragons guarding each side +des.monster("D",18,09) +des.monster("D",49,10) +des.monster("D",33,05) +des.monster("D",33,14) +-- Eels in the moat +des.monster("giant eel",17,08) +des.monster("giant eel",17,11) +des.monster("giant eel",48,08) +des.monster("giant eel",48,11) +-- The corner rooms treasures +des.object("diamond",19,06) +des.object("diamond",20,06) +des.object("diamond",21,06) +des.object("emerald",19,13) +des.object("emerald",20,13) +des.object("emerald",21,13) +des.object("ruby",46,06) +des.object("ruby",47,06) +des.object("ruby",48,06) +des.object("amethyst",46,13) +des.object("amethyst",47,13) +des.object("amethyst",48,13) diff --git a/dat/medusa-1.lua b/dat/medusa-1.lua new file mode 100644 index 000000000..635763a5b --- /dev/null +++ b/dat/medusa-1.lua @@ -0,0 +1,121 @@ +-- NetHack 3.6 medusa.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1990, 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- These are the Medusa's levels : +-- + +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport") + +des.map([[ +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +}}.}}}}}..}}}}}......}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}....}}}...}}}}} +}...}}.....}}}}}....}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}...............} +}....}}}}}}}}}}....}}}..}}}}}}}}}}}.......}}}}}}}}}}}}}}}}..}}.....}}}...}} +}....}}}}}}}}.....}}}}..}}}}}}.................}}}}}}}}}}}.}}}}.....}}...}} +}....}}}}}}}}}}}}.}}}}.}}}}}}.-----------------.}}}}}}}}}}}}}}}}}.........} +}....}}}}}}}}}}}}}}}}}}.}}}...|...............S...}}}}}}}}}}}}}}}}}}}....}} +}.....}.}}....}}}}}}}}}.}}....--------+--------....}}}}}}..}}}}}}}}}}}...}} +}......}}}}..}}}}}}}}}}}}}........|.......|........}}}}}....}}}}}}}}}}}}}}} +}.....}}}}}}}}}}}}}}}}}}}}........|.......|........}}}}}...}}}}}}}}}.}}}}}} +}.....}}}}}}}}}}}}}}}}}}}}....--------+--------....}}}}}}.}.}}}}}}}}}}}}}}} +}......}}}}}}}}}}}}}}}}}}}}...S...............|...}}}}}}}}}}}}}}}}}.}}}}}}} +}.......}}}}}}}..}}}}}}}}}}}}.-----------------.}}}}}}}}}}}}}}}}}....}}}}}} +}........}}.}}....}}}}}}}}}}}}.................}}}}}..}}}}}}}}}.......}}}}} +}.......}}}}}}}......}}}}}}}}}}}}}}.......}}}}}}}}}.....}}}}}}...}}..}}}}}} +}.....}}}}}}}}}}}.....}}}}}}}}}}}}}}}}}}}}}}.}}}}}}}..}}}}}}}}}}....}}}}}}} +}}..}}}}}}}}}}}}}....}}}}}}}}}}}}}}}}}}}}}}...}}..}}}}}}}.}}.}}}}..}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +]]); +-- Dungeon Description +des.region(selection.area(00,00,74,19),"lit") +des.region(selection.area(31,07,45,07),"unlit") +-- (must maintain one room definition; `filled=0' forces its room to be kept) +des.region({ region={35,09, 41,10}, lit = 0, type="ordinary", prefilled = 1 }) +des.region(selection.area(31,12,45,12),"unlit") +-- Teleport: down to up stairs island, up to Medusa's island +des.teleport_region({ region = {01,01,05,17}, dir="down" }) +des.teleport_region({ region = {26,04,50,15}, dir="up" }) +-- Stairs +des.stair("up", 05,14) +des.stair("down", 36,10) +-- Doors +des.door("closed",46,07) +des.door("locked",38,08) +des.door("locked",38,11) +des.door("closed",30,12) +-- Branch, not allowed inside Medusa's building. +des.levregion({ region = {01,00,79,20}, exclude = {30,06,46,13}, type = "branch" }) +-- Non diggable walls +des.non_diggable(selection.area(30,06,46,13)) +-- Objects +des.object({ id = "statue", x=36,y=10, buc="uncursed", + montype="knight", historic=1, male = 1, name="Perseus", + contents = function() + if math.random(0,99) < 75 then + des.object({ id = "shield of reflection", buc="cursed", spe=0 }) + end + if math.random(0,99) < 25 then + des.object({ id = "levitation boots", spe=0 }) + end + if math.random(0,99) < 50 then + des.object({ id = "scimitar", buc="blessed", spe=2 }) + end + if math.random(0,99) < 50 then + des.object("sack") + end + end +}); + +-- Specifying explicit contents forces them to be empty. +des.object({ id = "statue", contents = 0 }) +des.object({ id = "statue", contents = 0 }) +des.object({ id = "statue", contents = 0 }) +des.object({ id = "statue", contents = 0 }) +des.object({ id = "statue", contents = 0 }) +des.object({ id = "statue", contents = 0 }) +des.object({ id = "statue", contents = 0 }) +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap("board",38,07) +des.trap("board",38,12) +-- Random monsters +des.monster({ id = "Medusa", x=36,y=10, asleep=1 }) +des.monster("giant eel",11,06) +des.monster("giant eel",23,13) +des.monster("giant eel",29,02) +des.monster("jellyfish",02,02) +des.monster("jellyfish",00,08) +des.monster("jellyfish",04,18) +des.monster("water troll",51,03) +des.monster("water troll",64,11) +des.monster({ class = 'S', x=38, y=07 }) +des.monster({ class = 'S', x=38, y=12 }) +des.monster() +des.monster() +des.monster() +des.monster() +des.monster() +des.monster() +des.monster() +des.monster() +des.monster() +des.monster() diff --git a/dat/medusa-2.lua b/dat/medusa-2.lua new file mode 100644 index 000000000..405627f63 --- /dev/null +++ b/dat/medusa-2.lua @@ -0,0 +1,126 @@ +-- NetHack 3.6 medusa.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1990, 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport") + +des.map([[ +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +}------}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}-------}}}}}}}}--------------} +}|....|}}}}}}}}}..}.}}..}}}}}}}}}}}}}..}}}}}}-.....--}}}}}}}|............|} +}|....|.}}}}}}}}}}}.}...}}..}}}}}}}}}}}}}}}}}---......}}}}}.|............|} +}S....|.}}}}}}---}}}}}}}}}}}}}}}}}}}}}}}}}}---...|..-}}}}}}.S..----------|} +}|....|.}}}}}}-...}}}}}}}}}.}}...}.}}}}.}}}......----}}}}}}.|............|} +}|....|.}}}}}}-....--}}}}}}}}}}}}}}}}}}}}}}----...--}}}}}}}.|..--------+-|} +}|....|.}}}}}}}......}}}}...}}}}}}.}}}}}}}}}}}---..---}}}}}.|..|..S...|..|} +}|....|.}}}}}}-....-}}}}}}}------}}}}}}}}}}}}}}-...|.-}}}}}.|..|..|...|..|} +}|....|.}}}}}}}}}---}}}}}}}........}}}}}}}}}}---.|....}}}}}.|..|..|...|..|} +}|....|.}}}}}}}}}}}}}}}}}}-....|...-}}}}}}}}--...----.}}}}}.|..|..|...|..|} +}|....|.}}}}}}..}}}}}}}}}}---..--------}}}}}-..---}}}}}}}}}.|..|..-------|} +}|...}|...}}}.}}}}}}...}}}}}--..........}}}}..--}}}}}}}}}}}.|..|.........|} +}|...}S...}}.}}}}}}}}}}}}}}}-..--------}}}}}}}}}}}}}}...}}}.|..--------..S} +}|...}|...}}}}}}}..}}}}}}----..|....-}}}}}}}}}}}}}}}}}..}}}.|............|} +}|....|}}}}}....}}}}..}}.-.......----}}......}}}}}}.......}}|............|} +}------}}}}}}}}}}}}}}}}}}---------}}}}}}}}}}}}}}}}}}}}}}}}}}--------------} +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +]]); +-- Dungeon Description +des.region(selection.area(00,00,74,19),"lit") +des.region(selection.area(02,03,05,16),"unlit") +des.region({ region={61,03, 72,16}, lit=0, type="ordinary", prefilled = 1,irregular = 1 }) +des.region(selection.area(71,08,72,11),"unlit") +des.region(selection.area(67,08,69,11),"lit") +-- Teleport: down to up stairs island, up to Medusa's island +des.teleport_region({ region = {02,03,05,16}, dir="down" }) +des.teleport_region({ region = {61,03,72,16}, dir="up" }) +-- Stairs +des.stair("up", 04,09) +des.stair("down", 68,10) +-- Doors +des.door("locked", 71,07) +-- Branch, not allowed on Medusa's island. +des.levregion({ type="branch", region = {01,00,79,20}, exclude = {59,01,73,17} }) +-- Non diggable walls +des.non_diggable(selection.area(01,02,06,17)) +des.non_diggable(selection.area(60,02,73,17)) +-- Objects +des.object({ id = "statue", x=68,y=10,buc="uncursed", + montype="knight", historic=1, male=1,name="Perseus", + contents = function() + if math.random(0,99) < 25 then + des.object({ id = "shield of reflection", buc="cursed", spe=0 }) + end + if math.random(0,99) < 75 then + des.object({ id = "levitation boots", spe=0 }) + end + if math.random(0,99) < 50 then + des.object({ id = "scimitar", buc="blessed", spe=2 }) + end + if math.random(0,99) < 50 then + des.object("sack") + end + end +}); +des.object({ id = "statue", x=64, y=08, contents=0 }) +des.object({ id = "statue", x=65, y=08, contents=0 }) +des.object({ id = "statue", x=64, y=09, contents=0 }) +des.object({ id = "statue", x=65, y=09, contents=0 }) +des.object({ id = "statue", x=64, y=10, contents=0 }) +des.object({ id = "statue", x=65, y=10, contents=0 }) +des.object({ id = "statue", x=64, y=11, contents=0 }) +des.object({ id = "statue", x=65, y=11, contents=0 }) +des.object("boulder",04,04) +des.object("/",52,09) +des.object("boulder",52,09) +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- Traps +des.trap("magic",03,12) +des.trap() +des.trap() +des.trap() +des.trap() +-- Monsters. +des.monster({ id="Medusa",x=68,y=10,asleep=1 }) +des.monster("gremlin",02,14) +des.monster("titan",02,05) +des.monster("electric eel",10,13) +des.monster("electric eel",11,13) +des.monster("electric eel",10,14) +des.monster("electric eel",11,14) +des.monster("electric eel",10,15) +des.monster("electric eel",11,15) +des.monster("jellyfish",01,01) +des.monster("jellyfish",00,08) +des.monster("jellyfish",04,19) +des.monster({ id = "stone golem",x=64,y=08,asleep=1 }) +des.monster({ id = "stone golem",x=65,y=08,asleep=1 }) +des.monster({ id = "stone golem",x=64,y=09,asleep=1 }) +des.monster({ id = "stone golem",x=65,y=09,asleep=1 }) +des.monster({ id = "cobra",x=64,y=10,asleep=1 }) +des.monster({ id = "cobra",x=65,y=10,asleep=1 }) +des.monster("A",72,08) +des.monster({ id = "yellow light",x=72,y=11,asleep=1 }) +des.monster({ x = 17, y = 07 }) +des.monster({ x = 28, y = 11 }) +des.monster({ x = 32, y = 13 }) +des.monster({ x = 49, y = 09 }) +des.monster({ x = 48, y = 07 }) +des.monster({ x = 65, y = 03 }) +des.monster({ x = 70, y = 04 }) +des.monster({ x = 70, y = 15 }) +des.monster({ x = 65, y = 16 }) +des.monster() +des.monster() +des.monster() +des.monster() + diff --git a/dat/medusa-3.lua b/dat/medusa-3.lua new file mode 100644 index 000000000..65961b5e5 --- /dev/null +++ b/dat/medusa-3.lua @@ -0,0 +1,115 @@ +-- NetHack 3.6 medusa.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1990, 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); +des.level_flags("noteleport", "mazelevel", "shortsighted") +-- +-- Here you disturb ravens nesting in the trees. +-- +des.map([[ +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}.}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}.}}}}}}}}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}T..T.}}}}}}}}}}}}}}}}}}}}..}}}}}}}}.}}}...}}}}}}}.}}}}}......}}}}}}} +}}}}}}.......T.}}}}}}}}}}}..}}}}..T.}}}}}}...T...T..}}...T..}}..-----..}}}}} +}}}...-----....}}}}}}}}}}.T..}}}}}...}}}}}.....T..}}}}}......T..|...|.T..}}} +}}}.T.|...|...T.}}}}}}}.T......}}}}..T..}}.}}}.}}...}}}}}.T.....+...|...}}}} +}}}}..|...|.}}.}}}}}.....}}}T.}}}}.....}}}}}}.T}}}}}}}}}}}}}..T.|...|.}}}}}} +}}}}}.|...|.}}}}}}..T..}}}}}}}}}}}}}T.}}}}}}}}..}}}}}}}}}}}.....-----.}}}}}} +}}}}}.--+--..}}}}}}...}}}}}}}}}}}}}}}}}}}T.}}}}}}}}}}}}}}}}.T.}........}}}}} +}}}}}.......}}}}}}..}}}}}}}}}.}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}.}}}.}}.T.}}}}}} +}}.T...T...}}}}T}}}}}}}}}}}....}}}}}}}}}}T}}}}}.T}}...}}}}}}}}}}}}}}...}}}}} +}}}...T}}}}}}}..}}}}}}}}}}}.T...}}}}}}}}.T.}.T.....T....}}}}}}}}}}}}}.}}}}}} +}}}}}}}}}}}}}}}....}}}}}}}...}}.}}}}}}}}}}............T..}}}}}.T.}}}}}}}}}}} +}}}}}}}}}}}}}}}}..T..}}}}}}}}}}}}}}..}}}}}..------+--...T.}}}....}}}}}}}}}}} +}}}}.}..}}}}}}}.T.....}}}}}}}}}}}..T.}}}}.T.|...|...|....}}}}}.}}}}}...}}}}} +}}}.T.}...}..}}}}T.T.}}}}}}.}}}}}}}....}}...|...+...|.}}}}}}}}}}}}}..T...}}} +}}}}..}}}.....}}...}}}}}}}...}}}}}}}}}}}}}T.|...|...|}}}}}}}}}}}....T..}}}}} +}}}}}..}}}.T..}}}.}}}}}}}}.T..}}}}}}}}}}}}}}---S-----}}}}}}}}}}}}}....}}}}}} +}}}}}}}}}}}..}}}}}}}}}}}}}}}.}}}}}}}}}}}}}}}}}T..T}}}}}}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +]]); + +local place = selection.new(); +place:set(08,06); +place:set(66,05); +place:set(46,15); + +des.region(selection.area(00,00,74,19),"lit") +des.region({ region={49,14, 51,16}, lit=-1, type="ordinary", prefilled = 1 }); +des.region(selection.area(07,05,09,07),"unlit") +des.region(selection.area(65,04,67,06),"unlit") +des.region(selection.area(45,14,47,16),"unlit") +-- Non diggable walls +-- 4th room has diggable walls as Medusa is never placed there +des.non_diggable(selection.area(06,04,10,08)) +des.non_diggable(selection.area(64,03,68,07)) +des.non_diggable(selection.area(44,13,48,17)) +-- All places are accessible also with jumping, so don't bother +-- restricting the placement when teleporting from levels below this. +des.teleport_region({ region = {33,02,38,07}, dir="down" }) +des.levregion({ region = {32,01,39,07}, type="stair-up" }); +local mx, my = place:rndcoord(1); +des.stair("down", mx, my) +des.door("locked",08,08) +des.door("locked",64,05) +des.door("random",50,13) +des.door("locked",48,15) +-- +local px, py = place:rndcoord(1); +des.feature("fountain", px,py); +-- +local px, py = place:rndcoord(1); +des.object({ id="statue",x=px, y=py, buc="uncursed", + montype="knight", historic=1, male=1,name="Perseus", + contents = function() + if math.random(0,99) < 75 then + des.object({ id = "shield of reflection", buc="cursed", spe=0 }) + end + if math.random(0,99) < 25 then + des.object({ id = "levitation boots", spe=0 }) + end + if math.random(0,99) < 50 then + des.object({ id = "scimitar", buc="blessed", spe=2 }) + end + if math.random(0,99) < 50 then + des.object("sack") + end + end +}); +-- +des.object({ id = "statue", contents=0 }) +des.object({ id = "statue", contents=0 }) +des.object({ id = "statue", contents=0 }) +des.object({ id = "statue", contents=0 }) +des.object({ id = "statue", contents=0 }) +des.object({ id = "statue", contents=0 }) +des.object({ id = "statue", contents=0 }) + +for i=1,8 do + des.object() +end +des.object("blank paper",48,18) +des.object("blank paper",48,18) +-- +des.trap("rust") +des.trap("rust") +des.trap("board") +des.trap("board") +des.trap() +-- +des.monster({ id = "Medusa", x=mx, y=my, asleep=1 }) +des.monster("giant eel") +des.monster("giant eel") +des.monster("jellyfish") +des.monster("jellyfish") +des.monster("wood nymph") +des.monster("wood nymph") +des.monster("water nymph") +des.monster("water nymph") + +for i=1,30 do + des.monster({ id = "raven", hostile = 1 }) +end + diff --git a/dat/medusa-4.lua b/dat/medusa-4.lua new file mode 100644 index 000000000..b30540c51 --- /dev/null +++ b/dat/medusa-4.lua @@ -0,0 +1,129 @@ +-- NetHack 3.6 medusa.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1990, 1991 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); +des.level_flags("noteleport", "mazelevel") +-- +-- Here the Medusa rules some slithery monsters from her 'palace', with +-- a yellow dragon nesting in the backyard. +-- +des.map([[ +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +}}}}}}}}}}}}}}........}}}}}}}}}}}}}}}}}}}}}}}..}}}.....}}}}}}}}}}}----|}}}}} +}}}}}}..----------F-.....}}}}}}}}}}}}}}}}..---...}}}}....T.}}}}}}}....|}}}}} +}}}.....|...F......S}}}}....}}}}}}}...}}.....|}}.}}}}}}}......}}}}|......}}} +}}}.....+...|..{...|}}}}}}}}}}}}.....}}}}|...|}}}}}}}}}}}.}}}}}}}}----.}}}}} +}}......|...|......|}}}}}}}}}......}}}}}}|.......}}}}}}}}}}}}}..}}}}}...}}}} +}}|-+--F|-+--....|F|-|}}}}}....}}}....}}}-----}}.....}}}}}}}......}}}}.}}}}} +}}|...}}|...|....|}}}|}}}}}}}..}}}}}}}}}}}}}}}}}}}}....}}}}}}}}....T.}}}}}}} +}}|...}}F...+....F}}}}}}}..}}}}}}}}}}}}}}...}}}}}}}}}}}}}}}}}}}}}}....}}..}} +}}|...}}|...|....|}}}|}....}}}}}}....}}}...}}}}}...}}}}}}}}}}}}}}}}}.....}}} +}}--+--F|-+--....-F|-|....}}}}}}}}}}.T...}}}}....---}}}}}}}}}}}}}}}}}}}}}}}} +}}......|...|......|}}}}}.}}}}}}}}}....}}}}}}}.....|}}}}}}}}}.}}}}}}}}}}}}}} +}}}}....+...|..{...|.}}}}}}}}}}}}}}}}}}}}}}}}}}.|..|}}}}}}}......}}}}...}}}} +}}}}}}..|...F......|...}}}}}}}}}}..---}}}}}}}}}}--.-}}}}}....}}}}}}....}}}}} +}}}}}}}}-----S----F|....}}}}}}}}}|...|}}}}}}}}}}}}...}}}}}}...}}}}}}..}}}}}} +}}}}}}}}}..............T...}}}}}.|.......}}}}}}}}}}}}}}..}...}.}}}}....}}}}} +}}}}}}}}}}....}}}}...}...}}}}}.......|.}}}}}}}}}}}}}}.......}}}}}}}}}...}}}} +}}}}}}}}}}..}}}}}}}}}}.}}}}}}}}}}-..--.}}}}}}}}..}}}}}}..T...}}}..}}}}}}}}}} +}}}}}}}}}...}}}}}}}}}}}}}}}}}}}}}}}...}}}}}}}....}}}}}}}.}}}..}}}...}}}}}}}} +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}.}}}}}}....}}}}}}}}}}}}}}}}}}}...}}}}}} +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +]]); +-- +local place = selection.new(); +place:set(04,08); +place:set(10,04); +place:set(10,08); +place:set(10,12); +-- +des.region(selection.area(00,00,74,19),"lit") +des.region({ region={13,03, 18,13}, lit=1, type="ordinary", prefilled=1 }) +-- +des.teleport_region({ region = {64,01,74,17}, dir="down" }); +des.teleport_region({ region = {02,02,18,13}, dir="up" }); +-- +des.levregion({ region = {67,01,74,20}, type="stair-up" }); +local mx, my = place:rndcoord(1); +des.stair("down", mx, my) +-- +des.door("locked",04,06) +des.door("locked",04,10) +des.door("locked",08,04) +des.door("locked",08,12) +des.door("locked",10,06) +des.door("locked",10,10) +des.door("locked",12,08) +-- +des.levregion({ region = {27,00,79,20}, type="branch" }); +-- +des.non_diggable(selection.area(01,01,22,14)); +-- +des.object("crystal ball", 07,08) +-- +local px, py = place:rndcoord(1); +des.object({ id="statue",x=px, y=py, buc="uncursed", + montype="knight", historic=1, male=1,name="Perseus", + contents = function() + if math.random(0,99) < 75 then + des.object({ id = "shield of reflection", buc="cursed", spe=0 }) + end + if math.random(0,99) < 25 then + des.object({ id = "levitation boots", spe=0 }) + end + if math.random(0,99) < 50 then + des.object({ id = "scimitar", buc="blessed", spe=2 }) + end + if math.random(0,99) < 50 then + des.object("sack") + end + end +}); +-- +des.object({ id = "statue", contents=0 }) +des.object({ id = "statue", contents=0 }) +des.object({ id = "statue", contents=0 }) +des.object({ id = "statue", contents=0 }) +des.object({ id = "statue", contents=0 }) +des.object({ id = "statue", contents=0 }) +des.object({ id = "statue", contents=0 }) +for i=1,8 do + des.object() +end +-- +for i=1,7 do + des.trap() +end +-- +des.monster("Medusa", mx, my) +des.monster("kraken", 07,07) +-- +-- the nesting dragon +des.monster({ id = "yellow dragon", x=05, y=04, asleep=1 }) +if math.random(0,99) < 50 then + des.monster({ id = "baby yellow dragon", x=04,y=04, asleep=1 }) +end +if math.random(0,99) < 25 then + des.monster({ id = "baby yellow dragon", x=04, y=05, asleep=1 }) +end +des.object({ id = "egg", x=05, y=04, montype="yellow dragon" }); +if math.random(0,99) < 50 then + des.object({ id = "egg", x=05, y=04, montype="yellow dragon" }); +end +if math.random(0,99) < 25 then + des.object({ id = "egg", x=05, y=04, montype="yellow dragon" }); +end +-- +des.monster("giant eel") +des.monster("giant eel") +des.monster("jellyfish") +des.monster("jellyfish") +for i=1,14 do + des.monster("S") +end +for i=1,4 do + des.monster("black naga hatchling") + des.monster("black naga") +end diff --git a/dat/medusa.des b/dat/medusa.des deleted file mode 100644 index b449a29e2..000000000 --- a/dat/medusa.des +++ /dev/null @@ -1,416 +0,0 @@ -# NetHack 3.6 medusa.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# Copyright (c) 1990, 1991 by M. Stephenson -# NetHack may be freely redistributed. See license for details. -# -# These are the Medusa's levels : -# - -MAZE:"medusa-1",' ' -FLAGS: noteleport -GEOMETRY:center,center -MAP -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} -}}.}}}}}..}}}}}......}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}....}}}...}}}}} -}...}}.....}}}}}....}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}...............} -}....}}}}}}}}}}....}}}..}}}}}}}}}}}.......}}}}}}}}}}}}}}}}..}}.....}}}...}} -}....}}}}}}}}.....}}}}..}}}}}}.................}}}}}}}}}}}.}}}}.....}}...}} -}....}}}}}}}}}}}}.}}}}.}}}}}}.-----------------.}}}}}}}}}}}}}}}}}.........} -}....}}}}}}}}}}}}}}}}}}.}}}...|...............S...}}}}}}}}}}}}}}}}}}}....}} -}.....}.}}....}}}}}}}}}.}}....--------+--------....}}}}}}..}}}}}}}}}}}...}} -}......}}}}..}}}}}}}}}}}}}........|.......|........}}}}}....}}}}}}}}}}}}}}} -}.....}}}}}}}}}}}}}}}}}}}}........|.......|........}}}}}...}}}}}}}}}.}}}}}} -}.....}}}}}}}}}}}}}}}}}}}}....--------+--------....}}}}}}.}.}}}}}}}}}}}}}}} -}......}}}}}}}}}}}}}}}}}}}}...S...............|...}}}}}}}}}}}}}}}}}.}}}}}}} -}.......}}}}}}}..}}}}}}}}}}}}.-----------------.}}}}}}}}}}}}}}}}}....}}}}}} -}........}}.}}....}}}}}}}}}}}}.................}}}}}..}}}}}}}}}.......}}}}} -}.......}}}}}}}......}}}}}}}}}}}}}}.......}}}}}}}}}.....}}}}}}...}}..}}}}}} -}.....}}}}}}}}}}}.....}}}}}}}}}}}}}}}}}}}}}}.}}}}}}}..}}}}}}}}}}....}}}}}}} -}}..}}}}}}}}}}}}}....}}}}}}}}}}}}}}}}}}}}}}...}}..}}}}}}}.}}.}}}}..}}}}}}}} -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} -ENDMAP -# Dungeon Description -# (must maintain one room definition; `unfilled' forces its room to be kept) -REGION:(00,00,74,19),lit,"ordinary" -REGION:(31,07,45,07),unlit,"ordinary" -REGION:(35,09,41,10),unlit,"ordinary",unfilled -REGION:(31,12,45,12),unlit,"ordinary" -# Teleport: down to up stairs island, up to Medusa's island -TELEPORT_REGION:(01,01,05,17),(0,0,0,0),down -TELEPORT_REGION:(26,04,50,15),(0,0,0,0),up -# Stairs -STAIR:(05,14),up -STAIR:(36,10),down -# Doors -DOOR:closed,(46,07) -DOOR:locked,(38,08) -DOOR:locked,(38,11) -DOOR:closed,(30,12) -# Branch, not allowed inside Medusa's building. -BRANCH:levregion(01,00,79,20),(30,06,46,13) -# Non diggable walls -NON_DIGGABLE:(30,06,46,13) -# Objects -CONTAINER:('`',"statue"),(36,10),uncursed,montype:"knight",3,name:"Perseus" { - [75%]: OBJECT:('[',"shield of reflection"),cursed,+0 - [25%]: OBJECT:('[',"levitation boots"),+0 - [50%]: OBJECT:(')',"scimitar"),blessed,+2 - [50%]: OBJECT:('(',"sack") -} -# These aren't really containers, but specifying CONTAINER forces them to be -# empty, since CONTAINERs contain only what is explicitly specified. -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:"board",(38,07) -TRAP:"board",(38,12) -# Random monsters -MONSTER:('@',"Medusa"),(36,10),asleep -MONSTER:(';',"giant eel"),(11,06) -MONSTER:(';',"giant eel"),(23,13) -MONSTER:(';',"giant eel"),(29,02) -MONSTER:(';',"jellyfish"),(02,02) -MONSTER:(';',"jellyfish"),(00,08) -MONSTER:(';',"jellyfish"),(04,18) -MONSTER:('T',"water troll"),(51,03) -MONSTER:('T',"water troll"),(64,11) -MONSTER:'S',(38,07) -MONSTER:'S',(38,12) -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random - -MAZE:"medusa-2",' ' -FLAGS: noteleport -GEOMETRY:center,center -MAP -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} -}------}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}-------}}}}}}}}--------------} -}|....|}}}}}}}}}..}.}}..}}}}}}}}}}}}}..}}}}}}-.....--}}}}}}}|............|} -}|....|.}}}}}}}}}}}.}...}}..}}}}}}}}}}}}}}}}}---......}}}}}.|............|} -}S....|.}}}}}}---}}}}}}}}}}}}}}}}}}}}}}}}}}---...|..-}}}}}}.S..----------|} -}|....|.}}}}}}-...}}}}}}}}}.}}...}.}}}}.}}}......----}}}}}}.|............|} -}|....|.}}}}}}-....--}}}}}}}}}}}}}}}}}}}}}}----...--}}}}}}}.|..--------+-|} -}|....|.}}}}}}}......}}}}...}}}}}}.}}}}}}}}}}}---..---}}}}}.|..|..S...|..|} -}|....|.}}}}}}-....-}}}}}}}------}}}}}}}}}}}}}}-...|.-}}}}}.|..|..|...|..|} -}|....|.}}}}}}}}}---}}}}}}}........}}}}}}}}}}---.|....}}}}}.|..|..|...|..|} -}|....|.}}}}}}}}}}}}}}}}}}-....|...-}}}}}}}}--...----.}}}}}.|..|..|...|..|} -}|....|.}}}}}}..}}}}}}}}}}---..--------}}}}}-..---}}}}}}}}}.|..|..-------|} -}|...}|...}}}.}}}}}}...}}}}}--..........}}}}..--}}}}}}}}}}}.|..|.........|} -}|...}S...}}.}}}}}}}}}}}}}}}-..--------}}}}}}}}}}}}}}...}}}.|..--------..S} -}|...}|...}}}}}}}..}}}}}}----..|....-}}}}}}}}}}}}}}}}}..}}}.|............|} -}|....|}}}}}....}}}}..}}.-.......----}}......}}}}}}.......}}|............|} -}------}}}}}}}}}}}}}}}}}}---------}}}}}}}}}}}}}}}}}}}}}}}}}}--------------} -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} -ENDMAP -# Dungeon Description -REGION:(00,00,74,19),lit,"ordinary" -REGION:(02,03,05,16),unlit,"ordinary" -REGION:(61,03,72,16),unlit,"ordinary",unfilled,irregular -REGION:(71,08,72,11),unlit,"ordinary" -REGION:(67,08,69,11),lit,"ordinary" -# Teleport: down to up stairs island, up to Medusa's island -TELEPORT_REGION:(02,03,05,16),(0,0,0,0),down -TELEPORT_REGION:(61,03,72,16),(0,0,0,0),up -# Stairs -STAIR:(04,09),up -STAIR:(68,10),down -# Doors -DOOR:locked,(71,07) -# Branch, not allowed on Medusa's island. -BRANCH:levregion(01,00,79,20),(59,01,73,17) -# Non diggable walls -NON_DIGGABLE:(01,02,06,17) -NON_DIGGABLE:(60,02,73,17) -# Objects -CONTAINER:('`',"statue"),(68,10),uncursed,montype:"knight",3,name:"Perseus" { - [25%]: OBJECT:('[',"shield of reflection"),cursed,+0 - [75%]: OBJECT:('[',"levitation boots"),+0 - [50%]: OBJECT:(')',"scimitar"),blessed,+2 - [50%]: OBJECT:('(',"sack") -} -CONTAINER:('`',"statue"),(64,08) { } -CONTAINER:('`',"statue"),(65,08) { } -CONTAINER:('`',"statue"),(64,09) { } -CONTAINER:('`',"statue"),(65,09) { } -CONTAINER:('`',"statue"),(64,10) { } -CONTAINER:('`',"statue"),(65,10) { } -CONTAINER:('`',"statue"),(64,11) { } -CONTAINER:('`',"statue"),(65,11) { } -OBJECT:('`',"boulder"),(04,04) -OBJECT:'/',(52,09) -OBJECT:('`',"boulder"),(52,09) -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Traps -TRAP:"magic",(03,12) -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Monsters. -MONSTER:('@',"Medusa"),(68,10),asleep -MONSTER:('g',"gremlin"),(02,14) -MONSTER:('H',"titan"),(02,05) -MONSTER:(';',"electric eel"),(10,13) -MONSTER:(';',"electric eel"),(11,13) -MONSTER:(';',"electric eel"),(10,14) -MONSTER:(';',"electric eel"),(11,14) -MONSTER:(';',"electric eel"),(10,15) -MONSTER:(';',"electric eel"),(11,15) -MONSTER:(';',"jellyfish"),(01,01) -MONSTER:(';',"jellyfish"),(00,08) -MONSTER:(';',"jellyfish"),(04,19) -MONSTER:(''',"stone golem"),(64,08),asleep -MONSTER:(''',"stone golem"),(65,08),asleep -MONSTER:(''',"stone golem"),(64,09),asleep -MONSTER:(''',"stone golem"),(65,09),asleep -MONSTER:('S',"cobra"),(64,10),asleep -MONSTER:('S',"cobra"),(65,10),asleep -MONSTER:'A',(72,08) -MONSTER:('y',"yellow light"),(72,11),asleep -MONSTER:random,(17,07) -MONSTER:random,(28,11) -MONSTER:random,(32,13) -MONSTER:random,(49,09) -MONSTER:random,(48,07) -MONSTER:random,(65,03) -MONSTER:random,(70,04) -MONSTER:random,(70,15) -MONSTER:random,(65,16) -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random - - -LEVEL:"medusa-3" -FLAGS: noteleport,mazelevel,shortsighted -INIT_MAP:solidfill,' ' -GEOMETRY:center,center -# -# Here you disturb ravens nesting in the trees. -# -MAP -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} -}}}}}}}}}}.}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}.}}}}}}}}}}}}}}}}}}}}}}}}}}}} -}}}}}}}}T..T.}}}}}}}}}}}}}}}}}}}}..}}}}}}}}.}}}...}}}}}}}.}}}}}......}}}}}}} -}}}}}}.......T.}}}}}}}}}}}..}}}}..T.}}}}}}...T...T..}}...T..}}..-----..}}}}} -}}}...-----....}}}}}}}}}}.T..}}}}}...}}}}}.....T..}}}}}......T..|...|.T..}}} -}}}.T.|...|...T.}}}}}}}.T......}}}}..T..}}.}}}.}}...}}}}}.T.....+...|...}}}} -}}}}..|...|.}}.}}}}}.....}}}T.}}}}.....}}}}}}.T}}}}}}}}}}}}}..T.|...|.}}}}}} -}}}}}.|...|.}}}}}}..T..}}}}}}}}}}}}}T.}}}}}}}}..}}}}}}}}}}}.....-----.}}}}}} -}}}}}.--+--..}}}}}}...}}}}}}}}}}}}}}}}}}}T.}}}}}}}}}}}}}}}}.T.}........}}}}} -}}}}}.......}}}}}}..}}}}}}}}}.}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}.}}}.}}.T.}}}}}} -}}.T...T...}}}}T}}}}}}}}}}}....}}}}}}}}}}T}}}}}.T}}...}}}}}}}}}}}}}}...}}}}} -}}}...T}}}}}}}..}}}}}}}}}}}.T...}}}}}}}}.T.}.T.....T....}}}}}}}}}}}}}.}}}}}} -}}}}}}}}}}}}}}}....}}}}}}}...}}.}}}}}}}}}}............T..}}}}}.T.}}}}}}}}}}} -}}}}}}}}}}}}}}}}..T..}}}}}}}}}}}}}}..}}}}}..------+--...T.}}}....}}}}}}}}}}} -}}}}.}..}}}}}}}.T.....}}}}}}}}}}}..T.}}}}.T.|...|...|....}}}}}.}}}}}...}}}}} -}}}.T.}...}..}}}}T.T.}}}}}}.}}}}}}}....}}...|...+...|.}}}}}}}}}}}}}..T...}}} -}}}}..}}}.....}}...}}}}}}}...}}}}}}}}}}}}}T.|...|...|}}}}}}}}}}}....T..}}}}} -}}}}}..}}}.T..}}}.}}}}}}}}.T..}}}}}}}}}}}}}}---S-----}}}}}}}}}}}}}....}}}}}} -}}}}}}}}}}}..}}}}}}}}}}}}}}}.}}}}}}}}}}}}}}}}}T..T}}}}}}}}}}}}}}}}}}}}}}}}}} -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} -ENDMAP -$place = { (08,06),(66,05),(46,15) } -SHUFFLE: $place -REGION:(00,00,74,19),lit,"ordinary" -REGION:(49,14,51,16),random,"ordinary",unfilled -REGION:(07,05,09,07),unlit,"ordinary" -REGION:(65,04,67,06),unlit,"ordinary" -REGION:(45,14,47,16),unlit,"ordinary" -# Non diggable walls -# 4th room has diggable walls as Medusa is never placed there -NON_DIGGABLE:(06,04,10,08) -NON_DIGGABLE:(64,03,68,07) -NON_DIGGABLE:(44,13,48,17) -# All places are accessible also with jumping, so don't bother -# restricting the placement when teleporting from levels below this. -TELEPORT_REGION:(33,02,38,07),(0,0,0,0),down -STAIR:(32,01,39,07),(0,0,0,0),up -STAIR:$place[0],down -DOOR:locked,(08,08) -DOOR:locked,(64,05) -DOOR:random,(50,13) -DOOR:locked,(48,15) -# -FOUNTAIN:$place[1] -# -CONTAINER:('`',"statue"),$place[2],uncursed,montype:"knight",3,name:"Perseus" { - [75%]: OBJECT: ('[',"shield of reflection"),cursed,+0 - [25%]: OBJECT: ('[',"levitation boots"),+0 - [50%]: OBJECT: (')',"scimitar"),blessed,+2 - [50%]: OBJECT: ('(',"sack") -} -# -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } - -LOOP [8] { - OBJECT:random,random -} -OBJECT:('?',"blank paper"),(48,18) -OBJECT:('?',"blank paper"),(48,18) -# -TRAP:"rust",random -TRAP:"rust",random -TRAP:"board",random -TRAP:"board",random -TRAP:random,random -# -MONSTER:('@',"Medusa"),$place[0] -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"jellyfish"),random -MONSTER:(';',"jellyfish"),random -MONSTER:('n',"wood nymph"),random -MONSTER:('n',"wood nymph"),random -MONSTER:('n',"water nymph"),random -MONSTER:('n',"water nymph"),random - -LOOP [30] { - MONSTER:('B',"raven"),random,hostile -} - - -LEVEL:"medusa-4" -FLAGS: noteleport,mazelevel -INIT_MAP:solidfill,' ' -GEOMETRY:center,center -# -# Here the Medusa rules some slithery monsters from her 'palace', with -# a yellow dragon nesting in the backyard. -# -MAP -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} -}}}}}}}}}}}}}}........}}}}}}}}}}}}}}}}}}}}}}}..}}}.....}}}}}}}}}}}----|}}}}} -}}}}}}..----------F-.....}}}}}}}}}}}}}}}}..---...}}}}....T.}}}}}}}....|}}}}} -}}}.....|...F......S}}}}....}}}}}}}...}}.....|}}.}}}}}}}......}}}}|......}}} -}}}.....+...|..{...|}}}}}}}}}}}}.....}}}}|...|}}}}}}}}}}}.}}}}}}}}----.}}}}} -}}......|...|......|}}}}}}}}}......}}}}}}|.......}}}}}}}}}}}}}..}}}}}...}}}} -}}|-+--F|-+--....|F|-|}}}}}....}}}....}}}-----}}.....}}}}}}}......}}}}.}}}}} -}}|...}}|...|....|}}}|}}}}}}}..}}}}}}}}}}}}}}}}}}}}....}}}}}}}}....T.}}}}}}} -}}|...}}F...+....F}}}}}}}..}}}}}}}}}}}}}}...}}}}}}}}}}}}}}}}}}}}}}....}}..}} -}}|...}}|...|....|}}}|}....}}}}}}....}}}...}}}}}...}}}}}}}}}}}}}}}}}.....}}} -}}--+--F|-+--....-F|-|....}}}}}}}}}}.T...}}}}....---}}}}}}}}}}}}}}}}}}}}}}}} -}}......|...|......|}}}}}.}}}}}}}}}....}}}}}}}.....|}}}}}}}}}.}}}}}}}}}}}}}} -}}}}....+...|..{...|.}}}}}}}}}}}}}}}}}}}}}}}}}}.|..|}}}}}}}......}}}}...}}}} -}}}}}}..|...F......|...}}}}}}}}}}..---}}}}}}}}}}--.-}}}}}....}}}}}}....}}}}} -}}}}}}}}-----S----F|....}}}}}}}}}|...|}}}}}}}}}}}}...}}}}}}...}}}}}}..}}}}}} -}}}}}}}}}..............T...}}}}}.|.......}}}}}}}}}}}}}}..}...}.}}}}....}}}}} -}}}}}}}}}}....}}}}...}...}}}}}.......|.}}}}}}}}}}}}}}.......}}}}}}}}}...}}}} -}}}}}}}}}}..}}}}}}}}}}.}}}}}}}}}}-..--.}}}}}}}}..}}}}}}..T...}}}..}}}}}}}}}} -}}}}}}}}}...}}}}}}}}}}}}}}}}}}}}}}}...}}}}}}}....}}}}}}}.}}}..}}}...}}}}}}}} -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}.}}}}}}....}}}}}}}}}}}}}}}}}}}...}}}}}} -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} -ENDMAP -# -$place = { (04,08),(10,04),(10,08),(10,12) } -SHUFFLE: $place -# -REGION:(00,00,74,19),lit,"ordinary" -REGION:(13,03,18,13),lit,"ordinary",unfilled -# -TELEPORT_REGION:(64,01,74,17),(0,0,0,0),down -TELEPORT_REGION:(02,02,18,13),(0,0,0,0),up -# -STAIR:(67,01,74,20),(0,0,0,0),up -STAIR:$place[0],down -# -DOOR:locked,(04,06) -DOOR:locked,(04,10) -DOOR:locked,(08,04) -DOOR:locked,(08,12) -DOOR:locked,(10,06) -DOOR:locked,(10,10) -DOOR:locked,(12,08) -# -BRANCH:levregion(27,00,79,20),(0,0,0,0) -# -NON_DIGGABLE:(01,01,22,14) -# -OBJECT:('(',"crystal ball"),(07,08) -# -CONTAINER:('`',"statue"),$place[1],uncursed,montype:"knight",3,name:"Perseus" { - [75%]: OBJECT: ('[',"shield of reflection"),cursed,+0 - [25%]: OBJECT: ('[',"levitation boots"),+0 - [50%]: OBJECT: (')',"scimitar"),blessed,+2 - [50%]: OBJECT: ('(',"sack") -} -# -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } -CONTAINER:('`',"statue"),random { } -LOOP [8] { - OBJECT:random,random -} -# -LOOP [7] { - TRAP:random,random -} -# -MONSTER:('@',"Medusa"),$place[0] -MONSTER:(';',"kraken"),(07,07) -# -# the nesting dragon -MONSTER:('D',"yellow dragon"), (05,04), asleep -[50%]: MONSTER: ('D',"baby yellow dragon"), (04,04), asleep -[25%]: MONSTER: ('D',"baby yellow dragon"), (04,05), asleep -OBJECT:('%',"egg"), (05,04), montype:"yellow dragon" -[50%]: OBJECT: ('%',"egg"), (05,04), montype:"yellow dragon" -[25%]: OBJECT: ('%',"egg"), (05,04), montype:"yellow dragon" -# -MONSTER:(';',"giant eel"),random -MONSTER:(';',"giant eel"),random -MONSTER:(';',"jellyfish"),random -MONSTER:(';',"jellyfish"),random -LOOP [14] { - MONSTER:'S',random -} -LOOP [4] { - MONSTER:('N',"black naga hatchling"), random - MONSTER:('N',"black naga"), random -} diff --git a/dat/minefill.lua b/dat/minefill.lua new file mode 100644 index 000000000..be738098a --- /dev/null +++ b/dat/minefill.lua @@ -0,0 +1,50 @@ +-- NetHack 3.6 mines.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.25 $ +-- Copyright (c) 1989-95 by Jean-Christophe Collet +-- Copyright (c) 1991-95 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- + +-- The "fill" level for the mines. +-- +-- This level is used to fill out any levels not occupied by +-- specific levels. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.level_init({ style="mines", fg=".", bg=" ", smoothed=true ,joined=true, lit="random", walled=true }) + +-- +des.stair("up") +des.stair("down") +-- +des.object("*") +des.object("*") +des.object("*") +des.object("(") +des.object() +des.object() +des.object() +-- +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome lord") +des.monster("dwarf") +des.monster("dwarf") +des.monster("G") +des.monster("G") +des.monster("h") +-- +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() diff --git a/dat/minend-1.lua b/dat/minend-1.lua new file mode 100644 index 000000000..109cc0737 --- /dev/null +++ b/dat/minend-1.lua @@ -0,0 +1,118 @@ +-- NetHack 3.6 mines.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.25 $ +-- Copyright (c) 1989-95 by Jean-Christophe Collet +-- Copyright (c) 1991-95 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- Mine end level variant 1 +-- "Mimic of the Mines" + +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.map([[ +------------------------------------------------------------------ ------ +| |.......| |.......-...| |.....|. | +| --------- ----.......-------...........| ---...-S- | +| |.......| |..........................-S- --.......| | +| |......------- ---........................|. |.......-- | +| |..--........-----..........................|. -.-..---- | +| --..--.-----........-.....................--- --..-- | +| --..--..| -----------..................---.----------..-- | +| |...--.| |..S...S..............---................-- | +| ----..----- ------------........--- ------------...--- | +| |.........-- ---------- ---...-- ----- | +| --.....---..-- -------- --...---...-- | +| ----..-..-- --..--------------------- --......-- ---........| | +|--....----- --..-..................--- |........| |.......-- | +|.......| --......................S.. --......-- ---..---- | +|--.--.-- ----.................--- ------..------...-- | +| |....S.. |...............-..| ..S...........| | +-------- -------------------- ------------------------ +]]); + +-- Dungeon Description +local place = { {08,16},{13,07},{21,08},{41,14},{50,04},{50,16},{66,01} } +shuffle(place) + +des.region({ region={26,01,32,01},lit=0,type="ordinary",prefilled=0,irregular=1 }) +des.region(selection.area(20,08,21,08),"unlit") +des.region(selection.area(23,08,25,08),"unlit"); +-- Secret doors +des.door("locked",07,16) +des.door("locked",22,08) +des.door("locked",26,08) +des.door("locked",40,14) +des.door("locked",50,03) +des.door("locked",51,16) +des.door("locked",66,02) +-- Stairs +des.stair("up", 36,04) +-- Non diggable walls +des.non_diggable(selection.area(00,00,74,17)) +-- Niches +-- Note: place[6] empty +des.object("diamond",place[7]) +des.object("emerald",place[7]) +des.object("worthless piece of violet glass",place[7]) +des.monster({ class="m", coord=place[7], appear_as="obj:luckstone" }) +des.object("worthless piece of white glass",place[1]) +des.object("emerald",place[1]) +des.object("amethyst",place[1]) +des.monster({ class="m", coord=place[1], appear_as="obj:loadstone" }) +des.object("diamond",place[2]) +des.object("worthless piece of green glass",place[2]) +des.object("amethyst",place[2]) +des.monster({ class="m", coord=place[2], appear_as="obj:flint" }) +des.object("worthless piece of white glass",place[3]) +des.object("emerald",place[3]) +des.object("worthless piece of violet glass",place[3]) +des.monster({ class="m", coord=place[3], appear_as="obj:touchstone" }) +des.object("worthless piece of red glass",place[4]) +des.object("ruby",place[4]) +des.object("loadstone",place[4]) +des.object("ruby",place[5]) +des.object("worthless piece of red glass",place[5]) +des.object("luckstone",place[5]) +-- Random objects +des.object("*") +des.object("*") +des.object("*") +des.object("*") +des.object("*") +des.object("*") +des.object("*") +des.object("(") +des.object("(") +des.object() +des.object() +des.object() +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Random monsters +des.monster("gnome king") +des.monster("gnome lord") +des.monster("gnome lord") +des.monster("gnome lord") +des.monster("gnomish wizard") +des.monster("gnomish wizard") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("hobbit") +des.monster("hobbit") +des.monster("dwarf") +des.monster("dwarf") +des.monster("dwarf") +des.monster("h") diff --git a/dat/minend-2.lua b/dat/minend-2.lua new file mode 100644 index 000000000..d8370d102 --- /dev/null +++ b/dat/minend-2.lua @@ -0,0 +1,152 @@ +-- NetHack 3.6 mines.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.25 $ +-- Copyright (c) 1989-95 by Jean-Christophe Collet +-- Copyright (c) 1991-95 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- Mine end level variant 2 +-- "Gnome King's Wine Cellar" + +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.map([[ +--------------------------------------------------------------------------- +|...................................................| | +|.|---------S--.--|...|--------------------------|..| | +|.||---| |.||-| |...|..........................|..| | +|.||...| |-|.|.|---...|.............................| .. | +|.||...|-|.....|....|-|..........................|..|. .. | +|.||.....|-S|..|....|............................|..|.. | +|.||--|..|..|..|-|..|----------------------------|..|-. | +|.| |..|..|....|..................................|... | +|.| |..|..|----|..-----------------------------|..|.... | +|.|---|..|--|.......|----------------------------|..|..... | +|...........|----.--|......................| |..|....... | +|-----------|...|.| |------------------|.|.|-----|..|.....|.. | +|-----------|.{.|.|--------------------|.|..........|.....|.... | +|...............|.S......................|-------------..-----... | +|.--------------|.|--------------------|.|......................... | +|.................| |.....................|........ | +--------------------------------------------------------------------------- +]]); + +if math.random(0, 99) < 50 then + des.terrain({55,14},"-") + des.terrain({56,14},"-") + des.terrain({61,15},"|") + des.terrain({52,5}, "S") + des.door("locked", 52,5) +end +if math.random(0, 99) < 50 then + des.terrain({18,1}, "|") + des.terrain(selection.area(7,12, 8,13), ".") +end +if math.random(0, 99) < 50 then + des.terrain({49,4}, "|") + des.terrain({21,5}, ".") +end +if math.random(0, 99) < 50 then + if math.random(0, 99) < 50 then + des.terrain({22,1}, "|") + else + des.terrain({50,7}, "-") + des.terrain({51,7}, "-") + end +end + + +-- Dungeon Description +des.feature("fountain", {14,13}) +des.region(selection.area(23,03,48,06),"lit") +des.region(selection.area(21,06,22,06),"lit") +des.region(selection.area(14,04,14,04),"unlit") +des.region(selection.area(10,05,14,08),"unlit") +des.region(selection.area(10,09,11,09),"unlit") +des.region(selection.area(15,08,16,08),"unlit") +-- Secret doors +des.door("locked",12,02) +des.door("locked",11,06) +-- Stairs +des.stair("up", 36,04) +-- Non diggable walls +des.non_diggable(selection.area(00,00,52,17)) +des.non_diggable(selection.area(53,00,74,00)) +des.non_diggable(selection.area(53,17,74,17)) +des.non_diggable(selection.area(74,01,74,16)) +des.non_diggable(selection.area(53,07,55,07)) +des.non_diggable(selection.area(53,14,61,14)) +-- The Gnome King's wine cellar. +-- the Trespassers sign is a long-running joke +des.engraving({12,03},"engrave","You are now entering the Gnome King's wine cellar.") +des.engraving({12,04},"engrave","Trespassers will be persecuted!") +des.object("booze", 10, 07) +des.object("booze", 10, 07) +des.object("!", 10, 07) +des.object("booze", 10, 08) +des.object("booze", 10, 08) +des.object("!", 10, 08) +des.object("booze", 10, 09) +des.object("booze", 10, 09) +des.object("object detection", 10, 09) +-- Objects +-- The Treasure chamber... +des.object("diamond", 69, 04) +des.object("*", 69, 04) +des.object("diamond", 69, 04) +des.object("*", 69, 04) +des.object("emerald", 70, 04) +des.object("*", 70, 04) +des.object("emerald", 70, 04) +des.object("*", 70, 04) +des.object("emerald", 69, 05) +des.object("*", 69, 05) +des.object("ruby", 69, 05) +des.object("*", 69, 05) +des.object("ruby", 70, 05) +des.object("amethyst", 70, 05) +des.object("*", 70, 05) +des.object("amethyst", 70, 05) +des.object("luckstone", 70, 05) +-- Scattered gems... +des.object("*") +des.object("*") +des.object("*") +des.object("*") +des.object("*") +des.object("*") +des.object("*") +des.object("(") +des.object("(") +des.object() +des.object() +des.object() +-- Random traps +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- Random monsters. +des.monster("gnome king") +des.monster("gnome lord") +des.monster("gnome lord") +des.monster("gnome lord") +des.monster("gnomish wizard") +des.monster("gnomish wizard") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("hobbit") +des.monster("hobbit") +des.monster("dwarf") +des.monster("dwarf") +des.monster("dwarf") +des.monster("h") diff --git a/dat/minend-3.lua b/dat/minend-3.lua new file mode 100644 index 000000000..a40d7448a --- /dev/null +++ b/dat/minend-3.lua @@ -0,0 +1,107 @@ +-- NetHack 3.6 mines.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.25 $ +-- Copyright (c) 1989-95 by Jean-Christophe Collet +-- Copyright (c) 1991-95 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- "Catacombs" by Kelly Bailey +-- Relies on some very specific behavior of MAZEWALK. + +des.level_init({ style = "solidfill", fg = "-" }); + +des.level_flags("mazelevel", "nommap") + +des.map({ halign = "center", valign = "bottom", map = [[ + - - - - - - - - - - -- -- - - . - - - - - - - - - -- - - -- - - - - . - - | +------...---------.-----------...-----.-------.------- ----------------| + - - - - - - - - - - - . - - - . - - - - - - - - - - -- - -- - . - - - - - | +------------.---------...-------------------------.--- ------------------| + - - - - - - - - - - . . - - --- - . - - - - - - - - -- -- - - - - |.....| | +--.---------------.......------------------------------- ----------|.....S-| + - - - - |.. ..| - ....... . - - - - |.........| - - - --- - - - - |.....| | +----.----|.....|------.......--------|.........|--------------.------------| + - - - - |..{..| - - -.... . --- - -.S.........S - - - - - - - - - - - - - | +---------|.....|--.---...------------|.........|---------------------------| + - - - - |.. ..| - - - . - - - - - - |.........| - --- . - - - - - - - - - | +----------------------...-------.---------------------...------------------| +---..| - - - - - - - - . --- - - - - - - - - - - - - - . - - --- - - --- - | +-.S..|----.-------.------- ---------.-----------------...----- -----.------- +---..| - - - - - - - -- - - -- . - - - - - . - - - . - . - - -- -- - - - -- +-.S..|--------.---.--- -...---------------...{.--------- --------- +--|. - - - - - - - -- - - - -- . - - - --- - - - . . - - - - -- - - - - - - +]] }); + +local place = { {1,15},{68,6},{1,13} } +shuffle(place) + +des.non_diggable(selection.area(67,3,73,7)) +des.non_diggable(selection.area(0,12,2,16)) +des.feature("fountain", {12,08}) +des.feature("fountain", {51,15}) +des.region(selection.area(0,0,75,16),"unlit") +des.region(selection.area(38,6,46,10),"lit") +des.door("closed",37,8) +des.door("closed",47,8) +des.door("closed",73,5) +des.door("closed",2,15) +des.mazewalk({ x=36, y=8, dir="west", stocked=false }) +des.stair("up", 42,8) +des.wallify() + +-- Objects +des.object("diamond") +des.object("*") +des.object("diamond") +des.object("*") +des.object("emerald") +des.object("*") +des.object("emerald") +des.object("*") +des.object("emerald") +des.object("*") +des.object("ruby") +des.object("*") +des.object("ruby") +des.object("amethyst") +des.object("*") +des.object("amethyst") +des.object("luckstone",place[2]) +des.object("flint",place[1]) +des.object("?") +des.object("?") +des.object("?") +des.object("?") +des.object("?") +des.object("+") +des.object("+") +des.object("+") +des.object("+") +des.object() +des.object() +des.object() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +des.trap() +-- One-time annoyance factor +des.trap("level teleport",place[2]) +des.trap("level teleport",place[1]) +des.monster("M") +des.monster("M") +des.monster("M") +des.monster("M") +des.monster("M") +des.monster("ettin mummy") +des.monster("V") +des.monster("Z") +des.monster("Z") +des.monster("Z") +des.monster("Z") +des.monster("Z") +des.monster("V") +des.monster("e") +des.monster("e") +des.monster("e") +des.monster("e") diff --git a/dat/mines.des b/dat/mines.des deleted file mode 100644 index 1ef2031f5..000000000 --- a/dat/mines.des +++ /dev/null @@ -1,1209 +0,0 @@ -# NetHack 3.6 mines.des $NHDT-Date: 1548631704 2019/01/27 23:28:24 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.30 $ -# Copyright (c) 1989-95 by Jean-Christophe Collet -# Copyright (c) 1991-95 by M. Stephenson -# NetHack may be freely redistributed. See license for details. -# - -# The "fill" level for the mines. -# -# This level is used to fill out any levels not occupied by -# specific levels as defined below. -# -MAZE: "minefill" , ' ' -INIT_MAP: mines, '.' , ' ' , true , true , random , true -NOMAP -# -STAIR: random, up -STAIR: random, down -# -OBJECT: '*', random -OBJECT: '*', random -OBJECT: '*', random -OBJECT: '(', random -OBJECT: random, random -OBJECT: random, random -OBJECT: random, random -# -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome lord"), random -MONSTER: ('h', "dwarf"), random -MONSTER: ('h', "dwarf"), random -MONSTER: 'G', random -MONSTER: 'G', random -MONSTER: 'h', random -# -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random -TRAP: random, random - - -# A tragic accident has occurred in Frontier Town.... -# -# Minetown variant 1 -# Orcish Town - a variant of Frontier Town that has been -# overrun by orcs. Note the barricades (iron bars). -# -LEVEL: "minetn-1" -FLAGS:mazelevel -INIT_MAP:mines,'.',' ',true,true,random,true -GEOMETRY:center,center -MAP -..................................... -.----------------F------------------. -.|.................................|. -.|.-------------......------------.|. -.|.|...|...|...|......|..|...|...|.|. -.F.|...|...|...|......|..|...|...|.|. -.|.|...|...|...|......|..|...|...|.F. -.|.|...|...|----......------------.|. -.|.---------.......................|. -.|.................................|. -.|.---------.....--...--...........|. -.|.|...|...|----.|.....|.---------.|. -.|.|...|...|...|.|.....|.|..|....|.|. -.|.|...|...|...|.|.....|.|..|....|.|. -.|.|...|...|...|.|.....|.|..|....|.|. -.|.-------------.-------.---------.|. -.|.................................F. -.-----------F------------F----------. -..................................... -ENDMAP - -# Don't let the player fall into his likely death -TELEPORT_REGION:levregion(01,01,20,19),levregion(20,00,70,19) -REGION:(00,00,36,16),lit,"ordinary" -STAIR:levregion(01,03,20,19),(00,00,36,15),up -STAIR:levregion(61,03,75,19),(00,00,36,15),down - -# shame we can't make polluted fountains -FOUNTAIN:(16,09) -FOUNTAIN:(25,09) - -# the altar's defiled; useful for BUC but never coaligned -ALTAR:(20,13),noalign,shrine - -# set up the shop doors; could be broken down -DOOR:random,(5,8) -DOOR:random,(9,8) -DOOR:random,(13,7) -DOOR:random,(22,5) -DOOR:random,(27,7) -DOOR:random,(31,7) -DOOR:random,(5,10) -DOOR:random,(9,10) -DOOR:random,(15,13) -DOOR:random,(25,13) -DOOR:random,(31,11) - -# knock a few holes in the shop interior walls -REPLACE_TERRAIN:(07,04,11,06),'|','.',18% -REPLACE_TERRAIN:(25,04,29,06),'|','.',18% -REPLACE_TERRAIN:(07,12,11,14),'|','.',18% -REPLACE_TERRAIN:(28,12,28,14),'|','.',33% - -# One spot each in most shops... -$place = { (05,04),(09,05),(13,04),(26,04),(31,05),(30,14),(05,14),(10,13),(26,14),(27,13) } -SHUFFLE:$place - -# scatter some bodies -OBJECT:('%',"corpse"),(20,12),montype:"aligned priest" -OBJECT:('%',"corpse"),$place[0],montype:"shopkeeper" -OBJECT:('%',"corpse"),$place[1],montype:"shopkeeper" -OBJECT:('%',"corpse"),$place[2],montype:"shopkeeper" -OBJECT:('%',"corpse"),$place[3],montype:"shopkeeper" -OBJECT:('%',"corpse"),$place[4],montype:"shopkeeper" -OBJECT:('%',"corpse"),random,montype:"watchman" -OBJECT:('%',"corpse"),random,montype:"watchman" -OBJECT:('%',"corpse"),random,montype:"watchman" -OBJECT:('%',"corpse"),random,montype:"watchman" -OBJECT:('%',"corpse"),random,montype:"watch captain" - -# Rubble! -LOOP [9 + 2d5] { - [90%]: OBJECT:('`',"boulder"),random - OBJECT:('*',"rock"),random -} - -# Guarantee 7 candles since we won't have Izchak available -OBJECT:('(',"wax candle"),$place[0],quantity:1d2 -OBJECT:('(',"wax candle"),$place[1],quantity:2d2 -OBJECT:('(',"wax candle"),$place[2],quantity:1d2 -OBJECT:('(',"tallow candle"),$place[3],quantity:1d3 -OBJECT:('(',"tallow candle"),$place[2],quantity:1d2 -OBJECT:('(',"tallow candle"),$place[0],quantity:1d2 - -# go ahead and leave a lamp next to one corpse to be suggestive -# and some empty wands... -OBJECT:('(',"oil lamp"),$place[2] -OBJECT:('/',"striking"),$place[1],uncursed,0 -OBJECT:('/',"striking"),$place[3],uncursed,0 -OBJECT:('/',"striking"),$place[4],uncursed,0 -OBJECT:('/',"magic missile"),$place[4],uncursed,0 -OBJECT:('/',"magic missile"),$place[0],uncursed,0 - -# the Orcish Army - -$inside = selection: floodfill(18,8) -$near_temple = selection: filter(fillrect(17,8, 23,14), $inside) - -LOOP [5 + 1d10] { - IF [50%] { - MONSTER: ('o', "orc-captain"), rndcoord($inside), hostile - } ELSE { - IF [80%] { - MONSTER: ('o', "Uruk-hai"), rndcoord($inside), hostile - } ELSE { - MONSTER: ('o', "Mordor orc"), rndcoord($inside), hostile - } - } -} -# shamans can be hanging out in/near the temple -LOOP [2d3] { - MONSTER: ('o', "orc shaman"), rndcoord($near_temple), hostile -} -# these are not such a big deal -# to run into outside the bars -LOOP [9 + 2d5] { - IF [90%] { - MONSTER: ('o', "hill orc"), random, hostile - } ELSE { - MONSTER: ('o', "goblin"), random, hostile - } -} - -# Hack to force full-level wallification -NOMAP -WALLIFY - - -# Minetown variant 2 -# "Town Square" -# -LEVEL: "minetn-2" -ROOM: "ordinary" , lit, (3,3), (center,center), (31,15) { -FOUNTAIN: (17, 5) -FOUNTAIN: (13, 8) - -[75%]: SUBROOM: "ordinary", random, (2,0), (2,2) { - ROOMDOOR: false, closed, west, random -} - -[75%]: SUBROOM: "ordinary", unlit, (5,0), (2,2) { - ROOMDOOR: false, closed, south, random -} - -[75%]: SUBROOM: "ordinary", random, (8,0), (2,2) { - ROOMDOOR: false, closed, east, random -} - -[75%]: SUBROOM: "ordinary", lit, (16,0), (2,2) { - ROOMDOOR: false, closed, west, random -} - -[75%]: SUBROOM: "ordinary", unlit, (19,0), (2,2) { - ROOMDOOR: false, closed, south, random -} - -[75%]: SUBROOM: "ordinary", random, (22,0), (2,2) { - ROOMDOOR: false, locked, south, random - MONSTER: ('G', "gnome"), random -} - -[75%]: SUBROOM: "ordinary", unlit, (25,0), (2,2) { - ROOMDOOR: false, closed, east, random -} - -[75%]: SUBROOM: "ordinary", lit, (2,5), (2,2) { - ROOMDOOR: false, closed, north, random -} - -[75%]: SUBROOM: "ordinary", lit, (5,5), (2,2) { - ROOMDOOR: false, closed, south, random -} - -[75%]: SUBROOM: "ordinary", random, (8,5), (2,2) { - ROOMDOOR: false, locked, north, random - MONSTER: ('G', "gnome"), random -} - -SUBROOM: "shop" [90%] , lit, (2,10), (4,3) { - ROOMDOOR: false, closed, west, random -} - -SUBROOM: "tool shop" [90%], lit, (23,10), (4,3) { - ROOMDOOR: false, closed, east, random -} - -SUBROOM: "food shop" [90%], lit, (24,5), (3,4) { - ROOMDOOR: false, closed, north, random -} - -SUBROOM: "candle shop", lit, (11,10), (4,3) { - ROOMDOOR: false, closed, east, random -} - -[75%]: SUBROOM: "ordinary", unlit, (7,10), (3,3) { - ROOMDOOR: false, locked, north, random - MONSTER: ('G', "gnome"), random -} - -SUBROOM: "temple", lit, (19,5), (4,4) { - ROOMDOOR: false, closed, north, random - ALTAR:(02,02),align[0],shrine - MONSTER: ('G', "gnomish wizard"), random - MONSTER: ('G', "gnomish wizard"), random -} - -[75%]: SUBROOM: "ordinary", lit, (18,10), (4,3) { - ROOMDOOR: false, locked, west, random - MONSTER: ('G', "gnome lord"), random -} - -# The Town Watch -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watch captain"), random, peaceful - -} - -ROOM: "ordinary" , random, random, random, random { - STAIR: random, up -} - -ROOM: "ordinary" , random, random, random, random { - STAIR: random, down - TRAP: random, random - MONSTER: ('G', "gnome"), random - MONSTER: ('G', "gnome"), random -} - -ROOM: "ordinary" , random, random, random, random { - MONSTER: ('h', "dwarf"), random -} - -ROOM: "ordinary" , random, random, random, random { - TRAP: random, random - MONSTER: ('G', "gnome"), random -} - -RANDOM_CORRIDORS - - -# Minetown variant 3 by Kelly Bailey -# "Alley Town" -# -LEVEL: "minetn-3" -ROOM: "ordinary",lit,(3,3),(center,center),(31,15) { -FOUNTAIN:(01,06) -FOUNTAIN:(29,13) - -SUBROOM:"ordinary",random,(2,2),(2,2) { - ROOMDOOR: false,closed,south,random -} - -SUBROOM:"tool shop" [30%], lit,(5,3),(2,3) { - ROOMDOOR: false,closed,south,random -} - -SUBROOM:"ordinary",random,(2,10),(2,3) { - ROOMDOOR: false, locked, north, random - MONSTER: 'G',random -} - -SUBROOM:"ordinary",random,(5,9),(2,2) { - ROOMDOOR: false,closed,north,random -} - -SUBROOM:"temple",lit,(10,2),(3,4) { - ROOMDOOR: false,closed,east,random - ALTAR:(1,1),align[0],shrine - MONSTER: ('G', "gnomish wizard"), random - MONSTER: ('G', "gnomish wizard"), random -} - -SUBROOM:"ordinary",random,(11,7),(2,2) { - ROOMDOOR: false,closed,west,random -} - -SUBROOM:"shop",lit,(10,10),(3,3) { - ROOMDOOR:false,closed,west,random -} - -SUBROOM:"ordinary",random,(14,8),(2,2) { - ROOMDOOR:false,locked,north,random - MONSTER: 'G',random -} - -SUBROOM:"ordinary",random,(14,11),(2,2) { - ROOMDOOR:false,closed,south,random -} - -SUBROOM:"tool shop" [40%],lit,(17,10),(3,3) { - ROOMDOOR:false,closed,north,random -} - -SUBROOM:"ordinary",random,(21,11),(2,2) { - ROOMDOOR:false,locked,east,random - MONSTER:'G',random -} - -SUBROOM:"food shop" [90%],lit,(26,8),(3,2) { - ROOMDOOR:false,closed,west,random -} - -SUBROOM:"ordinary",random,(16,2),(2,2) { - ROOMDOOR:false,closed,west,random -} - -SUBROOM:"ordinary",random,(19,2),(2,2) { - ROOMDOOR:false,closed,north,random -} - -SUBROOM:"wand shop" [30%],lit,(19,5),(3,2) { - ROOMDOOR:false,closed,west,random -} - -SUBROOM: "candle shop",lit,(25,2),(3,3) { - ROOMDOOR:false,closed,south,random -} - -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watch captain"), random, peaceful - -} - -ROOM: "ordinary", random, random, random, random { - STAIR: random, up -} - -ROOM: "ordinary" , random, random, random, random { - STAIR: random, down - TRAP: random, random - MONSTER: ('G', "gnome"), random - MONSTER: ('G', "gnome"), random -} - -ROOM: "ordinary" , random, random, random, random { - MONSTER: ('h', "dwarf"), random -} - -ROOM: "ordinary" , random, random, random, random { - TRAP: random, random - MONSTER: ('G', "gnome"), random -} - -RANDOM_CORRIDORS - - -# Minetown variant 4 by Kelly Bailey -# "College Town" -# -LEVEL: "minetn-4" -ROOM: "ordinary",lit,(3,3),(center,center),(30,15) { -FOUNTAIN:(08,07) -FOUNTAIN:(18,07) - -SUBROOM:"book shop",lit,(4,2),(3,3) { - ROOMDOOR: false,closed,south,random -} - -SUBROOM:"ordinary",random,(8,2),(2,2) { - ROOMDOOR: false,closed,south,random -} - -SUBROOM:"temple",lit,(11,3),(5,4) { - ROOMDOOR: false,closed,south,random - ALTAR:(2,1),align[0],shrine - MONSTER: ('G', "gnomish wizard"), random - MONSTER: ('G', "gnomish wizard"), random -} - -SUBROOM:"ordinary",random,(19,2),(2,2) { - ROOMDOOR: false,closed,south,random - MONSTER: 'G', random -} - -SUBROOM:"candle shop",lit,(22,2),(3,3) { - ROOMDOOR:false,closed,south,random -} - -SUBROOM:"ordinary",random,(26,2),(2,2) { - ROOMDOOR:false,locked,east,random - MONSTER: 'G',random -} - -SUBROOM:"tool shop" [90%],lit,(4,10),(3,3) { - ROOMDOOR:false,closed,north,random -} - -SUBROOM:"ordinary",random,(8,11),(2,2) { - ROOMDOOR:false,locked,south,random - MONSTER: ('k',"kobold shaman"),random - MONSTER: ('k',"kobold shaman"),random - MONSTER: ('f',"kitten"),random - MONSTER: 'f',random -} - -SUBROOM:"food shop" [90%],lit,(11,11),(3,2) { - ROOMDOOR:false,closed,east,random -} - -SUBROOM:"ordinary",random,(17,11),(2,2) { - ROOMDOOR:false,closed,west,random -} - -SUBROOM:"ordinary",random,(20,10),(2,2) { - ROOMDOOR:false,locked,north,random - MONSTER:'G',random -} - -SUBROOM:"shop" [90%],lit,(23,10),(3,3) { - ROOMDOOR:false,closed,north,random -} - -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watch captain"), random, peaceful - -} - -ROOM: "ordinary" , random, random, random, random { - STAIR: random, up -} - -ROOM: "ordinary" , random, random, random, random { - STAIR: random, down - TRAP: random, random - MONSTER: ('G', "gnome"), random - MONSTER: ('G', "gnome"), random -} - -ROOM: "ordinary" , random, random, random, random { - MONSTER: ('h', "dwarf"), random -} - -ROOM: "ordinary" , random, random, random, random { - TRAP: random, random - MONSTER: ('G', "gnome"), random -} - -RANDOM_CORRIDORS - - -# "Grotto Town" by Kelly Bailey -# -MAZE: "minetn-5",' ' -GEOMETRY:center,center -MAP ------ --------- -|...--- ------.......-- ------- --------------- -|.....----.........--..| |.....| ------- |.............| ---..-....-.----------..| |.....| |.....| --+---+--.----+- - --.--.....---- ---- |.....| ------ --....---- |..-...--.-.+..| - ---.........---- ----- ---+--- |..+.| ---..-..----..---+-..---..| - ----.-....|..----...-- |.| |..|.| ---+-.....-+--........--+- - -----..|....-.....---- |.| |..|.------......--................| - ------ |..|.............---.-- ----.+..|-.......--..--------+--..-- - |....| --......---...........----- |.|..|-...{....---|.........|..-- - |....| |........-...-...........----.|..|--.......| |.........|...| - ---+--------....-------...---......--.-------....---- -----------...| - ------.---...--...--..-..--...-..---...|.--..-...-....------- |.......-- - |..|-.........-..---..-..---.....--....|........---...-|....| |.------- - |..+...............-+---+-----..--..........--....--...+....| |.|...S. ------.....{....----...............-...........--...-...-|....| |.|...| -|..............-- --+--.---------.........--..-........------- |.--+------- --+-----.........| |...|.|....| --.......------...|....---------.....|....| -|...| --..------- |...|.+....| ---...--- --..|...--......-...{..+..-+| -|...| ---- ------|....| ----- -----.....----........|..|.| ------ ------ ------- --------------- -ENDMAP - -IF [75%] { - IF [50%] { - TERRAIN:line (25,8),(25,9), '|' - } ELSE { - TERRAIN:line (16,13),(17,13), '-' - } -} -IF [75%] { - IF [50%] { - TERRAIN:line (36,10),(36,11), '|' - } ELSE { - TERRAIN:line (32,15),(33,15), '-' - } -} -IF [50%] { - TERRAIN:fillrect (21,4,22,5), '.' - TERRAIN:line (14,9),(14,10), '|' -} -IF [50%] { - TERRAIN:(46,13), '|' - TERRAIN:line (43,5),(47,5), '-' - TERRAIN:line (42,6),(46,6), '.' - TERRAIN:line (46,7),(47,7), '.' -} -[50%]: TERRAIN:fillrect (69,11,71,11), '-' - -STAIR:(01,01),up -STAIR:(46,03),down -FOUNTAIN:(50,09) -FOUNTAIN:(10,15) -FOUNTAIN:(66,18) - -REGION:(00,00,74,20),unlit,"ordinary" -REGION:(09,13,11,17),lit,"ordinary" -REGION:(08,14,12,16),lit,"ordinary" -REGION:(49,07,51,11),lit,"ordinary" -REGION:(48,08,52,10),lit,"ordinary" -REGION:(64,17,68,19),lit,"ordinary" -REGION:(37,13,39,17),lit,"ordinary" -REGION:(36,14,40,17),lit,"ordinary" -REGION:(59,02,72,10),lit,"ordinary" - -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watch captain"), random, peaceful -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome lord"), random -MONSTER: ('G', "gnome lord"), random -MONSTER: ('h', "dwarf"), random -MONSTER: ('h', "dwarf"), random -MONSTER: ('h', "dwarf"), random - -# The shops -REGION:(25,17,28,19),lit,"candle shop" -DOOR:closed,(24,18) -REGION:(59,9,67,10),lit,"shop" -DOOR:closed,(66,08) -REGION:(57,13,60,15),lit,"tool shop" -DOOR:closed,(56,14) -REGION:(05,09,08,10),lit,"food shop" -DOOR:closed,(07,11) -# Gnome homes -DOOR:closed,(04,14) -DOOR:locked,(01,17) -MONSTER: ('G', "gnomish wizard"), (02,19) -DOOR:locked,(20,16) -MONSTER: 'G', (20,18) -DOOR:random,(21,14) -DOOR:random,(25,14) -DOOR:random,(42,08) -DOOR:locked,(40,05) -MONSTER: 'G', (38,07) -DOOR:random,(59,03) -DOOR:random,(58,06) -DOOR:random,(63,03) -DOOR:random,(63,05) -DOOR:locked,(71,03) -DOOR:locked,(71,06) -DOOR:closed,(69,04) -DOOR:closed,(67,16) -MONSTER: ('G', "gnomish wizard"), (67,14) -OBJECT: '=', (70,14) -DOOR:locked,(69,18) -MONSTER: ('G', "gnome lord"), (71,19) -DOOR:locked,(73,18) -OBJECT: ('(', "chest"), (73,19) -DOOR:locked,(50,06) -OBJECT: '(', (50,03) -OBJECT: ('`', "statue"), (38,15), montype:"gnome king", 1 -# Temple -REGION:(29,02,33,04),lit,"temple" -DOOR:closed,(31,05) -ALTAR:(31,03),align[0],shrine - - -# "Bustling Town" by Kelly Bailey -# -MAZE: "minetn-6",' ' -FLAGS: inaccessibles -INIT_MAP:mines,'.','-',true,true,lit,true -GEOMETRY:center,top -MAP -.-----................----------------.- -.|...|................|...|..|...|...|.. -.|...+..--+--.........|...|..|...|...|.. -.|...|..|...|..-----..|...|..|-+---+--.. -.-----..|...|--|...|..--+---+-.........| -........|...|..|...+.............-----.. -........-----..|...|......--+-...|...|.. -.----...|...|+------..{...|..|...+...|.. -.|..+...|...|.............|..|...|...|.. -.|..|...|...|-+-.....---+-------------.| -.----...--+--..|..-+-|.................. -...|........|..|..|..|----....---------. -...|..T.....----..|..|...+....|......|-. -...|-....{........|..|...|....+......|-. -...--..-....T.....--------....|......|-. -.......--.....................---------- -ENDMAP - -REGION:(00,00,38,15),lit,"ordinary" -STAIR:levregion(01,03,20,19),(0,0,39,15),up -STAIR:levregion(61,03,75,19),(0,0,39,15),down -FOUNTAIN:(22,07) -FOUNTAIN:(09,13) -REGION:(13,5,14,6),unlit,"ordinary" -REGION:(9,7,11,9),lit,"candle shop" -REGION:(16,4,18,6),lit,"tool shop" -REGION:(23,1,25,3),lit,"shop" -REGION:(22,12,24,13),lit,"food shop" -REGION:(31,12,36,14),lit,"temple" -ALTAR:(35,13),align[0],shrine - -DOOR:closed,(5,2) -DOOR:locked,(4,8) -DOOR:closed,(10,2) -DOOR:closed,(10,10) -DOOR:locked,(13,7) -DOOR:locked,(14,9) -DOOR:closed,(19,5) -DOOR:closed,(19,10) -DOOR:closed,(24,4) -DOOR:closed,(24,9) -DOOR:closed,(25,12) -DOOR:closed,(28,4) -DOOR:locked,(28,6) -DOOR:closed,(30,13) -DOOR:closed,(31,3) -DOOR:closed,(35,3) -DOOR:closed,(33,7) - -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome"), random -MONSTER: ('G', "gnome"), (14,6) -MONSTER: ('G', "gnome lord"), (14,5) -MONSTER: ('G', "gnome"), (27,8) -MONSTER: ('G', "gnome lord"), random -MONSTER: ('G', "gnome lord"), random -MONSTER: ('h', "dwarf"), random -MONSTER: ('h', "dwarf"), random -MONSTER: ('h', "dwarf"), random -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watch captain"), random, peaceful -MONSTER: ('@', "watch captain"), random, peaceful - - -# "Bazaar Town" by Kelly Bailey -# -LEVEL: "minetn-7" -ROOM: "ordinary" , lit, (3,3), (center,center), (30,15) { -FOUNTAIN: (12, 07) -FOUNTAIN: (11, 13) - -[75%]: SUBROOM: "ordinary", random, (2,2), (4,2) { - ROOMDOOR: false, closed, south, random -} - -[75%]: SUBROOM: "ordinary", random, (7,2), (2,2) { - ROOMDOOR: false, closed, north, random -} - -[75%]: SUBROOM: "ordinary", random, (7,5), (2,2) { - ROOMDOOR: false, closed, south, random -} - -[75%]: SUBROOM: "ordinary", lit, (10,2), (3,4) { - MONSTER:('G',"gnome"),random - MONSTER:('Y',"monkey"),random - MONSTER:('Y',"monkey"),random - MONSTER:('Y',"monkey"),random - ROOMDOOR: false, closed, south, random -} - -[75%]: SUBROOM: "ordinary", random, (14,2), (4,2) { - ROOMDOOR: false, closed, south, 0 - MONSTER: 'n', random -} - -[75%]: SUBROOM: "ordinary", random, (16,5), (2,2) { - ROOMDOOR: false, closed, south, random -} - -[75%]: SUBROOM: "ordinary", unlit, (19,2), (2,2) { - ROOMDOOR: false, locked, east, random - MONSTER: ('G',"gnome king"),random -} - -SUBROOM: "food shop" [50%], lit, (19,5), (2,3) { - ROOMDOOR: false, closed, south, random -} - -[75%]: SUBROOM: "ordinary", random, (2,7), (2,2) { - ROOMDOOR: false, closed, east, random -} - -SUBROOM: "tool shop" [50%], lit, (2,10), (2,3) { - ROOMDOOR: false, closed, south, random -} - -SUBROOM: "candle shop", lit, (5,10),(3,3) { - ROOMDOOR: false, closed, north, random -} - -[75%]: SUBROOM: "ordinary", random, (11,10), (2,2) { - ROOMDOOR: false, locked, west, random - MONSTER: 'G',random -} - -SUBROOM: "shop" [60%], lit, (14,10), (2,3) { - ROOMDOOR: false, closed, north, random -} - -[75%]: SUBROOM: "ordinary", random, (17,11), (4,2) { - ROOMDOOR: false, closed, north, random -} - -[75%]: SUBROOM: "ordinary", random, (22,11), (2,2) { - ROOMDOOR: false, closed, south, random - SINK: (00,00) -} - -SUBROOM: "food shop" [50%], lit, (25,11), (3,2) { - ROOMDOOR: false, closed, east, random -} - -SUBROOM: "tool shop" [30%], lit, (25,2), (3,3) { - ROOMDOOR: false, closed, west, random -} - -SUBROOM: "temple", lit, (24,6), (4,4) { - ROOMDOOR: false, closed, west, random - ALTAR:(02,01),align[0],shrine - MONSTER: ('G', "gnomish wizard"), random - MONSTER: ('G', "gnomish wizard"), random -} - -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watchman"), random, peaceful -MONSTER: ('@', "watch captain"), random, peaceful -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome lord"),random -MONSTER:('Y',"monkey"),random -MONSTER:('Y',"monkey"),random - -} - -ROOM: "ordinary" , random, random, random, random { - STAIR: random, up -} - -ROOM: "ordinary" , random, random, random, random { - STAIR: random, down - TRAP: random, random - MONSTER: ('G', "gnome"), random - MONSTER: ('G', "gnome"), random -} - -ROOM: "ordinary" , random, random, random, random { - MONSTER: ('h', "dwarf"), random -} - -ROOM: "ordinary" , random, random, random, random { - TRAP: random, random - MONSTER: ('G', "gnome"), random -} - -RANDOM_CORRIDORS - - -# Mine end level variant 1 -# "Mimic of the Mines" -# -MAZE: "minend-1", ' ' -GEOMETRY:center,center -#1234567890123456789012345678901234567890123456789012345678901234567890 -MAP ------------------------------------------------------------------- ------ -| |.......| |.......-...| |.....|. | -| --------- ----.......-------...........| ---...-S- | -| |.......| |..........................-S- --.......| | -| |......------- ---........................|. |.......-- | -| |..--........-----..........................|. -.-..---- | -| --..--.-----........-.....................--- --..-- | -| --..--..| -----------..................---.----------..-- | -| |...--.| |..S...S..............---................-- | -| ----..----- ------------........--- ------------...--- | -| |.........-- ---------- ---...-- ----- | -| --.....---..-- -------- --...---...-- | -| ----..-..-- --..--------------------- --......-- ---........| | -|--....----- --..-..................--- |........| |.......-- | -|.......| --......................S.. --......-- ---..---- | -|--.--.-- ----.................--- ------..------...-- | -| |....S.. |...............-..| ..S...........| | --------- -------------------- ------------------------ -ENDMAP - -# Dungeon Description -$place = { (08,16),(13,07),(21,08),(41,14),(50,04),(50,16),(66,01) } -SHUFFLE: $place - -REGION:(26,01,32,01),unlit,"ordinary",filled,irregular -REGION:(20,08,21,08),unlit,"ordinary" -REGION:(23,08,25,08),unlit,"ordinary" -# Secret doors -DOOR:locked,(07,16) -DOOR:locked,(22,08) -DOOR:locked,(26,08) -DOOR:locked,(40,14) -DOOR:locked,(50,03) -DOOR:locked,(51,16) -DOOR:locked,(66,02) -# Stairs -STAIR:(36,04),up -# Non diggable walls -NON_DIGGABLE:(00,00,74,17) -# Niches -# Note: $place[6] empty -OBJECT:('*',"diamond"),$place[0] -OBJECT:('*',"emerald"),$place[0] -OBJECT:('*',"worthless piece of violet glass"),$place[0] -MONSTER:'m',$place[0], m_object "luckstone" -OBJECT:('*',"worthless piece of white glass"),$place[1] -OBJECT:('*',"emerald"),$place[1] -OBJECT:('*',"amethyst"),$place[1] -MONSTER:'m',$place[1], m_object "loadstone" -OBJECT:('*',"diamond"),$place[2] -OBJECT:('*',"worthless piece of green glass"),$place[2] -OBJECT:('*',"amethyst"),$place[2] -MONSTER:'m',$place[2], m_object "flint" -OBJECT:('*',"worthless piece of white glass"),$place[3] -OBJECT:('*',"emerald"),$place[3] -OBJECT:('*',"worthless piece of violet glass"),$place[3] -MONSTER:'m',$place[3], m_object "touchstone" -OBJECT:('*',"worthless piece of red glass"),$place[4] -OBJECT:('*',"ruby"),$place[4] -OBJECT:('*',"loadstone"),$place[4] -OBJECT:('*',"ruby"),$place[5] -OBJECT:('*',"worthless piece of red glass"),$place[5] -OBJECT:('*',"luckstone"),$place[5] -# Random objects -OBJECT:'*',random -OBJECT:'*',random -OBJECT:'*',random -OBJECT:'*',random -OBJECT:'*',random -OBJECT:'*',random -OBJECT:'*',random -OBJECT:'(',random -OBJECT:'(',random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters -MONSTER:('G',"gnome king"),random -MONSTER:('G',"gnome lord"),random -MONSTER:('G',"gnome lord"),random -MONSTER:('G',"gnome lord"),random -MONSTER:('G',"gnomish wizard"),random -MONSTER:('G',"gnomish wizard"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('h',"hobbit"),random -MONSTER:('h',"hobbit"),random -MONSTER:('h',"dwarf"),random -MONSTER:('h',"dwarf"),random -MONSTER:('h',"dwarf"),random -MONSTER:'h',random - - -# Mine end level variant 2 -# "Gnome King's Wine Cellar" -# -MAZE: "minend-2", ' ' -GEOMETRY:center,center -MAP ---------------------------------------------------------------------------- -|...................................................| | -|.|---------S--.--|...|--------------------------|..| | -|.||---| |.||-| |...|..........................|..| | -|.||...| |-|.|.|---...|.............................| .. | -|.||...|-|.....|....|-|..........................|..|. .. | -|.||.....|-S|..|....|............................|..|.. | -|.||--|..|..|..|-|..|----------------------------|..|-. | -|.| |..|..|....|..................................|... | -|.| |..|..|----|..-----------------------------|..|.... | -|.|---|..|--|.......|----------------------------|..|..... | -|...........|----.--|......................| |..|....... | -|-----------|...|.| |------------------|.|.|-----|..|.....|.. | -|-----------|.{.|.|--------------------|.|..........|.....|.... | -|...............|.S......................|-------------..-----... | -|.--------------|.|--------------------|.|......................... | -|.................| |.....................|........ | ---------------------------------------------------------------------------- -ENDMAP - -IF [50%] { - TERRAIN:(55,14),'-' - TERRAIN:(56,14),'-' - TERRAIN:(61,15),'|' - TERRAIN:(52,5), 'S' - DOOR:locked, (52,5) -} -IF [50%] { - TERRAIN:(18,1), '|' - TERRAIN:rect (7,12, 8,13), '.' -} -IF [50%] { - TERRAIN:(49,4), '|' - TERRAIN:(21,5), '.' -} -IF [50%] { - IF [50%] { - TERRAIN:(22,1), '|' - } ELSE { - TERRAIN:(50,7), '-' - TERRAIN:(51,7), '-' - } -} - - -# Dungeon Description -FOUNTAIN:(14,13) -REGION:(23,03,48,06),lit,"ordinary" -REGION:(21,06,22,06),lit,"ordinary" -REGION:(14,04,14,04),unlit,"ordinary" -REGION:(10,05,14,08),unlit,"ordinary" -REGION:(10,09,11,09),unlit,"ordinary" -REGION:(15,08,16,08),unlit,"ordinary" -# Secret doors -DOOR:locked,(12,02) -DOOR:locked,(11,06) -# Stairs -STAIR:(36,04),up -# Non diggable walls -NON_DIGGABLE:(00,00,52,17) -NON_DIGGABLE:(53,00,74,00) -NON_DIGGABLE:(53,17,74,17) -NON_DIGGABLE:(74,01,74,16) -NON_DIGGABLE:(53,07,53,07) -NON_DIGGABLE:(58,12,58,13) -NON_DIGGABLE:(53,14,61,14) -NON_DIGGABLE:(61,15,61,16) -# The Gnome King's wine cellar. -# the Trespassers sign is a long-running joke -ENGRAVING:(12,03),engrave,"You are now entering the Gnome King's wine cellar." -ENGRAVING:(12,04),engrave,"Trespassers will be persecuted!" -OBJECT:('!',"booze"),(10,07) -OBJECT:('!',"booze"),(10,07) -OBJECT:'!',(10,07) -OBJECT:('!',"booze"),(10,08) -OBJECT:('!',"booze"),(10,08) -OBJECT:'!',(10,08) -OBJECT:('!',"booze"),(10,09) -OBJECT:('!',"booze"),(10,09) -OBJECT:('!',"object detection"),(10,09) -# Objects -# The Treasure chamber... -OBJECT:('*',"luckstone"),(70,05) -OBJECT:('*',"diamond"),(69,04) -OBJECT:'*',(69,04) -OBJECT:('*',"diamond"),(69,04) -OBJECT:'*',(69,04) -OBJECT:('*',"emerald"),(70,04) -OBJECT:'*',(70,04) -OBJECT:('*',"emerald"),(70,04) -OBJECT:'*',(70,04) -OBJECT:('*',"emerald"),(69,05) -OBJECT:'*',(69,05) -OBJECT:('*',"ruby"),(69,05) -OBJECT:'*',(69,05) -OBJECT:('*',"ruby"),(70,05) -OBJECT:('*',"amethyst"),(70,05) -OBJECT:'*',(70,05) -OBJECT:('*',"amethyst"),(70,05) -# Scattered gems... -OBJECT:'*',random -OBJECT:'*',random -OBJECT:'*',random -OBJECT:'*',random -OBJECT:'*',random -OBJECT:'*',random -OBJECT:'*',random -OBJECT:'(',random -OBJECT:'(',random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -# Random traps -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# Random monsters. -MONSTER:('G',"gnome king"),random -MONSTER:('G',"gnome lord"),random -MONSTER:('G',"gnome lord"),random -MONSTER:('G',"gnome lord"),random -MONSTER:('G',"gnomish wizard"),random -MONSTER:('G',"gnomish wizard"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('G',"gnome"),random -MONSTER:('h',"hobbit"),random -MONSTER:('h',"hobbit"),random -MONSTER:('h',"dwarf"),random -MONSTER:('h',"dwarf"),random -MONSTER:('h',"dwarf"),random -MONSTER:'h',random - - -# "Catacombs" by Kelly Bailey -# Relies on some very specific behavior of MAZEWALK. -# -MAZE:"minend-3",'-' -FLAGS:nommap -GEOMETRY:center,bottom -MAP - - - - - - - - - - - -- -- - - . - - - - - - - - - -- - - -- - - - - . - - | -------...---------.-----------...-----.-------.------- ----------------| - - - - - - - - - - - - . - - - . - - - - - - - - - - -- - -- - . - - - - - | -------------.---------...-------------------------.--- ------------------| - - - - - - - - - - - . . - - --- - . - - - - - - - - -- -- - - - - |.....| | ---.---------------.......------------------------------- ----------|.....S-| - - - - - |.. ..| - ....... . - - - - |.........| - - - --- - - - - |.....| | -----.----|.....|------.......--------|.........|--------------.------------| - - - - - |..{..| - - -.... . --- - -.S.........S - - - - - - - - - - - - - | ----------|.....|--.---...------------|.........|---------------------------| - - - - - |.. ..| - - - . - - - - - - |.........| - --- . - - - - - - - - - | -----------------------...-------.---------------------...------------------| ----..| - - - - - - - - . --- - - - - - - - - - - - - - . - - --- - - --- - | --.S..|----.-------.------- ---------.-----------------...----- -----.------- ----..| - - - - - - - -- - - -- . - - - - - . - - - . - . - - -- -- - - - -- --.S..|--------.---.--- -...---------------...{.--------- --------- ---|. - - - - - - - -- - - - -- . - - - --- - - - . . - - - - -- - - - - - - -ENDMAP - -$place = { (1,15),(68,6),(1,13) } -SHUFFLE: $place - -NON_DIGGABLE:(67,3,73,7) -NON_DIGGABLE:(0,12,2,16) -FOUNTAIN:(12,08) -FOUNTAIN:(51,15) -REGION:(0,0,75,16),unlit,"ordinary" -REGION:(38,6,46,10),lit,"ordinary" -DOOR:closed,(37,8) -DOOR:closed,(47,8) -DOOR:closed,(73,5) -DOOR:closed,(2,15) -MAZEWALK:(36,8),west,false -STAIR:(42,8),up -WALLIFY - -# Objects -OBJECT:('*',"luckstone"),$place[0] -OBJECT:('*',"flint"),$place[1] -OBJECT:('*',"diamond"),random -OBJECT:'*',random -OBJECT:('*',"diamond"),random -OBJECT:'*',random -OBJECT:('*',"emerald"),random -OBJECT:'*',random -OBJECT:('*',"emerald"),random -OBJECT:'*',random -OBJECT:('*',"emerald"),random -OBJECT:'*',random -OBJECT:('*',"ruby"),random -OBJECT:'*',random -OBJECT:('*',"ruby"),random -OBJECT:('*',"amethyst"),random -OBJECT:'*',random -OBJECT:('*',"amethyst"),random -OBJECT:'?',random -OBJECT:'?',random -OBJECT:'?',random -OBJECT:'?',random -OBJECT:'?',random -OBJECT:'+',random -OBJECT:'+',random -OBJECT:'+',random -OBJECT:'+',random -OBJECT:random,random -OBJECT:random,random -OBJECT:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -TRAP:random,random -# One-time annoyance factor -TRAP:"level teleport",$place[0] -TRAP:"level teleport",$place[1] -MONSTER:'M',random -MONSTER:'M',random -MONSTER:'M',random -MONSTER:'M',random -MONSTER:'M',random -MONSTER:('M',"ettin mummy"),random -MONSTER:'V',random -MONSTER:'Z',random -MONSTER:'Z',random -MONSTER:'Z',random -MONSTER:'Z',random -MONSTER:'Z',random -MONSTER:'V',random -MONSTER:'e',random -MONSTER:'e',random -MONSTER:'e',random -MONSTER:'e',random - - -# end mines.des diff --git a/dat/minetn-1.lua b/dat/minetn-1.lua new file mode 100644 index 000000000..c9cab0732 --- /dev/null +++ b/dat/minetn-1.lua @@ -0,0 +1,145 @@ +-- NetHack 3.6 mines.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.25 $ +-- Copyright (c) 1989-95 by Jean-Christophe Collet +-- Copyright (c) 1991-95 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- A tragic accident has occurred in Frontier Town.... +-- +-- Minetown variant 1 +-- Orcish Town - a variant of Frontier Town that has been +-- overrun by orcs. Note the barricades (iron bars). + +des.level_flags("mazelevel") + +des.level_init({ style="mines", fg=".", bg=" ", smoothed=true ,joined=true, lit="random", walled=true }) + +des.map([[ +..................................... +.----------------F------------------. +.|.................................|. +.|.-------------......------------.|. +.|.|...|...|...|......|..|...|...|.|. +.F.|...|...|...|......|..|...|...|.|. +.|.|...|...|...|......|..|...|...|.F. +.|.|...|...|----......------------.|. +.|.---------.......................|. +.|.................................|. +.|.---------.....--...--...........|. +.|.|...|...|----.|.....|.---------.|. +.|.|...|...|...|.|.....|.|..|....|.|. +.|.|...|...|...|.|.....|.|..|....|.|. +.|.|...|...|...|.|.....|.|..|....|.|. +.|.-------------.-------.---------.|. +.|.................................F. +.-----------F------------F----------. +..................................... +]]); + +-- Don't let the player fall into his likely death +des.teleport_region({ region={01,01,20,19}, region_islev=1, exclude={20,00,70,19}, exclude_islev=1 }) +des.region(selection.area(00,00,36,16),"lit") +des.levregion({ type="stair-up", region={01,03,20,19}, region_islev=1, exclude={00,00,36,15}, exclude_islev=1 }); +des.levregion({ type="stair-down", region={61,03,75,19}, region_islev=1, exclude={00,00,36,15} }) + +-- shame we can't make polluted fountains +des.feature("fountain",16,09) +des.feature("fountain",25,09) + +-- the altar's defiled; useful for BUC but never coaligned +des.altar({ x=20,y=13,align="noalign", type="shrine" }) + +-- set up the shop doors; could be broken down +des.door("random",5,8) +des.door("random",9,8) +des.door("random",13,7) +des.door("random",22,5) +des.door("random",27,7) +des.door("random",31,7) +des.door("random",5,10) +des.door("random",9,10) +des.door("random",15,13) +des.door("random",25,13) +des.door("random",31,11) + +-- knock a few holes in the shop interior walls +des.replace_terrain({ region={07,04,11,06}, fromterrain="|", toterrain=".", chance=18 }) +des.replace_terrain({ region={25,04,29,06}, fromterrain="|", toterrain=".", chance=18 }) +des.replace_terrain({ region={07,12,11,14}, fromterrain="|", toterrain=".", chance=18 }) +des.replace_terrain({ region={28,12,28,14}, fromterrain="|", toterrain=".", chance=33 }) + +-- One spot each in most shops... +local place = { {05,04},{09,05},{13,04},{26,04},{31,05},{30,14},{05,14},{10,13},{26,14},{27,13} } +shuffle(place); + +-- scatter some bodies +des.object({ id = "corpse", x=20,y=12, montype="aligned priest" }) +des.object({ id = "corpse", coord = place[1], montype="shopkeeper" }) +des.object({ id = "corpse", coord = place[2], montype="shopkeeper" }) +des.object({ id = "corpse", coord = place[3], montype="shopkeeper" }) +des.object({ id = "corpse", coord = place[4], montype="shopkeeper" }) +des.object({ id = "corpse", coord = place[5], montype="shopkeeper" }) +des.object({ id = "corpse", montype="watchman" }) +des.object({ id = "corpse", montype="watchman" }) +des.object({ id = "corpse", montype="watchman" }) +des.object({ id = "corpse", montype="watchman" }) +des.object({ id = "corpse", montype="watch captain" }) + +-- Rubble! +for i=1,9 + math.random(2 - 1,2*5) do + if math.random(0,99) < 90 then + des.object("boulder") + end + des.object("rock") +end + +-- Guarantee 7 candles since we won't have Izchak available +des.object({ id = "wax candle", coord = place[4], quantity = math.random(1,2) }) + +des.object({ id = "wax candle", coord = place[1], quantity = math.random(2,4) }) +des.object({ id = "wax candle", coord = place[2], quantity = math.random(1,2) }) +des.object({ id = "tallow candle", coord = place[3], quantity = math.random(1,3) }) +des.object({ id = "tallow candle", coord = place[2], quantity = math.random(1,2) }) +des.object({ id = "tallow candle", coord = place[4], quantity = math.random(1,2) }) + +-- go ahead and leave a lamp next to one corpse to be suggestive +-- and some empty wands... +des.object("oil lamp",place[2]) +des.object({ id = "striking", coord = place[1], buc="uncursed", spe=0 }) +des.object({ id = "striking", coord = place[3], buc="uncursed", spe=0 }) +des.object({ id = "striking", coord = place[4], buc="uncursed", spe=0 }) +des.object({ id = "magic missile", coord = place[4], buc="uncursed", spe=0 }) +des.object({ id = "magic missile", coord = place[5], buc="uncursed", spe=0 }) + +-- the Orcish Army + +local inside = selection.floodfill(selection.new(), 18,8) +local near_temple = selection.area(selection.new(), 17,8, 23,14) & inside + +for i=1,5 + math.random(1 - 1,1*10) do + if math.random(0, 99) < 50 then + des.monster({ id = "orc-captain", coord = { inside:rndcoord(1) }, peaceful=0 }); + else + if math.random(0, 99) < 80 then + des.monster({ id = "Uruk-hai", coord = { inside:rndcoord(1) }, peaceful=0 }) + else + des.monster({ id = "Mordor orc", coord = { inside:rndcoord(1) }, peaceful=0 }) + end + end +end +-- shamans can be hanging out in/near the temple +for i=1,math.random(2 - 1,2*3) do + des.monster({ id = "orc shaman", coord = { near_temple:rndcoord(0) }, peaceful=0 }); +end +-- these are not such a big deal +-- to run into outside the bars +for i=1,9 + math.random(2 - 1,2*5) do + if math.random(0, 99) < 90 then + des.monster({ id = "hill orc", peaceful = 0 }) + else + des.monster({ id = "goblin", peaceful = 0 }) + end +end + +-- Hack to force full-level wallification + +des.wallify() diff --git a/dat/minetn-2.lua b/dat/minetn-2.lua new file mode 100644 index 000000000..7031c280f --- /dev/null +++ b/dat/minetn-2.lua @@ -0,0 +1,182 @@ +-- NetHack 3.6 mines.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.25 $ +-- Copyright (c) 1989-95 by Jean-Christophe Collet +-- Copyright (c) 1991-95 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- Minetown variant 2 +-- "Town Square" + +des.room({ type = "ordinary", lit=1, x=3, y=3, + xalign="center", yalign="center", w=31, h=15, + contents = function() + des.feature("fountain", 17, 5) + des.feature("fountain", 13, 8) + + if math.random(0,99) < 75 then + des.room({ type = "ordinary", x=2,y=0, w=2,h=2, + contents = function() + des.door({ state="closed", wall="west" }) + end + }) + end + + if math.random(0,99) < 75 then + des.room({ type = "ordinary", lit=0, x=5,y=0, w=2,h=2, + contents = function() + des.door({ state="closed", wall="south" }) + end + }) + end + + if math.random(0,99) < 75 then + des.room({ type = "ordinary", x=8,y=0, w=2,h=2, + contents = function() + des.door({ state="closed", wall="east" }) + end + }) + end + + if math.random(0,99) < 75 then + des.room({ type = "ordinary", lit=1, x=16,y=0, w=2,h=2, + contents = function() + des.door({ state="closed", wall="west" }) + end + }) + end + + if math.random(0,99) < 75 then + des.room({ type = "ordinary", lit=0, x=19,y=0, w=2,h=2, + contents = function() + des.door({ state="closed", wall="south" }) + end + }) + end + + if math.random(0,99) < 75 then + des.room({ type = "ordinary", x=22,y=0, w=2,h=2, + contents = function() + des.door({ state="closed", wall="south" }) + des.monster("gnome") + end + }) + end + + if math.random(0,99) < 75 then + des.room({ type = "ordinary", lit=0, x=25,y=0, w=2,h=2, + contents = function() + des.door({ state="closed", wall="east" }) + end + }) + end + + if math.random(0,99) < 75 then + des.room({ type = "ordinary", lit=1, x=2,y=5, w=2,h=2, + contents = function() + des.door({ state="closed", wall="north" }) + end + }) + end + + if math.random(0,99) < 75 then + des.room({ type = "ordinary", lit=1, x=5,y=5, w=2,h=2, + contents = function() + des.door({ state="closed", wall="south" }) + end + }) + end + + if math.random(0,99) < 75 then + des.room({ type = "ordinary", x=8,y=5, w=2,h=2, + contents = function() + des.door({ state="locked", wall="north" }) + des.monster("gnome") + end + }) + end + + des.room({ type="shop", chance=90, lit=1, x=2,y=10, w=4,h=3, + contents = function() + des.door({ state="closed", wall="west" }) + end + }); + + des.room({ type = "tool shop", chance=90, lit=1, x=23,y=10, w=4,h=3, + contents = function() + des.door({ state="closed", wall="east" }) + end + }); + + des.room({ type = "food shop", chance=90, lit=1, x=24,y=5, w=3,h=4, + contents = function() + des.door({ state="closed", wall="north" }) + end + }); + + des.room({ type = "candle shop", lit=1, x=11,y=10, w=4,h=3, + contents = function() + des.door({ state="closed", wall="east" }) + end + }); + + if math.random(0,99) < 75 then + des.room({ type = "ordinary", lit=0, x=7,y=10, w=3,h=3, + contents = function() + des.door({ state="locked", wall="north" }) + des.monster("gnome") + end + }); + end + + des.room({ type = "temple", lit=1, x=19,y=5, w=4,h=4, + contents = function() + des.door({ state="closed", wall="north" }) + des.altar({ x=02, y=02, align=align[1],type="shrine" }) + des.monster("gnomish wizard") + des.monster("gnomish wizard") + end + }); + + if math.random(0,99) < 75 then + des.room({ type = "ordinary", lit=1, x=18,y=10, w=4,h=3, + contents = function() + des.door({ state="locked", wall="west" }) + des.monster("gnome lord") + end + }); + end + + -- The Town Watch + des.monster({ id = "watchman", peaceful = 1 }) + des.monster({ id = "watchman", peaceful = 1 }) + des.monster({ id = "watchman", peaceful = 1 }) + des.monster({ id = "watchman", peaceful = 1 }) + des.monster({ id = "watch captain", peaceful = 1 }) + end +}); + +des.room({ contents = function() + des.stair("up") + end +}); + +des.room({ contents = function() + des.stair("down") + des.trap() + des.monster("gnome") + des.monster("gnome") + end +}); + +des.room({ contents = function() + des.monster("dwarf") + end +}); + +des.room({ contents = function() + des.trap() + des.monster("gnome") + end +}); + +des.random_corridors() + diff --git a/dat/minetn-3.lua b/dat/minetn-3.lua new file mode 100644 index 000000000..6217d174e --- /dev/null +++ b/dat/minetn-3.lua @@ -0,0 +1,150 @@ +-- NetHack 3.6 mines.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.25 $ +-- Copyright (c) 1989-95 by Jean-Christophe Collet +-- Copyright (c) 1991-95 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- Minetown variant 3 by Kelly Bailey +-- "Alley Town" + +des.room({ type = "ordinary",lit=1,x=3,y=3, + xalign="center",yalign="center",w=31,h=15, + contents = function() + des.feature("fountain", 01,06) + des.feature("fountain", 29,13) + + des.room({ type = "ordinary",x=2,y=2,w=2,h=2, + contents = function() + des.door({ state="closed", wall="south" }) + end + }); + + des.room({ type = "tool shop", chance=30, lit=1,x=5,y=3,w=2,h=3, + contents = function() + des.door({ state="closed", wall="south" }) + end + }) + + des.room({ type = "ordinary",x=2,y=10,w=2,h=3, + contents = function() + des.door({ state ="locked", wall="north" }) + des.monster("G") + end + }) + + des.room({ type = "ordinary", x=5,y=9,w=2,h=2, + contents = function() + des.door({ state="closed", wall="north" }) + end + }) + + des.room({ type = "temple",lit=1,x=10,y=2,w=3,h=4, + contents = function() + des.door({ state="closed", wall="east" }) + des.altar({ x=1, y=1, align = align[1], type="shrine" }) + des.monster("gnomish wizard") + des.monster("gnomish wizard") + end + }) + + des.room({ type = "ordinary",x=11,y=7,w=2,h=2, + contents = function() + des.door({ state="closed", wall="west" }) + end + }) + + des.room({ type = "shop",lit=1,x=10,y=10,w=3,h=3, + contents = function() + des.door({ state="closed", wall="west" }) + end + }) + + des.room({ type = "ordinary",random,x=14,y=8,w=2,h=2, + contents = function() + des.door({ state="locked", wall="north" }) + des.monster("G") + end + }) + + des.room({ type = "ordinary",random,x=14,y=11,w=2,h=2, + contents = function() + des.door({ state="closed", wall="south" }) + end + }) + + des.room({ type = "tool shop", chance=40,lit=1,x=17,y=10,w=3,h=3, + contents = function() + des.door({ state="closed", wall="north" }) + end + }) + + des.room({ type = "ordinary",x=21,y=11,w=2,h=2, + contents = function() + des.door({ state="locked", wall="east" }) + des.monster("G") + end + }) + + des.room({ type = "food shop", chance=90,lit=1,x=26,y=8,w=3,h=2, + contents = function() + des.door({ state="closed", wall="west" }) + end + }) + + des.room({ type = "ordinary",random,x=16,y=2,w=2,h=2, + contents = function() + des.door({ state="closed", wall="west" }) + end + }) + + des.room({ type = "ordinary",random,x=19,y=2,w=2,h=2, + contents = function() + des.door({ state="closed", wall="north" }) + end + }) + + des.room({ type = "wand shop", chance=30,lit=1,x=19,y=5,w=3,h=2, + contents = function() + des.door({ state="closed", wall="west" }) + end + }) + + des.room({ type = "candle shop",lit=1,x=25,y=2,w=3,h=3, + contents = function() + des.door({ state="closed", wall="south" }) + end + }) + + des.monster({ id = "watchman", peaceful = 1 }) + des.monster({ id = "watchman", peaceful = 1 }) + des.monster({ id = "watchman", peaceful = 1 }) + des.monster({ id = "watchman", peaceful = 1 }) + des.monster({ id = "watch captain", peaceful = 1 }) + + end +}) + +des.room({ type = "ordinary", contents = function() + des.stair("up") + end +}) + +des.room({ type = "ordinary", contents = function() + des.stair("down") + des.trap() + des.monster("gnome") + des.monster("gnome") + end +}) + +des.room({ type = "ordinary", contents = function() + des.monster("dwarf") + end +}) + +des.room({ type = "ordinary", contents = function() + des.trap() + des.monster("gnome") + end +}) + +des.random_corridors() diff --git a/dat/minetn-4.lua b/dat/minetn-4.lua new file mode 100644 index 000000000..717185d67 --- /dev/null +++ b/dat/minetn-4.lua @@ -0,0 +1,133 @@ +-- NetHack 3.6 mines.des $NHDT-Date: 1548631704 2019/01/27 23:28:24 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.30 $ +-- Copyright (c) 1989-95 by Jean-Christophe Collet +-- Copyright (c) 1991-95 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- Minetown variant 4 by Kelly Bailey +-- "College Town" + +des.room({ type = "ordinary", lit=1, x=3,y=3, + xalign="center", yalign="center", w=30, h=15, + contents = function() + des.feature("fountain", 08,07) + des.feature("fountain", 18,07) + + des.room({ type = "book shop", lit=1, x=4, y=2, w=3, h=3, + contents = function() + des.door({ state = "closed", wall="south" }) + end + }) + + des.room({ type = "ordinary", x=8, y=2, w=2, h=2, + contents = function() + des.door({ state = "closed", wall="south" }) + end + }) + + des.room({ type = "temple", lit=1, x=11, y=3, w=5, h=4, + contents = function() + des.door({ state = "closed", wall="south" }) + des.altar({ x=2,y=1,align=align[1], type="shrine" }) + des.monster("gnomish wizard") + des.monster("gnomish wizard") + end + }) + + des.room({ type = "ordinary", x=19, y=2, w=2, h=2, + contents = function() + des.door({ state = "closed", wall="south" }) + des.monster("G") + end + }) + + des.room({ type = "candle shop", lit=1, x=22, y=2, w=3, h=3, + contents = function() + des.door({ state = "closed", wall="south" }) + end + }) + + des.room({ type = "ordinary", x=26, y=2, w=2, h=2, + contents = function() + des.door({ state = "locked", wall="east" }) + des.monster("G") + end + }) + + des.room({ type = "tool shop", chance=90, lit=1, x=4,y=10, w=3,h=3, + contents = function() + des.door({ state = "closed", wall="north" }) + end + }) + + des.room({ type = "ordinary", x=8, y=11, w=2, h=2, + contents = function() + des.door({ state = "locked", wall="south" }) + des.monster("kobold shaman") + des.monster("kobold shaman") + des.monster("kitten") + des.monster("f") + end + }) + + des.room({ type = "food shop", chance=90, lit=1, x=11, y=11, w=3, h=2, + contents = function() + des.door({ state = "closed", wall="east" }) + end + }) + + des.room({ type = "ordinary", x=17, y=11, w=2, h=2, + contents = function() + des.door({ state = "closed", wall="west" }) + end + }) + + des.room({ type = "ordinary", x=20, y=10, w=2, h=2, + contents = function() + des.door({ state = "locked", wall="north" }) + des.monster("G") + end + }) + + des.room({ type = "shop", chance=90, lit=1, x=23, y=10, w=3, h=3, + contents = function() + des.door({ state = "closed", wall="north" }) + end + }) + + des.monster({ id = "watchman", peaceful = 1 }) + des.monster({ id = "watchman", peaceful = 1 }) + des.monster({ id = "watchman", peaceful = 1 }) + des.monster({ id = "watchman", peaceful = 1 }) + des.monster({ id = "watch captain", peaceful = 1 }) + end +}) + +des.room({ type = "ordinary", + contents = function() + des.stair("up") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.stair("down") + des.trap() + des.monster("gnome") + des.monster("gnome") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.monster("dwarf") + end +}) + +des.room({ type = "ordinary", + contents = function() + des.trap() + des.monster("gnome") + end +}) + +des.random_corridors() diff --git a/dat/minetn-5.lua b/dat/minetn-5.lua new file mode 100644 index 000000000..1f5974864 --- /dev/null +++ b/dat/minetn-5.lua @@ -0,0 +1,137 @@ +-- NetHack 3.6 mines.des $NHDT-Date: 1548631704 2019/01/27 23:28:24 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.30 $ +-- Copyright (c) 1989-95 by Jean-Christophe Collet +-- Copyright (c) 1991-95 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- "Grotto Town" by Kelly Bailey + +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel"); + +des.map([[ +----- --------- +|...--- ------.......-- ------- --------------- +|.....----.........--..| |.....| ------- |.............| +--..-....-.----------..| |.....| |.....| --+---+--.----+- + --.--.....---- ---- |.....| ------ --....---- |..-...--.-.+..| + ---.........---- ----- ---+--- |..+.| ---..-..----..---+-..---..| + ----.-....|..----...-- |.| |..|.| ---+-.....-+--........--+- + -----..|....-.....---- |.| |..|.------......--................| + ------ |..|.............---.-- ----.+..|-.......--..--------+--..-- + |....| --......---...........----- |.|..|-...{....---|.........|..-- + |....| |........-...-...........----.|..|--.......| |.........|...| + ---+--------....-------...---......--.-------....---- -----------...| + ------.---...--...--..-..--...-..---...|.--..-...-....------- |.......-- + |..|-.........-..---..-..---.....--....|........---...-|....| |.------- + |..+...............-+---+-----..--..........--....--...+....| |.|...S. +-----.....{....----...............-...........--...-...-|....| |.|...| +|..............-- --+--.---------.........--..-........------- |.--+------- +-+-----.........| |...|.|....| --.......------...|....---------.....|....| +|...| --..------- |...|.+....| ---...--- --..|...--......-...{..+..-+| +|...| ---- ------|....| ----- -----.....----........|..|.| +----- ------ ------- --------------- +]]); + +if math.random(0, 99) < 75 then + if math.random(0, 99) < 50 then + des.terrain(selection.line(25,8, 25,9), "|") + else + des.terrain(selection.line(16,13, 17,13), "-") + end +end +if math.random(0, 99) < 75 then + if math.random(0, 99) < 50 then + des.terrain(selection.line(36,10, 36,11), "|") + else + des.terrain(selection.line(32,15, 33,15), "-") + end +end +if math.random(0, 99) < 50 then + des.terrain(selection.area(21,4, 22,5), ".") + des.terrain(selection.line(14,9, 14,10), "|") +end +if math.random(0, 99) < 50 then + des.terrain({46,13}, "|") + des.terrain(selection.line(43,5, 47,5), "-") + des.terrain(selection.line(42,6, 46,6), ".") + des.terrain(selection.line(46,7, 47,7), ".") +end +if math.random(0,99) < 50 then + des.terrain(selection.area(69,11, 71,11), "-") +end + +des.stair("up", 01,01) +des.stair("down", 46,03) +des.feature("fountain", 50,09) +des.feature("fountain", 10,15) +des.feature("fountain", 66,18) + +des.region(selection.area(00,00,74,20),"unlit") +des.region(selection.area(09,13,11,17),"lit") +des.region(selection.area(08,14,12,16),"lit") +des.region(selection.area(49,07,51,11),"lit") +des.region(selection.area(48,08,52,10),"lit") +des.region(selection.area(64,17,68,19),"lit") +des.region(selection.area(37,13,39,17),"lit") +des.region(selection.area(36,14,40,17),"lit") +des.region(selection.area(59,02,72,10),"lit") + +des.monster({ id = "watchman", peaceful = 1 }) +des.monster({ id = "watchman", peaceful = 1 }) +des.monster({ id = "watchman", peaceful = 1 }) +des.monster({ id = "watchman", peaceful = 1 }) +des.monster({ id = "watch captain", peaceful = 1 }) +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome lord") +des.monster("gnome lord") +des.monster("dwarf") +des.monster("dwarf") +des.monster("dwarf") + +-- The shops +des.region({ region={25,17, 28,19}, lit=1, type="candle shop", prefilled=0 }) +des.door("closed",24,18) +des.region({ region={59, 9, 67,10}, lit=1, type="shop", prefilled=0 }) +des.door("closed",66,08) +des.region({ region={57,13, 60,15}, lit=1, type="tool shop", prefilled=0 }) +des.door("closed",56,14) +des.region({ region={05,09, 08,10}, lit=1, type="food shop", prefilled=0 }) +des.door("closed",07,11) +-- Gnome homes +des.door("closed",04,14) +des.door("locked",01,17) +des.monster("gnomish wizard", 02, 19) +des.door("locked",20,16) +des.monster("G", 20, 18) +des.door("random",21,14) +des.door("random",25,14) +des.door("random",42,08) +des.door("locked",40,05) +des.monster("G", 38, 07) +des.door("random",59,03) +des.door("random",58,06) +des.door("random",63,03) +des.door("random",63,05) +des.door("locked",71,03) +des.door("locked",71,06) +des.door("closed",69,04) +des.door("closed",67,16) +des.monster("gnomish wizard", 67, 14) +des.object("=", 70, 14) +des.door("locked",69,18) +des.monster("gnome lord", 71, 19) +des.door("locked",73,18) +des.object("chest", 73, 19) +des.door("locked",50,06) +des.object("(", 50, 03) +des.object({ id = "statue", x=38, y=15, montype="gnome king", historic=1 }) +-- Temple +des.region({ region={29,02, 33,04}, lit=1, type="temple" }) +des.door("closed",31,05) +des.altar({ x=31,y=03, align=align[1], type="shrine" }) diff --git a/dat/minetn-6.lua b/dat/minetn-6.lua new file mode 100644 index 000000000..758ce320b --- /dev/null +++ b/dat/minetn-6.lua @@ -0,0 +1,83 @@ +-- NetHack 3.6 mines.des $NHDT-Date: 1548631704 2019/01/27 23:28:24 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.30 $ +-- Copyright (c) 1989-95 by Jean-Christophe Collet +-- Copyright (c) 1991-95 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- "Bustling Town" by Kelly Bailey + +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "inaccessibles") + +des.level_init({ style="mines", fg=".", bg="-", smoothed=true, joined=true,lit=1,walled=true }) + +des.map({ halign = "center", valign = "top", map = [[ +.-----................----------------.- +.|...|................|...|..|...|...|.. +.|...+..--+--.........|...|..|...|...|.. +.|...|..|...|..-----..|...|..|-+---+--.. +.-----..|...|--|...|..--+---+-.........| +........|...|..|...+.............-----.. +........-----..|...|......--+-...|...|.. +.----...|...|+------..{...|..|...+...|.. +.|..+...|...|.............|..|...|...|.. +.|..|...|...|-+-.....---+-------------.| +.----...--+--..|..-+-|.................. +...|........|..|..|..|----....---------. +...|..T.....----..|..|...+....|......|-. +...|-....{........|..|...|....+......|-. +...--..-....T.....--------....|......|-. +.......--.....................---------- +]] }); + +des.region(selection.area(00,00,38,15),"lit") +des.levregion({ type="stair-up", region={01,03,20,19}, region_islev=1, exclude={0,0,39,15} }) +des.levregion({ type="stair-down", region={61,03,75,19}, region_islev=1, exclude={0,0,39,15} }) +des.feature("fountain" ,22,07) +des.feature("fountain", 09,13) +des.region(selection.area(13,5,14,6),"unlit") +des.region({ region={09,07, 11,09}, lit=1, type="candle shop", prefilled=0 }) +des.region({ region={16,04, 18,06}, lit=1, type="tool shop", prefilled=0 }) +des.region({ region={23,01, 25,03}, lit=1, type="shop", prefilled=0 }) +des.region({ region={22,12, 24,13}, lit=1, type="food shop", prefilled=0 }) +des.region({ region={31,12, 36,14}, lit=1, type="temple", prefilled=0 }) +des.altar({ x=35,y=13,align=align[1],type="shrine"}) + +des.door("closed",5,2) +des.door("locked",4,8) +des.door("closed",10,2) +des.door("closed",10,10) +des.door("locked",13,7) +des.door("locked",14,9) +des.door("closed",19,5) +des.door("closed",19,10) +des.door("closed",24,4) +des.door("closed",24,9) +des.door("closed",25,12) +des.door("closed",28,4) +des.door("locked",28,6) +des.door("closed",30,13) +des.door("closed",31,3) +des.door("closed",35,3) +des.door("closed",33,7) + +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome") +des.monster("gnome", 14, 6) +des.monster("gnome lord", 14, 5) +des.monster("gnome", 27, 8) +des.monster("gnome lord") +des.monster("gnome lord") +des.monster("dwarf") +des.monster("dwarf") +des.monster("dwarf") +des.monster({ id = "watchman", peaceful = 1 }) +des.monster({ id = "watchman", peaceful = 1 }) +des.monster({ id = "watchman", peaceful = 1 }) +des.monster({ id = "watch captain", peaceful = 1 }) +des.monster({ id = "watch captain", peaceful = 1 }) + diff --git a/dat/minetn-7.lua b/dat/minetn-7.lua new file mode 100644 index 000000000..dae4a9148 --- /dev/null +++ b/dat/minetn-7.lua @@ -0,0 +1,198 @@ +-- NetHack 3.6 mines.des $NHDT-Date: 1548631704 2019/01/27 23:28:24 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.30 $ +-- Copyright (c) 1989-95 by Jean-Christophe Collet +-- Copyright (c) 1991-95 by M. Stephenson +-- NetHack may be freely redistributed. See license for details. +-- +-- "Bazaar Town" by Kelly Bailey + +des.room({ type="ordinary", lit=1, x=3,y=3, + xalign="center",yalign="center", w=30,h=15, + contents = function() + des.feature("fountain", 12, 07) + des.feature("fountain", 11, 13) + + if math.random(0,99) < 75 then + des.room({ type="ordinary", x=2,y=2, w=4,h=2, + contents = function() + des.door({ state = "closed", wall="south" }) + end + }) + end + + if math.random(0,99) < 75 then + des.room({ type="ordinary", x=7,y=2, w=2,h=2, + contents = function() + des.door({ state = "closed", wall="north" }) + end + }) + end + + if math.random(0,99) < 75 then + des.room({ type="ordinary", x=7,y=5, w=2,h=2, + contents = function() + des.door({ state = "closed", wall="south" }) + end + }) + end + + if math.random(0,99) < 75 then + des.room({ type="ordinary", lit=1, x=10,y=2, w=3,h=4, + contents = function() + des.monster("gnome") + des.monster("monkey") + des.monster("monkey") + des.monster("monkey") + des.door({ state = "closed", wall="south" }) + end + }) + end + + if math.random(0,99) < 75 then + des.room({ type="ordinary", x=14,y=2, w=4,h=2, + contents = function() + des.door({ state = "closed", wall="south", pos=0 }) + des.monster("n") + end + }) + end + + if math.random(0,99) < 75 then + des.room({ type="ordinary", x=16,y=5, w=2,h=2, + contents = function() + des.door({ state = "closed", wall="south" }) + end + }) + end + + if math.random(0,99) < 75 then + des.room({ type="ordinary", lit=0, x=19,y=2, w=2,h=2, + contents = function() + des.door({ state = "locked", wall="east" }) + des.monster("gnome king") + end + }) + end + + des.room({ type="food shop", chance=50, lit=1, x=19,y=5, w=2,h=3, + contents = function() + des.door({ state = "closed", wall="south" }) + end + }) + + if math.random(0,99) < 75 then + des.room({ type="ordinary", x=2,y=7, w=2,h=2, + contents = function() + des.door({ state = "closed", wall="east" }) + end + }) + end + + des.room({ type="tool shop", chance=50, lit=1, x=2,y=10, w=2,h=3, + contents = function() + des.door({ state = "closed", wall="south" }) + end + }) + + des.room({ type="candle shop", lit=1, x=5,y=10, w=3,h=3, + contents = function() + des.door({ state = "closed", wall="north" }) + end + }) + + if math.random(0,99) < 75 then + des.room({ type="ordinary", x=11,y=10, w=2,h=2, + contents = function() + des.door({ state = "locked", wall="west" }) + des.monster("G") + end + }) + end + + des.room({ type="shop", chance=60, lit=1, x=14,y=10, w=2,h=3, + contents = function() + des.door({ state = "closed", wall="north" }) + end + }) + + if math.random(0,99) < 75 then + des.room({ type="ordinary", x=17,y=11, w=4,h=2, + contents = function() + des.door({ state = "closed", wall="north" }) + end + }) + end + + if math.random(0,99) < 75 then + des.room({ type="ordinary", x=22,y=11, w=2,h=2, + contents = function() + des.door({ state = "closed", wall="south" }) + des.feature("sink", 00,00) + end + }) + end + + des.room({ type="food shop", chance=50, lit=1, x=25,y=11, w=3,h=2, + contents = function() + des.door({ state = "closed", wall="east" }) + end + }) + + des.room({ type="tool shop", chance=30, lit=1, x=25,y=2, w=3,h=3, + contents = function() + des.door({ state = "closed", wall="west" }) + end + }) + + des.room({ type="temple", lit=1, x=24,y=6, w=4,h=4, + contents = function() + des.door({ state = "closed", wall = "west" }) + des.altar({ x=02, y=01, align=align[1], type="shrine" }) + des.monster("gnomish wizard") + des.monster("gnomish wizard") + end + }) + + des.monster({ id = "watchman", peaceful = 1 }) + des.monster({ id = "watchman", peaceful = 1 }) + des.monster({ id = "watchman", peaceful = 1 }) + des.monster({ id = "watchman", peaceful = 1 }) + des.monster({ id = "watch captain", peaceful = 1 }) + des.monster("gnome") + des.monster("gnome") + des.monster("gnome") + des.monster("gnome lord") + des.monster("monkey") + des.monster("monkey") + + end +}) + +des.room({ type="ordinary", + contents = function() + des.stair("up") + end +}) + +des.room({ type="ordinary", + contents = function() + des.stair("down") + des.trap() + des.monster("gnome") + des.monster("gnome") + end +}) + +des.room({ type="ordinary", + contents = function() + des.monster("dwarf") + end +}) + +des.room({ type="ordinary", + contents = function() + des.trap() + des.monster("gnome") + end +}) + +des.random_corridors() diff --git a/dat/nhlib.lua b/dat/nhlib.lua new file mode 100644 index 000000000..5cd1e6cf2 --- /dev/null +++ b/dat/nhlib.lua @@ -0,0 +1,12 @@ + +math.randomseed( os.time() ) + +function shuffle(list) + for i = #list, 2, -1 do + local j = math.random(i) + list[i], list[j] = list[j], list[i] + end +end + +align = { "law", "neutral", "chaos" }; +shuffle(align); diff --git a/dat/opthelp b/dat/opthelp index ee9092ede..0bcc8547e 100644 --- a/dat/opthelp +++ b/dat/opthelp @@ -99,7 +99,7 @@ altmeta For unix and VMS, treat two character sequence "ESC c" as M-c (Meta+c, 8th bit set) when nethack [FALSE] obtains a command from player's keyboard. -Boolean option if USE_TILES was set at compile time (MSDOS protected mode only): +Boolean option if USE_TILES was set at compile time (MSDOS protected mode): preload_tiles control whether tiles get pre-loaded into RAM at [TRUE] the start of the game. Doing so enhances performance of the tile graphics, but uses more memory. @@ -157,9 +157,13 @@ paranoid_confirmation space separated list [paranoid_confirmation:pray] die -- yes vs y to confirm dying (for explore or debug mode) bones -- yes vs y to confirm saving bones data in debug mode attack -- yes vs y to confirm attacking a peaceful monster + wand-break -- yes vs y to confirm breaking a wand + eating -- yes vs y to confirm whether to continue eating + Were-change -- yes vs y to confirm changing form due to + lycanthropy when hero has polymorph control; pray -- y to confirm an attempt to pray; on by default Remove -- always pick from inventory for 'R' and 'T' even when - wearing just one applicable item to remove or take off + wearing just one applicable item to remove or take off pickup_burden when you pick up an item that exceeds this encumbrance [S] level (Unencumbered, Burdened, streSsed, straiNed, overTaxed, or overLoaded), you will be asked if you want to continue. diff --git a/dat/oracle.des b/dat/oracle.des deleted file mode 100644 index 64603a935..000000000 --- a/dat/oracle.des +++ /dev/null @@ -1,65 +0,0 @@ -# NetHack 3.6 oracle.des $NHDT-Date: 1524689580 2018/04/25 20:53:00 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.10 $ -# Copyright (c) 2015 by Pasi Kallinen -# NetHack may be freely redistributed. See license for details. -# -# Oracle level -# - -LEVEL: "oracle" - -ROOM: "ordinary" , lit, (3,3), (center,center), (11,9) { - OBJECT:('`',"statue"),(0,0),montype:'C',1 - OBJECT:('`',"statue"),(0,8),montype:'C',1 - OBJECT:('`',"statue"),(10,0),montype:'C',1 - OBJECT:('`',"statue"),(10,8),montype:'C',1 - OBJECT:('`',"statue"),(5,1),montype:'C',1 - OBJECT:('`',"statue"),(5,7),montype:'C',1 - OBJECT:('`',"statue"),(2,4),montype:'C',1 - OBJECT:('`',"statue"),(8,4),montype:'C',1 - - SUBROOM: "delphi" , lit , (4,3) , (3,3) { - FOUNTAIN: (0, 1) - FOUNTAIN: (1, 0) - FOUNTAIN: (1, 2) - FOUNTAIN: (2, 1) - MONSTER: ('@', "Oracle"), (1,1) - ROOMDOOR: false , nodoor , random, random - } - - MONSTER: random, random - MONSTER: random, random - -} - -ROOM: "ordinary" , random, random, random, random { - STAIR: random, up - OBJECT: random,random -} - -ROOM: "ordinary" , random, random, random, random { - STAIR: random, down - OBJECT: random, random - TRAP: random, random - MONSTER: random, random - MONSTER: random, random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - OBJECT: random, random - MONSTER: random, random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - MONSTER: random, random -} - -ROOM: "ordinary" , random, random, random, random { - OBJECT: random, random - TRAP: random, random - MONSTER: random, random -} - -RANDOM_CORRIDORS diff --git a/dat/oracle.lua b/dat/oracle.lua new file mode 100644 index 000000000..1158a18d0 --- /dev/null +++ b/dat/oracle.lua @@ -0,0 +1,63 @@ + +des.room({ type = "ordinary", lit=1, x=3,y=3, xalign="center",yalign="center", w=11,h=9, contents = function() + des.object({ id = "statue", x = 0, y = 0, montype = "C", historic = true }); + des.object({ id = "statue", x = 0, y = 8, montype = "C", historic = true }); + des.object({ id = "statue", x =10, y = 0, montype = "C", historic = true }); + des.object({ id = "statue", x =10, y = 8, montype = "C", historic = true }); + des.object({ id = "statue", x = 5, y = 1, montype = "C", historic = true }); + des.object({ id = "statue", x = 5, y = 7, montype = "C", historic = true }); + des.object({ id = "statue", x = 2, y = 4, montype = "C", historic = true }); + des.object({ id = "statue", x = 8, y = 4, montype = "C", historic = true }); + + des.room({ type = "delphi", lit = 1, x=4,y=3, w=3,h=3, contents = function() + des.feature("fountain", 0, 1); + des.feature("fountain", 1, 0); + des.feature("fountain", 1, 2); + des.feature("fountain", 2, 1); + des.monster("Oracle", 1, 1); + des.door({ state="nodoor", wall="all" }); + end + }); + + des.monster(); + des.monster(); + end +}); + +des.room({ contents = function() + des.stair("up"); + des.object(); + end +}); + +des.room({ contents = function() + des.stair("down"); + des.object(); + des.trap(); + des.monster(); + des.monster(); + end +}); + +des.room({ contents = function() + des.object(); + des.object(); + des.monster(); + end +}); + +des.room({ contents = function() + des.object(); + des.trap(); + des.monster(); + end +}); + +des.room({ contents = function() + des.object(); + des.trap(); + des.monster(); + end +}); + +des.random_corridors(); diff --git a/dat/orcus.lua b/dat/orcus.lua new file mode 100644 index 000000000..203899959 --- /dev/null +++ b/dat/orcus.lua @@ -0,0 +1,142 @@ +-- NetHack 3.6 gehennom.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1992 by M. Stephenson and Izchak Miller +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style="mazegrid", bg ="-" }); + +des.level_flags("mazelevel", "noteleport", "shortsighted") +-- A ghost town +des.map({ halign = "right", valign = "center", map = [[ +.|....|....|....|..............|....|........ +.|....|....|....|..............|....|........ +.|....|....|....|--...-+-------|............. +.|....|....|....|..............+............. +.|.........|....|..............|....|........ +.--+-...-+----+--....-------...--------.-+--- +.....................|.....|................. +.....................|.....|................. +.--+----....-+---....|.....|...----------+--- +.|....|....|....|....---+---...|......|...... +.|.........|....|..............|......|...... +.----...---------.....-----....+......|...... +.|........................|....|......|...... +.----------+-...--+--|....|....----------+--- +.|....|..............|....+....|............. +.|....+.......|......|....|....|............. +.|....|.......|......|....|....|............. +]] }); +des.mazewalk(00,06,"west") +-- Entire main area +des.region(selection.area(01,00,44,16),"unlit") +des.stair("down", 33,15) +des.levregion({ region={01,00,12,20}, region_islev=1, exclude={20,01,70,20}, exclude_islev=1, type="stair-up" }); +des.levregion({ region={01,00,12,20}, region_islev=1, exclude={20,01,70,20}, exclude_islev=1, type="branch" }); +des.teleport_region({ region={01,00,12,20}, region_islev=1, exclude={20,01,70,20}, exclude_islev=1 }); +-- Wall "ruins" +des.object("boulder",19,02) +des.object("boulder",20,02) +des.object("boulder",21,02) +des.object("boulder",36,02) +des.object("boulder",36,03) +des.object("boulder",06,04) +des.object("boulder",05,05) +des.object("boulder",06,05) +des.object("boulder",07,05) +des.object("boulder",39,05) +des.object("boulder",08,08) +des.object("boulder",09,08) +des.object("boulder",10,08) +des.object("boulder",11,08) +des.object("boulder",06,10) +des.object("boulder",05,11) +des.object("boulder",06,11) +des.object("boulder",07,11) +des.object("boulder",21,11) +des.object("boulder",21,12) +des.object("boulder",13,13) +des.object("boulder",14,13) +des.object("boulder",15,13) +des.object("boulder",14,14) +-- Doors +des.door("closed",23,02) +des.door("open",31,03) +des.door("nodoor",03,05) +des.door("closed",09,05) +des.door("closed",14,05) +des.door("closed",41,05) +des.door("open",03,08) +des.door("nodoor",13,08) +des.door("open",41,08) +des.door("closed",24,09) +des.door("closed",31,11) +des.door("open",11,13) +des.door("closed",18,13) +des.door("closed",41,13) +des.door("open",26,14) +des.door("closed",06,15) +-- Special rooms +des.altar({ x=24,y=07,align="noalign",type="sanctum" }) +des.region({ region={22,12,25,16},lit=0,type="morgue", prefilled=0 }) +des.region({ region={32,09,37,12},lit=1,type="shop",prefilled=0 }) +des.region({ region={12,00,15,04},lit=1,type="shop",prefilled=0 }) +-- Some traps. +des.trap("spiked pit") +des.trap("sleep gas") +des.trap("anti magic") +des.trap("fire") +des.trap("fire") +des.trap("fire") +des.trap("magic") +des.trap("magic") +-- Some random objects +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +des.object() +-- The resident nasty +des.monster("Orcus",33,15) +-- And its preferred companions +des.monster("human zombie",32,15) +des.monster("shade",32,14) +des.monster("shade",32,16) +des.monster("vampire",35,16) +des.monster("vampire",35,14) +des.monster("vampire lord",36,14) +des.monster("vampire lord",36,15) +-- Randomly placed companions +des.monster("skeleton") +des.monster("skeleton") +des.monster("skeleton") +des.monster("skeleton") +des.monster("skeleton") +des.monster("shade") +des.monster("shade") +des.monster("shade") +des.monster("shade") +des.monster("giant zombie") +des.monster("giant zombie") +des.monster("giant zombie") +des.monster("ettin zombie") +des.monster("ettin zombie") +des.monster("ettin zombie") +des.monster("human zombie") +des.monster("human zombie") +des.monster("human zombie") +des.monster("vampire") +des.monster("vampire") +des.monster("vampire") +des.monster("vampire lord") +des.monster("vampire lord") +-- A few more for the party +des.monster() +des.monster() +des.monster() +des.monster() +des.monster() diff --git a/dat/quest.lua b/dat/quest.lua new file mode 100644 index 000000000..891556987 --- /dev/null +++ b/dat/quest.lua @@ -0,0 +1,3048 @@ + +-- TODO: +-- - output = "verbalize" +-- - export the quest string replacements to lua, instead of %H etc +-- - allow checking if hero is carrying item (see comments for %Cp Arc 00042) +-- - fold quest_portal, quest_portal_again, quest_portal_demand into one +-- - some roles have no goal_alt, fold into goal_next? +-- - qt_pager hack(?): if (qt_msg->delivery == 'p' && strcmp(windowprocs.name, "X11")) + + + + +-- text = "something" +-- Text is shown to the user. + +-- synopsis = "something" +-- Synopsis is inserted into the message history. +-- +-- output = "pline" | "menu" | "text" +-- The output can be manually set by using output = "menu" +-- Valid values for output are "pline", "text", and "menu, defaulting to +-- pline, unless the text contains newlines, or is too long to fit a message buffer, +-- then will be shown as a text window instead. + + + +questtext = { + common = { + TEST_PATTERN = { + output = "text", + text = [[%p: return(plname); + %c: return(pl_character); + %r: return((char *)rank_of(u.ulevel)); + %R: return((char *)rank_of(MIN_QUEST_LEVEL)); + %s: return((flags.female) ? "sister" : "brother" ); + %S: return((flags.female) ? "daughter" : "son" ); + %l: return((char *)ldrname()); + %i: return(intermed()); + %o: return(artiname()); + %O: return(shortened(artiname())); + %n: return((char *)neminame()); + %g: return((char *)guardname()); + %G: return((char *)align_gtitle(u.ualignbase[1])); + %H: return((char *)homebase()); + %a: return(Alignnam(u.ualignbase[1])); + %A: return(Alignnam(u.ualign.type)); + %d: return((char *)align_gname(u.ualignbase[1])); + %D: return((char *)align_gname(A_LAWFUL)); + %C: return("chaotic"); + %N: return("neutral"); + %L: return("lawful"); + %x: return((Blind) ? "sense" : "see"); + %Z: return("The Dungeons of Doom"); + %%: return(percent_sign); + a suffix: return an(root); + A suffix: return An(root); + C suffix: return capitalized(root); + h suffix: return pronoun(he_or_she, mon_of(root)); /* for %l,%n,%d,%o */ + H suffix: return capitalized(pronoun(he_or_she, mon_of(root))); + i suffix: return pronoun(him_or_her, mon_of(root)); + I suffix: return capitalized(pronoun(him_or_her, mon_of(root))); + j suffix: return pronoun(his_or_her, mon_of(root)); + J suffix: return capitalized(pronoun(his_or_her, mon_of(root))); + p suffix: return makeplural(root); + P suffix: return makeplural(capitalized(root)); + s suffix: return s_suffix(root); + S suffix: return s_suffix(capitalized(root)); + t suffix: return strip_the_prefix(root);]], + }, + angel_cuss = { + "\"Repent, and thou shalt be saved!\"", + "\"Thou shalt pay for thine insolence!\"", + "\"Very soon, my child, thou shalt meet thy maker.\"", + "\"The great %D has sent me to make you pay for your sins!\"", + "\"The wrath of %D is now upon you!\"", + "\"Thy life belongs to %D now!\"", + "\"Dost thou wish to receive thy final blessing?\"", + "\"Thou art but a godless void.\"", + "\"Thou art not worthy to seek the Amulet.\"", + "\"No one expects the Spanish Inquisition!\"", + }, + banished = { + synopsis = "[You are banished from %H for betraying your allegiance to %d.]", + output = "text", + text = [["You have betrayed all those who hold allegiance to %d, as you once did. +My allegiance to %d holds fast and I cannot condone or accept what you +have done. + +Leave this place. You shall never set foot at %H again. +That which you seek is now lost forever, for without the Bell of Opening, +you will never be able to enter the place where he who has the Amulet +resides. + +Go now! You are banished from this place.]], + }, + demon_cuss = { + "\"I first mistook thee for a statue, when I regarded thy head of stone.\"", + "\"Come here often?\"", + "\"Doth pain excite thee? Wouldst thou prefer the whip?\"", + "\"Thinkest thou it shall tickle as I rip out thy lungs?\"", + "\"Eat slime and die!\"", + "\"Go ahead, fetch thy mama! I shall wait.\"", + "\"Go play leapfrog with a herd of unicorns!\"", + "\"Hast thou been drinking, or art thou always so clumsy?\"", + "\"This time I shall let thee off with a spanking, but let it not happen again.\"", + "\"I've met smarter (and prettier) acid blobs.\"", + "\"Look! Thy bootlace is undone!\"", + "\"Mercy! Dost thou wish me to die of laughter?\"", + "\"Run away! Live to flee another day!\"", + "\"Thou hadst best fight better than thou canst dress!\"", + "\"Twixt thy cousin and thee, Medusa is the prettier.\"", + "\"Methinks thou wert unnaturally stirred by yon corpse back there, eh, varlet?\"", + "\"Up thy nose with a rubber hose!\"", + "\"Verily, thy corpse could not smell worse!\"", + "\"Wait! I shall polymorph into a grid bug to give thee a fighting chance!\"", + "\"Why search for the Amulet? Thou wouldst but lose it, cretin.\"", + }, + legacy = { + synopsis = "[%dC has chosen you to recover the Amulet of Yendor for %dI.]", + output = "menu", + text = [[It is written in the Book of %d: + + After the Creation, the cruel god Moloch rebelled + against the authority of Marduk the Creator. + Moloch stole from Marduk the most powerful of all + the artifacts of the gods, the Amulet of Yendor, + and he hid it in the dark cavities of Gehennom, the + Under World, where he now lurks, and bides his time. + +Your %G %d seeks to possess the Amulet, and with it +to gain deserved ascendance over the other gods. + +You, a newly trained %r, have been heralded +from birth as the instrument of %d. You are destined +to recover the Amulet for your deity, or die in the +attempt. Your hour of destiny has come. For the sake +of us all: Go bravely with %d!]], + }, + quest_complete_no_bell = { + text = [["The silver bell which was hoarded by %n will be +essential in locating the Amulet of Yendor."]], + }, + quest_portal = { + output = "pline", + text = [[You receive a faint telepathic message from %l: +Your help is urgently needed at %H! +Look for a ...ic transporter. +You couldn't quite make out that last message.]], + }, + quest_portal_again = { + text = "You again sense %l pleading for help.", + }, + quest_portal_demand = { + text = "You again sense %l demanding your attendance.", + }, + }, + Arc = { + assignquest = { + synopsis = "[%nC has stolen %o. Locate %i, defeat %ni, and return %O.]", + output = "text", + text = [["Grave times have befallen the college, for %na has +stolen %o. Without it, the board of directors of +the university will soon have no choice but to revoke our research grants. + +"You must locate the entrance to %i. Within it, +you will find %n. + +"You must then defeat %n and return %o +to me. + +"Only in this way will we be able to prevent the budget cuts that could +close this college. + +"May the wisdom of %d be your guide."]], + }, + badalign = { + synopsis = "[\"%pC, you have strayed from the %a path. Purify yourself!\"]", + output = "text", + text = [["%pC! I've heard that you've been using sloppy techniques. Your +results lately can hardly be called suitable for %ra! + +"How could you have strayed from the %a path? Go from here, and come +back only when you have purified yourself."]], + }, + badlevel = { + synopsis = "[%pC, a mere %r is too inexperienced.]", + output = "text", + text = [["%p, you are yet too inexperienced to undertake such a demanding +quest. A mere %r could not possibly face the rigors demanded and +survive. Go forth, and come here again when your adventures have further +taught you."]], + }, + discourage = { + "\"Try your best, %p. You cannot defeat me.\"", + "\"I shall rend the flesh from your body whilst you still breathe!\"", + "\"First you, %p, then I shall destroy your mentor, %l.\"", + "\"Tiring yet, %p? I draw my power from my master and cannot falter!\"", + "\"I shall rend thy soul from thy body and consume it!\"", + "\"You are far too %a -- it weakens you. You shall die in this place.\"", + "\"%d has forsaken you! You are lost now!\"", + "\"A mere %r cannot hope to defeat me!\"", + "\"If you are the best %l can send, I have nothing to fear.\"", + "\"Die %c! I shall exhibit your carcass as a trophy.\"", + }, + encourage = { + "\"Beware, for %n is powerful and cunning.\"", + "\"To locate the entrance to %i, you must pass many traps.\"", + "\"A %nt may be vulnerable to attacks by magical cold.\"", + "\"Call upon %d when you encounter %n.\"", + "\"You must destroy %n. It will pursue you otherwise.\"", + "\"%oC is a mighty talisman. With it you can destroy %n.\"", + "\"Go forth with the blessings of %d.\"", + "\"I will have my %gP watch for your return.\"", + "\"Remember not to stray from the true %a path.\"", + "\"You may be able to sense %o when you are near.\"", + }, + firsttime = { + synopsis = "[You arrive at %H, but all is not well.]", + output = "text", + text = [[You are suddenly in familiar surroundings. The buildings in the distance +seem to be those of your old alma mater, but something is wrong. It feels +as if there has been a riot recently, or %H has +been under siege. + +All of the windows are boarded up, and there are objects scattered around +the entrance. + +Strange forbidding shapes seem to be moving in the distance.]], + }, + goal_alt = { + text = "The have returned to %ns lair.", + }, + goal_first = { + synopsis = "[This strange feeling must be the presence of %o.]", + output = "text", + text = [[A strange feeling washes over you, and you think back to things you +learned during the many lectures of %l. + +You realize the feeling must be the presence of %o.]], + }, + goal_next = { + text = "The familiar presence of %o is in the ether.", + }, + gotit = { + synopsis = "[The power of %o flows through your body! You must return it to %l.]", + output = "text", + text = [[The power of %o flows through your body! You feel +as if you could now take on the Wizard of Yendor himself and win, but +you know you must return %o to %l.]], + }, + guardtalk_after = { + "\"Did you see Lash LaRue in 'Song of Old Wyoming' the other night?\"", + "\"Hey man, got any potions of hallucination for sale?\"", + "\"I guess you are guaranteed to make full professor now.\"", + "\"So, what was worse, %n or your entrance exams?\"", + "\"%oC is impressive, but nothing like the bones I dug up!\"", + }, + guardtalk_before = { + "\"Did you see Lash LaRue in 'Song of Old Wyoming' the other night?\"", + "\"Hey man, got any potions of hallucination for sale?\"", + "\"Did you see the artifact %l brought back from the last dig?\"", + "\"So what species do *you* think we evolved from?\"", + "\"So you're %ls prize pupil! I don't know what he sees in you.\"", + }, + hasamulet = { + synopsis = "[Take the Amulet to the Astral Plane and sacrifice it at the altar of %d.]", + output = "text", + text = [["Congratulations, %p. I wondered if anyone could prevail against +the Wizard and the minions of Moloch. Now, you must embark on one +final adventure. + +"Take the Amulet, and find your way onto the Astral Plane. +There you must find the altar of %d and sacrifice the +Amulet on that altar to fulfill your destiny. + +"Remember, your path now should always be upwards."]], + }, + killed_nemesis = { + text = "The body of %n dissipates in a cloud of noxious fumes.", + }, + leader_first = { + synopsis = "[\"You have returned, %p, to a difficult task.\"]", + output = "text", + text = [["Finally you have returned, %p. You were always +my most promising student. Allow me to see if you are ready for the +most difficult task of your career."]], + }, + leader_last = { + synopsis = "[\"%pC, you have failed us. Begone!\"]", + output = "text", + text = [["%p, you have failed us. All of my careful training has been in +vain. Begone! Your tenure at this college has been revoked! + +"You are a disgrace to the profession!"]], + }, + leader_next = { + text = [["Again, %p, you stand before me. +Let me see if you have gained experience in the interim."]], + }, + leader_other = { + text = [["Once more, %p, you have returned from the field. +Are you finally ready for the task that must be accomplished?"]], + }, + locate_first = { + synopsis = "[This foreboding edifice must hide the entrance to %i.]", + output = "text", + text = [[A plain opens before you. Beyond the plain lies a foreboding edifice. + +You have the feeling that you will soon find the entrance to +%i.]], + }, + locate_next = { + text = "Once again, you are near the entrance to %i.", + }, + nemesis_first = { + synopsis = "[\"Come, %p, I shall destroy you!\"]", + output = "text", + text = [["So, %p, you think that you can succeed in recovering +%o, when your teacher, %l, has already failed. + +"Come, try your best! I shall destroy you, and gnaw on your bones."]], + }, + nemesis_next = { + synopsis = "[\"Again you try to best me, %p? You shall never recover %o.\"]", + output = "text", + text = [["Again you try to best me, eh %p? Well, you shall fail again. + +"You shall never recover %o. + +"I shall bear your soul to the Plane of Origins for my master's pleasure."]], + }, + nemesis_other = { + text = "\"You persist yet %p! Good. Now, you shall die!\"", + }, + nemesis_wantsit = { + text = [["I shall have %o from you, %p, then feast +upon your entrails!"]], + }, + nexttime = { + text = "Once again, you are back at %H.", + }, + offeredit = { + synopsis = "[%lC instructs you to guard %o from now on.]", + output = "text", + text = [[%lC touches %o briefly, gazes into it, +then smiles at you and says: + +"Well done, %p. You have defeated %n and +recovered %o. But I fear that it shall never be safe +here. + +Please take %o with you. You, %p, can +guard it now far better than I. + +May the blessings of %d follow you and guard you."]], + }, + offeredit2 = { + synopsis = "[\"Resume your search for the Amulet beyond the magic portal to %Z.\"]", + output = "text", + text = [["Careful, %p! %oC might break, and that would be +a tragic loss. You are its keeper now, and the time has come to +resume your search for the Amulet. %Z await your +return through the magic portal that brought you here."]], + }, + othertime = { + text = [[You are back at %H. +You have an odd feeling this may be the last time you ever come here.]], + }, + posthanks = { + synopsis = "[\"Have you progressed with your quest to regain the Amulet of Yendor for %d?\"]", + output = "text", + text = [["Welcome back, %p. Have you progressed with your quest to +regain the Amulet of Yendor for %d?"]], + }, + }, + Bar = { + assignquest = { + synopsis = "[\"Find %n, defeat %ni, and return %o to us.\"]", + output = "text", + text = [["The world is in great need of your assistance, %p. + +"About six months ago, I learned that a mysterious sorcerer, known +as %n, had begun to gather a large group of cutthroats and brigands +about %ni. + +"At about the same time, these people you once rode with `liberated' a +potent magical talisman, %o, from a Turanian caravan. + +"%nC and %nj Black Horde swept down upon %i and defeated +the people there, driving them out into the desert. He has taken +%o, and seeks to bend it to %nj will. I detected the +subtle changes in the currents of fate, and joined these people. +Then I sent forth a summons for you. + +"If %n can bend %o to %nj will, he will become +almost indestructible. He will then be able to enslave the minds of +men across the world. You are the only hope. The gods smile upon you, +and with %d behind you, you alone can defeat %n. + +"You must go to %i. From there, you can track down +%n, defeat %ni, and return %o to us. Only +then will the world be safe."]], + }, + badalign = { + synopsis = "[\"You have wandered from the path of the %a. Come back when you have atoned.\"]", + output = "text", + text = [["%pC! You have wandered from the path of the %a! +If you attempt to overcome %n in this state, he will surely +enslave your soul. Your only hope, and ours, lies in your purification. +Go forth, and return when you feel ready."]], + }, + badlevel = { + synopsis = "[\"You are too inexperienced. Come back when you are %Ra.\"]", + output = "text", + text = [["%p, I fear that you are as yet too inexperienced to face +%n. Only %Ra with the help of %d could ever hope to +defeat %ni."]], + }, + discourage = { + "\"My pets will dine on your carcass tonight!\"", + "\"You are a sorry excuse for %ra.\"", + "\"Run while you can, %c. My next spell will be your last.\"", + "\"I shall use your very skin to bind my next grimoire.\"", + "\"%d cannot protect you now. Here, you die.\"", + "\"Your %a nature makes you weak. You cannot defeat me.\"", + "\"Come, %c. I shall kill you, then unleash the horde on your tribe.\"", + "\"Once you are dead, my horde shall finish off %l, and your tribe.\"", + "\"Fight, %c, or are you afraid of the mighty %n?\"", + "\"You have failed, %c. Now, my victory is complete.\"", + }, + encourage = { + "\"%nC is strong in the dark arts, but not immune to cold steel.\"", + "\"Remember that %n is a great sorcerer. He lived in the time of Atlantis.\"", + "\"If you fail, %p, I will not be able to protect these people long.\"", + "\"To enter %i, you must be very stealthy. The horde will be on guard.\"", + "\"Call upon %d in your time of need.\"", + "\"May %d protect you, and guide your steps.\"", + "\"If you can lay hands upon %o, carry it for good fortune.\"", + "\"I cannot stand against %ns sorcery. But %d will help you.\"", + "\"Do not fear %n. I know you can defeat %ni.\"", + "\"You have a great road to travel, %p, but only after you defeat %n.\"", + }, + firsttime = { + synopsis = "[You reach the vicinity of %H, but sense evil magic nearby.]", + output = "text", + text = [[Warily you scan your surroundings, all of your senses alert for signs +of possible danger. Off in the distance, you can %x the familiar shapes +of %H. + +But why, you think, should %l be there? + +Suddenly, the hairs on your neck stand on end as you detect the aura of +evil magic in the air. + +Without thought, you ready your weapon, and mutter under your breath: + + "By %d, there will be blood spilt today."]], + }, + goal_first = { + synopsis = "[This is surely the lair of %n.]", + output = "text", + text = [[The hairs on the nape of your neck lift as you sense an energy in the +very air around you. You fight down a primordial panic that seeks to +make you turn and run. This is surely the lair of %n.]], + }, + goal_next = { + text = "Yet again you feel the air around you heavy with malevolent magical energy.", + }, + gotit = { + synopsis = "[You feel the power of %o flowing through your hands.]", + output = "text", + text = [[As you pick up %o, you feel the power of it +flowing through your hands. It seems to be in two or more places +at once, even though you are holding it.]], + }, + guardtalk_after = { + "\"The battles here have been good -- our enemies' blood soaks the soil!\"", + "\"Remember that glory is crushing your enemies beneath your feet!\"", + "\"Times will be good again, now that the horde is vanquished.\"", + "\"You have brought our clan much honor in defeating %n.\"", + "\"You will be a worthy successor to %l.\"", + }, + guardtalk_before = { + "\"The battles here have been good -- our enemies' blood soaks the soil!\"", + "\"Remember that glory is crushing your enemies beneath your feet!\"", + "\"There has been little treasure to loot, since the horde arrived.\"", + "\"The horde is mighty in numbers, but they have little courage.\"", + "\"%lC is a strange one, but he has helped defend us.\"", + }, + hasamulet = { + synopsis = "[\"Take the Amulet to the altar of %d on the Astral Plane and offer it.\"]", + output = "text", + text = [["This is wondrous, %p. I feared that you could not possibly +succeed in your quest, but here you are in possession of the Amulet +of Yendor! + +"I have studied the texts of the magi constantly since you left. In +the Book of Skelos, I found this: + + %d will cause a child to be sent into the world. This child is to + be made strong by trial of battle and magic, for %d has willed it so. + It is said that the child of %d will recover the Amulet of Yendor + that was stolen from the Creator at the beginning of time. + +"As you now possess the amulet, %p, I suspect that the Book +speaks of you. + + The child of %d will take the Amulet, and travel to the Astral + Plane, where the Great Temple of %d is to be found. The Amulet + will be sacrificed to %d, there on %dJ altar. Then the child will + stand by %d as champion of all %cP for eternity. + +"This is all I know, %p. I hope it will help you."]], + }, + killed_nemesis = { + synopsis = "[%nC curses you, but you feel the overpowering aura of magic fading.]", + output = "text", + text = [[%nC falls to the ground, and utters a last curse at you. Then %nj +body fades slowly, seemingly dispersing into the air around you. You +slowly become aware that the overpowering aura of magic in the air has +begun to fade.]], + }, + leader_first = { + synopsis = "[\"At last you have returned. There is a great quest you must undertake.\"]", + output = "text", + text = [["Ah, %p. You have returned at last. The world is in dire +need of your help. There is a great quest you must undertake. + +"But first, I must see if you are ready to take on such a challenge."]], + }, + leader_last = { + synopsis = "[\"You have betrayed %d; soon %n will destroy us. Begone!\"]", + output = "text", + text = [["Pah! You have betrayed the gods, %p. You will never attain +the glory which you aspire to. Your failure to follow the true path has +closed this future to you. + +"I will protect these people as best I can, but soon %n will overcome +me and destroy all who once called you %s. Now begone!"]], + }, + leader_next = { + text = "\"%p, you are back. Are you ready now for the challenge?\"", + }, + leader_other = { + text = "\"Again, you stand before me, %p. Surely you have prepared yourself.\"", + }, + locate_first = { + synopsis = "[You have located %i.]", + output = "text", + text = [[The scent of water comes to you in the desert breeze. You know that +you have located %i.]], + }, + locate_next = { + text = "Yet again you have a chance to infiltrate %i.", + }, + nemesis_first = { + synopsis = "[%nC boasts that %nh has slain many. \"Prepare to die, %c.\"]", + output = "text", + text = [["So. This is what that second rate sorcerer %l sends to do %lj bidding. +I have slain many before you. You shall give me little sport. + +"Prepare to die, %c."]], + }, + nemesis_next = { + text = "\"I have wasted too much time on you already. Now, you shall die.\"", + }, + nemesis_other = { + text = "\"You return yet again, %c! Are you prepared for death now?\"", + }, + nemesis_wantsit = { + text = [["I shall have %o back, you pitiful excuse for %ca. +And your life as well."]], + }, + nexttime = { + text = [[Once again, you near %H. You know that %l +will be waiting.]], + }, + offeredit = { + synopsis = "[%lC tells you to guard %o, and to return when you have triumphed.]", + output = "text", + text = [[When %l sees %o, he smiles, and says: + + Well done, %p. You have saved the world from certain doom. + What, now, should be done with %o? + + These people, brave as they are, cannot hope to guard it from + other sorcerers who will detect it, as surely as %n did. + + Take %o with you, %p. It will guard you in + your adventures, and you can best guard it. You embark on a + quest far greater than you realize. + + Remember me, %p, and return when you have triumphed. I + will tell you then of what you must do. You will understand when the + time comes.]], + }, + offeredit2 = { + synopsis = "[\"You keep %o. Return to %Z to search for the Amulet.\"]", + output = "text", + text = [[%l gazes reverently at %o, then back at you. + +"You are its keeper now, and the time has come to resume your search +for the Amulet. %Z await your return through the +magic portal which brought you here."]], + }, + othertime = { + text = [[Again, and you think possibly for the last time, you approach +%H.]], + }, + posthanks = { + text = "\"Tell us, %p, have you fared well on your great quest?\"", + }, + }, + Cav = { + assignquest = { + synopsis = "[Find and defeat %n, recover %o, and return with it.]", + output = "text", + text = [["You are indeed ready now, %p. I shall tell you a tale of +great suffering among your people: + +"Shortly after you left on your vision quest, the caves were invaded by +the creatures sent against us by %n. + +"She, herself, could not attack us due to her great size, but her minions +have harassed us ever since. In the first attacks, many died, and the +minions of %n managed to steal %o. +They took it to %i and there, none of our +%g warriors have been able to go. + +"You must find %i, and within it wrest +%o from %n. She guards it as +jealously as she guards all treasures she attains. But with it, +we can make our caves safe once more. + +"Please, %p, recover %o for us, and return it here."]], + }, + badalign = { + synopsis = "[\"You no longer follow the path of the %a. Go, and purify yourself.\"]", + output = "text", + text = [["%pC! You have deviated from my teachings. You no longer follow +the path of the %a as you should. I banish you from these caves, to +go forth and purify yourself. Then, you might be able to accomplish this +quest."]], + }, + badlevel = { + synopsis = "[\"%rA is too inexperienced. Come back when you have progressed.\"]", + output = "text", + text = [["Alas, %p, you are as yet too inexperienced to embark upon such +a difficult quest as that I propose to give you. + +"%rA could not possibly survive the rigors demanded to find +%i, never mind to confront %n herself. + +"Adventure some more, and you will learn the skills you will require. +%d decrees it."]], + }, + discourage = { + "\"You are weak, %c. No challenge for the Mother of all Dragons.\"", + "\"I grow hungry, %r. You look like a nice appetizer!\"", + "\"Join me for lunch? You're the main course, %c.\"", + "\"With %o, I am invincible! You cannot succeed.\"", + "\"Your mentor, %l has failed. You are nothing to fear.\"", + "\"You shall die here, %c. %rA cannot hope to defeat me.\"", + "\"You, a mere %r challenge the might of %n? Hah!\"", + "\"I am the Mother of all Dragons! You cannot hope to defeat me.\"", + "\"My claws are sharp now. I shall rip you to shreds!\"", + "\"%d has deserted you, %c. This is my domain.\"", + }, + encourage = { + "\"%nC is immune to her own breath weapons. You should use magic upon her that she does not use herself.\"", + "\"When you encounter %n, call upon %d for assistance.\"", + "\"There will be nowhere to hide inside %ns inner sanctum.\"", + "\"Your best chance with %n will be to keep moving.\"", + "\"Do not be distracted by the great treasures in %ns lair. Concentrate on %o.\"", + "\"%oC is the only object that %n truly fears.\"", + "\"Do not be fooled by %ns size. She is fast, and it is rumored that she uses magic.\"", + "\"I would send a party of %gP with you, but we will need all of our strength to defend ourselves.\"", + "\"Remember, be %a at all times. This is your strength.\"", + "\"If only we had an amulet of reflection, this would not have happened.\"", + }, + firsttime = { + synopsis = "[You arrive back at %H, but something is wrong here.]", + output = "text", + text = [[You descend through a barely familiar stairwell that you remember +%l showing you when you embarked upon your vision quest. + +You arrive back at %H, but something seems +wrong here. The usual smoke and glowing light of the fires of the +outer caves are absent, and an uneasy quiet fills the damp air.]], + }, + goal_first = { + synopsis = "[You enter a large cavern. %nC is present.]", + output = "text", + text = [[You find yourself in a large cavern, with neatly polished walls, that +nevertheless show signs of being scorched by fire. + +Bones litter the floor, and there are objects scattered everywhere. +The air is close with the stench of sulphurous fumes. + +%nC is clearly visible, but %nh seems to be asleep.]], + }, + goal_next = { + text = "Once again, you find yourself in the lair of %n.", + }, + gotit = { + synopsis = "[%oC fills you with a feeling of power.]", + output = "text", + text = [[As you pick up %o it seems heavy at first, but as you +hold it strength flows into your arms. + +You suddenly feel full of power, as if nothing could possibly stand +in your path.]], + }, + guardtalk_after = { + "\"The rains have returned and the land grows lush again.\"", + "\"Peace has returned, give thanks to %d!\"", + "\"Welcome back! Did you find %o?\"", + "\"So, %p, tell us the story of your fight with %n.\"", + "\"%lC grows old. Perhaps you will guide us after he ascends.\"", + }, + guardtalk_before = { + "\"We have not been able to gather as much food since the Giants sealed off our access to the outer world.\"", + "\"Since %n sent her minions, we have been constantly fighting.\"", + "\"I have heard your vision quest was successful. Is this so?\"", + "\"So, tell me, %p, how have you fared?\"", + "\"%lC grows old. We know not who will guide us after he ascends.\"", + }, + hasamulet = { + synopsis = "[\"Take the Amulet to the altar of %d on the Astral Plane and offer it.\"]", + output = "text", + text = [["You have been successful, I see, %p. + +"Now that the Amulet of Yendor is yours, here is what you must do: + +"Journey upwards to the open air. The Amulet you carry will then +take you into the Astral Planes, where the Great Temple of %d +casts its influence throughout our world. + +"Sacrifice the Amulet on the altar. Thus shall %d become supreme!"]], + }, + killed_nemesis = { + text = [[%nC sinks to the ground, her heads flailing about. +As she dies, a cloud of noxious fumes billows about her.]], + }, + leader_first = { + synopsis = "[\"You have returned. We are in dire need of your help.\"]", + output = "text", + text = [["You have returned from your vision quest, %p. Thank %d. + +"We are in dire need of your help, my %S. + +"But first, I must see if you are yet capable of the quest I would +ask you to undertake."]], + }, + leader_last = { + synopsis = "[\"You have betrayed the %L. Begone!\"]", + output = "text", + text = [["%pC! You have sealed our fate. You seem unable to reform yourself, +so I must select another to take your place. + +"Begone from %H! You have betrayed us by choosing +the path of the %C over the true path of the %L. + +"You no longer live in our eyes."]], + }, + leader_next = { + text = "\"Again, you return to us, %p. Let me see if you are ready now.\"", + }, + leader_other = { + text = "\"Ah, %p. Are you finally ready?\"", + }, + locate_first = { + synopsis = "[You %x many large claw marks, smell carrion, and notice bones.]", + output = "text", + text = [[You %x many large claw marks on the ground. The tunnels ahead +of you are larger than most of those in any cave complex you have +ever been in before. + +Your nose detects the smell of carrion from within, and bones litter +the sides of the tunnels.]], + }, + locate_next = { + text = "Once again, you approach %i.", + }, + nemesis_first = { + synopsis = "[%nC threatens to eat you.]", + output = "text", + text = [["So, follower of %l, you seek to invade the lair of +%n. Only my meals are allowed down here. Prepare +to be eaten!"]], + }, + nemesis_next = { + text = [["So, again you face me, %c. No one has ever before escaped me. +Now I shall kill you."]], + }, + nemesis_other = { + text = "\"You are getting annoying, %c. Prepare to die.\"", + }, + nemesis_wantsit = { + text = "\"I'll have %o from you, %c. You shall die.\"", + }, + nexttime = { + text = "Once again, you arrive back at %H.", + }, + offeredit = { + synopsis = "[\"Take %o with you. It will help in your quest for the Amulet of Yendor.\"]", + output = "text", + text = [[%lC glimpses %o in your possession. +He smiles and says: + + You have done it! We are saved. But I fear that %o + will always be a target for %C forces who will want it for their + own. + + To prevent further trouble, I would like you, %p, + to take %o away with you. It will help you as you + quest for the Amulet of Yendor.]], + }, + offeredit2 = { + synopsis = "[\"You are the keeper of %o now. Return to %Z to search for the Amulet.]", + output = "text", + text = [[%l grasps %o proudly for a moment, then looks at you. + +"You are its keeper now, and the time has come to resume your search +for the Amulet. %Z await your return through the +magic portal which brought you here."]], + }, + othertime = { + text = [[For some reason, you think that this may be the last time you will +enter %H.]], + }, + posthanks = { + text = [["%pC! Welcome back. +How goes your quest to recover the Amulet for %d?"]], + }, + }, + Hea = { + assignquest = { + synopsis = "[Travel to %i on your way to recover %o from %n.]", + output = "text", + text = [[For the first time, you sense a smile on %ls face. + + "You have indeed learned as much as we can teach you in preparation + for this task. Let me tell you what I know of the symptoms and hope + that you can provide a cure. + + "A short while ago, the dreaded %nt was fooled by the gods + into thinking that %nh could use %o to find a + cure for old age. Think of it, eternal youth! But %nj good + health is accomplished by drawing the health from those around %ni. + + "He has exhausted %nj own supply of healthy people and now %nh seeks to + extend %nj influence into our world. You must recover from %ni + %o and break the spell. + + "You must travel into the swamps to %i, and from there + follow the trail to %ns island lair. Be careful."]], + }, + badalign = { + synopsis = "[Return when you are more %a.]", + output = "text", + text = [["You have learned much of the remedies that benefit, but you must also +know which physic for which ail. That is why %ds teachings are a +part of your training. + +"Return to us when you have healed thyself."]], + }, + badlevel = { + synopsis = "[You are too inexperienced. Return when you are %Ra.]", + output = "text", + text = [["Alas, %p, you are yet too inexperienced to deal with the rigors +of such a task. You must be able to draw on the knowledge of botany, +alchemy and veterinary practices before I can send you on this quest +with good conscience. + +"Return when you wear %Ra's caduceus."]], + }, + discourage = { + "\"They might as well give scalpels to wizards as to let you try to use %o!\"", + "\"If I could strike %l, surrounded by %lj %gP, imagine what I can do to you here by yourself.\"", + "\"I will put my %Rp to work making a physic out of your ashes.\"", + "\"As we speak, Hades gathers your patients to join you.\"", + "\"After I'm done with you, I'll destroy %l as well.\"", + "\"You will have to kill me if you ever hope to leave this place.\"", + "\"I will impale your head on my caduceus for all to see.\"", + "\"There is no materia medica in your sack which will cure you of me!\"", + "\"Do not fight too hard, I want your soul strong, not weakened!\"", + "\"You should have stopped studying at vetenary.\"", + }, + encourage = { + "\"Remember, %p, to always wash your hands before operating.\"", + "\"%nC has no real magic of %nj own. To this %nh is vulnerable.\"", + "\"If you have been true to %d, you can draw on the power of %o.\"", + "\"Bring with you antidotes for poisons.\"", + "\"Remember this, %n can twist the powers of %o to hurt instead of heal.\"", + "\"I have sent for Chiron, but I am afraid he will come too late.\"", + "\"Maybe when you return the snakes will once again begin to shed.\"", + "\"The plague grows worse as we speak. Hurry, %p!\"", + "\"Many times %n has caused trouble in these lands. It is time that %nh was eradicated like the diseases %nh has caused.\"", + "\"With but one eye, %n should be easy to blind. Remember this.\"", + }, + firsttime = { + synopsis = "[You arrive back at %H and must find %l.]", + output = "text", + text = [[What sorcery has brought you back to %H? The smell +of fresh funeral pyres tells you that something is amiss with the healing +powers that used to practice here. + +No rhizotomists are tending the materia medica gardens, and where are the +common folk who used to come for the cures? + +You know that you must quickly make your way to the collegium, and +%ls iatreion, and find out what has happened in your absence.]], + }, + goal_first = { + synopsis = "[You have reached the lair of %n. Take %o away from %ni.]", + output = "text", + text = [[You stand within sight of the infamous Isle of %n. Even +the words of %l had not prepared you for this. + +Steeling yourself against the wails of the ill that pierce your ears, +you hurry on your task. Maybe with %o you can +heal them on your return, but not now.]], + }, + goal_next = { + text = "Once again, you %x the Isle of %n in the distance.", + }, + gotit = { + synopsis = "[You feel the healing power of %o and should return it to %l.]", + output = "text", + text = [[As you pick up %o, you feel its healing begin to +warm your soul. You curse Zeus for taking it from its rightful owner, +but at least you hope that %l can put it to good use once +again.]], + }, + guardtalk_after = { + "\"Did you read that new treatise on the therapeutic use of leeches?\"", + "\"Paint a red caduceus on your shield and monsters won't hit you.\"", + "\"How are you feeling? Perhaps a good bleeding will improve your spirits.\"", + "\"Have you heard the absurd new theory that diseases are caused by microscopic organisms, and not ill humors?\"", + "\"I see that you bring %o, now you can cure this plague!\"", + }, + guardtalk_before = { + "\"Did you read that new treatise on the therapeutic use of leeches?\"", + "\"Paint a red caduceus on your shield and monsters won't hit you.\"", + "\"I passed handwriting so they are demoting me a rank.\"", + "\"I've heard that even %l has not been able to cure Chiron.\"", + "\"We think %n has used %nj alchemists, and %o, to unleash a new disease we call 'the cold' on Gehennom.\"", + }, + hasamulet = { + synopsis = "[\"You have recovered the Amulet. Travel to the Astral Plane and return it to %d.\"]", + output = "text", + text = [["Ah, you have recovered the Amulet, %p. Well done! + +"Now, you should know that you must travel through the Elemental Planes +to the Astral, and there return the Amulet to %d. Go forth and +may our prayers be as a wind upon your back."]], + }, + killed_nemesis = { + synopsis = "[%nC curses you as %nh dies.]", + output = "text", + text = [[The battered body of %n slumps to the ground and gasps +out one last curse: + + "You have defeated me, %p, but I shall have my revenge. + How, I shall not say, but this curse shall be like a cancer + on you." + +With that %n dies.]], + }, + leader_first = { + synopsis = "[%l is weak from the struggle with %n. %lH wants to examine you.]", + output = "text", + text = [[Feebly, %l raises %lj head to look at you. + +"It is good to see you again, %p. I see the concern in your +eyes, but do not worry for me. I am not ready for Hades yet. We have +exhausted much of our healing powers holding off %n. +I need your fresh strength to carry on our work. + +"Come closer and let me lay hands on you, and determine if you have +the skills necessary to accomplish this mission."]], + }, + leader_last = { + synopsis = "[You are a failure as a healer.]", + output = "text", + text = [["You have failed us, %p. You are a quack! A charlatan! + +"Hades will be happy to hear that you are once again practicing your +arts on the unsuspecting."]], + }, + leader_next = { + text = [["Again you return to me, %p. I sense that each trip back +the pleurisy and maladies of our land begin to infect you. Let us +hope and pray to %d that you become ready for your task before +you fall victim to the bad humors."]], + }, + leader_other = { + text = [["Chiron has fallen, Hermes has fallen, what else must I tell you to +impress upon you the importance of your mission! I hope that you +have come prepared this time."]], + }, + locate_first = { + synopsis = "[You have reached %i but all is not well.]", + output = "text", + text = [[You stand before the entrance to %i. Strange +scratching noises come from within the building. + +The swampy ground around you seems to stink with disease.]], + }, + locate_next = { + text = "Once again you stand at the entrance to %i.", + }, + nemesis_first = { + synopsis = "[\"I will take your life, then defeat %l.\"]", + output = "text", + text = [["They have made a mistake in sending you, %p. + +"When I add your youth to mine, it will just make it easier for me +to defeat %l."]], + }, + nemesis_next = { + text = "\"Unlike your patients, you seem to keep coming back, %p!\"", + }, + nemesis_other = { + text = "\"Which would you like, %p? Boils, pleurisy, convulsions?\"", + }, + nemesis_wantsit = { + text = [["I'll have %o back from you, %r. You are +not going to live to escape this place."]], + }, + nexttime = { + text = [[After your last experience you expected to be here, but you certainly +did not expect to see things so much worse. This time you must succeed.]], + }, + offeredit = { + synopsis = "[%l touches %o and tells %lj %gP to do so too, then tells you to take it with you.]", + output = "text", + text = [[As soon as %l sees %o %lh summons %lj +%gP. + +Gently, %l reaches out and touches %o. +He instructs each of the assembled to do the same. When everyone +has finished %lh speaks to you. + + "Now that we have been replenished we can defeat this plague. You must + take %o with you and replenish the worlds you have + been called upon to travel next. I wish you could ride Chiron to the + end of your journey, but I need him to help me spread the cure. Go + now and continue your journey."]], + }, + offeredit2 = { + synopsis = "[%l tells you to keep %o and return to %Z to search for the Amulet.]", + output = "text", + text = [[%l cautiously handles %o while watching you. + +"You are its keeper now, and the time has come to resume your search +for the Amulet. %Z await your return through the +magic portal which brought you here."]], + }, + othertime = { + text = [[Again, you %x %H in the distance. + +The smell of death and disease permeates the air. You do not have +to be %Ra to know that %n is on the verge of victory.]], + }, + posthanks = { + text = [["You have again returned to us, %p. We have done well in your +absence, yes? How fare you upon your quest for the Amulet?"]], + }, + }, + Kni = { + assignquest = { + synopsis = "[Pass through %i to reach %n. Destroy %ni and return with %o.]", + output = "text", + text = [["Ah, %p. Thou art truly ready, as no %c before thee hath +been. Hear now Our words: + +"As thou noticed as thou approached %H, a great battle hath +been fought recently in these fields. Know thou that Merlin himself +came to aid Us here as We battled the foul %n. In the midst of that +battle, %n struck Merlin a great blow, felling him. Then, as Our +forces were pressed back, %n stole %o. + +"We eventually turned the tide, but lost many %cP in doing so. +Merlin was taken off by his apprentice, but hath not recovered. We have +been told that so long as %n possesseth %o, +Merlin will not regain his health. + +"We hereby charge thee with this most important of duties: + +"Go forth from this place, to the fens, and there thou wilt find +%i. From there, thou must track down %n. Destroy the +beast, and return to Us %o. Only then can +We restore Merlin to health."]], + }, + badalign = { + synopsis = "[Go and do penance. Return when you are truly %a.]", + output = "text", + text = [["Thou dishonourest Us, %p! Thou hast strayed from the path of +chivalry! Go from Our presence and do penance. Only when thou art again +pure mayst thou return hence."]], + }, + badlevel = { + synopsis = "[You are not prepared to face %n. Return when you are %Ra.]", + output = "text", + text = [["Verily, %p, thou hast done well. That thou hast survived thus +far is a credit to thy valor, but thou art yet unprepared for +the demands required as Our Champion. %rA, no matter how +pure, could never hope to defeat the foul %n. + +"Journey forth from this place, and hone thy skills. Return to +Our presence when thou hast attained the noble title of %R."]], + }, + discourage = { + "\"A mere %r can never withstand me!\"", + "\"I shall kill thee now, and feast!\"", + "\"Puny %c. What manner of death dost thou wish?\"", + "\"First thee, %p, then I shall feast upon %l.\"", + "\"Hah! Thou hast failed, %r. Now thou shalt die.\"", + "\"Die, %c. Thou art as nothing against my might.\"", + "\"I shall suck the marrow from thy bones, %c.\"", + "\"Let's see... Baked? No. Fried? Nay. Broiled? Yea verily, that is the way I like my %c for dinner.\"", + "\"Thy strength waneth, %p. The time of thy death draweth near.\"", + "\"Call upon thy precious %d, %p. It shall not avail thee.\"", + }, + encourage = { + "\"Remember, %p, follow always the path of %d.\"", + "\"Though %n is verily a mighty foe, We have confidence in thy victory.\"", + "\"Beware, for %n hath surrounded %niself with hordes of foul creatures.\"", + "\"Great treasure, 'tis said, is hoarded in the lair of %n.\"", + "\"If thou possessest %o, %p, %ns magic shall therewith be thwarted.\"", + "\"The gates of %i are guarded by forces unseen, %p. Go carefully.\"", + "\"Return %o to Us quickly, %p.\"", + "\"Destroy %n, %p, else %H shall surely fall.\"", + "\"Call upon %d when thou art in need.\"", + "\"To find %i, thou must keep thy heart pure.\"", + }, + firsttime = { + synopsis = "[Signs of battle include long gouges in the walls of %H.]", + output = "text", + text = [[You materialize in the shadows of %H. Immediately, you notice +that something is wrong. The fields around the castle are trampled and +withered, as if some great battle has been recently fought. + +Exploring further, you %x long gouges in the walls of %H. +You know of only one creature that makes those kinds of marks...]], + }, + goal_first = { + synopsis = "[You %x the entrance to a cavern inside a hill.]", + output = "text", + text = [[As you exit the swamps, you %x before you a huge, gaping hole in the +side of a hill. From within, you smell the foul stench of carrion. + +The pools on either side of the entrance are fouled with blood, and +pieces of rusted metal and broken weapons show above the surface.]], + }, + goal_next = { + text = "Again, you stand at the entrance to %ns lair.", + }, + gotit = { + synopsis = "[You feel the magic of %o.]", + output = "text", + text = [[As you pick up %o, you feel its protective fields +form around your body. You also feel a faint stirring in your mind, as +if you are in two places at once, and in the second, you are waking from +a long sleep.]], + }, + guardtalk_after = { + "\"Hail, %p! Verily, thou lookest well.\"", + "\"So, %p, didst thou find %n in the fens near %i?\"", + "\"Worthy %p, hast thou proven thy right purpose on the body of %n?\"", + "\"Verily, %l could have no better champion, %p.\"", + "\"Hast thou indeed recovered %o?\"", + }, + guardtalk_before = { + "\"Hail, %p! Verily, thou lookest well.\"", + "\"There is word, %p, that %n hath been sighted in the fens near %i.\"", + "\"Thou art our only hope now, %p.\"", + "\"Verily, %l could have no better champion, %p.\"", + "\"Many brave %cP died when %n attacked.\"", + }, + hasamulet = { + synopsis = "[Take the Amulet to the Astral Plane and deliver it to %d.]", + output = "text", + text = [["Thou hast succeeded, We see, %p! Now thou art commanded to take +the Amulet to be sacrificed to %d in the Plane of the Astral. + +"Merlin hath counseled Us that thou must travel always upwards through +the Planes of the Elements, to achieve this goal. + +"Go with %d, %p."]], + }, + killed_nemesis = { + synopsis = "[%nC curses you as %nh dies.]", + output = "text", + text = [[As %n sinks to the ground, blood gushing from %nj open mouth, %nh +defiantly curses you and %l: + + "Thou hast not won yet, %r. By the gods, I shall return + and dog thy steps to the grave!" + +%nJ tail flailing madly, %n tries to crawl towards you, but slumps +to the ground and dies in a pool of %nj own blood.]], + }, + leader_first = { + synopsis = "[%lC checks whether you are ready for a great undertaking.]", + output = "text", + text = [["Ah, %p. We see thou hast received Our summons. +We are in dire need of thy prowess. But first, We must needs +decide if thou art ready for this great undertaking."]], + }, + leader_last = { + synopsis = "[You are a disgrace as %ca.]", + output = "text", + text = [["Thou disgracest this noble court with thine impure presence. We have been +lenient with thee, but no more. Thy name shall be spoken no more. We +hereby strip thee of thy title, thy lands, and thy standing as %ca. +Begone from Our sight!"]], + }, + leader_next = { + text = "\"Welcome again, %p. We hope thou art ready now.\"", + }, + leader_other = { + text = "\"Once again, thou standest before Us, %p. Art thou ready now?\"", + }, + locate_first = { + synopsis = "[You have reached %i and can %x a shrine.]", + output = "text", + text = [[You stand at the foot of %i. Atop, you can %x a shrine. +Strange energies seem to be focused here, and the hair on the back of +your neck stands on end.]], + }, + locate_next = { + text = "Again, you stand at the foot of %i.", + }, + nemesis_first = { + synopsis = "[%nC taunts you and issues a threat against %H.]", + output = "text", + text = [["Hah! Another puny %c seeks death. I shall dine well tonight, +then tomorrow, %H shall fall!"]], + }, + nemesis_next = { + text = "\"Again, thou challengest me, %r? So be it. Thou wilt die here.\"", + }, + nemesis_other = { + text = "\"Thou art truly foolish, %r. I shall dispatch thee anon.\"", + }, + nemesis_wantsit = { + text = [["So, thou darest touch MY property! I shall have that bauble back, +puny %r. Thou wilt die in agony!"]], + }, + nexttime = { + text = "Once again you stand in the shadows of %H.", + }, + offeredit = { + synopsis = "[%oC is yours now. It will aid in your search for the Amulet.]", + output = "text", + text = [[As you approach %l, %lh beams at you and says: + + "Well done! Thou art truly the Champion of %H. We + have received word that Merlin is recovering, and shall soon + rejoin Us. + + "He hath instructed Us that thou art now to be the guardian of + %o. He feeleth that thou mayst have need of + its powers in thine adventures. It is Our wish that thou keepest + %o with thee as thou searchest for the fabled + Amulet of Yendor."]], + }, + offeredit2 = { + synopsis = "[You are the keeper of %o. Return to %Z and find the Amulet.]", + output = "text", + text = [["Careful, %p! %oC might break, and that would +be a tragic loss. Thou art its keeper now, and the time hath come +to resume thy search for the Amulet. %Z await thy +return through the magic portal that brought thee here."]], + }, + othertime = { + text = [[Again, you stand before %H. You vaguely sense that this +may be the last time you stand before %l.]], + }, + posthanks = { + text = "\"Well met, %p. How goeth thy search for the Amulet of Yendor?\"", + }, + }, + Mon = { + assignquest = { + synopsis = "[Find %i, then continue to %ns lair. Defeat %ni and return with %o.]", + output = "text", + text = [["Yes, %p. You are truly ready now. Attend to me and I shall +tell you of what has transpired: + +"During one of the Great Meditations a short time ago, %n and +a legion of elementals invaded %H. Many %gP +were killed, including the one bearing %o. + +Now, there are barely enough %gP left to keep the elementals +at bay. + +"We need you to find %i, then, from there, +travel to %ns lair. If you can manage to defeat %n and +return %o here, we can then drive off the legions +of elementals that slay our students. + +"Go with %d as your guide, %p."]], + }, + badalign = { + synopsis = "[You must atone. Come back when you are worthy of %d.]", + output = "text", + text = [["This is terrible, %p. You have deviated from the true path! +You know that %d requires the most strident devotion of this +order. The %shood must stand for utmost piety. + +"Go from here, atone for your sins against %d. Return only when +you have purified yourself."]], + }, + badlevel = { + synopsis = "[You are not ready to face %n. Come back when you are %Ra.]", + output = "text", + text = [["Alas, %p, it is not yet to be. A mere %r could never +withstand the might of %n. Go forth, again into the world, and +return when you have attained the post of %R."]], + }, + discourage = { + "\"Submit to my will, %c, and I shall spare you.\"", + "\"Your puny powers are no match for me, %c.\"", + "\"I shall have you turned into a zombie for my pleasure!\"", + "\"Despair now, %r. %d cannot help you.\"", + "\"I shall feast upon your soul for many days, %c.\"", + "\"Your death will be slow and painful. That I promise!\"", + "\"You cannot defeat %n, you fool. I shall kill you now.\"", + "\"Your precious %lt will be my next victim.\"", + "\"I feel your powers failing you, %r. You shall die now.\"", + "\"With %o, nothing can stand in my way.\"", + }, + encourage = { + "\"You can prevail, if you rely on %d.\"", + "\"Remember that %n has great magic at his command.\"", + "\"Be pure, my %S.\"", + "\"Beware, %i is surrounded by hordes of earth elementals.\"", + "\"Remember your studies, and you will prevail!\"", + "\"Acquire and wear %o if you can. They will aid you against %n.\"", + "\"Call upon %d when your need is greatest. You will be answered.\"", + "\"Remember to use the elementals' strength against them!\"", + "\"Do not lose faith, %p. If you do so, %n will grow stronger.\"", + "\"Wear %o. They will assist you in your efforts.\"", + }, + firsttime = { + synopsis = "[You have reached %H but something is wrong. %lC needs your aid.]", + output = "text", + text = [[You find yourself standing in sight of %H. +Something is obviously wrong here. Strange shapes lumber around +outside %H! + +You realize that the %l needs your assistance!]], + }, + goal_first = { + synopsis = "[You are surrounded by brimstone, lava, and elementals.]", + output = "text", + text = [[The stench of brimstone is all about you, and the elementals close in +from all sides! + +Ahead, there is a small clearing amidst the bubbling pits of lava...]], + }, + goal_next = { + text = "Again, you have invaded %ns domain.", + }, + gotit = { + synopsis = "[You feel the essence of %d and realize that you should take %o to %l.]", + output = "text", + text = [[As you pick up %o, you feel the essence of +%d fill your soul. You know now why %n stole %oi from +%H, for with %oi, %ca of %d could +easily defeat his plans. + +You sense a message from %d. Though not verbal, you +get the impression that you must return to %l as soon +as possible.]], + }, + guardtalk_after = { + "\"Greetings, honorable %r. It is good to see you again.\"", + "\"Ah, %p! Our deepest gratitude for all of your help.\"", + "\"Greetings, %s. Perhaps you will take some time to meditate with us?\"", + "\"With this test behind you, may %d bring you enlightenment.\"", + "\"May %d be with you, %s.\"", + }, + guardtalk_before = { + "\"Greetings, honorable %r. It is good to see you.\"", + "\"Ah, %p! Surely you can help us in our hour of need.\"", + "\"Greetings, %s. %lC has great need of your help.\"", + "\"Alas, it seems as if even %d has deserted us.\"", + "\"May %d be with you, %s.\"", + }, + hasamulet = { + synopsis = "[Take the Amulet to the Astral Plane and deliver it to %d.]", + output = "text", + text = [["You have prevailed, %p! %d is surely with you. Now, +you must take the Amulet, and sacrifice it on %ds altar on +the Astral Plane. I suspect that I shall never see you again in this +life, but I hope to at %ds feet."]], + }, + killed_nemesis = { + synopsis = "[As %n dies, %nh threatens to return.]", + output = "text", + text = [[%nC gasps: + + "You have only defeated this mortal body. Know this: my spirit + is strong. I shall return and reclaim what is mine!" + +With that, %n expires.]], + }, + leader_first = { + synopsis = "[%lC checks whether you are ready for the great challenge.]", + output = "text", + text = [["Ah, %p, my %S. You have returned to us at last. +A great blow has befallen our order; perhaps you can help us. +First, however, I must determine if you are prepared for this +great challenge."]], + }, + leader_last = { + synopsis = "[You are a heretic and have failed utterly.]", + output = "text", + text = [["You are a heretic, %p! How can you, %ra, deviate so from the +teachings of %d? Begone from this temple. You are no longer +%sa to this order. We will pray to %d for other assistance, +as you have failed us utterly."]], + }, + leader_next = { + text = "\"Again, my %S, you stand before me. Are you ready now to help us?\"", + }, + leader_other = { + text = "\"Once more, %p, you stand within the sanctum. Are you ready now?\"", + }, + locate_first = { + synopsis = "[You have reached %i. %nC lurks further ahead.]", + output = "text", + text = [[You remember the descriptions of %i, given +to you by the %l. It is ahead that you will find +%n's trail.]], + }, + locate_next = { + text = "Again, you stand before %i.", + }, + nemesis_first = { + synopsis = "[You are no %g. You shall never regain %o.]", + output = "text", + text = [["Ah, so %l has sent another %g to retrieve +%o. + +"No, I see you are no %g. Perhaps I shall have some fun today +after all. Prepare to die, %r! You shall never regain +%o."]], + }, + nemesis_next = { + text = "\"So, %r. Again you challenge me.\"", + }, + nemesis_other = { + text = "\"Die now, %r. %d has no power here to aid you.\"", + }, + nemesis_wantsit = { + text = "\"You shall die, %r, and I will have %o back.\"", + }, + nexttime = { + text = "Once again, you stand before %H.", + }, + offeredit = { + synopsis = "[Keep %o. %oH will help you recover the Amulet of Yendor.]", + output = "text", + text = [["You have returned, %p. And with %o, I see. +Congratulations. + +"I have been in meditation, and have received direction from +a minion of %d. %d commands that you retain +%o. With %oi, you must recover the Amulet +of Yendor. + +"Go forth, and let %d guide your steps."]], + }, + offeredit2 = { + synopsis = "[Keep %o and return to %Z to search for the Amulet.]", + output = "text", + text = [[%lC studies %o for a moment, +then returns his gaze to you. + +"%oC must remain with you. Use %oi +as you resume your search for the Amulet. +%Z await your return through the magic portal +that brought you here."]], + }, + othertime = { + text = [[Again you face %H. Your intuition hints that this +may be the final time you come here.]], + }, + posthanks = { + text = "\"Welcome back, %p. How is your quest for the Amulet going?\"", + }, + }, + Pri = { + assignquest = { + synopsis = "[%nC invaded %H and captured %o. Defeat %ni and retrieve %oh.]", + output = "text", + text = [["Yes, %p. You are truly ready now. Attend to me and I shall +tell you of what has transpired: + +"At one of the Great Festivals a short time ago, %n and a legion +of undead invaded %H. Many %gP were killed, including +the one carrying %o. + +"As a final act of vengefulness, %n desecrated the altar here. +Without it, we could not mount a counter-attack. Now, there are +barely enough %gP left to keep the undead at bay. + +"We need you to find %i, then, from there, travel +to %ns lair. If you can manage to defeat %n and return +%o here, we can then drive off the legions of +undead that befoul the land. + +"Go with %d as your guide, %p."]], + }, + badalign = { + synopsis = "[You have deviated from the path. Return when you have purified yourself.]", + output = "text", + text = [["This is terrible, %p. You have deviated from the true path! +You know that %d requires the most strident devotion of this +order. The %shood must stand for utmost piety. + +"Go from here, atone for your sins against %d. Return only when +you have purified yourself."]], + }, + badlevel = { + synopsis = "[%rA cannot withstand %n. Come back when you are %Ra.]", + output = "text", + text = [["Alas, %p, it is not yet to be. A mere %r could never +withstand the might of %n. Go forth, again into the world, and return +when you have attained the post of %R."]], + }, + discourage = { + "\"Submit to my will, %c, and I shall spare you.\"", + "\"Your puny powers are no match for me, %c.\"", + "\"I shall have you turned into a zombie for my pleasure!\"", + "\"Despair now, %r. %d cannot help you.\"", + "\"I shall feast upon your soul for many days, %c.\"", + "\"Your death will be slow and painful. That I promise!\"", + "\"You cannot defeat %n, you fool. I shall kill you now.\"", + "\"Your precious %lt will be my next victim.\"", + "\"I feel your powers failing you, %r. You shall die now.\"", + "\"With %o, nothing can stand in my way.\"", + }, + encourage = { + "\"You can prevail, if you rely on %d.\"", + "\"Remember that %n has great magic at his command.\"", + "\"Be pure, my %S.\"", + "\"Beware, %i is surrounded by a great graveyard.\"", + "\"You may be able to affect %n with magical cold.\"", + "\"Acquire and wear %o if you can. It will aid you against %n.\"", + "\"Call upon %d when your need is greatest. You will be answered.\"", + "\"The undead legions are weakest during the daylight hours.\"", + "\"Do not lose faith, %p. If you do so, %n will grow stronger.\"", + "\"Wear %o. It will assist you against the undead.\"", + }, + firsttime = { + synopsis = "[You are at %H; the doors are closed. %lC needs your help!]", + output = "text", + text = [[You find yourself standing in sight of %H. Something +is obviously wrong here. The doors to %H, which usually +stand open, are closed. Strange human shapes shamble around +outside. + +You realize that %l needs your assistance!]], + }, + goal_first = { + synopsis = "[The stench of brimstone surrounds you, the shrieks and moans are endless.]", + output = "text", + text = [[The stench of brimstone is all about you, and the shrieks and moans +of tortured souls assault your psyche. + +Ahead, there is a small clearing amidst the bubbling pits of lava...]], + }, + goal_next = { + text = "Again, you have invaded %ns domain.", + }, + gotit = { + synopsis = "[You feel %d as you pick up %o; return %oh to %l.]", + output = "text", + text = [[As you pick up %o, you feel the essence of +%d fill your soul. You know now why %n stole it from +%H, for with it, %ca of %d could +easily defeat his plans. + +You sense a message from %d. Though not verbal, you +get the impression that you must return to %l as soon +as possible.]], + }, + guardtalk_after = { + "\"Greetings, %r. It is good to see you again.\"", + "\"Ah, %p! Our deepest gratitude for all of your help.\"", + "\"Welcome back, %s! With %o, no undead can stand against us.\"", + "\"Praise be to %d, for delivering us from %n.\"", + "\"May %d be with you, %s.\"", + }, + guardtalk_before = { + "\"Greetings, honored %r. It is good to see you.\"", + "\"Ah, %p! Surely you can help us in our hour of need.\"", + "\"Greetings, %s. %lC has great need of your help.\"", + "\"Alas, it seems as if even %d has deserted us.\"", + "\"May %d be with you, %s.\"", + }, + hasamulet = { + synopsis = "[Take the Amulet to the Astral Plane and offer it on %ds altar.]", + output = "text", + text = [["You have prevailed, %p! %d is surely with you. Now, +you must take the amulet, and sacrifice it on %ds altar on +the Astral Plane. I suspect that I shall never see you again in this +life, but I hope to at %ds feet."]], + }, + killed_nemesis = { + synopsis = "[%nC dies. Moloch is aware of you and angry at %n.]", + output = "text", + text = [[You feel a wrenching shift in the ether as %ns body dissolves +into a cloud of noxious gas. + +Suddenly, a voice booms out: + + "Thou hast defeated the least of my minions, %r. + Know now that Moloch is aware of thy presence. + As for thee, %n, I shall deal with thy failure + at my leisure." + +You then hear the voice of %n, screaming in terror...]], + }, + leader_first = { + synopsis = "[You have returned and we need your help. Are you ready?]", + output = "text", + text = [["Ah, %p, my %S. You have returned to us at last. +A great blow has befallen our order; perhaps you can help us. +First, however, I must determine if you are prepared for this +great challenge."]], + }, + leader_last = { + synopsis = "[You are a heretic who has deviated from the teachings of %d.]", + output = "text", + text = [["You are a heretic, %p! How can you, %ra, deviate so from the +teachings of %d? Begone from this temple. You are no longer +%sa to this order. We will pray to %d for other assistance, +as you have failed us utterly."]], + }, + leader_next = { + text = "\"Again, my %S, you stand before me. Are you ready now to help us?\"", + }, + leader_other = { + text = "\"Once more, %p, you stand within the sanctum. Are you ready now?\"", + }, + locate_first = { + synopsis = "[You have found %i. The trail to %n lies ahead.]", + output = "text", + text = [[You stand facing a large graveyard. The sky above is filled with clouds +that seem to get thicker closer to the center. You sense the presence of +undead in larger numbers than you have ever encountered before. + +You remember the descriptions of %i, given to you by +%l. It is ahead that you will find %ns trail.]], + }, + locate_next = { + text = "Again, you stand before %i.", + }, + nemesis_first = { + synopsis = "[%lC has sent you, but you are no %gC. I shall destroy you.]", + output = "text", + text = [["Ah, so %l has sent another %gC to retrieve +%o. + +"No, I see you are no %gC. Perhaps I shall have some fun today +after all. Prepare to die, %r! You shall never regain +%o."]], + }, + nemesis_next = { + text = "\"So, %r. Again you challenge me.\"", + }, + nemesis_other = { + text = "\"Die now, %r. %d has no power here to aid you.\"", + }, + nemesis_wantsit = { + text = "\"You shall die, %r, and I will have %o back.\"", + }, + nexttime = { + text = "Once again, you stand before %H.", + }, + offeredit = { + synopsis = "[Congratulations, %p. Keep %o; go and recover the Amulet.]", + output = "text", + text = [["You have returned, %p. And with %o, I see. +Congratulations. + +"I have been in meditation, and have received direction from +a minion of %d. %d commands that you retain +%o. With it, you must recover the Amulet +of Yendor. + +"Go forth, and let %d guide your steps."]], + }, + offeredit2 = { + synopsis = "[%oC is yours now. Return to %Z and find the Amulet.]", + output = "text", + text = [[%lC reiterates that %o is yours now. + +"The time has come to resume your search for the Amulet. +%Z await your return through the magic portal +that brought you here."]], + }, + othertime = { + text = [[Again you face %H. Your intuition hints that this may be +the final time you come here.]], + }, + posthanks = { + text = "\"Welcome back, %p. How is your quest for the Amulet going?\"", + }, + }, + Ran = { + assignquest = { + synopsis = "[%nC has stolen %o. Infiltrate %i and retrieve %oh for us.]", + output = "text", + text = [["You are indeed ready, %p. I shall tell you what has transpired, +and why we so desperately need your help: + +"A short time ago, the mountain centaurs to the east invaded +and enslaved the plains centaurs in this area. The local +leader is now only a figurehead, and serves %n. + +"During our last gathering of worship here, we were beset by hordes of +hostile centaurs, as you witnessed. In the first onslaught a group, +headed by %n %niself, managed to breach the grove and steal +%o. + +"Since then, we have been besieged. We do not know how much longer +we will be able to maintain our magical barriers. + +"If we are to survive, you, %p, must infiltrate +%i. There, you will find a pathway down, to the +underground cavern of %n. He has always coveted +%o, and will surely keep it. + +"Recover %o for us, %p! Only then will %d be safe."]], + }, + badalign = { + synopsis = "[You are not sufficiently %a. Come back when you have purified yourself.]", + output = "text", + text = [["You have strayed, %p! You know that %d requires that +we maintain a pure devotion to things %a! + +"You must go from us. Return when you have purified yourself."]], + }, + badlevel = { + synopsis = "[You are too inexperienced. Come back when you are %Ra.]", + output = "text", + text = [["%p, you are yet too inexperienced to withstand the demands of that +which we need you to do. %RA might just be able to do this thing. + +"Return to us when you have learned more, my %S."]], + }, + discourage = { + "\"Your %d is nothing, %c. You are mine now!\"", + "\"Run away little %c! You can never hope to defeat %n!\"", + "\"My servants will rip you to shreds!\"", + "\"I shall display your head as a trophy. What do you think about that wall?\"", + "\"I shall break your %ls grove, and destroy all the %gP!\"", + "\"%d has abandoned you, %c. You are doomed.\"", + "\"%rA? %lC sends a mere %r against me? Hah!\"", + "\"%lC has failed, %c. %oC will never leave here.\"", + "\"You really think you can defeat me, eh %c? You are wrong!\"", + "\"You weaken, %c. I shall kill you now.\"", + }, + encourage = { + "\"It is rumored that the Forest and Mountain Centaurs have resolved their ancient feud and now band together against us.\"", + "\"%nC is strong, and very smart.\"", + "\"Use %o, when you find it. It will help you survive to reach us.\"", + "\"Remember, let %d be your guide.\"", + "\"Call upon %d when you face %n. The very act of doing so will infuriate him, and give you advantage.\"", + "\"%n and his kind have always hated us.\"", + "\"We cannot hold the grove much longer, %p. Hurry!\"", + "\"To infiltrate %i, you must be very stealthy.\"", + "\"Remember that %n is a braggart. Trust not what he says.\"", + "\"You can triumph, %p, if you trust in %d.\"", + }, + firsttime = { + synopsis = "[The ancient forest grove is surrounded by centaurs.]", + output = "text", + text = [[You arrive in familiar surroundings. In the distance, you %x the +ancient forest grove, the place of worship to %d. + +Something is wrong, though. Surrounding the grove are centaurs! +And they've noticed you!]], + }, + goal_first = { + synopsis = "[You descend into a subterranean complex. Hooves clatter in the distance.]", + output = "text", + text = [[You descend into a weird place, in which roughly cut cave-like walls +join with smooth, finished ones, as if someone was in the midst of +finishing off the construction of a subterranean complex. + +Off in the distance, you hear a sound like the clattering of many +hooves on rock.]], + }, + goal_next = { + text = "Once again, you enter the distorted castle of %n.", + }, + gotit = { + synopsis = "[You pick up %o and feel power. It's time to return %oh to %l.]", + output = "text", + text = [[As you pick up %o, it seems to glow, and a warmth +fills you completely. You realize that its power is what has protected +your %sp against their enemies for so long. + +You must now return it to %l without delay -- their lives depend +on your speed.]], + }, + guardtalk_after = { + "\"%pC! I have not seen you in many moons. How do you fare?\"", + "\"Birdsong has returned to the grove, surely this means you have defeated %n.\"", + "\"%lC seems to have regained some of his strength.\"", + "\"So, tell us how you entered %i, in case some new evil arises there.\"", + "\"Is that truly %o that I see you carrying?\"", + }, + guardtalk_before = { + "\"%pC! I have not seen you in many moons. How do you fare?\"", + "\"%nC continues to threaten the grove. But we hold fast.\"", + "\"%lC is growing weak. The magic required to defend the grove drains us.\"", + "\"Remember %i is hard to enter. Beware the distraction of leatherwings.\"", + "\"We must regain %o. Without it we will be overrun.\"", + }, + hasamulet = { + synopsis = "[You have the Amulet! Take it to the Astral Plane and offer it to %d.]", + output = "text", + text = [["You have it! You have recovered the Amulet of Yendor! +Now attend to me, %p, and I will tell you what must be done: + +"The Amulet has within it magic, the capability to transport you to +the Astral Plane, where the primary circle of %d resides. + +"To activate this magic, you must travel upwards as far as you can. +When you reach the temple, sacrifice the Amulet to %d. + +"Thus will you fulfill your destiny."]], + }, + killed_nemesis = { + synopsis = "[%nC curses you as %nh dies.]", + output = "text", + text = [[%nC collapses to the ground, cursing you and %l, then says: + + "You have defeated me, %r! But I curse you one final time, with + my dying breath! You shall die before you leave my castle!"]], + }, + leader_first = { + synopsis = "[You have returned, %p. We need your help. Are you ready?]", + output = "text", + text = [["%pC! You have returned! Thank %d. + +"We have great need of you. But first, I must see if you have the +required abilities to take on this responsibility."]], + }, + leader_last = { + synopsis = "[You are not sufficiently %a. We renounce your %shood.]", + output = "text", + text = [["%pC! You have doomed us all. You fairly radiate %L influences +and weaken the power we have raised in this grove as a result! + +"Begone! We renounce your %shood with us! You are an outcast now!"]], + }, + leader_next = { + text = "\"Once again, %p, you stand in our midst. Are you ready now?\"", + }, + leader_other = { + text = "\"Ah, you are here again, %p. Allow me to determine your readiness...\"", + }, + locate_first = { + synopsis = "[This is %i. There are bats nearby. Beware the wumpus!]", + output = "text", + text = [[This must be %i. + +You are in a cave built of many different rooms, all interconnected +by tunnels. Your quest is to find and shoot the evil wumpus that +resides elsewhere in the cave without running into any bottomless +pits or using up your limited supply of arrows. Good luck. + +You are in room 9 of the cave. There are tunnels to rooms +5, 8, and 10. +*rustle* *rustle* (must be bats nearby.) +*sniff* (I can smell the evil wumpus nearby!)]], + }, + locate_next = { + synopsis = "[You are in %i. There are pits. There are bats nearby.]", + output = "text", + text = [[Once again, you descend into %i. + +*whoosh* (I feel a draft from some pits.) +*rustle* *rustle* (must be bats nearby.)]], + }, + nemesis_first = { + synopsis = "[You have come to recover %o, but I shall keep %oh and you shall die.]", + output = "text", + text = [["So, %c. %lC has sent you to recover %o. + +"Well, I shall keep that bauble. It pleases me. You, %c, shall die."]], + }, + nemesis_next = { + text = "\"Back again, eh? Well, a mere %r is no threat to me! Die, %c!\"", + }, + nemesis_other = { + text = "\"You haven't learned your lesson, %c. You can't kill me! You shall die now.\"", + }, + nemesis_wantsit = { + text = [["I shall have %o from you, %r. Then I shall +kill you."]], + }, + nexttime = { + text = "Once again, you stand before %H.", + }, + offeredit = { + synopsis = "[You have succeeded. Take %o with you as you go to find the Amulet.]", + output = "text", + text = [["%pC! You have succeeded! I feared it was not possible! + +"You have returned with %o! + +"I fear, now, that the Centaurs will regroup and plot yet another raid. +This will take some time, but if you can recover the Amulet of Yendor +for %d before that happens, we will be eternally safe. + +"Take %o with you. It will aid in your quest for +the Amulet."]], + }, + offeredit2 = { + synopsis = "[You are the keeper of %o now. Go and find the Amulet.]", + output = "text", + text = [[%l flexes %o reverently. + +"With this wondrous bow, one need never run out of arrows. +You are its keeper now, and the time has come to resume your +search for the Amulet. %Z await your return +through the magic portal that brought you here."]], + }, + othertime = { + text = [[You have the oddest feeling that this may be the last time you +are to enter %H.]], + }, + posthanks = { + text = [["Welcome, %p. How have you fared on your quest for the Amulet +of Yendor?"]], + }, + }, + Rog = { + assignquest = { + synopsis = "[Get %o from %n and bring it to %l.]", + output = "text", + text = [["Will everyone not going to retrieve %o from that +jerk, %n, take one step backwards. Good choice, +%p, because I was going to send you anyway. My other %gp +are too valuable to me. + +"Here's the deal. I want %o, %n +has %o. You are going to get %o +and bring it back to me. So simple an assignment even you can understand +it."]], + }, + badalign = { + synopsis = "[Come back when you are really %a.]", + output = "text", + text = [["Maybe I should chain you to my perch here for a while. Perhaps watching +real %a men at work will bring some sense back to you. I don't +think I could stand the sight of you for that long though. Come back +when you can be trusted to act properly."]], + }, + badlevel = { + synopsis = "[%rA is not adequately trained to handle this job.]", + output = "text", + text = [["In the time that you've been gone you've only been able to master the +arts of %ra? I've trained ten times again as many %Rp +in that time. Maybe I should send one of them, no? Where would that +leave you, %p? Oh yeah, I remember, I was going to kill you!"]], + }, + discourage = { + "\"May I suggest a compromise. Are you interested in gold or gems?\"", + "\"Please don't force me to kill you.\"", + "\"Grim times are upon us all. Will you not see reason?\"", + "\"I knew %l, and you're no %lt, thankfully.\"", + "\"It is a shame that we are not meeting under more pleasant circumstances.\"", + "\"I was once like you are now, %p. Believe in me -- our way is better.\"", + "\"Stay with me, and I will make you %os guardian.\"", + "\"When you return, with or without %o, %l will have you killed.\"", + "\"Do not be fooled; I am prepared to kill to defend %o.\"", + "\"I can reunite you with the Twain. Oh, the stories you can swap.\"", + }, + encourage = { + "\"You don't seem to understand, %o isn't here so neither should you be!\"", + "\"May %d curse you with lead fingers. Get going!\"", + "\"We don't have all year. GET GOING!\"", + "\"How would you like a scar necklace? I'm just the jeweler to do it!\"", + "\"Lazy S.O.B. Maybe I should call up someone else...\"", + "\"Maybe I should open your skull and see if my instructions are inside?\"", + "\"This is not a task you can complete in the afterlife, you know.\"", + "\"Inside every living person is a dead person trying to get out, and I have your key!\"", + "\"We're almost out of hell-hound chow, so why don't you just get moving!\"", + "\"You know, %o isn't going to come when you whistle. You must get it yourself.\"", + }, + firsttime = { + synopsis = "[You are in Ransmannsby, where you trained. Find %l.]", + output = "text", + text = [[Unexpectedly, you find yourself back in Ransmannsby, where you trained to +be a thief. Quickly you make the guild sign, hoping that you AND word +of your arrival reach %ls den.]], + }, + goal_first = { + synopsis = "[You sense %o.]", + output = "text", + text = [[You feel a great swelling up of courage, sensing the presence of +%o. Or is it fear?]], + }, + goal_next = { + text = "The hairs on the back of your neck whisper -- it's fear.", + }, + gotit = { + synopsis = "[You pick up %o and know that %l should not have it.]", + output = "text", + text = [[As you pick up %o, the hairs on the back of your +neck fall out. At once you realize why %n was +willing to die to keep it out of %ls hands. Somehow +you know that you must do likewise.]], + }, + guardtalk_after = { + "\"I was sure wrong about Lady Tyvefelle's house; I barely got away with my life and lost my lock pick in the process.\"", + "\"You're back? Even the Twain don't come back anymore.\"", + "\"Can you spare an old cutpurse a zorkmid for some grog?\"", + "\"Fritz tried to join the other side, and now he's hell-hound chow.\"", + "\"Be careful what you steal, I hear the boss has perfected turning rocks into worthless pieces of glass.\"", + }, + guardtalk_before = { + "\"I hear that Lady Tyvefelle's household is lightly guarded.\"", + "\"You're back? Even the Twain don't come back anymore.\"", + "\"Can you spare an old cutpurse a zorkmid for some grog?\"", + "\"Fritz tried to join the other side, and now he's hell-hound chow.\"", + "\"Be careful what you steal, I hear the boss has perfected turning rocks into worthless pieces of glass.\"", + }, + hasamulet = { + synopsis = "[Take the Amulet to the Astral Plane and find %ds temple.]", + output = "text", + text = [["I see that with your abilities, and my brains, we could rule this world. + +"All that we would need to be all-powerful is for you to take that little +trinket you've got there up to the Astral Plane. From there, %d will +show you what to do with it. Once that's done, we will be invincible!"]], + }, + killed_nemesis = { + synopsis = "[Before dying, %n tells you to use the %o wisely.]", + output = "text", + text = [["I know what you are thinking, %p. It is not too late for you +to use %o wisely. For the sake of your guild +%sp, do what is right." + +You sit and wait for death to come for %n, and then you +brace yourself for your next meeting with %l!]], + }, + leader_first = { + synopsis = "[You owe back dues to your guild. You can pay them off if you're up to the job.]", + output = "text", + text = [["Well, look who it is boys -- %p has come home. You seem to have +fallen behind in your dues. I should kill you as an example to these +other worthless cutpurses, but I have a better plan. If you are ready +maybe you could work off your back dues by performing a little job for +me. Let us just see if you are ready..."]], + }, + leader_last = { + synopsis = "[You must go.]", + output = "text", + text = [["Well %gp, it looks like our friend has forgotten who is the boss +around here. Our friend seems to think that %rp have been put in +charge. Wrong. DEAD WRONG!" + +Your sudden shift in surroundings prevents you from hearing the end +of %ls curse.]], + }, + leader_next = { + synopsis = "[Are you stupid or are you ready?]", + output = "text", + text = [["Well, I didn't expect to see you back. It shows that you are either stupid, +or you are finally ready to accept my offer. Let us hope for your sake it +isn't stupidity that brings you back."]], + }, + leader_other = { + text = [["Did you perhaps mistake me for some other %lt? You must +think me as stupid as your behavior. I warn you not to try my patience."]], + }, + locate_first = { + text = "Those damn little hairs tell you that you are nearer to %o.", + }, + locate_next = { + text = "Not wanting to face %l without having stolen %o, you continue.", + }, + nemesis_first = { + text = "\"Ah! You must be %ls ... er, `hero'. A pleasure to meet you.\"", + }, + nemesis_next = { + text = "\"We meet again. Please reconsider your actions.\"", + }, + nemesis_other = { + synopsis = "[You cannot trust %l.]", + output = "text", + text = [["Surely, %p, you have learned that you cannot trust any bargains +that %l has made. I can show you how to continue on +your quest without having to run into him again."]], + }, + nemesis_wantsit = { + synopsis = "[%lC should not have %o.]", + output = "text", + text = [["Please, think for a moment about what you are doing. Do you truly +believe that %d would want %l to have +%o?"]], + }, + nexttime = { + text = [[Once again, you find yourself back in Ransmannsby. Fond memories are +replaced by fear, knowing that %l is waiting for you.]], + }, + offeredit = { + synopsis = "[Take %o with you and go.]", + output = "text", + text = [["Well, I'll be damned. You got it. I am proud of you, a fine %r +you've turned out to be. + +"While you were gone I got to thinking, you and %o +together could bring me more treasure than either of you apart, so why don't +you take it with you. All I ask is a cut of whatever loot you come by. +That is a better deal than I offered %n. + +"But, you see what happened to %n when he refused. +Don't make me find another to send after you this time."]], + }, + offeredit2 = { + synopsis = "[Take %o and acquire the Amulet.]", + output = "text", + text = [[%lC seems tempted to swap %o for +the mundane one you detect in his pocket, but noticing your alertness, +evidently chickens out. + +"Go filch the Amulet before someone else beats you to it. +%Z are back the way you came, through the magic portal."]], + }, + othertime = { + text = [[You rub your hands through your hair, hoping that the little ones on +the back of your neck stay down, and prepare yourself for your meeting +with %l.]], + }, + posthanks = { + synopsis = "[How about trading %o for something?]", + output = "text", + text = [["Quite the little thief, aren't we, %p. Can I interest you in a +swap for %o? Look around, anything in the keep +is yours for the asking."]], + }, + }, + Sam = { + assignquest = { + synopsis = "[You must enter %i, then regain %o from %n.]", + output = "text", + text = [["Domo %p-san, indeed you are ready. I can now tell you what +it is that I require of you. + +"The daimyo, %n, has betrayed us. He has stolen from us +%o and taken it to his donjon deep within +%i. + +"If I cannot show the emperor %o when he comes +for the festival he will know that I have failed in my duty, and +request that I commit seppuku. + +"You must gain entrance to %i and retrieve the +emperor's property. Be quick! The emperor will be here for the +cha-no-you in 5 sticks. + +"Wakarimasu ka?"]], + }, + badalign = { + synopsis = "[When you can think %a and act %a then return.]", + output = "text", + text = [["%p-san, you would do better to join the kyokaku. + +"You have skills, but until you can call upon the bushido to know when and +how to use them you are not samurai. When you can think %a and +act %a then return."]], + }, + badlevel = { + synopsis = "[\"I require %Ra to defeat %n. Return when you are ready.\"]", + output = "text", + text = [["%p-san, you have learned well and honored your family. +I require the skills of %Ra in order to defeat %n. +Go and seek out teachers. Learn what they have learned. When you +are ready, return to me."]], + }, + discourage = { + "\"Ahh, I finally meet the daimyo of the kyokaku!\"", + "\"There is no honor for me in your death.\"", + "\"You know that I cannot resash my swords until they have killed.\"", + "\"Your presence only compounds the dishonor of %l in not coming %liself.\"", + "\"I will make tea with your hair and serve it to %l.\"", + "\"Your fear shows in your eyes, coward!\"", + "\"I have not heard of you, %p-san; has your life been that unworthy?\"", + "\"If you will not obey me, you will die.\"", + "\"Kneel now and make the two cuts of honor. I will tell your %sp of your honorable death.\"", + "\"Your master was a poor teacher. You will pay for his mistakes in your teaching.\"", + }, + encourage = { + "\"To defeat %n you must overcome the seven emotions: hate, adoration, joy, anxiety, anger, grief, and fear.\"", + "\"Remember your honor is my honor, you perform in my name.\"", + "\"I will go to the temple and burn incense for your safe return.\"", + "\"Sayonara.\"", + "\"There can be honor in defeat, but no gain.\"", + "\"Your kami must be strong in order to succeed.\"", + "\"You are indeed a worthy %R, but now you must be a worthy samurai.\"", + "\"If you fail, %n will be like a tai-fun on the land.\"", + "\"If you are truly %a, %d will listen.\"", + "\"Sharpen your swords and your wits for the task before you.\"", + }, + firsttime = { + synopsis = "[The banner of %n flies above town. What has happened to %l?]", + output = "text", + text = [[Even before your senses adjust, you recognize the kami of +%H. + +You %x the standard of your teki, %n, flying above +the town. How could such a thing have happened? Why are ninja +wandering freely; where are the samurai of your daimyo, %l? + +You quickly say a prayer to Izanagi and Izanami and walk towards +town.]], + }, + goal_alt = { + text = "As you arrive once again at the home of %n.", + }, + goal_first = { + synopsis = "[You feel the taunts %n, but after offering a prayer to %d, you proceed.]", + output = "text", + text = [[In your mind, you hear the taunts of %n. + +You become like the rice plant and bend to the ground, offering a +prayer to %d. But when the wind has passed, you stand +proudly again. Putting your kami in the hands of fate, you advance.]], + }, + goal_next = { + text = [[As you arrive once again at the home of %n, your thoughts +turn only to %o.]], + }, + gotit = { + synopsis = "[You feel the power of %o and are humbled.]", + output = "text", + text = [[As you pick up %o, you feel the strength of its karma. +You realize at once why so many good samurai had to die to defend it. +You are humbled knowing that you hold one of the artifacts of the +sun goddess.]], + }, + guardtalk_after = { + "\"Come, join us in celebrating with some sake.\"", + "\"Ikaga desu ka?\"", + "\"You have brought our clan and %l much honor.\"", + "\"Please %r, sit for a while and tell us how you overcame the Ninja.\"", + "\"%lC still lives! You have saved us from becoming ronin.\"", + }, + guardtalk_before = { + "\"To succeed, you must walk like a butterfly on the wind.\"", + "\"Ikaga desu ka?\"", + "\"I fear for The Land of The Gods.\"", + "\"%nC has hired the Ninja -- be careful.\"", + "\"If %o is not returned, we will all be ronin.\"", + }, + hasamulet = { + synopsis = "[Take the Amulet to the Astral Plane to finish your task.]", + output = "text", + text = [["Ah, %p-sama. You have wasted your efforts returning home. +Now that you are in possession of the Amulet, you are honor-bound to +finish the quest you have undertaken. There will be plenty of time +for saki and stories when you have finished. + +"Go now, and may our prayers be a wind at your back."]], + }, + killed_nemesis = { + synopsis = "[%nC dies without honor.]", + output = "text", + text = [[Your healing skills tell you that %ns wounds are mortal. + +You know that the bushido tells you to finish him and let his kami +die with honor, but the thought of so many samurai dead due to this +man's dishonor prevents you from giving the final blow. + +You order that his unwashed head be given to the crows and his body +thrown into the sea.]], + }, + leader_first = { + synopsis = "[%lC needs someone to lead %lj samurai against %n. Are you ready?]", + output = "text", + text = [["Ah, %p-san, it is good to see you again. I need someone who can +lead my samurai against %n. If you are ready, you will be +that person."]], + }, + leader_last = { + synopsis = "[Leave and do not come back.]", + output = "text", + text = [["You are no longer my samurai, %p. + +"Hara-kiri is denied. You are ordered to shave your head and then to +become a monk. Your fief and family are forfeit. Wakarimasu ka?"]], + }, + leader_next = { + text = [["Once again, %p-san, you kneel before me. Are you yet capable of +being my vassal?"]], + }, + leader_other = { + synopsis = "[Are you truely a samurai?]", + output = "text", + text = [["You begin to test my matsu, %p-san. +If you cannot determine what I want in a samurai, how can I rely on you +to figure out what I need from a samurai?"]], + }, + locate_first = { + text = [[You instinctively reach for your swords. You do not recognize the +lay of this land, but you know that your teki are everywhere.]], + }, + locate_next = { + text = [[Thankful that your %sp at %H cannot see +your fear, you prepare again to advance.]], + }, + nemesis_first = { + text = [["Ah, so it is to be you, %p-san. I offer you seppuku. +I will be your second if you wish."]], + }, + nemesis_next = { + text = [["I have offered you the honorable exit. Now I will have your +head to send unwashed to %l."]], + }, + nemesis_other = { + text = "\"After I have dispatched you, I will curse your kami.\"", + }, + nemesis_wantsit = { + text = [["You have fought my samurai; surely you must know that you +will not be able to take %o back to +%H."]], + }, + nexttime = { + text = "Once again, you are back at %H.", + }, + offeredit = { + synopsis = "[The emperor wants you to take %o and recover the Amulet.]", + output = "text", + text = [[As you bow before %l, he welcomes you: + + "You have brought your family great honor, %p-sama. + + "While you have been gone the emperor's advisors have discovered in + the ancient texts that the karma of the samurai who seeks to recover + the Amulet and the karma of %o are joined + as the seasons join to make a year. + + "Because you have shown such fidelity, the emperor requests + that you take leave of other obligations and continue on the + road that fate has set your feet upon. I would consider it + an honor if you would allow me to watch your household until + you return with the Amulet." + +With that, %l bows, and places his sword atop +%o.]], + }, + offeredit2 = { + synopsis = "[Take %o, return to %Z, and recover the Amulet.]", + output = "text", + text = [[%l holds %o tightly for a moment, then returns +his gaze to you. + +"The time is ripe to recover the Amulet. Return to %Z +through the magic portal that transported you here so that you may +achieve the destiny which awaits you."]], + }, + othertime = { + synopsis = "[%HC is threatened by %n.]", + output = "text", + text = [[You are back at %H. + +Instantly you sense a subtle change in your karma. You seem to know that +if you do not succeed in your quest, %n will have destroyed +the kami of %H before you return again.]], + }, + posthanks = { + text = "%lC bows. \"%p-sama, tell us of your search for the Amulet.\"", + }, + }, + Tou = { + assignquest = { + synopsis = "[Enter %i and recover %o from %n.]", + output = "text", + text = [["You have indeed proven yourself a worthy %c, %p. + +"But now your kinfolk and I must ask you to put aside your travels and +help us in our time of need. After you left us we elected a new mayor, +%n. He proved to be a most heinous and vile creature. + +"Soon after taking office he absconded with %o +and fled town, leaving behind his henchmen to rule over us. In order +for us to regain control of our town, you must enter %i +and recover %o. + +"Do not be distracted on your quest. If you do not return quickly I fear +that all will be lost. Let us both pray now that %d will guide you +and keep you safe."]], + }, + badalign = { + synopsis = "[You are not sufficiently %a. Return when you are.]", + output = "text", + text = [["It would be an affront to %d to have one not true to the +%a path undertake her bidding. + +"You must not return to us until you have purified yourself of these +bad influences on your actions. Remember, only by following the %a +path can you hope to overcome the obstacles you will face."]], + }, + badlevel = { + synopsis = "[Return when you are %Ra.]", + output = "text", + text = [["There is still too much that you have to learn before you can undertake +the next step. Return to us as a proven %R, and perhaps then +you will be ready. + +"Go back now, and may the teachings of %d serve you well."]], + }, + discourage = { + "\"I defeated %l and I will defeat you, %p.\"", + "\"Where is %d now! You must realize no one can help you here.\"", + "\"Beg for mercy now and I may be lenient on you.\"", + "\"If you were not so %a, you might have stood a chance.\"", + "\"Vengeance is mine at last, %p.\"", + "\"I only wish that %l had a more worthy %r to send against me.\"", + "\"With %o in my possession you cannot hope to defeat me.\"", + "\"%nC has never been defeated, NEVER!\"", + "\"Are you truly the best %H has to send against me? I pity %l.\"", + "\"How do you spell %p? I want to ensure the marker on your grave is correct as a warning to your %sp.\"", + }, + encourage = { + "\"Do not be fooled by the false promises of %n.\"", + "\"To enter %i you must pass many traps.\"", + "\"If you do not return with %o, your quest will be in vain.\"", + "\"Do not be afraid to call upon %d if you truly need help.\"", + "\"If you do not destroy %n, he will follow you back here!\"", + "\"Take %o from %n and you may be able to defeat him.\"", + "\"You must hurry, %p!\"", + "\"You are like %Sa to me, %p. Do not let me down.\"", + "\"If you are %a at all times you may succeed, %p.\"", + "\"Let all who meet you on your journey know that you are on a quest for %l and grant safe passage.\"", + }, + firsttime = { + synopsis = "[You find yourself back at %H, but the quiet is ominous.]", + output = "text", + text = [[You breathe a sigh of relief as you find yourself back in the familiar +surroundings of %H. + +You quickly notice that things do not appear the way they did when you +left. The town is dark and quiet. There are no sounds coming from +behind the town walls, and no campfires burning in the fields. As a +matter of fact, you do not %x any movement in the fields at all, and +the crops seem as though they have been untended for many weeks.]], + }, + goal_alt = { + text = "You have returned to %ns lair.", + }, + goal_first = { + text = "You sense the presence of %o.", + }, + goal_next = { + text = [[You gain confidence, knowing that you may soon be united with +%o.]], + }, + gotit = { + synopsis = "[You pick up %o and feel relief. Return it to %l.]", + output = "text", + text = [[As you pick up %o, you feel a great +weight has been lifted from your shoulders. Your only thoughts are +to quickly return to %H and find %l.]], + }, + guardtalk_after = { + "\"Gehennom on 5 zorkmids a day -- more like 500 a day if you ask me.\"", + "\"Do you know where I could find some nice postcards of The Gnomish Mines?\"", + "\"Have you tried the weird toilets?\"", + "\"If you stick around, I'll show you the pictures from my latest trip.\"", + "\"Did you bring me back any souvenirs?\"", + }, + guardtalk_before = { + "\"Gehennom on 5 zorkmids a day -- more like 500 a day if you ask me.\"", + "\"Do you know where I could find some nice postcards of The Gnomish Mines?\"", + "\"Have you tried the weird toilets?\"", + "\"Don't stay at the Inn, I hear the food is terrible and it has rats.\"", + "\"They told me that this was the off season!\"", + }, + hasamulet = { + synopsis = "[You have the Amulet. Take it to the Astral Plane to finish your task.]", + output = "text", + text = [["Stand back and let me look at you, %p. +Now that you have recovered the Amulet of Yendor, I'm afraid living +out your days in %H would seem pretty tame. + +"You have come too far to stop now, for there are still more tasks that +our oral history foretells for you. Forever more, though, your name shall +be spoken by the %gP with awe. You are truly an inspiration to your +%sp!"]], + }, + killed_nemesis = { + synopsis = "[%nC curses at you as %nh dies.]", + output = "text", + text = [[You turn in the direction of %n. As his earthly body begins +to vanish before your eyes, you hear him curse: + + "You shall never be rid of me, %p! + I will find you where ever you go and regain what is rightly mine."]], + }, + leader_first = { + synopsis = "[Someone must defeat %n. Are your ready?]", + output = "text", + text = [["Is it really you, %p! I had given up hope for your return. +As you can %x, we are desperately in need of your talents. Someone must +defeat %n if our town is to become what it once was. + +"Let me see if you are ready to be that someone."]], + }, + leader_last = { + synopsis = "[Leave %H and never return.]", + output = "text", + text = [["It is too late, %p. You are not even worthy to die amongst us. +Leave %H and never return."]], + }, + leader_next = { + text = "\"Things are getting worse, %p. I hope that this time you are ready.\"", + }, + leader_other = { + text = "\"I hope that for the sake of %H you have prepared yourself this time.\"", + }, + locate_first = { + synopsis = "[You %x the handiwork of %ns henchlings.]", + output = "text", + text = [[Only your faith in %d keeps you from trembling. You %x +the handiwork of %ns henchlings everywhere.]], + }, + locate_next = { + text = "You know that this time you must find and destroy %n.", + }, + nemesis_first = { + synopsis = "[%rA will not defeat me.]", + output = "text", + text = [["So, %p, %l thinks that you can wrest +%o from me! + +"It only proves how desperate he has become that he sends %ra to +try and defeat me. When this day is over, I will have you enslaved +in the mines where you will rue the day that you ever entered +%i."]], + }, + nemesis_next = { + text = [["I let you live the last time because it gave me pleasure. +This time I will destroy you, %p."]], + }, + nemesis_other = { + synopsis = "[Run away or you will suffer severely.]", + output = "text", + text = [["These meetings come to bore me. You disturb my workings with +%o. + +"If you do not run away now, I will inflict so much suffering on you that +%l will feel guilty for ever having sent his %S to me!"]], + }, + nemesis_wantsit = { + synopsis = "[\"Return %o to me and we will rule %H.\"]", + output = "text", + text = [["You fool. You do not know how to call upon the powers of +%o. + +"Return it to me and I will teach you how to use it, and together we +will rule %H. But do so now, as my patience grows thin."]], + }, + nexttime = { + text = "Once again, you are back at %H.", + }, + offeredit = { + synopsis = "[Take %o and with %ds guidance, recover the Amulet.]", + output = "text", + text = [[As %l detects the presence of %o, +he almost smiles for the first time in many a full moon. + +As he looks up from %o he says: + + "You have recovered %o. You are its + owner now, but not its master. Let it work with you as you continue + your journey. With its help, and %d to guide you on the + %a path, you may yet recover the Amulet of Yendor."]], + }, + offeredit2 = { + synopsis = "[Keep %o and return to %Z through the portal.]", + output = "text", + text = [["%oC is yours now. %Z +await your return through the magic portal that brought you here."]], + }, + othertime = { + text = [[You are back at %H. +Things appear to have become so bad that you fear that soon +%H will not be here to return to.]], + }, + posthanks = { + text = [["I could not be more proud than if you were my own %S, %p! +Tell me of your adventures in quest of the Amulet of Yendor."]], + }, + }, + Val = { + assignquest = { + synopsis = "[Find %i; defeat %n; return with %o.]", + output = "text", + text = [["It is not clear, %p, for my sight is limited without our relic. +But it is now likely that you can defeat %n, and recover +%o. + +"A short time ago, %n and his minions attacked this place. They +opened the huge volcanic vents you %x about the hill, and attacked. I knew +that this was to come to pass, and had asked %d for a group of %gP +to help defend this place. The few you %x here are the mightiest of +Valhalla's own, and are all that are left of one hundred %d sent. + +"Despite the great and glorious battle we fought, %n managed at +last to steal %o. This has upset the balance of the universe, +and unless %oh is returned into my care, %n may start Ragnarok. + +"You must find the entrance to %i. Travel downward +from there and you will find %ns lair. Defeat him and +return %o to me."]], + }, + badalign = { + synopsis = "[You have strayed from the %a path. Return after you purify yourself.]", + output = "text", + text = [["NO! This is terrible. I see you becoming an ally of %n, and +leading his armies in the final great battles. This must not come to +pass! You have strayed from the %a path. You must purge yourself, +and return here only when you have regained a state of purity."]], + }, + badlevel = { + synopsis = "[Come back when you are %Ra.]", + output = "text", + text = [["I see you and %n fighting, %p. But you are not prepared and +shall die at %ns hand if you proceed. No. This will not do. +Go back out into the world, and grow more experienced at the ways of war. +Only when you have returned %Ra will you be able to defeat %n."]], + }, + discourage = { + "\"I am your death, %c.\"", + "\"You cannot prevail, %r. I have foreseen your every move.\"", + "\"With you out of the way, Valhalla will be mine for the taking.\"", + "\"I killed scores of %ds best when I took %o. Do you really think that one %c can stand against me?\"", + "\"Who bears the souls of %cP to Valhalla, %r?\"", + "\"No, %d cannot help you here.\"", + "\"Some instrument of %d you are, %p. You are a weakling!\"", + "\"Never have I seen %ca so clumsy in battle.\"", + "\"You die now, little %s.\"", + "\"Your body I destroy now, your soul when my hordes overrun Valhalla!\"", + }, + encourage = { + "\"Go with the blessings of %d.\"", + "\"Call upon %d when you are in need.\"", + "\"Use %o if you can. It will protect you.\"", + "\"Magical cold is very effective against %n.\"", + "\"To face %n, you will need to be immune to fire.\"", + "\"May %d strengthen your sword-arm.\"", + "\"Trust in %d. He will not desert you.\"", + "\"It becomes more likely that Ragnarok will come with every passing moment. You must hurry, %p.\"", + "\"If %n can master %o, he will be powerful enough to face %d far earlier than is fated. This must not be!\"", + "\"Remember your training, %p. You can succeed.\"", + }, + firsttime = { + synopsis = "[You arrive below %H. Something is wrong; there is lava present.]", + output = "text", + text = [[You materialize at the base of a snowy hill. Atop the hill sits +a place you know well, %H. You immediately realize +that something here is very wrong! + +In places, the snow and ice have been melted into steaming pools of +water. Fumaroles and pools of bubbling lava surround the hill. +The stench of sulphur is carried through the air, and you %x creatures +that should not be able to live in this environment moving towards you.]], + }, + goal_first = { + synopsis = "[This is the lair of %n.]", + output = "text", + text = [[Through clouds of sulphurous gasses, you %x a rock palisade +surrounded with a moat of bubbling lava. You remember the description +from something that %l said. This is the lair of %n.]], + }, + goal_next = { + text = "Once again, you stand in sight of %ns lair.", + }, + gotit = { + synopsis = "[You must return %o to %l.]", + output = "text", + text = [[As you pick up %o, your mind is suddenly filled with images, +and you perceive all of the possibilities of each potential choice you +could make. As you begin to control and channel your thoughts, you +realize that you must return %o to %l immediately.]], + }, + guardtalk_after = { + "\"Hail, and well met, brave %c.\"", + "\"May %d guide your steps, %p.\"", + "\"%lC told us you had succeeded!\"", + "\"You recovered %o just in time, %p.\"", + "\"Hail %d, for delivering %o back to us.\"", + }, + guardtalk_before = { + "\"Hail, and well met, brave %c.\"", + "\"May %d guide your steps, %p.\"", + "\"%lC weakens. Without %o, her foresight is dim.\"", + "\"You must hurry, %p, else Ragnarok may well come.\"", + "\"I would deal with this foul %n myself, but %d forbids it.\"", + }, + hasamulet = { + synopsis = "[Take the Amulet to %ds temple on the Astral Plane and offer it.]", + output = "text", + text = [["Excellent, %p. I see you have recovered the Amulet! + +"You must take the Amulet to the Great Temple of %d, on the Astral +Plane. There you must offer the Amulet to %d. + +"Go now, my %S. I cannot tell you your fate, as the power of the +Amulet interferes with mine. I hope for your success."]], + }, + killed_nemesis = { + synopsis = "[%nC dies.]", + output = "text", + text = [[A look of surprise and horror appears on %ns face. + + "No!!! %o has lied to me! I have been misled!" + +Suddenly, %n grasps his head and screams in agony, then dies.]], + }, + leader_first = { + synopsis = "[We need your aid. Are you ready?]", + output = "text", + text = [["Ah, %p, my %S. You have returned to %H +at last. We are in dire need of your aid, but I must determine if you +are yet ready for such an undertaking. + +"Let me read your fate..."]], + }, + leader_last = { + synopsis = "[\"Begone from my presence and never return.\"]", + output = "text", + text = [["No, %p. Your fate is sealed. I must cast about for another +champion. Begone from my presence, and never return. Know this, that +you shall never succeed in this life, and Valhalla is denied to you."]], + }, + leader_next = { + text = [["Let me read the future for you now, %p, perhaps you have managed to +change it enough..."]], + }, + leader_other = { + text = [["Again, I shall read your fate, my %S. Let us both hope that you have +made changes to become ready for this task..."]], + }, + locate_first = { + synopsis = "[This is the entrance to %i.]", + output = "text", + text = [[The ice and snow gives way to a valley floor. You %x ahead of you +a huge round hill surrounded by pools of lava. This then is the entrance +to %i. It looks like you're not going to get in without +a fight though.]], + }, + locate_next = { + text = "Once again, you stand before the entrance to %i.", + }, + nemesis_first = { + synopsis = "[\"%oC has shown me that I must kill you.\"]", + output = "text", + text = [["So! %lC has finally sent %ca to challenge me! + +"I thought that mastering %o would enable me to challenge +%d, but it has shown me that first I must kill you! So come, little +%s. Once I defeat you, I can at last begin the final battle with %d."]], + }, + nemesis_next = { + text = "\"Again you challenge me, %r. Good. I will kill you now.\"", + }, + nemesis_other = { + text = "\"Have you not learned yet? You cannot defeat %n!\"", + }, + nemesis_wantsit = { + text = "\"I will kill you, %c, and wrest %o from your mangled hands.\"", + }, + nexttime = { + text = "Once again, you are near the abode of %l.", + }, + offeredit = { + synopsis = "[Take %o. Search for the Amulet.]", + output = "text", + text = [[As you approach, %l rises and touches %o. + +"You may take %o with you, %p. I have removed from +it the power to foretell the future, for that power no mortal should +have. Its other abilities, however, you have at your disposal. + +"You must now begin in %ds name to search for the Amulet of Yendor. +May your steps be guided by %d, my %S."]], + }, + offeredit2 = { + synopsis = "[You are %os keeper now. Return through the portal and find the Amulet.]", + output = "text", + text = [["Careful, %p! %oC might break, and that would be +a tragic loss. You are its keeper now, and the time has come to +resume your search for the Amulet. %Z await your +return through the magic portal that brought you here."]], + }, + othertime = { + text = [[Again you materialize near %ls abode. You have a nagging feeling +that this may be the last time you come here.]], + }, + posthanks = { + text = [["Greetings, %p. I have not been able to pay as much attention to +your search for the Amulet as I have wished. How do you fare?"]], + }, + }, + Wiz = { + assignquest = { + synopsis = "[Travel to %i; overcome %n; return with %o.]", + output = "text", + text = [["Yes, %p, you truly are ready for this dire task. Listen, +carefully, for what I tell you now will be of vital importance. + +"Since you left us to hone your skills in the world, we unexpectedly came +under attack by the forces of %n. As you know, we thought +%n had perished at the end of the last age, but, alas, this was +not the case. + +"%nC sent an army of abominations against us. Among them was a +minion, mindless and ensorcelled, and thus, in the confusion, it was +able to penetrate our defenses. Alas, this creature has stolen +%o and I fear has delivered %oh to %n. + +"Over the years, I had woven most of my power into this amulet, and thus, +without it, I have but a shadow of my former power, and I fear that I +shall soon perish. + +"You must travel to %i, and within its dungeons, +find and overcome %n, and return %o to me. + +"Go now, with %d, and complete this quest before it is too late."]], + }, + badalign = { + synopsis = "[Go; come back when you are worthy of %d.]", + output = "text", + text = [["You amaze me, %p! How many times did I tell you that the way of a mage +is an exacting one. One must use the world with care, lest one leave it +in ruins and simplify the task of %n. + +"You must go back and show your worthiness. Do not return until you are +truly ready for this quest. May %d guide you in this task."]], + }, + badlevel = { + synopsis = "[Go; return when you are %Ra.]", + output = "text", + text = [["Alas, %p, you have not yet shown your proficiency as a worthy +spellcaster. As %ra, you would surely be overcome in the challenge +ahead. Go, now, expand your horizons, and return when you have attained +renown as %Ra."]], + }, + discourage = { + "\"Your puny powers are no match for me, fool!\"", + "\"When you are defeated, your torment will last for a thousand years.\"", + "\"After your downfall, %p, I shall devour %l for dessert!\"", + "\"Are you ready yet to beg for mercy? I could be lenient...\"", + "\"Your soul shall join the enslaved multitude I command!\"", + "\"Your lack of will is evident, and you shall die as a result.\"", + "\"Your faith in %d is for naught! Come, submit to me now!\"", + "\"A mere %r is nothing compared to my skill!\"", + "\"So, you are the best hope of %l? How droll.\"", + "\"Feel my power, %c! My victory is imminent!\"", + }, + encourage = { + "\"Beware, for %n is immune to most magical attacks.\"", + "\"To enter %i you must pass many traps.\"", + "\"%nC may be vulnerable to physical attacks.\"", + "\"%d will come to your aid when you call.\"", + "\"You must utterly destroy %n. He will pursue you otherwise.\"", + "\"%oC is a mighty artifact. With it you can destroy %n.\"", + "\"Go forth with the blessings of %d.\"", + "\"I will have my %gP watch for your return.\"", + "\"Feel free to take any items in that chest that might aid you.\"", + "\"You will know when %o is near. Proceed with care!\"", + }, + firsttime = { + synopsis = "[You have arrived at %ls tower but something is very wrong.]", + output = "text", + text = [[You are suddenly in familiar surroundings. You notice what appears to +be a large, squat stone structure nearby. Wait! That looks like the +tower of your former teacher, %l. + +However, things are not the same as when you were last here. Mists and +areas of unexplained darkness surround the tower. There is movement in +the shadows. + +Your teacher would never allow such unaesthetic forms to surround the +tower... unless something were dreadfully wrong!]], + }, + goal_alt = { + text = "You have returned to %ns lair.", + }, + goal_first = { + text = "You feel your mentor's presence; perhaps %o is nearby.", + }, + goal_next = { + text = "The aura of %o tingles at the edge of your perception.", + }, + gotit = { + synopsis = "[You feel %os power and know you should return %oh to %l.]", + output = "text", + text = [[As you touch %o, its comforting power infuses you +with new energy. You feel as if you can detect others' thoughts flowing +through it. Although you yearn to wear %o and +attack the Wizard of Yendor, you know you must return it to its rightful +owner, %l.]], + }, + guardtalk_after = { + "\"I have some eye of newt to trade, do you have a spare blind-worm's sting?\"", + "\"The magic portal now seems like it will remain stable for quite some time.\"", + "\"Have you noticed how much stronger %l is since %o was recovered?\"", + "\"Thank %d! We weren't positive you would defeat %n.\"", + "\"I, too, will venture into the world, because %n was but one of many evils to be vanquished.\"", + }, + guardtalk_before = { + "\"Would you happen to have some eye of newt in that overstuffed pack, %s?\"", + "\"Ah, the spell to create the magic portal worked. Outstanding!\"", + "\"Hurry! %lC may not survive that casting of the portal spell!\"", + "\"The spells of %n were just too powerful for us to withstand.\"", + "\"I, too, will venture into the world, because %n is but one of many evils to be vanquished.\"", + }, + hasamulet = { + synopsis = "[Take the Amulet to %ds altar on the Astral Plane.]", + output = "text", + text = [["Congratulations, %p. I always knew that if anyone could succeed +in defeating the Wizard of Yendor and his minions, it would be you. + +"Go now, and take the Amulet to the Astral Plane. Once there, present +the Amulet on the altar of %d. Along the way you shall pass through +the four Elemental Planes. These planes are like nothing you have ever +experienced before, so be prepared! + +"For this you were born, %s! I am very proud of you."]], + }, + killed_nemesis = { + synopsis = "[%nC curses you as %nh dies.]", + output = "text", + text = [[%nC, whose body begins to shrivel up, croaks out: + + "I shall haunt your progress until the end of time. A thousand + curses on you and %l." + +Then, the body bursts into a cloud of choking dust, and blows away.]], + }, + leader_first = { + synopsis = "[You have come a long way, but are you ready for the task I require?]", + output = "text", + text = [["Come closer, %p, for my voice falters in my old age. +Yes, I see that you have come a long way since you went out into the +world, leaving the safe confines of this tower. However, I must first +determine if you have all of the skills required to take on the task +I require of you."]], + }, + leader_last = { + synopsis = "[\"Get out of here!\"]", + output = "text", + text = [["You fool, %p! Why did I waste all of those years teaching you +the esoteric arts? Get out of here! I shall find another."]], + }, + leader_next = { + text = "\"Well, %p, you have returned. Perhaps you are now ready...\"", + }, + leader_other = { + text = [["This is getting tedious, %p, but perseverance is a sign of a true mage. +I certainly hope that you are truly ready this time!"]], + }, + locate_first = { + text = "Wisps of fog swirl nearby. You feel that %ns lair is close.", + }, + locate_next = { + text = "You believe that you may once again invade %i.", + }, + nemesis_first = { + synopsis = "[\"Your destruction should make for good sport.\"]", + output = "text", + text = [["Ah, I recognize you, %p. So, %l has sent you to steal +%o from me, hmmm? Well, %lh is a fool to send such +a mental weakling against me. + +"Your destruction, however, should make for good sport. In the end, you +shall beg me to kill you!"]], + }, + nemesis_next = { + synopsis = "[\"Your soul shall soon be mine to command.\"]", + output = "text", + text = [["How nice of you to return, %p! I enjoyed our last meeting. Are you +still hungry for more pain? + +"Come! Your soul, like %o, shall soon be mine to command."]], + }, + nemesis_other = { + text = [["I'm sure that your perseverance shall be the subject of innumerable +ballads, but you shall not be around to hear them, I fear!"]], + }, + nemesis_wantsit = { + text = [["Thief! %oC belongs to me, now. I shall feed +your living flesh to my minions."]], + }, + nexttime = { + text = "Once again, you are back at %H.", + }, + offeredit = { + synopsis = "[Take %o with you in your quest for the Amulet.]", + output = "text", + text = [[%lC notices %o in your possession, +beams at you and says: + + "I knew you could defeat %n and retrieve + %o. We shall never forget this + brave service. + + "Take %oh with you in your quest for the Amulet of Yendor. + I can sense that it has attuned %oiself to you already. + + "May %d guide you in your quest, and keep you from harm."]], + }, + offeredit2 = { + synopsis = "[Keep %o, return through the portal to %Z; find the other Amulet.]", + output = "text", + text = [["You are the keeper of %o now. It is time to +recover the /other/ Amulet. %Z await your return through +the magic portal which brought you here."]], + }, + othertime = { + text = [[You are back at %H. +You have an odd feeling this may be the last time you ever come here.]], + }, + posthanks = { + text = [["Come near, my %S, and share your adventures with me. +So, have you succeeded in your quest for the Amulet of Yendor?"]], + }, + }, +} diff --git a/dat/quest.txt b/dat/quest.txt deleted file mode 100644 index 269ec76a1..000000000 --- a/dat/quest.txt +++ /dev/null @@ -1,3521 +0,0 @@ -# NetHack 3.6 quest.txt $NHDT-Date: 1505170340 2017/09/11 22:52:20 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.34 $ -# Copyright (c) 1991 by M. Stephenson -# NetHack may be freely redistributed. See license for details. -# -# The quest text file for NetHack 3.4 -# -# These are the "standard" message numbers from qtext.h. All class -# dialogue must have at least these entries. -# -# QT_FIRSTTIME 1 -# QT_NEXTTIME 2 -# QT_OTHERTIME 3 -# -# QT_GUARDTALK 5 /* 5 random things guards say before quest */ -# QT_GUARDTALK2 10 /* 5 random things guards say after quest */ -# -# QT_FIRSTLEADER 15 -# QT_NEXTLEADER 16 -# QT_OTHERLEADER 17 -# QT_LASTLEADER 18 -# QT_BADLEVEL 19 -# QT_BADALIGN 20 -# QT_ASSIGNQUEST 21 -# -# QT_ENCOURAGE 25 /* 1-10 random encouragement messages */ -# -# QT_FIRSTLOCATE 35 -# QT_NEXTLOCATE 36 -# -# QT_FIRSTGOAL 40 /* %n (nemesis) and %o (artifact) will always -# be present on first visit in normal play */ -# QT_NEXTGOAL 41 /* subsequent visits to goal level */ -# QT_ALTGOAL 42 /* alternate to NEXTGOAL if quest artifact -# is absent from the level (optional) */ -# QT_FIRSTNEMESIS 50 -# QT_NEXTNEMESIS 51 -# QT_OTHERNEMESIS 52 -# QT_NEMWANTSIT 53 /* you somehow got the artifact */ -# -# QT_DISCOURAGE 60 /* 1-10 random maledictive messages */ -# -# QT_GOTIT 70 -# -# QT_KILLEDNEM 80 -# QT_OFFEREDIT 81 -# QT_OFFEREDIT2 82 /* if you throw artifact to leader after #81 */ -# -# QT_POSTHANKS 90 -# QT_HASAMULET 91 -# -# -# Archeologist -# -%Cc Arc 00001 -You are suddenly in familiar surroundings. The buildings in the distance -seem to be those of your old alma mater, but something is wrong. It feels -as if there has been a riot recently, or %H has -been under siege. - -All of the windows are boarded up, and there are objects scattered around -the entrance. - -Strange forbidding shapes seem to be moving in the distance. -%E [You arrive at %H, but all is not well.] -%Cp Arc 00002 -Once again, you are back at %H. -%E -%Cp Arc 00003 -You are back at %H. -You have an odd feeling this may be the last time you ever come here. -%E -%Cp Arc 00005 -"Did you see Lash LaRue in 'Song of Old Wyoming' the other night?" -%E -%Cp Arc 00006 -"Hey man, got any potions of hallucination for sale?" -%E -%Cp Arc 00007 -"Did you see the artifact %l brought back from the last dig?" -%E -%Cp Arc 00008 -"So what species do *you* think we evolved from?" -%E -%Cp Arc 00009 -"So you're %ls prize pupil! I don't know what he sees in you." -%E -%Cp Arc 00010 -"Did you see Lash LaRue in 'Song of Old Wyoming' the other night?" -%E -%Cp Arc 00011 -"Hey man, got any potions of hallucination for sale?" -%E -%Cp Arc 00012 -"I guess you are guaranteed to make full professor now." -%E -%Cp Arc 00013 -"So, what was worse, %n or your entrance exams?" -%E -%Cp Arc 00014 -"%oC is impressive, but nothing like the bones I dug up!" -%E -%Cc Arc 00015 -"Finally you have returned, %p. You were always -my most promising student. Allow me to see if you are ready for the -most difficult task of your career." -%E ["You have returned, %p, to a difficult task."] -%Cp Arc 00016 -"Again, %p, you stand before me. -Let me see if you have gained experience in the interim." -%E -%Cp Arc 00017 -"Once more, %p, you have returned from the field. -Are you finally ready for the task that must be accomplished?" -%E -%Cc Arc 00018 -"%p, you have failed us. All of my careful training has been in -vain. Begone! Your tenure at this college has been revoked! - -"You are a disgrace to the profession!" -%E ["%pC, you have failed us. Begone!"] -%Cc Arc 00019 -"%p, you are yet too inexperienced to undertake such a demanding -quest. A mere %r could not possibly face the rigors demanded and -survive. Go forth, and come here again when your adventures have further -taught you." -%E [%pC, a mere %r is too inexperienced.] -%Cc Arc 00020 -"%pC! I've heard that you've been using sloppy techniques. Your -results lately can hardly be called suitable for %ra! - -"How could you have strayed from the %a path? Go from here, and come -back only when you have purified yourself." -%E ["%pC, you have strayed from the %a path. Purify yourself!"] -%Cc Arc 00021 -"Grave times have befallen the college, for %na has -stolen %o. Without it, the board of directors of -the university will soon have no choice but to revoke our research grants. - -"You must locate the entrance to %i. Within it, -you will find %n. - -"You must then defeat %n and return %o -to me. - -"Only in this way will we be able to prevent the budget cuts that could -close this college. - -"May the wisdom of %d be your guide." -%E [%nC has stolen %o. Locate %i, defeat %ni, and return %O.] -%Cp Arc 00025 -"Beware, for %n is powerful and cunning." -%E -%Cp Arc 00026 -"To locate the entrance to %i, you must pass -many traps." -%E -%Cp Arc 00027 -"A %nt may be vulnerable to attacks by magical cold." -%E -%Cp Arc 00028 -"Call upon %d when you encounter %n." -%E -%Cp Arc 00029 -"You must destroy %n. It will pursue you otherwise." -%E -%Cp Arc 00030 -"%oC is a mighty talisman. With it you -can destroy %n." -%E -%Cp Arc 00031 -"Go forth with the blessings of %d." -%E -%Cp Arc 00032 -"I will have my %gP watch for your return." -%E -%Cp Arc 00033 -"Remember not to stray from the true %a path." -%E -%Cp Arc 00034 -"You may be able to sense %o when you are near." -%E -%Cc Arc 00035 -A plain opens before you. Beyond the plain lies a foreboding edifice. - -You have the feeling that you will soon find the entrance to -%i. -%E [This foreboding edifice must hide the entrance to %i.] -%Cp Arc 00036 -Once again, you are near the entrance to %i. -%E -%Cc Arc 00040 -A strange feeling washes over you, and you think back to things you -learned during the many lectures of %l. - -You realize the feeling must be the presence of %o. -%E [This strange feeling must be the presence of %o.] -%Cp Arc 00041 -The familiar presence of %o is in the ether. -%E -# delivered instead of 00041 if %o is not on the level anymore; -# hero might already be carrying it, so don't say anything like -# "%o's presence can't be felt" -%Cp Arc 00042 -The have returned to %ns lair. -%E -%Cc Arc 00050 -"So, %p, you think that you can succeed in recovering -%o, when your teacher, %l, has already failed. - -"Come, try your best! I shall destroy you, and gnaw on your bones." -%E ["Come, %p, I shall destroy you!"] -%Cc Arc 00051 -"Again you try to best me, eh %p? Well, you shall fail again. - -"You shall never recover %o. - -"I shall bear your soul to the Plane of Origins for my master's pleasure." -%E ["Again you try to best me, %p? You shall never recover %o."] -%Cp Arc 00052 -"You persist yet %p! Good. Now, you shall die!" -%E -%Cp Arc 00053 -"I shall have %o from you, %p, then feast -upon your entrails!" -%E -%Cp Arc 00060 -"Try your best, %p. You cannot defeat me." -%E -%Cp Arc 00061 -"I shall rend the flesh from your body whilst you still breathe!" -%E -%Cp Arc 00062 -"First you, %p, then I shall destroy your mentor, %l." -%E -%Cp Arc 00063 -"Tiring yet, %p? I draw my power from my master and cannot -falter!" -%E -%Cp Arc 00064 -"I shall rend thy soul from thy body and consume it!" -%E -%Cp Arc 00065 -"You are far too %a -- it weakens you. You shall die in this place." -%E -%Cp Arc 00066 -"%d has forsaken you! You are lost now!" -%E -%Cp Arc 00067 -"A mere %r cannot hope to defeat me!" -%E -%Cp Arc 00068 -"If you are the best %l can send, I have nothing to fear." -%E -%Cp Arc 00069 -"Die %c! I shall exhibit your carcass as a trophy." -%E -%Cc Arc 00070 -The power of %o flows through your body! You feel -as if you could now take on the Wizard of Yendor himself and win, but -you know you must return %o to %l. -%E [The power of %o flows through your body! You must return it to %l.] -%Cp Arc 00080 -The body of %n dissipates in a cloud of noxious fumes. -%E -%Cc Arc 00081 -%lC touches %o briefly, gazes into it, -then smiles at you and says: - -"Well done, %p. You have defeated %n and -recovered %o. But I fear that it shall never be safe -here. - -Please take %o with you. You, %p, can -guard it now far better than I. - -May the blessings of %d follow you and guard you." -%E [%lC instructs you to guard %o from now on.] -# assumes Orb of Detection (glass object) -%Cc Arc 00082 -"Careful, %p! %oC might break, and that would be -a tragic loss. You are its keeper now, and the time has come to -resume your search for the Amulet. %Z await your -return through the magic portal that brought you here." -%E ["Resume your search for the Amulet beyond the magic portal to %Z."] -%Cc Arc 00090 -"Welcome back, %p. Have you progressed with your quest to -regain the Amulet of Yendor for %d?" -%E ["Have you progressed with your quest to regain the Amulet of Yendor for %d?"] -%Cc Arc 00091 -"Congratulations, %p. I wondered if anyone could prevail against -the Wizard and the minions of Moloch. Now, you must embark on one -final adventure. - -"Take the Amulet, and find your way onto the Astral Plane. -There you must find the altar of %d and sacrifice the -Amulet on that altar to fulfill your destiny. - -"Remember, your path now should always be upwards." -%E [Take the Amulet to the Astral Plane and sacrifice it at the altar of %d.] -# -# Barbarian -# -%Cc Bar 00001 -Warily you scan your surroundings, all of your senses alert for signs -of possible danger. Off in the distance, you can %x the familiar shapes -of %H. - -But why, you think, should %l be there? - -Suddenly, the hairs on your neck stand on end as you detect the aura of -evil magic in the air. - -Without thought, you ready your weapon, and mutter under your breath: - - "By %d, there will be blood spilt today." -%E [You reach the vicinity of %H, but sense evil magic nearby.] -%Cp Bar 00002 -Once again, you near %H. You know that %l -will be waiting. -%E -%Cp Bar 00003 -Again, and you think possibly for the last time, you approach -%H. -%E -%Cp Bar 00005 -"The battles here have been good -- our enemies' blood soaks the soil!" -%E -%Cp Bar 00006 -"Remember that glory is crushing your enemies beneath your feet!" -%E -%Cp Bar 00007 -"There has been little treasure to loot, since the horde arrived." -%E -%Cp Bar 00008 -"The horde is mighty in numbers, but they have little courage." -%E -%Cp Bar 00009 -"%lC is a strange one, but he has helped defend us." -%E -%Cp Bar 00010 -"The battles here have been good -- our enemies' blood soaks the soil!" -%E -%Cp Bar 00011 -"Remember that glory is crushing your enemies beneath your feet!" -%E -%Cp Bar 00012 -"Times will be good again, now that the horde is vanquished." -%E -%Cp Bar 00013 -"You have brought our clan much honor in defeating %n." -%E -%Cp Bar 00014 -"You will be a worthy successor to %l." -%E -%Cc Bar 00015 -"Ah, %p. You have returned at last. The world is in dire -need of your help. There is a great quest you must undertake. - -"But first, I must see if you are ready to take on such a challenge." -%E ["At last you have returned. There is a great quest you must undertake."] -%Cp Bar 00016 -"%p, you are back. Are you ready now for the challenge?" -%E -%Cp Bar 00017 -"Again, you stand before me, %p. Surely you have prepared yourself." -%E -%Cc Bar 00018 -"Pah! You have betrayed the gods, %p. You will never attain -the glory which you aspire to. Your failure to follow the true path has -closed this future to you. - -"I will protect these people as best I can, but soon %n will overcome -me and destroy all who once called you %s. Now begone!" -%E ["You have betrayed %d; soon %n will destroy us. Begone!"] -%Cc Bar 00019 -"%p, I fear that you are as yet too inexperienced to face -%n. Only %Ra with the help of %d could ever hope to -defeat %ni." -%E ["You are too inexperienced. Come back when you are %Ra."] -%Cc Bar 00020 -"%pC! You have wandered from the path of the %a! -If you attempt to overcome %n in this state, he will surely -enslave your soul. Your only hope, and ours, lies in your purification. -Go forth, and return when you feel ready." -%E ["You have wandered from the path of the %a. Come back when you have atoned."] -%Cc Bar 00021 -"The world is in great need of your assistance, %p. - -"About six months ago, I learned that a mysterious sorcerer, known -as %n, had begun to gather a large group of cutthroats and brigands -about %ni. - -"At about the same time, these people you once rode with `liberated' a -potent magical talisman, %o, from a Turanian caravan. - -"%nC and %nj Black Horde swept down upon %i and defeated -the people there, driving them out into the desert. He has taken -%o, and seeks to bend it to %nj will. I detected the -subtle changes in the currents of fate, and joined these people. -Then I sent forth a summons for you. - -"If %n can bend %o to %nj will, he will become -almost indestructible. He will then be able to enslave the minds of -men across the world. You are the only hope. The gods smile upon you, -and with %d behind you, you alone can defeat %n. - -"You must go to %i. From there, you can track down -%n, defeat %ni, and return %o to us. Only -then will the world be safe." -%E ["Find %n, defeat %ni, and return %o to us."] -%Cp Bar 00025 -"%nC is strong in the dark arts, but not immune to cold steel." -%E -%Cp Bar 00026 -"Remember that %n is a great sorcerer. He lived in the time -of Atlantis." -%E -%Cp Bar 00027 -"If you fail, %p, I will not be able to protect these people long." -%E -%Cp Bar 00028 -"To enter %i, you must be very stealthy. The horde will be on -guard." -%E -%Cp Bar 00029 -"Call upon %d in your time of need." -%E -%Cp Bar 00030 -"May %d protect you, and guide your steps." -%E -%Cp Bar 00031 -"If you can lay hands upon %o, carry it for good fortune." -%E -%Cp Bar 00032 -"I cannot stand against %ns sorcery. But %d will help you." -%E -%Cp Bar 00033 -"Do not fear %n. I know you can defeat %ni." -%E -%Cp Bar 00034 -"You have a great road to travel, %p, but only after you defeat -%n." -%E -%Cc Bar 00035 -The scent of water comes to you in the desert breeze. You know that -you have located %i. -%E [You have located %i.] -%Cp Bar 00036 -Yet again you have a chance to infiltrate %i. -%E -%Cc Bar 00040 -The hairs on the nape of your neck lift as you sense an energy in the -very air around you. You fight down a primordial panic that seeks to -make you turn and run. This is surely the lair of %n. -%E [This is surely the lair of %n.] -%Cp Bar 00041 -Yet again you feel the air around you heavy with malevolent magical energy. -%E -%Cc Bar 00050 -"So. This is what that second rate sorcerer %l sends to do %lj bidding. -I have slain many before you. You shall give me little sport. - -"Prepare to die, %c." -%E [%nC boasts that %nh has slain many. "Prepare to die, %c."] -%Cp Bar 00051 -"I have wasted too much time on you already. Now, you shall die." -%E -%Cp Bar 00052 -"You return yet again, %c! Are you prepared for death now?" -%E -%Cp Bar 00053 -"I shall have %o back, you pitiful excuse for %ca. -And your life as well." -%E -%Cp Bar 00060 -"My pets will dine on your carcass tonight!" -%E -%Cp Bar 00061 -"You are a sorry excuse for %ra." -%E -%Cp Bar 00062 -"Run while you can, %c. My next spell will be your last." -%E -%Cp Bar 00063 -"I shall use your very skin to bind my next grimoire." -%E -%Cp Bar 00064 -"%d cannot protect you now. Here, you die." -%E -%Cp Bar 00065 -"Your %a nature makes you weak. You cannot defeat me." -%E -%Cp Bar 00066 -"Come, %c. I shall kill you, then unleash the horde on your tribe." -%E -%Cp Bar 00067 -"Once you are dead, my horde shall finish off %l, and your tribe." -%E -%Cp Bar 00068 -"Fight, %c, or are you afraid of the mighty %n?" -%E -%Cp Bar 00069 -"You have failed, %c. Now, my victory is complete." -%E -%Cc Bar 00070 -As you pick up %o, you feel the power of it -flowing through your hands. It seems to be in two or more places -at once, even though you are holding it. -%E [You feel the power of %o flowing through your hands.] -%Cc Bar 00080 -%nC falls to the ground, and utters a last curse at you. Then %nj -body fades slowly, seemingly dispersing into the air around you. You -slowly become aware that the overpowering aura of magic in the air has -begun to fade. -%E [%nC curses you, but you feel the overpowering aura of magic fading.] -%Cc Bar 00081 -When %l sees %o, he smiles, and says: - - Well done, %p. You have saved the world from certain doom. - What, now, should be done with %o? - - These people, brave as they are, cannot hope to guard it from - other sorcerers who will detect it, as surely as %n did. - - Take %o with you, %p. It will guard you in - your adventures, and you can best guard it. You embark on a - quest far greater than you realize. - - Remember me, %p, and return when you have triumphed. I - will tell you then of what you must do. You will understand when the - time comes. -%E [%lC tells you to guard %o, and to return when you have triumphed.] -%Cc Bar 00082 -%l gazes reverently at %o, then back at you. - -"You are its keeper now, and the time has come to resume your search -for the Amulet. %Z await your return through the -magic portal which brought you here." -%E ["You keep %o. Return to %Z to search for the Amulet."] -%Cp Bar 00090 -"Tell us, %p, have you fared well on your great quest?" -%E -%Cc Bar 00091 -"This is wondrous, %p. I feared that you could not possibly -succeed in your quest, but here you are in possession of the Amulet -of Yendor! - -"I have studied the texts of the magi constantly since you left. In -the Book of Skelos, I found this: - - %d will cause a child to be sent into the world. This child is to - be made strong by trial of battle and magic, for %d has willed it so. - It is said that the child of %d will recover the Amulet of Yendor - that was stolen from the Creator at the beginning of time. - -"As you now possess the amulet, %p, I suspect that the Book -speaks of you. - - The child of %d will take the Amulet, and travel to the Astral - Plane, where the Great Temple of %d is to be found. The Amulet - will be sacrificed to %d, there on %dJ altar. Then the child will - stand by %d as champion of all %cP for eternity. - -"This is all I know, %p. I hope it will help you." -%E ["Take the Amulet to the altar of %d on the Astral Plane and offer it."] -# -# Cave(wo)man -# -%Cc Cav 00001 -You descend through a barely familiar stairwell that you remember -%l showing you when you embarked upon your vision quest. - -You arrive back at %H, but something seems -wrong here. The usual smoke and glowing light of the fires of the -outer caves are absent, and an uneasy quiet fills the damp air. -%E [You arrive back at %H, but something is wrong here.] -%Cp Cav 00002 -Once again, you arrive back at %H. -%E -%Cp Cav 00003 -For some reason, you think that this may be the last time you will -enter %H. -%E -%Cp Cav 00005 -"We have not been able to gather as much food since the Giants sealed -off our access to the outer world." -%E -%Cp Cav 00006 -"Since %n sent her minions, we have been constantly fighting." -%E -%Cp Cav 00007 -"I have heard your vision quest was successful. Is this so?" -%E -%Cp Cav 00008 -"So, tell me, %p, how have you fared?" -%E -%Cp Cav 00009 -"%lC grows old. We know not who will guide us after he ascends." -%E -%Cp Cav 00010 -"The rains have returned and the land grows lush again." -%E -%Cp Cav 00011 -"Peace has returned, give thanks to %d!" -%E -%Cp Cav 00012 -"Welcome back! Did you find %o?" -%E -%Cp Cav 00013 -"So, %p, tell us the story of your fight with %n." -%E -%Cp Cav 00014 -"%lC grows old. Perhaps you will guide us after he ascends." -%E -%Cc Cav 00015 -"You have returned from your vision quest, %p. Thank %d. - -"We are in dire need of your help, my %S. - -"But first, I must see if you are yet capable of the quest I would -ask you to undertake." -%E ["You have returned. We are in dire need of your help."] -%Cp Cav 00016 -"Again, you return to us, %p. Let me see if you are ready now." -%E -%Cp Cav 00017 -"Ah, %p. Are you finally ready?" -%E -%Cc Cav 00018 -"%pC! You have sealed our fate. You seem unable to reform yourself, -so I must select another to take your place. - -"Begone from %H! You have betrayed us by choosing -the path of the %C over the true path of the %L. - -"You no longer live in our eyes." -%E ["You have betrayed the %L. Begone!"] -%Cc Cav 00019 -"Alas, %p, you are as yet too inexperienced to embark upon such -a difficult quest as that I propose to give you. - -"%rA could not possibly survive the rigors demanded to find -%i, never mind to confront %n herself. - -"Adventure some more, and you will learn the skills you will require. -%d decrees it." -%E ["%rA is too inexperienced. Come back when you have progressed."] -%Cc Cav 00020 -"%pC! You have deviated from my teachings. You no longer follow -the path of the %a as you should. I banish you from these caves, to -go forth and purify yourself. Then, you might be able to accomplish this -quest." -%E ["You no longer follow the path of the %a. Go, and purify yourself."] -%Cc Cav 00021 -"You are indeed ready now, %p. I shall tell you a tale of -great suffering among your people: - -"Shortly after you left on your vision quest, the caves were invaded by -the creatures sent against us by %n. - -"She, herself, could not attack us due to her great size, but her minions -have harassed us ever since. In the first attacks, many died, and the -minions of %n managed to steal %o. -They took it to %i and there, none of our -%g warriors have been able to go. - -"You must find %i, and within it wrest -%o from %n. She guards it as -jealously as she guards all treasures she attains. But with it, -we can make our caves safe once more. - -"Please, %p, recover %o for us, and return it here." -%E [Find and defeat %n, recover %o, and return with it.] -%Cp Cav 00025 -"%nC is immune to her own breath weapons. -You should use magic upon her that she does not use herself." -%E -%Cp Cav 00026 -"When you encounter %n, call upon %d for assistance." -%E -%Cp Cav 00027 -"There will be nowhere to hide inside %ns inner sanctum." -%E -%Cp Cav 00028 -"Your best chance with %n will be to keep moving." -%E -%Cp Cav 00029 -"Do not be distracted by the great treasures in %ns lair. -Concentrate on %o." -%E -%Cp Cav 00030 -"%oC is the only object that %n truly fears." -%E -%Cp Cav 00031 -"Do not be fooled by %ns size. She is fast, and it is -rumored that she uses magic." -%E -%Cp Cav 00032 -"I would send a party of %gP with you, but we will need all -of our strength to defend ourselves." -%E -%Cp Cav 00033 -"Remember, be %a at all times. This is your strength." -%E -%Cp Cav 00034 -"If only we had an amulet of reflection, this would not have happened." -%E -%Cc Cav 00035 -You %x many large claw marks on the ground. The tunnels ahead -of you are larger than most of those in any cave complex you have -ever been in before. - -Your nose detects the smell of carrion from within, and bones litter -the sides of the tunnels. -%E [You %x many large claw marks, smell carrion, and notice bones.] -%Cp Cav 00036 -Once again, you approach %i. -%E -%Cc Cav 00040 -You find yourself in a large cavern, with neatly polished walls, that -nevertheless show signs of being scorched by fire. - -Bones litter the floor, and there are objects scattered everywhere. -The air is close with the stench of sulphurous fumes. - -%nC is clearly visible, but %nh seems to be asleep. -%E [You enter a large cavern. %nC is present.] -%Cp Cav 00041 -Once again, you find yourself in the lair of %n. -%E -%Cc Cav 00050 -"So, follower of %l, you seek to invade the lair of -%n. Only my meals are allowed down here. Prepare -to be eaten!" -%E [%nC threatens to eat you.] -%Cp Cav 00051 -"So, again you face me, %c. No one has ever before escaped me. -Now I shall kill you." -%E -%Cp Cav 00052 -"You are getting annoying, %c. Prepare to die." -%E -%Cp Cav 00053 -"I'll have %o from you, %c. You shall die." -%E -%Cp Cav 00060 -"You are weak, %c. No challenge for the Mother of all Dragons." -%E -%Cp Cav 00061 -"I grow hungry, %r. You look like a nice appetizer!" -%E -%Cp Cav 00062 -"Join me for lunch? You're the main course, %c." -%E -%Cp Cav 00063 -"With %o, I am invincible! You cannot succeed." -%E -%Cp Cav 00064 -"Your mentor, %l has failed. You are nothing to fear." -%E -%Cp Cav 00065 -"You shall die here, %c. %rA cannot hope to defeat me." -%E -%Cp Cav 00066 -"You, a mere %r challenge the might of %n? Hah!" -%E -%Cp Cav 00067 -"I am the Mother of all Dragons! You cannot hope to defeat me." -%E -%Cp Cav 00068 -"My claws are sharp now. I shall rip you to shreds!" -%E -%Cp Cav 00069 -"%d has deserted you, %c. This is my domain." -%E -%Cc Cav 00070 -As you pick up %o it seems heavy at first, but as you -hold it strength flows into your arms. - -You suddenly feel full of power, as if nothing could possibly stand -in your path. -%E [%oC fills you with a feeling of power.] -%Cp Cav 00080 -%nC sinks to the ground, her heads flailing about. -As she dies, a cloud of noxious fumes billows about her. -%E -%Cc Cav 00081 -%lC glimpses %o in your possession. -He smiles and says: - - You have done it! We are saved. But I fear that %o - will always be a target for %C forces who will want it for their - own. - - To prevent further trouble, I would like you, %p, - to take %o away with you. It will help you as you - quest for the Amulet of Yendor. -%E ["Take %o with you. It will help in your quest for the Amulet of Yendor."] -%Cc Cav 00082 -%l grasps %o proudly for a moment, then looks at you. - -"You are its keeper now, and the time has come to resume your search -for the Amulet. %Z await your return through the -magic portal which brought you here." -%E ["You are the keeper of %o now. Return to %Z to search for the Amulet.] -%Cp Cav 00090 -"%pC! Welcome back. -How goes your quest to recover the Amulet for %d?" -%E -%Cc Cav 00091 -"You have been successful, I see, %p. - -"Now that the Amulet of Yendor is yours, here is what you must do: - -"Journey upwards to the open air. The Amulet you carry will then -take you into the Astral Planes, where the Great Temple of %d -casts its influence throughout our world. - -"Sacrifice the Amulet on the altar. Thus shall %d become supreme!" -%E ["Take the Amulet to the altar of %d on the Astral Plane and offer it."] -# -# Healer -# -%Cc Hea 00001 -What sorcery has brought you back to %H? The smell -of fresh funeral pyres tells you that something is amiss with the healing -powers that used to practice here. - -No rhizotomists are tending the materia medica gardens, and where are the -common folk who used to come for the cures? - -You know that you must quickly make your way to the collegium, and -%ls iatreion, and find out what has happened in your absence. -%E [You arrive back at %H and must find %l.] -%Cp Hea 00002 -After your last experience you expected to be here, but you certainly -did not expect to see things so much worse. This time you must succeed. -%E -%Cp Hea 00003 -Again, you %x %H in the distance. - -The smell of death and disease permeates the air. You do not have -to be %Ra to know that %n is on the verge of victory. -%E -%Cp Hea 00005 -"Did you read that new treatise on the therapeutic use of leeches?" -%E -%Cp Hea 00006 -"Paint a red caduceus on your shield and monsters won't hit you." -%E -%Cp Hea 00007 -"I passed handwriting so they are demoting me a rank." -%E -%Cp Hea 00008 -"I've heard that even %l has not been able to cure Chiron." -%E -%Cp Hea 00009 -"We think %n has used %nj alchemists, and %o, -to unleash a new disease we call 'the cold' on Gehennom." -%E -%Cp Hea 00010 -"Did you read that new treatise on the therapeutic use of leeches?" -%E -%Cp Hea 00011 -"Paint a red caduceus on your shield and monsters won't hit you." -%E -%Cp Hea 00012 -"How are you feeling? Perhaps a good bleeding will improve your spirits." -%E -%Cp Hea 00013 -"Have you heard the absurd new theory that diseases are caused by -microscopic organisms, and not ill humors?" -%E -%Cp Hea 00014 -"I see that you bring %o, now you can cure this plague!" -%E -%Cc Hea 00015 -Feebly, %l raises %lj head to look at you. - -"It is good to see you again, %p. I see the concern in your -eyes, but do not worry for me. I am not ready for Hades yet. We have -exhausted much of our healing powers holding off %n. -I need your fresh strength to carry on our work. - -"Come closer and let me lay hands on you, and determine if you have -the skills necessary to accomplish this mission." -%E [%l is weak from the struggle with %n. %lH wants to examine you.] -%Cp Hea 00016 -"Again you return to me, %p. I sense that each trip back -the pleurisy and maladies of our land begin to infect you. Let us -hope and pray to %d that you become ready for your task before -you fall victim to the bad humors." -%E -%Cp Hea 00017 -"Chiron has fallen, Hermes has fallen, what else must I tell you to -impress upon you the importance of your mission! I hope that you -have come prepared this time." -%E -%Cc Hea 00018 -"You have failed us, %p. You are a quack! A charlatan! - -"Hades will be happy to hear that you are once again practicing your -arts on the unsuspecting." -%E [You are a failure as a healer.] -%Cc Hea 00019 -"Alas, %p, you are yet too inexperienced to deal with the rigors -of such a task. You must be able to draw on the knowledge of botany, -alchemy and veterinary practices before I can send you on this quest -with good conscience. - -"Return when you wear %Ra's caduceus." -%E [You are too inexperienced. Return when you are %Ra.] -%Cc Hea 00020 -"You have learned much of the remedies that benefit, but you must also -know which physic for which ail. That is why %ds teachings are a -part of your training. - -"Return to us when you have healed thyself." -%E [Return when you are more %a.] -%Cc Hea 00021 -For the first time, you sense a smile on %ls face. - - "You have indeed learned as much as we can teach you in preparation - for this task. Let me tell you what I know of the symptoms and hope - that you can provide a cure. - - "A short while ago, the dreaded %nt was fooled by the gods - into thinking that %nh could use %o to find a - cure for old age. Think of it, eternal youth! But %nj good - health is accomplished by drawing the health from those around %ni. - - "He has exhausted %nj own supply of healthy people and now %nh seeks to - extend %nj influence into our world. You must recover from %ni - %o and break the spell. - - "You must travel into the swamps to %i, and from there - follow the trail to %ns island lair. Be careful." -%E [Travel to %i on your way to recover %o from %n.] -%Cp Hea 00025 -"Remember, %p, to always wash your hands before operating." -%E -%Cp Hea 00026 -"%nC has no real magic of %nj own. To this %nh is vulnerable." -%E -%Cp Hea 00027 -"If you have been true to %d, you can draw on the power of -%o." -%E -%Cp Hea 00028 -"Bring with you antidotes for poisons." -%E -%Cp Hea 00029 -"Remember this, %n can twist the powers of %o -to hurt instead of heal." -%E -%Cp Hea 00030 -"I have sent for Chiron, but I am afraid he will come too late." -%E -%Cp Hea 00031 -"Maybe when you return the snakes will once again begin to shed." -%E -%Cp Hea 00032 -"The plague grows worse as we speak. Hurry, %p!" -%E -%Cp Hea 00033 -"Many times %n has caused trouble in these lands. It is -time that %nh was eradicated like the diseases %nh has caused." -%E -%Cp Hea 00034 -"With but one eye, %n should be easy to blind. Remember this." -%E -%Cc Hea 00035 -You stand before the entrance to %i. Strange -scratching noises come from within the building. - -The swampy ground around you seems to stink with disease. -%E [You have reached %i but all is not well.] -%Cp Hea 00036 -Once again you stand at the entrance to %i. -%E -%Cc Hea 00040 -You stand within sight of the infamous Isle of %n. Even -the words of %l had not prepared you for this. - -Steeling yourself against the wails of the ill that pierce your ears, -you hurry on your task. Maybe with %o you can -heal them on your return, but not now. -%E [You have reached the lair of %n. Take %o away from %ni.] -%Cp Hea 00041 -Once again, you %x the Isle of %n in the distance. -%E -%Cc Hea 00050 -"They have made a mistake in sending you, %p. - -"When I add your youth to mine, it will just make it easier for me -to defeat %l." -%E ["I will take your life, then defeat %l."] -%Cp Hea 00051 -"Unlike your patients, you seem to keep coming back, %p!" -%E -%Cp Hea 00052 -"Which would you like, %p? Boils, pleurisy, convulsions?" -%E -%Cp Hea 00053 -"I'll have %o back from you, %r. You are -not going to live to escape this place." -%E -%Cp Hea 00060 -"They might as well give scalpels to wizards as to let you try to -use %o!" -%E -%Cp Hea 00061 -"If I could strike %l, surrounded by %lj %gP, imagine what I -can do to you here by yourself." -%E -%Cp Hea 00062 -"I will put my %Rp to work making a physic out of your ashes." -%E -%Cp Hea 00063 -"As we speak, Hades gathers your patients to join you." -%E -%Cp Hea 00064 -"After I'm done with you, I'll destroy %l as well." -%E -%Cp Hea 00065 -"You will have to kill me if you ever hope to leave this place." -%E -%Cp Hea 00066 -"I will impale your head on my caduceus for all to see." -%E -%Cp Hea 00067 -"There is no materia medica in your sack which will cure you of me!" -%E -%Cp Hea 00068 -"Do not fight too hard, I want your soul strong, not weakened!" -%E -%Cp Hea 00069 -"You should have stopped studying at vetenary." -%E -%Cc Hea 00070 -As you pick up %o, you feel its healing begin to -warm your soul. You curse Zeus for taking it from its rightful owner, -but at least you hope that %l can put it to good use once -again. -%E [You feel the healing power of %o and should return it to %l.] -%Cc Hea 00080 -The battered body of %n slumps to the ground and gasps -out one last curse: - - "You have defeated me, %p, but I shall have my revenge. - How, I shall not say, but this curse shall be like a cancer - on you." - -With that %n dies. -%E [%nC curses you as %nh dies.] -%Cc Hea 00081 -As soon as %l sees %o %lh summons %lj -%gP. - -Gently, %l reaches out and touches %o. -He instructs each of the assembled to do the same. When everyone -has finished %lh speaks to you. - - "Now that we have been replenished we can defeat this plague. You must - take %o with you and replenish the worlds you have - been called upon to travel next. I wish you could ride Chiron to the - end of your journey, but I need him to help me spread the cure. Go - now and continue your journey." -%E [%l touches %o and tells %lj %gP to do so too, then tells you to take it with you.] -%Cc Hea 00082 -%l cautiously handles %o while watching you. - -"You are its keeper now, and the time has come to resume your search -for the Amulet. %Z await your return through the -magic portal which brought you here." -%E [%l tells you to keep %o and return to %Z to search for the Amulet.] -%Cp Hea 00090 -"You have again returned to us, %p. We have done well in your -absence, yes? How fare you upon your quest for the Amulet?" -%E -%Cc Hea 00091 -"Ah, you have recovered the Amulet, %p. Well done! - -"Now, you should know that you must travel through the Elemental Planes -to the Astral, and there return the Amulet to %d. Go forth and -may our prayers be as a wind upon your back." -%E ["You have recovered the Amulet. Travel to the Astral Plane and return it to %d."] -# -# Knight -# -%Cc Kni 00001 -You materialize in the shadows of %H. Immediately, you notice -that something is wrong. The fields around the castle are trampled and -withered, as if some great battle has been recently fought. - -Exploring further, you %x long gouges in the walls of %H. -You know of only one creature that makes those kinds of marks... -%E [Signs of battle include long gouges in the walls of %H.] -%Cp Kni 00002 -Once again you stand in the shadows of %H. -%E -%Cp Kni 00003 -Again, you stand before %H. You vaguely sense that this -may be the last time you stand before %l. -%E -%Cp Kni 00005 -"Hail, %p! Verily, thou lookest well." -%E -%Cp Kni 00006 -"There is word, %p, that %n hath been sighted in the fens -near %i." -%E -%Cp Kni 00007 -"Thou art our only hope now, %p." -%E -%Cp Kni 00008 -"Verily, %l could have no better champion, %p." -%E -%Cp Kni 00009 -"Many brave %cP died when %n attacked." -%E -%Cp Kni 00010 -"Hail, %p! Verily, thou lookest well." -%E -%Cp Kni 00011 -"So, %p, didst thou find %n in the fens near %i?" -%E -%Cp Kni 00012 -"Worthy %p, hast thou proven thy right purpose on the body of %n?" -%E -%Cp Kni 00013 -"Verily, %l could have no better champion, %p." -%E -%Cp Kni 00014 -"Hast thou indeed recovered %o?" -%E -%Cc Kni 00015 -"Ah, %p. We see thou hast received Our summons. -We are in dire need of thy prowess. But first, We must needs -decide if thou art ready for this great undertaking." -%E [%lC checks whether you are ready for a great undertaking.] -%Cp Kni 00016 -"Welcome again, %p. We hope thou art ready now." -%E -%Cp Kni 00017 -"Once again, thou standest before Us, %p. Art thou ready now?" -%E -%Cc Kni 00018 -"Thou disgracest this noble court with thine impure presence. We have been -lenient with thee, but no more. Thy name shall be spoken no more. We -hereby strip thee of thy title, thy lands, and thy standing as %ca. -Begone from Our sight!" -%E [You are a disgrace as %ca.] -%Cc Kni 00019 -"Verily, %p, thou hast done well. That thou hast survived thus -far is a credit to thy valor, but thou art yet unprepared for -the demands required as Our Champion. %rA, no matter how -pure, could never hope to defeat the foul %n. - -"Journey forth from this place, and hone thy skills. Return to -Our presence when thou hast attained the noble title of %R." -%E [You are not prepared to face %n. Return when you are %Ra.] -%Cc Kni 00020 -"Thou dishonourest Us, %p! Thou hast strayed from the path of -chivalry! Go from Our presence and do penance. Only when thou art again -pure mayst thou return hence." -%E [Go and do penance. Return when you are truly %a.] -%Cc Kni 00021 -"Ah, %p. Thou art truly ready, as no %c before thee hath -been. Hear now Our words: - -"As thou noticed as thou approached %H, a great battle hath -been fought recently in these fields. Know thou that Merlin himself -came to aid Us here as We battled the foul %n. In the midst of that -battle, %n struck Merlin a great blow, felling him. Then, as Our -forces were pressed back, %n stole %o. - -"We eventually turned the tide, but lost many %cP in doing so. -Merlin was taken off by his apprentice, but hath not recovered. We have -been told that so long as %n possesseth %o, -Merlin will not regain his health. - -"We hereby charge thee with this most important of duties: - -"Go forth from this place, to the fens, and there thou wilt find -%i. From there, thou must track down %n. Destroy the -beast, and return to Us %o. Only then can -We restore Merlin to health." -%E [Pass through %i to reach %n. Destroy %ni and return with %o.] -%Cp Kni 00025 -"Remember, %p, follow always the path of %d." -%E -%Cp Kni 00026 -"Though %n is verily a mighty foe, We have confidence in thy victory." -%E -%Cp Kni 00027 -"Beware, for %n hath surrounded %niself with hordes of foul creatures." -%E -%Cp Kni 00028 -"Great treasure, 'tis said, is hoarded in the lair of %n." -%E -%Cp Kni 00029 -"If thou possessest %o, %p, %ns magic -shall therewith be thwarted." -%E -%Cp Kni 00030 -"The gates of %i are guarded by forces unseen, %p. -Go carefully." -%E -%Cp Kni 00031 -"Return %o to Us quickly, %p." -%E -%Cp Kni 00032 -"Destroy %n, %p, else %H shall surely fall." -%E -%Cp Kni 00033 -"Call upon %d when thou art in need." -%E -%Cp Kni 00034 -"To find %i, thou must keep thy heart pure." -%E -%Cc Kni 00035 -You stand at the foot of %i. Atop, you can %x a shrine. -Strange energies seem to be focused here, and the hair on the back of -your neck stands on end. -%E [You have reached %i and can %x a shrine.] -%Cp Kni 00036 -Again, you stand at the foot of %i. -%E -%Cc Kni 00040 -As you exit the swamps, you %x before you a huge, gaping hole in the -side of a hill. From within, you smell the foul stench of carrion. - -The pools on either side of the entrance are fouled with blood, and -pieces of rusted metal and broken weapons show above the surface. -%E [You %x the entrance to a cavern inside a hill.] -%Cp Kni 00041 -Again, you stand at the entrance to %ns lair. -%E -%Cc Kni 00050 -"Hah! Another puny %c seeks death. I shall dine well tonight, -then tomorrow, %H shall fall!" -%E [%nC taunts you and issues a threat against %H.] -%Cp Kni 00051 -"Again, thou challengest me, %r? So be it. Thou wilt die here." -%E -%Cp Kni 00052 -"Thou art truly foolish, %r. I shall dispatch thee anon." -%E -%Cp Kni 00053 -"So, thou darest touch MY property! I shall have that bauble back, -puny %r. Thou wilt die in agony!" -%E -%Cp Kni 00060 -"A mere %r can never withstand me!" -%E -%Cp Kni 00061 -"I shall kill thee now, and feast!" -%E -%Cp Kni 00062 -"Puny %c. What manner of death dost thou wish?" -%E -%Cp Kni 00063 -"First thee, %p, then I shall feast upon %l." -%E -%Cp Kni 00064 -"Hah! Thou hast failed, %r. Now thou shalt die." -%E -%Cp Kni 00065 -"Die, %c. Thou art as nothing against my might." -%E -%Cp Kni 00066 -"I shall suck the marrow from thy bones, %c." -%E -%Cp Kni 00067 -"Let's see... Baked? No. Fried? Nay. Broiled? Yea verily, -that is the way I like my %c for dinner." -%E -%Cp Kni 00068 -"Thy strength waneth, %p. The time of thy death draweth near." -%E -%Cp Kni 00069 -"Call upon thy precious %d, %p. It shall not avail thee." -%E -%Cc Kni 00070 -As you pick up %o, you feel its protective fields -form around your body. You also feel a faint stirring in your mind, as -if you are in two places at once, and in the second, you are waking from -a long sleep. -%E [You feel the magic of %o.] -%Cc Kni 00080 -As %n sinks to the ground, blood gushing from %nj open mouth, %nh -defiantly curses you and %l: - - "Thou hast not won yet, %r. By the gods, I shall return - and dog thy steps to the grave!" - -%nJ tail flailing madly, %n tries to crawl towards you, but slumps -to the ground and dies in a pool of %nj own blood. -%E [%nC curses you as %nh dies.] -%Cc Kni 00081 -As you approach %l, %lh beams at you and says: - - "Well done! Thou art truly the Champion of %H. We - have received word that Merlin is recovering, and shall soon - rejoin Us. - - "He hath instructed Us that thou art now to be the guardian of - %o. He feeleth that thou mayst have need of - its powers in thine adventures. It is Our wish that thou keepest - %o with thee as thou searchest for the fabled - Amulet of Yendor." -%E [%oC is yours now. It will aid in your search for the Amulet.] -# assumes Magic Mirror of Merlin (glass object) -%Cc Kni 00082 -"Careful, %p! %oC might break, and that would -be a tragic loss. Thou art its keeper now, and the time hath come -to resume thy search for the Amulet. %Z await thy -return through the magic portal that brought thee here." -%E [You are the keeper of %o. Return to %Z and find the Amulet.] -%Cp Kni 00090 -"Well met, %p. How goeth thy search for the Amulet of Yendor?" -%E -%Cc Kni 00091 -"Thou hast succeeded, We see, %p! Now thou art commanded to take -the Amulet to be sacrificed to %d in the Plane of the Astral. - -"Merlin hath counseled Us that thou must travel always upwards through -the Planes of the Elements, to achieve this goal. - -"Go with %d, %p." -%E [Take the Amulet to the Astral Plane and deliver it to %d.] -# -# Monk -# -# The quest artifact is "The Eyes of the Overworld", hence needs -# to be treated as plural by messages which use %o. -# -%Cc Mon 00001 -You find yourself standing in sight of %H. -Something is obviously wrong here. Strange shapes lumber around -outside %H! - -You realize that the %l needs your assistance! -%E [You have reached %H but something is wrong. %lC needs your aid.] -%Cp Mon 00002 -Once again, you stand before %H. -%E -%Cp Mon 00003 -Again you face %H. Your intuition hints that this -may be the final time you come here. -%E -%Cp Mon 00005 -"Greetings, honorable %r. It is good to see you." -%E -%Cp Mon 00006 -"Ah, %p! Surely you can help us in our hour of need." -%E -%Cp Mon 00007 -"Greetings, %s. %lC has great need of your help." -%E -%Cp Mon 00008 -"Alas, it seems as if even %d has deserted us." -%E -%Cp Mon 00009 -"May %d be with you, %s." -%E -%Cp Mon 00010 -"Greetings, honorable %r. It is good to see you again." -%E -%Cp Mon 00011 -"Ah, %p! Our deepest gratitude for all of your help." -%E -%Cp Mon 00012 -"Greetings, %s. Perhaps you will take some time to meditate with us?" -%E -%Cp Mon 00013 -"With this test behind you, may %d bring you enlightenment." -%E -%Cp Mon 00014 -"May %d be with you, %s." -%E -%Cc Mon 00015 -"Ah, %p, my %S. You have returned to us at last. -A great blow has befallen our order; perhaps you can help us. -First, however, I must determine if you are prepared for this -great challenge." -%E [%lC checks whether you are ready for the great challenge.] -%Cp Mon 00016 -"Again, my %S, you stand before me. Are you ready now to help us?" -%E -%Cp Mon 00017 -"Once more, %p, you stand within the sanctum. Are you ready now?" -%E -%Cc Mon 00018 -"You are a heretic, %p! How can you, %ra, deviate so from the -teachings of %d? Begone from this temple. You are no longer -%sa to this order. We will pray to %d for other assistance, -as you have failed us utterly." -%E [You are a heretic and have failed utterly.] -%Cc Mon 00019 -"Alas, %p, it is not yet to be. A mere %r could never -withstand the might of %n. Go forth, again into the world, and -return when you have attained the post of %R." -%E [You are not ready to face %n. Come back when you are %Ra.] -%Cc Mon 00020 -"This is terrible, %p. You have deviated from the true path! -You know that %d requires the most strident devotion of this -order. The %shood must stand for utmost piety. - -"Go from here, atone for your sins against %d. Return only when -you have purified yourself." -%E [You must atone. Come back when you are worthy of %d.] -%Cc Mon 00021 -"Yes, %p. You are truly ready now. Attend to me and I shall -tell you of what has transpired: - -"During one of the Great Meditations a short time ago, %n and -a legion of elementals invaded %H. Many %gP -were killed, including the one bearing %o. - -Now, there are barely enough %gP left to keep the elementals -at bay. - -"We need you to find %i, then, from there, -travel to %ns lair. If you can manage to defeat %n and -return %o here, we can then drive off the legions -of elementals that slay our students. - -"Go with %d as your guide, %p." -%E [Find %i, then continue to %ns lair. Defeat %ni and return with %o.] -%Cp Mon 00025 -"You can prevail, if you rely on %d." -%E -%Cp Mon 00026 -"Remember that %n has great magic at his command." -%E -%Cp Mon 00027 -"Be pure, my %S." -%E -%Cp Mon 00028 -"Beware, %i is surrounded by hordes of earth elementals." -%E -%Cp Mon 00029 -"Remember your studies, and you will prevail!" -%E -%Cp Mon 00030 -"Acquire and wear %o if you can. They will aid you -against %n." -%E -%Cp Mon 00031 -"Call upon %d when your need is greatest. You will be answered." -%E -%Cp Mon 00032 -"Remember to use the elementals' strength against them!" -%E -%Cp Mon 00033 -"Do not lose faith, %p. If you do so, %n will grow stronger." -%E -%Cp Mon 00034 -"Wear %o. They will assist you in your efforts." -%E -%Cc Mon 00035 -You remember the descriptions of %i, given -to you by the %l. It is ahead that you will find -%n's trail. -%E [You have reached %i. %nC lurks further ahead.] -%Cp Mon 00036 -Again, you stand before %i. -%E -%Cc Mon 00040 -The stench of brimstone is all about you, and the elementals close in -from all sides! - -Ahead, there is a small clearing amidst the bubbling pits of lava... -%E [You are surrounded by brimstone, lava, and elementals.] -%Cp Mon 00041 -Again, you have invaded %ns domain. -%E -%Cc Mon 00050 -"Ah, so %l has sent another %g to retrieve -%o. - -"No, I see you are no %g. Perhaps I shall have some fun today -after all. Prepare to die, %r! You shall never regain -%o." -%E [You are no %g. You shall never regain %o.] -%Cp Mon 00051 -"So, %r. Again you challenge me." -%E -%Cp Mon 00052 -"Die now, %r. %d has no power here to aid you." -%E -%Cp Mon 00053 -"You shall die, %r, and I will have %o back." -%E -%Cp Mon 00060 -"Submit to my will, %c, and I shall spare you." -%E -%Cp Mon 00061 -"Your puny powers are no match for me, %c." -%E -%Cp Mon 00062 -"I shall have you turned into a zombie for my pleasure!" -%E -%Cp Mon 00063 -"Despair now, %r. %d cannot help you." -%E -%Cp Mon 00064 -"I shall feast upon your soul for many days, %c." -%E -%Cp Mon 00065 -"Your death will be slow and painful. That I promise!" -%E -%Cp Mon 00066 -"You cannot defeat %n, you fool. I shall kill you now." -%E -%Cp Mon 00067 -"Your precious %lt will be my next victim." -%E -%Cp Mon 00068 -"I feel your powers failing you, %r. You shall die now." -%E -%Cp Mon 00069 -"With %o, nothing can stand in my way." -%E -%Cc Mon 00070 -As you pick up %o, you feel the essence of -%d fill your soul. You know now why %n stole %oi from -%H, for with %oi, %ca of %d could -easily defeat his plans. - -You sense a message from %d. Though not verbal, you -get the impression that you must return to %l as soon -as possible. -%E [You feel the essence of %d and realize that you should take %o to %l.] -%Cc Mon 00080 -%nC gasps: - - "You have only defeated this mortal body. Know this: my spirit - is strong. I shall return and reclaim what is mine!" - -With that, %n expires. -%E [As %n dies, %nh threatens to return.] -%Cc Mon 00081 -"You have returned, %p. And with %o, I see. -Congratulations. - -"I have been in meditation, and have received direction from -a minion of %d. %d commands that you retain -%o. With %oi, you must recover the Amulet -of Yendor. - -"Go forth, and let %d guide your steps." -%E [Keep %o. %oH will help you recover the Amulet of Yendor.] -%Cc Mon 00082 -%lC studies %o for a moment, -then returns his gaze to you. - -"%oC must remain with you. Use %oi -as you resume your search for the Amulet. -%Z await your return through the magic portal -that brought you here." -%E [Keep %o and return to %Z to search for the Amulet.] -%Cp Mon 00090 -"Welcome back, %p. How is your quest for the Amulet going?" -%E -%Cc Mon 00091 -"You have prevailed, %p! %d is surely with you. Now, -you must take the Amulet, and sacrifice it on %ds altar on -the Astral Plane. I suspect that I shall never see you again in this -life, but I hope to at %ds feet." -%E [Take the Amulet to the Astral Plane and deliver it to %d.] -# -# Priest -# -%Cc Pri 00001 -You find yourself standing in sight of %H. Something -is obviously wrong here. The doors to %H, which usually -stand open, are closed. Strange human shapes shamble around -outside. - -You realize that %l needs your assistance! -%E [You are at %H; the doors are closed. %lC needs your help!] -%Cp Pri 00002 -Once again, you stand before %H. -%E -%Cp Pri 00003 -Again you face %H. Your intuition hints that this may be -the final time you come here. -%E -%Cp Pri 00005 -"Greetings, honored %r. It is good to see you." -%E -%Cp Pri 00006 -"Ah, %p! Surely you can help us in our hour of need." -%E -%Cp Pri 00007 -"Greetings, %s. %lC has great need of your help." -%E -%Cp Pri 00008 -"Alas, it seems as if even %d has deserted us." -%E -%Cp Pri 00009 -"May %d be with you, %s." -%E -%Cp Pri 00010 -"Greetings, %r. It is good to see you again." -%E -%Cp Pri 00011 -"Ah, %p! Our deepest gratitude for all of your help." -%E -%Cp Pri 00012 -"Welcome back, %s! With %o, no undead can stand against us." -%E -%Cp Pri 00013 -"Praise be to %d, for delivering us from %n." -%E -%Cp Pri 00014 -"May %d be with you, %s." -%E -%Cc Pri 00015 -"Ah, %p, my %S. You have returned to us at last. -A great blow has befallen our order; perhaps you can help us. -First, however, I must determine if you are prepared for this -great challenge." -%E [You have returned and we need your help. Are you ready?] -%Cp Pri 00016 -"Again, my %S, you stand before me. Are you ready now to help us?" -%E -%Cp Pri 00017 -"Once more, %p, you stand within the sanctum. Are you ready now?" -%E -%Cc Pri 00018 -"You are a heretic, %p! How can you, %ra, deviate so from the -teachings of %d? Begone from this temple. You are no longer -%sa to this order. We will pray to %d for other assistance, -as you have failed us utterly." -%E [You are a heretic who has deviated from the teachings of %d.] -%Cc Pri 00019 -"Alas, %p, it is not yet to be. A mere %r could never -withstand the might of %n. Go forth, again into the world, and return -when you have attained the post of %R." -%E [%rA cannot withstand %n. Come back when you are %Ra.] -%Cc Pri 00020 -"This is terrible, %p. You have deviated from the true path! -You know that %d requires the most strident devotion of this -order. The %shood must stand for utmost piety. - -"Go from here, atone for your sins against %d. Return only when -you have purified yourself." -%E [You have deviated from the path. Return when you have purified yourself.] -%Cc Pri 00021 -"Yes, %p. You are truly ready now. Attend to me and I shall -tell you of what has transpired: - -"At one of the Great Festivals a short time ago, %n and a legion -of undead invaded %H. Many %gP were killed, including -the one carrying %o. - -"As a final act of vengefulness, %n desecrated the altar here. -Without it, we could not mount a counter-attack. Now, there are -barely enough %gP left to keep the undead at bay. - -"We need you to find %i, then, from there, travel -to %ns lair. If you can manage to defeat %n and return -%o here, we can then drive off the legions of -undead that befoul the land. - -"Go with %d as your guide, %p." -%E [%nC invaded %H and captured %o. Defeat %ni and retrieve %oh.] -%Cp Pri 00025 -"You can prevail, if you rely on %d." -%E -%Cp Pri 00026 -"Remember that %n has great magic at his command." -%E -%Cp Pri 00027 -"Be pure, my %S." -%E -%Cp Pri 00028 -"Beware, %i is surrounded by a great graveyard." -%E -%Cp Pri 00029 -"You may be able to affect %n with magical cold." -%E -%Cp Pri 00030 -"Acquire and wear %o if you can. It will aid you -against %n." -%E -%Cp Pri 00031 -"Call upon %d when your need is greatest. You will be answered." -%E -%Cp Pri 00032 -"The undead legions are weakest during the daylight hours." -%E -%Cp Pri 00033 -"Do not lose faith, %p. If you do so, %n will grow stronger." -%E -%Cp Pri 00034 -"Wear %o. It will assist you against the undead." -%E -%Cc Pri 00035 -You stand facing a large graveyard. The sky above is filled with clouds -that seem to get thicker closer to the center. You sense the presence of -undead in larger numbers than you have ever encountered before. - -You remember the descriptions of %i, given to you by -%l. It is ahead that you will find %ns trail. -%E [You have found %i. The trail to %n lies ahead.] -%Cp Pri 00036 -Again, you stand before %i. -%E -%Cc Pri 00040 -The stench of brimstone is all about you, and the shrieks and moans -of tortured souls assault your psyche. - -Ahead, there is a small clearing amidst the bubbling pits of lava... -%E [The stench of brimstone surrounds you, the shrieks and moans are endless.] -%Cp Pri 00041 -Again, you have invaded %ns domain. -%E -%Cc Pri 00050 -"Ah, so %l has sent another %gC to retrieve -%o. - -"No, I see you are no %gC. Perhaps I shall have some fun today -after all. Prepare to die, %r! You shall never regain -%o." -%E [%lC has sent you, but you are no %gC. I shall destroy you.] -%Cp Pri 00051 -"So, %r. Again you challenge me." -%E -%Cp Pri 00052 -"Die now, %r. %d has no power here to aid you." -%E -%Cp Pri 00053 -"You shall die, %r, and I will have %o back." -%E -%Cp Pri 00060 -"Submit to my will, %c, and I shall spare you." -%E -%Cp Pri 00061 -"Your puny powers are no match for me, %c." -%E -%Cp Pri 00062 -"I shall have you turned into a zombie for my pleasure!" -%E -%Cp Pri 00063 -"Despair now, %r. %d cannot help you." -%E -%Cp Pri 00064 -"I shall feast upon your soul for many days, %c." -%E -%Cp Pri 00065 -"Your death will be slow and painful. That I promise!" -%E -%Cp Pri 00066 -"You cannot defeat %n, you fool. I shall kill you now." -%E -%Cp Pri 00067 -"Your precious %lt will be my next victim." -%E -%Cp Pri 00068 -"I feel your powers failing you, %r. You shall die now." -%E -%Cp Pri 00069 -"With %o, nothing can stand in my way." -%E -%Cc Pri 00070 -As you pick up %o, you feel the essence of -%d fill your soul. You know now why %n stole it from -%H, for with it, %ca of %d could -easily defeat his plans. - -You sense a message from %d. Though not verbal, you -get the impression that you must return to %l as soon -as possible. -%E [You feel %d as you pick up %o; return %oh to %l.] -%Cc Pri 00080 -You feel a wrenching shift in the ether as %ns body dissolves -into a cloud of noxious gas. - -Suddenly, a voice booms out: - - "Thou hast defeated the least of my minions, %r. - Know now that Moloch is aware of thy presence. - As for thee, %n, I shall deal with thy failure - at my leisure." - -You then hear the voice of %n, screaming in terror... -%E [%nC dies. Moloch is aware of you and angry at %n.] -%Cc Pri 00081 -"You have returned, %p. And with %o, I see. -Congratulations. - -"I have been in meditation, and have received direction from -a minion of %d. %d commands that you retain -%o. With it, you must recover the Amulet -of Yendor. - -"Go forth, and let %d guide your steps." -%E [Congratulations, %p. Keep %o; go and recover the Amulet.] -%Cc Pri 00082 -%lC reiterates that %o is yours now. - -"The time has come to resume your search for the Amulet. -%Z await your return through the magic portal -that brought you here." -%E [%oC is yours now. Return to %Z and find the Amulet.] -%Cp Pri 00090 -"Welcome back, %p. How is your quest for the Amulet going?" -%E -%Cc Pri 00091 -"You have prevailed, %p! %d is surely with you. Now, -you must take the amulet, and sacrifice it on %ds altar on -the Astral Plane. I suspect that I shall never see you again in this -life, but I hope to at %ds feet." -%E [Take the Amulet to the Astral Plane and offer it on %ds altar.] -# -# Ranger -# -# [Ran 00001: what if centaurs have been genocided?] -%Cc Ran 00001 -You arrive in familiar surroundings. In the distance, you %x the -ancient forest grove, the place of worship to %d. - -Something is wrong, though. Surrounding the grove are centaurs! -And they've noticed you! -%E [The ancient forest grove is surrounded by centaurs.] -%Cp Ran 00002 -Once again, you stand before %H. -%E -%Cp Ran 00003 -You have the oddest feeling that this may be the last time you -are to enter %H. -%E -%Cp Ran 00005 -"%pC! I have not seen you in many moons. How do you fare?" -%E -%Cp Ran 00006 -"%nC continues to threaten the grove. But we hold fast." -%E -%Cp Ran 00007 -"%lC is growing weak. The magic required to defend the grove drains us." -%E -%Cp Ran 00008 -"Remember %i is hard to enter. Beware the -distraction of leatherwings." -%E -%Cp Ran 00009 -"We must regain %o. Without it we will be overrun." -%E -%Cp Ran 00010 -"%pC! I have not seen you in many moons. How do you fare?" -%E -%Cp Ran 00011 -"Birdsong has returned to the grove, surely this means you have defeated %n." -%E -%Cp Ran 00012 -"%lC seems to have regained some of his strength." -%E -%Cp Ran 00013 -"So, tell us how you entered %i, in case some new evil arises there." -%E -%Cp Ran 00014 -"Is that truly %o that I see you carrying?" -%E -%Cc Ran 00015 -"%pC! You have returned! Thank %d. - -"We have great need of you. But first, I must see if you have the -required abilities to take on this responsibility." -%E [You have returned, %p. We need your help. Are you ready?] -%Cp Ran 00016 -"Once again, %p, you stand in our midst. Are you ready now?" -%E -%Cp Ran 00017 -"Ah, you are here again, %p. Allow me to determine your readiness..." -%E -%Cc Ran 00018 -"%pC! You have doomed us all. You fairly radiate %L influences -and weaken the power we have raised in this grove as a result! - -"Begone! We renounce your %shood with us! You are an outcast now!" -%E [You are not sufficiently %a. We renounce your %shood.] -%Cc Ran 00019 -"%p, you are yet too inexperienced to withstand the demands of that -which we need you to do. %RA might just be able to do this thing. - -"Return to us when you have learned more, my %S." -%E [You are too inexperienced. Come back when you are %Ra.] -%Cc Ran 00020 -"You have strayed, %p! You know that %d requires that -we maintain a pure devotion to things %a! - -"You must go from us. Return when you have purified yourself." -%E [You are not sufficiently %a. Come back when you have purified yourself.] -%Cc Ran 00021 -"You are indeed ready, %p. I shall tell you what has transpired, -and why we so desperately need your help: - -"A short time ago, the mountain centaurs to the east invaded -and enslaved the plains centaurs in this area. The local -leader is now only a figurehead, and serves %n. - -"During our last gathering of worship here, we were beset by hordes of -hostile centaurs, as you witnessed. In the first onslaught a group, -headed by %n %niself, managed to breach the grove and steal -%o. - -"Since then, we have been besieged. We do not know how much longer -we will be able to maintain our magical barriers. - -"If we are to survive, you, %p, must infiltrate -%i. There, you will find a pathway down, to the -underground cavern of %n. He has always coveted -%o, and will surely keep it. - -"Recover %o for us, %p! Only then will %d be safe." -%E [%nC has stolen %o. Infiltrate %i and retrieve %oh for us.] -%Cp Ran 00025 -"It is rumored that the Forest and Mountain Centaurs have resolved -their ancient feud and now band together against us." -%E -%Cp Ran 00026 -"%nC is strong, and very smart." -%E -%Cp Ran 00027 -"Use %o, when you find it. It will help you survive -to reach us." -%E -%Cp Ran 00028 -"Remember, let %d be your guide." -%E -%Cp Ran 00029 -"Call upon %d when you face %n. -The very act of doing so will infuriate him, and give you advantage." -%E -%Cp Ran 00030 -"%n and his kind have always hated us." -%E -%Cp Ran 00031 -"We cannot hold the grove much longer, %p. Hurry!" -%E -%Cp Ran 00032 -"To infiltrate %i, you must be very stealthy." -%E -%Cp Ran 00033 -"Remember that %n is a braggart. Trust not what he says." -%E -%Cp Ran 00034 -"You can triumph, %p, if you trust in %d." -%E -%Cc Ran 00035 -This must be %i. - -You are in a cave built of many different rooms, all interconnected -by tunnels. Your quest is to find and shoot the evil wumpus that -resides elsewhere in the cave without running into any bottomless -pits or using up your limited supply of arrows. Good luck. - -You are in room 9 of the cave. There are tunnels to rooms -5, 8, and 10. -*rustle* *rustle* (must be bats nearby.) -*sniff* (I can smell the evil wumpus nearby!) -%E [This is %i. There are bats nearby. Beware the wumpus!] -%Cc Ran 00036 -Once again, you descend into %i. - -*whoosh* (I feel a draft from some pits.) -*rustle* *rustle* (must be bats nearby.) -%E [You are in %i. There are pits. There are bats nearby.] -# [Ran 00040: 'hear a sound' but hero might be deaf.] -%Cc Ran 00040 -You descend into a weird place, in which roughly cut cave-like walls -join with smooth, finished ones, as if someone was in the midst of -finishing off the construction of a subterranean complex. - -Off in the distance, you hear a sound like the clattering of many -hooves on rock. -%E [You descend into a subterranean complex. Hooves clatter in the distance.] -%Cp Ran 00041 -Once again, you enter the distorted castle of %n. -%E -%Cc Ran 00050 -"So, %c. %lC has sent you to recover %o. - -"Well, I shall keep that bauble. It pleases me. You, %c, shall die." -%E [You have come to recover %o, but I shall keep %oh and you shall die.] -%Cp Ran 00051 -"Back again, eh? Well, a mere %r is no threat to me! Die, %c!" -%E -%Cp Ran 00052 -"You haven't learned your lesson, %c. You can't kill me! You shall die now." -%E -%Cp Ran 00053 -"I shall have %o from you, %r. Then I shall -kill you." -%E -%Cp Ran 00060 -"Your %d is nothing, %c. You are mine now!" -%E -%Cp Ran 00061 -"Run away little %c! You can never hope to defeat %n!" -%E -%Cp Ran 00062 -"My servants will rip you to shreds!" -%E -%Cp Ran 00063 -"I shall display your head as a trophy. What do you think about that wall?" -%E -%Cp Ran 00064 -"I shall break your %ls grove, and destroy all the %gP!" -%E -%Cp Ran 00065 -"%d has abandoned you, %c. You are doomed." -%E -%Cp Ran 00066 -"%rA? %lC sends a mere %r against me? Hah!" -%E -%Cp Ran 00067 -"%lC has failed, %c. %oC will never leave here." -%E -%Cp Ran 00068 -"You really think you can defeat me, eh %c? You are wrong!" -%E -%Cp Ran 00069 -"You weaken, %c. I shall kill you now." -%E -%Cc Ran 00070 -As you pick up %o, it seems to glow, and a warmth -fills you completely. You realize that its power is what has protected -your %sp against their enemies for so long. - -You must now return it to %l without delay -- their lives depend -on your speed. -%E [You pick up %o and feel power. It's time to return %oh to %l.] -%Cc Ran 00080 -%nC collapses to the ground, cursing you and %l, then says: - - "You have defeated me, %r! But I curse you one final time, with - my dying breath! You shall die before you leave my castle!" -%E [%nC curses you as %nh dies.] -%Cc Ran 00081 -"%pC! You have succeeded! I feared it was not possible! - -"You have returned with %o! - -"I fear, now, that the Centaurs will regroup and plot yet another raid. -This will take some time, but if you can recover the Amulet of Yendor -for %d before that happens, we will be eternally safe. - -"Take %o with you. It will aid in your quest for -the Amulet." -%E [You have succeeded. Take %o with you as you go to find the Amulet.] -# assumes The Longbow of Diana -%Cc Ran 00082 -%l flexes %o reverently. - -"With this wondrous bow, one need never run out of arrows. -You are its keeper now, and the time has come to resume your -search for the Amulet. %Z await your return -through the magic portal that brought you here." -%E [You are the keeper of %o now. Go and find the Amulet.] -%Cp Ran 00090 -"Welcome, %p. How have you fared on your quest for the Amulet -of Yendor?" -%E -%Cc Ran 00091 -"You have it! You have recovered the Amulet of Yendor! -Now attend to me, %p, and I will tell you what must be done: - -"The Amulet has within it magic, the capability to transport you to -the Astral Plane, where the primary circle of %d resides. - -"To activate this magic, you must travel upwards as far as you can. -When you reach the temple, sacrifice the Amulet to %d. - -"Thus will you fulfill your destiny." -%E [You have the Amulet! Take it to the Astral Plane and offer it to %d.] -# -# Rogue (with apologies to all Norsk speakers -dean) -# -%Cc Rog 00001 -Unexpectedly, you find yourself back in Ransmannsby, where you trained to -be a thief. Quickly you make the guild sign, hoping that you AND word -of your arrival reach %ls den. -%E [You are in Ransmannsby, where you trained. Find %l.] -%Cp Rog 00002 -Once again, you find yourself back in Ransmannsby. Fond memories are -replaced by fear, knowing that %l is waiting for you. -%E -%Cp Rog 00003 -You rub your hands through your hair, hoping that the little ones on -the back of your neck stay down, and prepare yourself for your meeting -with %l. -%E -%Cp Rog 00005 -"I hear that Lady Tyvefelle's household is lightly guarded." -%E -%Cp Rog 00006 -"You're back? Even the Twain don't come back anymore." -%E -%Cp Rog 00007 -"Can you spare an old cutpurse a zorkmid for some grog?" -%E -%Cp Rog 00008 -"Fritz tried to join the other side, and now he's hell-hound chow." -%E -%Cp Rog 00009 -"Be careful what you steal, I hear the boss has perfected turning -rocks into worthless pieces of glass." -%E -%Cp Rog 00010 -"I was sure wrong about Lady Tyvefelle's house; I barely got away with my -life and lost my lock pick in the process." -%E -%Cp Rog 00011 -"You're back? Even the Twain don't come back anymore." -%E -%Cp Rog 00012 -"Can you spare an old cutpurse a zorkmid for some grog?" -%E -%Cp Rog 00013 -"Fritz tried to join the other side, and now he's hell-hound chow." -%E -%Cp Rog 00014 -"Be careful what you steal, I hear the boss has perfected turning -rocks into worthless pieces of glass." -%E -%Cc Rog 00015 -"Well, look who it is boys -- %p has come home. You seem to have -fallen behind in your dues. I should kill you as an example to these -other worthless cutpurses, but I have a better plan. If you are ready -maybe you could work off your back dues by performing a little job for -me. Let us just see if you are ready..." -%E [You owe back dues to your guild. You can pay them off if you're up to the job.] -%Cc Rog 00016 -"Well, I didn't expect to see you back. It shows that you are either stupid, -or you are finally ready to accept my offer. Let us hope for your sake it -isn't stupidity that brings you back." -%E [Are you stupid or are you ready?] -%Cp Rog 00017 -"Did you perhaps mistake me for some other %lt? You must -think me as stupid as your behavior. I warn you not to try my patience." -%E -%Cc Rog 00018 -"Well %gp, it looks like our friend has forgotten who is the boss -around here. Our friend seems to think that %rp have been put in -charge. Wrong. DEAD WRONG!" - -Your sudden shift in surroundings prevents you from hearing the end -of %ls curse. -%E [You must go.] -%Cc Rog 00019 -"In the time that you've been gone you've only been able to master the -arts of %ra? I've trained ten times again as many %Rp -in that time. Maybe I should send one of them, no? Where would that -leave you, %p? Oh yeah, I remember, I was going to kill you!" -%E [%rA is not adequately trained to handle this job.] -%Cc Rog 00020 -"Maybe I should chain you to my perch here for a while. Perhaps watching -real %a men at work will bring some sense back to you. I don't -think I could stand the sight of you for that long though. Come back -when you can be trusted to act properly." -%E [Come back when you are really %a.] -%Cc Rog 00021 -"Will everyone not going to retrieve %o from that -jerk, %n, take one step backwards. Good choice, -%p, because I was going to send you anyway. My other %gp -are too valuable to me. - -"Here's the deal. I want %o, %n -has %o. You are going to get %o -and bring it back to me. So simple an assignment even you can understand -it." -%E [Get %o from %n and bring it to %l.] -%Cp Rog 00025 -"You don't seem to understand, -%o isn't here so neither should you be!" -%E -%Cp Rog 00026 -"May %d curse you with lead fingers. Get going!" -%E -%Cp Rog 00027 -"We don't have all year. GET GOING!" -%E -%Cp Rog 00028 -"How would you like a scar necklace? I'm just the jeweler to do it!" -%E -%Cp Rog 00029 -"Lazy S.O.B. Maybe I should call up someone else..." -%E -%Cp Rog 00030 -"Maybe I should open your skull and see if my instructions are inside?" -%E -%Cp Rog 00031 -"This is not a task you can complete in the afterlife, you know." -%E -%Cp Rog 00032 -"Inside every living person is a dead person trying to get out, -and I have your key!" -%E -%Cp Rog 00033 -"We're almost out of hell-hound chow, so why don't you just get moving!" -%E -%Cp Rog 00034 -"You know, %o isn't going to come when you whistle. You must get it yourself." -%E -%Cp Rog 00035 -Those damn little hairs tell you that you are nearer to %o. -%E -%Cp Rog 00036 -Not wanting to face %l without having stolen %o, you continue. -%E -%Cc Rog 00040 -You feel a great swelling up of courage, sensing the presence of -%o. Or is it fear? -%E [You sense %o.] -%Cp Rog 00041 -The hairs on the back of your neck whisper -- it's fear. -%E -%Cp Rog 00050 -"Ah! You must be %ls ... er, `hero'. A pleasure to meet you." -%E -%Cp Rog 00051 -"We meet again. Please reconsider your actions." -%E -%Cc Rog 00052 -"Surely, %p, you have learned that you cannot trust any bargains -that %l has made. I can show you how to continue on -your quest without having to run into him again." -%E [You cannot trust %l.] -%Cc Rog 00053 -"Please, think for a moment about what you are doing. Do you truly -believe that %d would want %l to have -%o?" -%E [%lC should not have %o.] -%Cp Rog 00060 -"May I suggest a compromise. Are you interested in gold or gems?" -%E -%Cp Rog 00061 -"Please don't force me to kill you." -%E -%Cp Rog 00062 -"Grim times are upon us all. Will you not see reason?" -%E -%Cp Rog 00063 -"I knew %l, and you're no %lt, thankfully." -%E -%Cp Rog 00064 -"It is a shame that we are not meeting under more pleasant circumstances." -%E -%Cp Rog 00065 -"I was once like you are now, %p. Believe in me -- our way is better." -%E -%Cp Rog 00066 -"Stay with me, and I will make you %os guardian." -%E -%Cp Rog 00067 -"When you return, with or without %o, -%l will have you killed." -%E -%Cp Rog 00068 -"Do not be fooled; I am prepared to kill to defend %o." -%E -%Cp Rog 00069 -"I can reunite you with the Twain. Oh, the stories you can swap." -%E -%Cc Rog 00070 -As you pick up %o, the hairs on the back of your -neck fall out. At once you realize why %n was -willing to die to keep it out of %ls hands. Somehow -you know that you must do likewise. -%E [You pick up %o and know that %l should not have it.] -%Cc Rog 00080 -"I know what you are thinking, %p. It is not too late for you -to use %o wisely. For the sake of your guild -%sp, do what is right." - -You sit and wait for death to come for %n, and then you -brace yourself for your next meeting with %l! -%E [Before dying, %n tells you to use the %o wisely.] -%Cc Rog 00081 -"Well, I'll be damned. You got it. I am proud of you, a fine %r -you've turned out to be. - -"While you were gone I got to thinking, you and %o -together could bring me more treasure than either of you apart, so why don't -you take it with you. All I ask is a cut of whatever loot you come by. -That is a better deal than I offered %n. - -"But, you see what happened to %n when he refused. -Don't make me find another to send after you this time." -%E [Take %o with you and go.] -# assumes Master Key of Thievery (small object) -%Cc Rog 00082 -%lC seems tempted to swap %o for -the mundane one you detect in his pocket, but noticing your alertness, -evidently chickens out. - -"Go filch the Amulet before someone else beats you to it. -%Z are back the way you came, through the magic portal." -%E [Take %o and acquire the Amulet.] -%Cc Rog 00090 -"Quite the little thief, aren't we, %p. Can I interest you in a -swap for %o? Look around, anything in the keep -is yours for the asking." -%E [How about trading %o for something?] -%Cc Rog 00091 -"I see that with your abilities, and my brains, we could rule this world. - -"All that we would need to be all-powerful is for you to take that little -trinket you've got there up to the Astral Plane. From there, %d will -show you what to do with it. Once that's done, we will be invincible!" -%E [Take the Amulet to the Astral Plane and find %ds temple.] -# -# Samurai -# -%Cc Sam 00001 -Even before your senses adjust, you recognize the kami of -%H. - -You %x the standard of your teki, %n, flying above -the town. How could such a thing have happened? Why are ninja -wandering freely; where are the samurai of your daimyo, %l? - -You quickly say a prayer to Izanagi and Izanami and walk towards -town. -%E [The banner of %n flies above town. What has happened to %l?] -%Cp Sam 00002 -Once again, you are back at %H. -%E -%Cc Sam 00003 -You are back at %H. - -Instantly you sense a subtle change in your karma. You seem to know that -if you do not succeed in your quest, %n will have destroyed -the kami of %H before you return again. -%E [%HC is threatened by %n.] -%Cp Sam 00005 -"To succeed, you must walk like a butterfly on the wind." -%E -%Cp Sam 00006 -"Ikaga desu ka?" -%E -%Cp Sam 00007 -"I fear for The Land of The Gods." -%E -%Cp Sam 00008 -"%nC has hired the Ninja -- be careful." -%E -%Cp Sam 00009 -"If %o is not returned, we will all be ronin." -%E -%Cp Sam 00010 -"Come, join us in celebrating with some sake." -%E -%Cp Sam 00011 -"Ikaga desu ka?" -%E -%Cp Sam 00012 -"You have brought our clan and %l much honor." -%E -%Cp Sam 00013 -"Please %r, sit for a while and tell us how you overcame the Ninja." -%E -%Cp Sam 00014 -"%lC still lives! You have saved us from becoming ronin." -%E -%Cc Sam 00015 -"Ah, %p-san, it is good to see you again. I need someone who can -lead my samurai against %n. If you are ready, you will be -that person." -%E [%lC needs someone to lead %lj samurai against %n. Are you ready?] -%Cp Sam 00016 -"Once again, %p-san, you kneel before me. Are you yet capable of -being my vassal?" -%E -# [Sam 00017: This summary is definitely a poor one.] -%Cc Sam 00017 -"You begin to test my matsu, %p-san. -If you cannot determine what I want in a samurai, how can I rely on you -to figure out what I need from a samurai?" -%E [Are you truely a samurai?] -%Cc Sam 00018 -"You are no longer my samurai, %p. - -"Hara-kiri is denied. You are ordered to shave your head and then to -become a monk. Your fief and family are forfeit. Wakarimasu ka?" -%E [Leave and do not come back.] -%Cc Sam 00019 -"%p-san, you have learned well and honored your family. -I require the skills of %Ra in order to defeat %n. -Go and seek out teachers. Learn what they have learned. When you -are ready, return to me." -%E ["I require %Ra to defeat %n. Return when you are ready."] -%Cc Sam 00020 -"%p-san, you would do better to join the kyokaku. - -"You have skills, but until you can call upon the bushido to know when and -how to use them you are not samurai. When you can think %a and -act %a then return." -%E [When you can think %a and act %a then return.] -%Cc Sam 00021 -"Domo %p-san, indeed you are ready. I can now tell you what -it is that I require of you. - -"The daimyo, %n, has betrayed us. He has stolen from us -%o and taken it to his donjon deep within -%i. - -"If I cannot show the emperor %o when he comes -for the festival he will know that I have failed in my duty, and -request that I commit seppuku. - -"You must gain entrance to %i and retrieve the -emperor's property. Be quick! The emperor will be here for the -cha-no-you in 5 sticks. - -"Wakarimasu ka?" -%E [You must enter %i, then regain %o from %n.] -%Cp Sam 00025 -"To defeat %n you must overcome the seven emotions: -hate, adoration, joy, anxiety, anger, grief, and fear." -%E -%Cp Sam 00026 -"Remember your honor is my honor, you perform in my name." -%E -%Cp Sam 00027 -"I will go to the temple and burn incense for your safe return." -%E -%Cp Sam 00028 -"Sayonara." -%E -%Cp Sam 00029 -"There can be honor in defeat, but no gain." -%E -%Cp Sam 00030 -"Your kami must be strong in order to succeed." -%E -%Cp Sam 00031 -"You are indeed a worthy %R, but now you must be a worthy samurai." -%E -%Cp Sam 00032 -"If you fail, %n will be like a tai-fun on the land." -%E -%Cp Sam 00033 -"If you are truly %a, %d will listen." -%E -%Cp Sam 00034 -"Sharpen your swords and your wits for the task before you." -%E -%Cp Sam 00035 -You instinctively reach for your swords. You do not recognize the -lay of this land, but you know that your teki are everywhere. -%E -%Cp Sam 00036 -Thankful that your %sp at %H cannot see -your fear, you prepare again to advance. -%E -%Cc Sam 00040 -In your mind, you hear the taunts of %n. - -You become like the rice plant and bend to the ground, offering a -prayer to %d. But when the wind has passed, you stand -proudly again. Putting your kami in the hands of fate, you advance. -%E [You feel the taunts %n, but after offering a prayer to %d, you proceed.] -%Cp Sam 00041 -As you arrive once again at the home of %n, your thoughts -turn only to %o. -%E -%Cp Sam 00042 -As you arrive once again at the home of %n. -%E -%Cp Sam 00050 -"Ah, so it is to be you, %p-san. I offer you seppuku. -I will be your second if you wish." -%E -%Cp Sam 00051 -"I have offered you the honorable exit. Now I will have your -head to send unwashed to %l." -%E -%Cp Sam 00052 -"After I have dispatched you, I will curse your kami." -%E -%Cp Sam 00053 -"You have fought my samurai; surely you must know that you -will not be able to take %o back to -%H." -%E -%Cp Sam 00060 -"Ahh, I finally meet the daimyo of the kyokaku!" -%E -%Cp Sam 00061 -"There is no honor for me in your death." -%E -%Cp Sam 00062 -"You know that I cannot resash my swords until they have killed." -%E -%Cp Sam 00063 -"Your presence only compounds the dishonor of %l in not coming %liself." -%E -%Cp Sam 00064 -"I will make tea with your hair and serve it to %l." -%E -%Cp Sam 00065 -"Your fear shows in your eyes, coward!" -%E -%Cp Sam 00066 -"I have not heard of you, %p-san; has your life been that unworthy?" -%E -%Cp Sam 00067 -"If you will not obey me, you will die." -%E -%Cp Sam 00068 -"Kneel now and make the two cuts of honor. I will tell your %sp -of your honorable death." -%E -%Cp Sam 00069 -"Your master was a poor teacher. You will pay for his mistakes in -your teaching." -%E -%Cc Sam 00070 -As you pick up %o, you feel the strength of its karma. -You realize at once why so many good samurai had to die to defend it. -You are humbled knowing that you hold one of the artifacts of the -sun goddess. -%E [You feel the power of %o and are humbled.] -%Cc Sam 00080 -Your healing skills tell you that %ns wounds are mortal. - -You know that the bushido tells you to finish him and let his kami -die with honor, but the thought of so many samurai dead due to this -man's dishonor prevents you from giving the final blow. - -You order that his unwashed head be given to the crows and his body -thrown into the sea. -%E [%nC dies without honor.] -%Cc Sam 00081 -As you bow before %l, he welcomes you: - - "You have brought your family great honor, %p-sama. - - "While you have been gone the emperor's advisors have discovered in - the ancient texts that the karma of the samurai who seeks to recover - the Amulet and the karma of %o are joined - as the seasons join to make a year. - - "Because you have shown such fidelity, the emperor requests - that you take leave of other obligations and continue on the - road that fate has set your feet upon. I would consider it - an honor if you would allow me to watch your household until - you return with the Amulet." - -With that, %l bows, and places his sword atop -%o. -%E [The emperor wants you to take %o and recover the Amulet.] -%Cc Sam 00082 -%l holds %o tightly for a moment, then returns -his gaze to you. - -"The time is ripe to recover the Amulet. Return to %Z -through the magic portal that transported you here so that you may -achieve the destiny which awaits you." -%E [Take %o, return to %Z, and recover the Amulet.] -%Cp Sam 00090 -%lC bows. "%p-sama, tell us of your search for the Amulet." -%E -# [Sam 00091: most other roles give more explicit directions for the -# feedback here, so this summary does that too.] -%Cc Sam 00091 -"Ah, %p-sama. You have wasted your efforts returning home. -Now that you are in possession of the Amulet, you are honor-bound to -finish the quest you have undertaken. There will be plenty of time -for saki and stories when you have finished. - -"Go now, and may our prayers be a wind at your back." -%E [Take the Amulet to the Astral Plane to finish your task.] -# -# Tourist -# -%Cc Tou 00001 -You breathe a sigh of relief as you find yourself back in the familiar -surroundings of %H. - -You quickly notice that things do not appear the way they did when you -left. The town is dark and quiet. There are no sounds coming from -behind the town walls, and no campfires burning in the fields. As a -matter of fact, you do not %x any movement in the fields at all, and -the crops seem as though they have been untended for many weeks. -%E [You find yourself back at %H, but the quiet is ominous.] -%Cp Tou 00002 -Once again, you are back at %H. -%E -%Cp Tou 00003 -You are back at %H. -Things appear to have become so bad that you fear that soon -%H will not be here to return to. -%E -%Cp Tou 00005 -"Gehennom on 5 zorkmids a day -- more like 500 a day if you ask me." -%E -%Cp Tou 00006 -"Do you know where I could find some nice postcards of The Gnomish Mines?" -%E -%Cp Tou 00007 -"Have you tried the weird toilets?" -%E -%Cp Tou 00008 -"Don't stay at the Inn, I hear the food is terrible and it has rats." -%E -%Cp Tou 00009 -"They told me that this was the off season!" -%E -%Cp Tou 00010 -"Gehennom on 5 zorkmids a day -- more like 500 a day if you ask me." -%E -%Cp Tou 00011 -"Do you know where I could find some nice postcards of The Gnomish Mines?" -%E -%Cp Tou 00012 -"Have you tried the weird toilets?" -%E -%Cp Tou 00013 -"If you stick around, I'll show you the pictures from my latest trip." -%E -%Cp Tou 00014 -"Did you bring me back any souvenirs?" -%E -%Cc Tou 00015 -"Is it really you, %p! I had given up hope for your return. -As you can %x, we are desperately in need of your talents. Someone must -defeat %n if our town is to become what it once was. - -"Let me see if you are ready to be that someone." -%E [Someone must defeat %n. Are your ready?] -%Cp Tou 00016 -"Things are getting worse, %p. I hope that this time you are ready." -%E -%Cp Tou 00017 -"I hope that for the sake of %H you have prepared yourself this time." -%E -%Cc Tou 00018 -"It is too late, %p. You are not even worthy to die amongst us. -Leave %H and never return." -%E [Leave %H and never return.] -%Cc Tou 00019 -"There is still too much that you have to learn before you can undertake -the next step. Return to us as a proven %R, and perhaps then -you will be ready. - -"Go back now, and may the teachings of %d serve you well." -%E [Return when you are %Ra.] -%Cc Tou 00020 -"It would be an affront to %d to have one not true to the -%a path undertake her bidding. - -"You must not return to us until you have purified yourself of these -bad influences on your actions. Remember, only by following the %a -path can you hope to overcome the obstacles you will face." -%E [You are not sufficiently %a. Return when you are.] -%Cc Tou 00021 -"You have indeed proven yourself a worthy %c, %p. - -"But now your kinfolk and I must ask you to put aside your travels and -help us in our time of need. After you left us we elected a new mayor, -%n. He proved to be a most heinous and vile creature. - -"Soon after taking office he absconded with %o -and fled town, leaving behind his henchmen to rule over us. In order -for us to regain control of our town, you must enter %i -and recover %o. - -"Do not be distracted on your quest. If you do not return quickly I fear -that all will be lost. Let us both pray now that %d will guide you -and keep you safe." -%E [Enter %i and recover %o from %n.] -%Cp Tou 00025 -"Do not be fooled by the false promises of %n." -%E -%Cp Tou 00026 -"To enter %i you must pass many traps." -%E -%Cp Tou 00027 -"If you do not return with %o, your quest -will be in vain." -%E -%Cp Tou 00028 -"Do not be afraid to call upon %d if you truly need help." -%E -%Cp Tou 00029 -"If you do not destroy %n, he will follow you back here!" -%E -%Cp Tou 00030 -"Take %o from %n -and you may be able to defeat him." -%E -%Cp Tou 00031 -"You must hurry, %p!" -%E -%Cp Tou 00032 -"You are like %Sa to me, %p. Do not let me down." -%E -%Cp Tou 00033 -"If you are %a at all times you may succeed, %p." -%E -%Cp Tou 00034 -"Let all who meet you on your journey know that you are on a quest for -%l and grant safe passage." -%E -%Cc Tou 00035 -Only your faith in %d keeps you from trembling. You %x -the handiwork of %ns henchlings everywhere. -%E [You %x the handiwork of %ns henchlings.] -%Cp Tou 00036 -You know that this time you must find and destroy %n. -%E -%Cp Tou 00040 -You sense the presence of %o. -%E -%Cp Tou 00041 -You gain confidence, knowing that you may soon be united with -%o. -%E -%Cp Tou 00042 -You have returned to %ns lair. -%E -%Cc Tou 00050 -"So, %p, %l thinks that you can wrest -%o from me! - -"It only proves how desperate he has become that he sends %ra to -try and defeat me. When this day is over, I will have you enslaved -in the mines where you will rue the day that you ever entered -%i." -%E [%rA will not defeat me.] -%Cp Tou 00051 -"I let you live the last time because it gave me pleasure. -This time I will destroy you, %p." -%E -%Cc Tou 00052 -"These meetings come to bore me. You disturb my workings with -%o. - -"If you do not run away now, I will inflict so much suffering on you that -%l will feel guilty for ever having sent his %S to me!" -%E [Run away or you will suffer severely.] -%Cc Tou 00053 -"You fool. You do not know how to call upon the powers of -%o. - -"Return it to me and I will teach you how to use it, and together we -will rule %H. But do so now, as my patience grows thin." -%E ["Return %o to me and we will rule %H."] -%Cp Tou 00060 -"I defeated %l and I will defeat you, %p." -%E -%Cp Tou 00061 -"Where is %d now! You must realize no one can help you here." -%E -%Cp Tou 00062 -"Beg for mercy now and I may be lenient on you." -%E -%Cp Tou 00063 -"If you were not so %a, you might have stood a chance." -%E -%Cp Tou 00064 -"Vengeance is mine at last, %p." -%E -%Cp Tou 00065 -"I only wish that %l had a more worthy %r to send against me." -%E -%Cp Tou 00066 -"With %o in my possession you cannot -hope to defeat me." -%E -%Cp Tou 00067 -"%nC has never been defeated, NEVER!" -%E -%Cp Tou 00068 -"Are you truly the best %H has to send against me? I pity %l." -%E -%Cp Tou 00069 -"How do you spell %p? I want to ensure the marker on your grave is -correct as a warning to your %sp." -%E -%Cc Tou 00070 -As you pick up %o, you feel a great -weight has been lifted from your shoulders. Your only thoughts are -to quickly return to %H and find %l. -%E [You pick up %o and feel relief. Return it to %l.] -%Cc Tou 00080 -You turn in the direction of %n. As his earthly body begins -to vanish before your eyes, you hear him curse: - - "You shall never be rid of me, %p! - I will find you where ever you go and regain what is rightly mine." -%E [%nC curses at you as %nh dies.] -%Cc Tou 00081 -As %l detects the presence of %o, -he almost smiles for the first time in many a full moon. - -As he looks up from %o he says: - - "You have recovered %o. You are its - owner now, but not its master. Let it work with you as you continue - your journey. With its help, and %d to guide you on the - %a path, you may yet recover the Amulet of Yendor." -%E [Take %o and with %ds guidance, recover the Amulet.] -%Cc Tou 00082 -"%oC is yours now. %Z -await your return through the magic portal that brought you here." -%E [Keep %o and return to %Z through the portal.] -%Cp Tou 00090 -"I could not be more proud than if you were my own %S, %p! -Tell me of your adventures in quest of the Amulet of Yendor." -%E -# [Tou 00091: like Sam 00091, the directions about what to do next are -# missing, so make the summary be a little bit more explicit.] -%Cc Tou 00091 -"Stand back and let me look at you, %p. -Now that you have recovered the Amulet of Yendor, I'm afraid living -out your days in %H would seem pretty tame. - -"You have come too far to stop now, for there are still more tasks that -our oral history foretells for you. Forever more, though, your name shall -be spoken by the %gP with awe. You are truly an inspiration to your -%sp!" -%E [You have the Amulet. Take it to the Astral Plane to finish your task.] -# -# Valkyrie -# -%Cc Val 00001 -You materialize at the base of a snowy hill. Atop the hill sits -a place you know well, %H. You immediately realize -that something here is very wrong! - -In places, the snow and ice have been melted into steaming pools of -water. Fumaroles and pools of bubbling lava surround the hill. -The stench of sulphur is carried through the air, and you %x creatures -that should not be able to live in this environment moving towards you. -%E [You arrive below %H. Something is wrong; there is lava present.] -%Cp Val 00002 -Once again, you are near the abode of %l. -%E -%Cp Val 00003 -Again you materialize near %ls abode. You have a nagging feeling -that this may be the last time you come here. -%E -%Cp Val 00005 -"Hail, and well met, brave %c." -%E -%Cp Val 00006 -"May %d guide your steps, %p." -%E -%Cp Val 00007 -"%lC weakens. Without %o, her foresight is dim." -%E -%Cp Val 00008 -"You must hurry, %p, else Ragnarok may well come." -%E -%Cp Val 00009 -"I would deal with this foul %n myself, but %d forbids it." -%E -%Cp Val 00010 -"Hail, and well met, brave %c." -%E -%Cp Val 00011 -"May %d guide your steps, %p." -%E -%Cp Val 00012 -"%lC told us you had succeeded!" -%E -%Cp Val 00013 -"You recovered %o just in time, %p." -%E -%Cp Val 00014 -"Hail %d, for delivering %o back to us." -%E -%Cc Val 00015 -"Ah, %p, my %S. You have returned to %H -at last. We are in dire need of your aid, but I must determine if you -are yet ready for such an undertaking. - -"Let me read your fate..." -%E [We need your aid. Are you ready?] -%Cp Val 00016 -"Let me read the future for you now, %p, perhaps you have managed to -change it enough..." -%E -%Cp Val 00017 -"Again, I shall read your fate, my %S. Let us both hope that you have -made changes to become ready for this task..." -%E -%Cc Val 00018 -"No, %p. Your fate is sealed. I must cast about for another -champion. Begone from my presence, and never return. Know this, that -you shall never succeed in this life, and Valhalla is denied to you." -%E ["Begone from my presence and never return."] -%Cc Val 00019 -"I see you and %n fighting, %p. But you are not prepared and -shall die at %ns hand if you proceed. No. This will not do. -Go back out into the world, and grow more experienced at the ways of war. -Only when you have returned %Ra will you be able to defeat %n." -%E [Come back when you are %Ra.] -%Cc Val 00020 -"NO! This is terrible. I see you becoming an ally of %n, and -leading his armies in the final great battles. This must not come to -pass! You have strayed from the %a path. You must purge yourself, -and return here only when you have regained a state of purity." -%E [You have strayed from the %a path. Return after you purify yourself.] -%Cc Val 00021 -"It is not clear, %p, for my sight is limited without our relic. -But it is now likely that you can defeat %n, and recover -%o. - -"A short time ago, %n and his minions attacked this place. They -opened the huge volcanic vents you %x about the hill, and attacked. I knew -that this was to come to pass, and had asked %d for a group of %gP -to help defend this place. The few you %x here are the mightiest of -Valhalla's own, and are all that are left of one hundred %d sent. - -"Despite the great and glorious battle we fought, %n managed at -last to steal %o. This has upset the balance of the universe, -and unless %oh is returned into my care, %n may start Ragnarok. - -"You must find the entrance to %i. Travel downward -from there and you will find %ns lair. Defeat him and -return %o to me." -%E [Find %i; defeat %n; return with %o.] -%Cp Val 00025 -"Go with the blessings of %d." -%E -%Cp Val 00026 -"Call upon %d when you are in need." -%E -%Cp Val 00027 -"Use %o if you can. It will protect you." -%E -%Cp Val 00028 -"Magical cold is very effective against %n." -%E -%Cp Val 00029 -"To face %n, you will need to be immune to fire." -%E -%Cp Val 00030 -"May %d strengthen your sword-arm." -%E -%Cp Val 00031 -"Trust in %d. He will not desert you." -%E -%Cp Val 00032 -"It becomes more likely that Ragnarok will come with every passing moment. -You must hurry, %p." -%E -%Cp Val 00033 -"If %n can master %o, he will be powerful enough to -face %d far earlier than is fated. This must not be!" -%E -%Cp Val 00034 -"Remember your training, %p. You can succeed." -%E -%Cc Val 00035 -The ice and snow gives way to a valley floor. You %x ahead of you -a huge round hill surrounded by pools of lava. This then is the entrance -to %i. It looks like you're not going to get in without -a fight though. -%E [This is the entrance to %i.] -%Cp Val 00036 -Once again, you stand before the entrance to %i. -%E -%Cc Val 00040 -Through clouds of sulphurous gasses, you %x a rock palisade -surrounded with a moat of bubbling lava. You remember the description -from something that %l said. This is the lair of %n. -%E [This is the lair of %n.] -%Cp Val 00041 -Once again, you stand in sight of %ns lair. -%E -%Cc Val 00050 -"So! %lC has finally sent %ca to challenge me! - -"I thought that mastering %o would enable me to challenge -%d, but it has shown me that first I must kill you! So come, little -%s. Once I defeat you, I can at last begin the final battle with %d." -%E ["%oC has shown me that I must kill you."] -%Cp Val 00051 -"Again you challenge me, %r. Good. I will kill you now." -%E -%Cp Val 00052 -"Have you not learned yet? You cannot defeat %n!" -%E -%Cp Val 00053 -"I will kill you, %c, and wrest %o from your mangled hands." -%E -%Cp Val 00060 -"I am your death, %c." -%E -%Cp Val 00061 -"You cannot prevail, %r. I have foreseen your every move." -%E -%Cp Val 00062 -"With you out of the way, Valhalla will be mine for the taking." -%E -%Cp Val 00063 -"I killed scores of %ds best when I took %o. -Do you really think that one %c can stand against me?" -%E -%Cp Val 00064 -"Who bears the souls of %cP to Valhalla, %r?" -%E -%Cp Val 00065 -"No, %d cannot help you here." -%E -%Cp Val 00066 -"Some instrument of %d you are, %p. You are a weakling!" -%E -%Cp Val 00067 -"Never have I seen %ca so clumsy in battle." -%E -%Cp Val 00068 -"You die now, little %s." -%E -%Cp Val 00069 -"Your body I destroy now, your soul when my hordes overrun Valhalla!" -%E -%Cc Val 00070 -As you pick up %o, your mind is suddenly filled with images, -and you perceive all of the possibilities of each potential choice you -could make. As you begin to control and channel your thoughts, you -realize that you must return %o to %l immediately. -%E [You must return %o to %l.] -%Cc Val 00080 -A look of surprise and horror appears on %ns face. - - "No!!! %o has lied to me! I have been misled!" - -Suddenly, %n grasps his head and screams in agony, then dies. -%E [%nC dies.] -%Cc Val 00081 -As you approach, %l rises and touches %o. - -"You may take %o with you, %p. I have removed from -it the power to foretell the future, for that power no mortal should -have. Its other abilities, however, you have at your disposal. - -"You must now begin in %ds name to search for the Amulet of Yendor. -May your steps be guided by %d, my %S." -%E [Take %o. Search for the Amulet.] -# assumes Orb of Fate (glass object) -%Cc Val 00082 -"Careful, %p! %oC might break, and that would be -a tragic loss. You are its keeper now, and the time has come to -resume your search for the Amulet. %Z await your -return through the magic portal that brought you here." -%E [You are %os keeper now. Return through the portal and find the Amulet.] -%Cp Val 00090 -"Greetings, %p. I have not been able to pay as much attention to -your search for the Amulet as I have wished. How do you fare?" -%E -%Cc Val 00091 -"Excellent, %p. I see you have recovered the Amulet! - -"You must take the Amulet to the Great Temple of %d, on the Astral -Plane. There you must offer the Amulet to %d. - -"Go now, my %S. I cannot tell you your fate, as the power of the -Amulet interferes with mine. I hope for your success." -%E [Take the Amulet to %ds temple on the Astral Plane and offer it.] -# -# Wizard -# -%Cc Wiz 00001 -You are suddenly in familiar surroundings. You notice what appears to -be a large, squat stone structure nearby. Wait! That looks like the -tower of your former teacher, %l. - -However, things are not the same as when you were last here. Mists and -areas of unexplained darkness surround the tower. There is movement in -the shadows. - -Your teacher would never allow such unaesthetic forms to surround the -tower... unless something were dreadfully wrong! -%E [You have arrived at %ls tower but something is very wrong.] -%Cp Wiz 00002 -Once again, you are back at %H. -%E -%Cp Wiz 00003 -You are back at %H. -You have an odd feeling this may be the last time you ever come here. -%E -%Cp Wiz 00005 -"Would you happen to have some eye of newt in that overstuffed pack, %s?" -%E -%Cp Wiz 00006 -"Ah, the spell to create the magic portal worked. Outstanding!" -%E -%Cp Wiz 00007 -"Hurry! %lC may not survive that casting of the portal spell!" -%E -%Cp Wiz 00008 -"The spells of %n were just too powerful for us to withstand." -%E -%Cp Wiz 00009 -"I, too, will venture into the world, because %n is but one of -many evils to be vanquished." -%E -%Cp Wiz 00010 -"I have some eye of newt to trade, do you have a spare blind-worm's sting?" -%E -%Cp Wiz 00011 -"The magic portal now seems like it will remain stable for quite some time." -%E -%Cp Wiz 00012 -"Have you noticed how much stronger %l is since %o was recovered?" -%E -%Cp Wiz 00013 -"Thank %d! We weren't positive you would defeat %n." -%E -%Cp Wiz 00014 -"I, too, will venture into the world, because %n was but one of -many evils to be vanquished." -%E -%Cc Wiz 00015 -"Come closer, %p, for my voice falters in my old age. -Yes, I see that you have come a long way since you went out into the -world, leaving the safe confines of this tower. However, I must first -determine if you have all of the skills required to take on the task -I require of you." -%E [You have come a long way, but are you ready for the task I require?] -%Cp Wiz 00016 -"Well, %p, you have returned. Perhaps you are now ready..." -%E -%Cp Wiz 00017 -"This is getting tedious, %p, but perseverance is a sign of a true mage. -I certainly hope that you are truly ready this time!" -%E -%Cc Wiz 00018 -"You fool, %p! Why did I waste all of those years teaching you -the esoteric arts? Get out of here! I shall find another." -%E ["Get out of here!"] -%Cc Wiz 00019 -"Alas, %p, you have not yet shown your proficiency as a worthy -spellcaster. As %ra, you would surely be overcome in the challenge -ahead. Go, now, expand your horizons, and return when you have attained -renown as %Ra." -%E [Go; return when you are %Ra.] -%Cc Wiz 00020 -"You amaze me, %p! How many times did I tell you that the way of a mage -is an exacting one. One must use the world with care, lest one leave it -in ruins and simplify the task of %n. - -"You must go back and show your worthiness. Do not return until you are -truly ready for this quest. May %d guide you in this task." -%E [Go; come back when you are worthy of %d.] -%Cc Wiz 00021 -"Yes, %p, you truly are ready for this dire task. Listen, -carefully, for what I tell you now will be of vital importance. - -"Since you left us to hone your skills in the world, we unexpectedly came -under attack by the forces of %n. As you know, we thought -%n had perished at the end of the last age, but, alas, this was -not the case. - -"%nC sent an army of abominations against us. Among them was a -minion, mindless and ensorcelled, and thus, in the confusion, it was -able to penetrate our defenses. Alas, this creature has stolen -%o and I fear has delivered %oh to %n. - -"Over the years, I had woven most of my power into this amulet, and thus, -without it, I have but a shadow of my former power, and I fear that I -shall soon perish. - -"You must travel to %i, and within its dungeons, -find and overcome %n, and return %o to me. - -"Go now, with %d, and complete this quest before it is too late." -%E [Travel to %i; overcome %n; return with %o.] -%Cp Wiz 00025 -"Beware, for %n is immune to most magical attacks." -%E -%Cp Wiz 00026 -"To enter %i you must pass many traps." -%E -%Cp Wiz 00027 -"%nC may be vulnerable to physical attacks." -%E -%Cp Wiz 00028 -"%d will come to your aid when you call." -%E -%Cp Wiz 00029 -"You must utterly destroy %n. He will pursue you otherwise." -%E -%Cp Wiz 00030 -"%oC is a mighty artifact. With it you can -destroy %n." -%E -%Cp Wiz 00031 -"Go forth with the blessings of %d." -%E -%Cp Wiz 00032 -"I will have my %gP watch for your return." -%E -%Cp Wiz 00033 -"Feel free to take any items in that chest that might aid you." -%E -%Cp Wiz 00034 -"You will know when %o is near. Proceed with care!" -%E -%Cp Wiz 00035 -Wisps of fog swirl nearby. You feel that %ns lair is close. -%E -%Cp Wiz 00036 -You believe that you may once again invade %i. -%E -%Cp Wiz 00040 -You feel your mentor's presence; perhaps %o is nearby. -%E -%Cp Wiz 00041 -The aura of %o tingles at the edge of your perception. -%E -%Cp Wiz 00042 -You have returned to %ns lair. -%E -%Cc Wiz 00050 -"Ah, I recognize you, %p. So, %l has sent you to steal -%o from me, hmmm? Well, %lh is a fool to send such -a mental weakling against me. - -"Your destruction, however, should make for good sport. In the end, you -shall beg me to kill you!" -%E ["Your destruction should make for good sport."] -%Cc Wiz 00051 -"How nice of you to return, %p! I enjoyed our last meeting. Are you -still hungry for more pain? - -"Come! Your soul, like %o, shall soon be mine to command." -%E ["Your soul shall soon be mine to command."] -%Cp Wiz 00052 -"I'm sure that your perseverance shall be the subject of innumerable -ballads, but you shall not be around to hear them, I fear!" -%E -%Cp Wiz 00053 -"Thief! %oC belongs to me, now. I shall feed -your living flesh to my minions." -%E -%Cp Wiz 00060 -"Your puny powers are no match for me, fool!" -%E -%Cp Wiz 00061 -"When you are defeated, your torment will last for a thousand years." -%E -%Cp Wiz 00062 -"After your downfall, %p, I shall devour %l for dessert!" -%E -%Cp Wiz 00063 -"Are you ready yet to beg for mercy? I could be lenient..." -%E -%Cp Wiz 00064 -"Your soul shall join the enslaved multitude I command!" -%E -%Cp Wiz 00065 -"Your lack of will is evident, and you shall die as a result." -%E -%Cp Wiz 00066 -"Your faith in %d is for naught! Come, submit to me now!" -%E -%Cp Wiz 00067 -"A mere %r is nothing compared to my skill!" -%E -%Cp Wiz 00068 -"So, you are the best hope of %l? How droll." -%E -%Cp Wiz 00069 -"Feel my power, %c! My victory is imminent!" -%E -%Cc Wiz 00070 -As you touch %o, its comforting power infuses you -with new energy. You feel as if you can detect others' thoughts flowing -through it. Although you yearn to wear %o and -attack the Wizard of Yendor, you know you must return it to its rightful -owner, %l. -%E [You feel %os power and know you should return %oh to %l.] -%Cc Wiz 00080 -%nC, whose body begins to shrivel up, croaks out: - - "I shall haunt your progress until the end of time. A thousand - curses on you and %l." - -Then, the body bursts into a cloud of choking dust, and blows away. -%E [%nC curses you as %nh dies.] -%Cc Wiz 00081 -%lC notices %o in your possession, -beams at you and says: - - "I knew you could defeat %n and retrieve - %o. We shall never forget this - brave service. - - "Take %oh with you in your quest for the Amulet of Yendor. - I can sense that it has attuned %oiself to you already. - - "May %d guide you in your quest, and keep you from harm." -%E [Take %o with you in your quest for the Amulet.] -%Cc Wiz 00082 -"You are the keeper of %o now. It is time to -recover the /other/ Amulet. %Z await your return through -the magic portal which brought you here." -%E [Keep %o, return through the portal to %Z; find the other Amulet.] -%Cp Wiz 00090 -"Come near, my %S, and share your adventures with me. -So, have you succeeded in your quest for the Amulet of Yendor?" -%E -%Cc Wiz 00091 -"Congratulations, %p. I always knew that if anyone could succeed -in defeating the Wizard of Yendor and his minions, it would be you. - -"Go now, and take the Amulet to the Astral Plane. Once there, present -the Amulet on the altar of %d. Along the way you shall pass through -the four Elemental Planes. These planes are like nothing you have ever -experienced before, so be prepared! - -"For this you were born, %s! I am very proud of you." -%E [Take the Amulet to %ds altar on the Astral Plane.] -# -# General -# -%Cc - 00001 -It is written in the Book of %d: - - After the Creation, the cruel god Moloch rebelled - against the authority of Marduk the Creator. - Moloch stole from Marduk the most powerful of all - the artifacts of the gods, the Amulet of Yendor, - and he hid it in the dark cavities of Gehennom, the - Under World, where he now lurks, and bides his time. - -Your %G %d seeks to possess the Amulet, and with it -to gain deserved ascendance over the other gods. - -You, a newly trained %r, have been heralded -from birth as the instrument of %d. You are destined -to recover the Amulet for your deity, or die in the -attempt. Your hour of destiny has come. For the sake -of us all: Go bravely with %d! -%E [%dC has chosen you to recover the Amulet of Yendor for %dI.] -%Cp - 00002 -You receive a faint telepathic message from %l: -Your help is urgently needed at %H! -Look for a ...ic transporter. -You couldn't quite make out that last message. -%E -%Cp - 00003 -You again sense %l pleading for help. -%E -%Cp - 00004 -You again sense %l demanding your attendance. -%E -# Completed the quest by returning with artifact, but not carrying -# the Bell of Opening; quest leader lets you know that it is needed. -#[ Should this be role-specific so that each leader has variant text? ] -%Cp - 00005 -"The silver bell which was hoarded by %n will be -essential in locating the Amulet of Yendor." -%E -# -# Angelic maledictions. -# -%Cp - 00010 -"Repent, and thou shalt be saved!" -%E -%Cp - 00011 -"Thou shalt pay for thine insolence!" -%E -%Cp - 00012 -"Very soon, my child, thou shalt meet thy maker." -%E -%Cp - 00013 -"The great %D has sent me to make you pay for your sins!" -%E -%Cp - 00014 -"The wrath of %D is now upon you!" -%E -%Cp - 00015 -"Thy life belongs to %D now!" -%E -%Cp - 00016 -"Dost thou wish to receive thy final blessing?" -%E -%Cp - 00017 -"Thou art but a godless void." -%E -%Cp - 00018 -"Thou art not worthy to seek the Amulet." -%E -%Cp - 00019 -"No one expects the Spanish Inquisition!" -%E -# -# Demonic maledictions. -# -%Cp - 00030 -"I first mistook thee for a statue, when I regarded thy head of stone." -%E -%Cp - 00031 -"Come here often?" -%E -%Cp - 00032 -"Doth pain excite thee? Wouldst thou prefer the whip?" -%E -%Cp - 00033 -"Thinkest thou it shall tickle as I rip out thy lungs?" -%E -%Cp - 00034 -"Eat slime and die!" -%E -%Cp - 00035 -"Go ahead, fetch thy mama! I shall wait." -%E -%Cp - 00036 -"Go play leapfrog with a herd of unicorns!" -%E -%Cp - 00037 -"Hast thou been drinking, or art thou always so clumsy?" -%E -%Cp - 00038 -"This time I shall let thee off with a spanking, but let it not happen again." -%E -%Cp - 00039 -"I've met smarter (and prettier) acid blobs." -%E -%Cp - 00040 -"Look! Thy bootlace is undone!" -%E -%Cp - 00041 -"Mercy! Dost thou wish me to die of laughter?" -%E -%Cp - 00042 -"Run away! Live to flee another day!" -%E -%Cp - 00043 -"Thou hadst best fight better than thou canst dress!" -%E -%Cp - 00044 -"Twixt thy cousin and thee, Medusa is the prettier." -%E -%Cp - 00045 -"Methinks thou wert unnaturally stirred by yon corpse back there, eh, varlet?" -%E -%Cp - 00046 -"Up thy nose with a rubber hose!" -%E -%Cp - 00047 -"Verily, thy corpse could not smell worse!" -%E -%Cp - 00048 -"Wait! I shall polymorph into a grid bug to give thee a fighting chance!" -%E -%Cp - 00049 -"Why search for the Amulet? Thou wouldst but lose it, cretin." -%E -# -# Banishment message (for converted hero) -# -%Cc - 00060 -"You have betrayed all those who hold allegiance to %d, as you once did. -My allegiance to %d holds fast and I cannot condone or accept what you -have done. - -Leave this place. You shall never set foot at %H again. -That which you seek is now lost forever, for without the Bell of Opening, -you will never be able to enter the place where he who has the Amulet -resides. - -Go now! You are banished from this place. -%E [You are banished from %H for betraying your allegiance to %d.] -# -# TEST PATTERN -# -%Cc - 00099 - %p: return(plname); - %c: return(pl_character); - %r: return((char *)rank_of(u.ulevel)); - %R: return((char *)rank_of(MIN_QUEST_LEVEL)); - %s: return((flags.female) ? "sister" : "brother" ); - %S: return((flags.female) ? "daughter" : "son" ); - %l: return((char *)ldrname()); - %i: return(intermed()); - %o: return(artiname()); - %O: return(shortened(artiname())); - %n: return((char *)neminame()); - %g: return((char *)guardname()); - %G: return((char *)align_gtitle(u.ualignbase[1])); - %H: return((char *)homebase()); - %a: return(Alignnam(u.ualignbase[1])); - %A: return(Alignnam(u.ualign.type)); - %d: return((char *)align_gname(u.ualignbase[1])); - %D: return((char *)align_gname(A_LAWFUL)); - %C: return("chaotic"); - %N: return("neutral"); - %L: return("lawful"); - %x: return((Blind) ? "sense" : "see"); - %Z: return("The Dungeons of Doom"); - %%: return(percent_sign); - a suffix: return an(root); - A suffix: return An(root); - C suffix: return capitalized(root); - h suffix: return pronoun(he_or_she, mon_of(root)); /* for %l,%n,%d,%o */ - H suffix: return capitalized(pronoun(he_or_she, mon_of(root))); - i suffix: return pronoun(him_or_her, mon_of(root)); - I suffix: return capitalized(pronoun(him_or_her, mon_of(root))); - j suffix: return pronoun(his_or_her, mon_of(root)); - J suffix: return capitalized(pronoun(his_or_her, mon_of(root))); - p suffix: return makeplural(root); - P suffix: return makeplural(capitalized(root)); - s suffix: return s_suffix(root); - S suffix: return s_suffix(capitalized(root)); - t suffix: return strip_the_prefix(root); -%E diff --git a/dat/rumors.tru b/dat/rumors.tru index 8181c5abc..464ee8c3a 100644 --- a/dat/rumors.tru +++ b/dat/rumors.tru @@ -151,6 +151,7 @@ Someone once said that what goes up < might come down >. Someone's been spiking the pits! Sometimes monsters are more likely to fight each other than attack you. Spinach, carrot, and jelly -- a meal fit for a nurse! +Surviving the full extent of the mines could mean that your luck is changing. Tainted meat is even more sickening than poison! Telepathy is just a trick: once you know how to do it, it's easy. The Leprechaun Gold Tru$t is no division of the Magic Memory Vault. @@ -299,7 +300,7 @@ They say that the Leprechaun King is rich as Croesus. They say that the Wizard of Yendor is schizophrenic and suicidal. They say that the experienced character knows how to convert an altar. They say that the gods are happy when they drop objects at your feet. -They say that the idea of invisible Nazguls has a certain ring to it. +They say that the idea of invisible Nazgul has a certain ring to it. They say that the lady of the lake now lives in a fountain somewhere. They say that the local shopkeeper frowns upon the rude tourist. They say that the only door to the vampire's tower is on its lowest level. diff --git a/dat/sanctum.lua b/dat/sanctum.lua new file mode 100644 index 000000000..bc669a7cd --- /dev/null +++ b/dat/sanctum.lua @@ -0,0 +1,131 @@ +-- NetHack 3.6 gehennom.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1992 by M. Stephenson and Izchak Miller +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor", "nommap") +-- This is outside the main map, below, so we must do it before adding +-- that map and anchoring coordinates to it. This extends the invisible +-- barrier up to the top row, which falls outside the drawn map. +des.non_passwall(selection.area(39,00,41,00)) +des.map([[ +---------------------------------------------------------------------------- +| -------------- | +| |............| ------- | +| -------............----- |.....| | +| |......................| --.....| --------- | +| ----......................---------|......---- |.......| | +| |........---------..........|......+.........| ------+---..| | +| ---........|.......|..........--S----|.........| |........|..| | +| |..........|.......|.............| |.........-------..---------- | +| |..........|.......|..........---- |..........|....|..|......| | +| |..........|.......|..........| --.......----+---S---S--..| | +| |..........---------..........| |.......|.............|..| | +| ---...........................| -----+-------S---------S--- | +| |...........................| |...| |......| |....|-- | +| ----.....................---- |...---....--- ---......| | +| |.....................| |..........| |.....---- | +| -------...........----- --...------- |.....| | +| |...........| |...| |.....| | +| ------------- ----- ------- | +---------------------------------------------------------------------------- +]]); +des.region({ region={15,07, 21,10}, lit=1, type="temple" }) +des.altar({ x=18, y=08, align="noalign", type="sanctum" }) +des.region({ region={41,06, 48,11}, lit=0, type="morgue", prefilled=0, irregular=1 }) +-- Non diggable walls +des.non_diggable(selection.area(00,00,75,19)) +-- Invisible barrier separating the left & right halves of the level +des.non_passwall(selection.area(37,00,39,19)) +-- Doors +des.door("closed",40,06) +des.door("locked",62,06) +des.door("closed",46,12) +des.door("closed",53,10) +-- Surround the temple with fire +des.trap("fire",13,05) +des.trap("fire",14,05) +des.trap("fire",15,05) +des.trap("fire",16,05) +des.trap("fire",17,05) +des.trap("fire",18,05) +des.trap("fire",19,05) +des.trap("fire",20,05) +des.trap("fire",21,05) +des.trap("fire",22,05) +des.trap("fire",23,05) +des.trap("fire",13,12) +des.trap("fire",14,12) +des.trap("fire",15,12) +des.trap("fire",16,12) +des.trap("fire",17,12) +des.trap("fire",18,12) +des.trap("fire",19,12) +des.trap("fire",20,12) +des.trap("fire",21,12) +des.trap("fire",22,12) +des.trap("fire",23,12) +des.trap("fire",13,06) +des.trap("fire",13,07) +des.trap("fire",13,08) +des.trap("fire",13,09) +des.trap("fire",13,10) +des.trap("fire",13,11) +des.trap("fire",23,06) +des.trap("fire",23,07) +des.trap("fire",23,08) +des.trap("fire",23,09) +des.trap("fire",23,10) +des.trap("fire",23,11) +-- Some traps. +des.trap("spiked pit") +des.trap("fire") +des.trap("sleep gas") +des.trap("anti magic") +des.trap("fire") +des.trap("magic") +-- Some random objects +des.object("[") +des.object("[") +des.object("[") +des.object("[") +des.object(")") +des.object(")") +des.object("*") +des.object("!") +des.object("!") +des.object("!") +des.object("!") +des.object("?") +des.object("?") +des.object("?") +des.object("?") +des.object("?") +-- Some monsters. +des.monster({ id = "horned devil", x=14,y=12,peaceful=0 }) +des.monster({ id = "barbed devil", x=18,y=08,peaceful=0 }) +des.monster({ id = "erinys", x=10,y=04,peaceful=0 }) +des.monster({ id = "marilith", x=07,y=09,peaceful=0 }) +des.monster({ id = "nalfeshnee", x=27,y=08,peaceful=0 }) +-- Moloch's horde +des.monster({ id = "aligned priest", x=20,y=03,align="noalign",peaceful=0 }) +des.monster({ id = "aligned priest", x=15,y=04,align="noalign",peaceful=0 }) +des.monster({ id = "aligned priest", x=11,y=05,align="noalign",peaceful=0 }) +des.monster({ id = "aligned priest", x=11,y=07,align="noalign",peaceful=0 }) +des.monster({ id = "aligned priest", x=11,y=09,align="noalign",peaceful=0 }) +des.monster({ id = "aligned priest", x=11,y=12,align="noalign",peaceful=0 }) +des.monster({ id = "aligned priest", x=15,y=13,align="noalign",peaceful=0 }) +des.monster({ id = "aligned priest", x=17,y=13,align="noalign",peaceful=0 }) +des.monster({ id = "aligned priest", x=21,y=13,align="noalign",peaceful=0 }) +-- A few nasties +des.monster("L") +des.monster("L") +des.monster("V") +des.monster("V") +des.monster("V") +des.stair("up", 63,15) +-- Teleporting to this level is allowed after the invocation creates its +-- entrance. Force arrival in that case to be on rightmost third of level. +des.teleport_region({ region = {54,1,79,18}, region_islev=1, dir="down" }) diff --git a/dat/soko1-1.lua b/dat/soko1-1.lua new file mode 100644 index 000000000..efcb3dd13 --- /dev/null +++ b/dat/soko1-1.lua @@ -0,0 +1,107 @@ +-- NetHack 3.6 sokoban.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ +-- Copyright (c) 1998-1999 by Kevin Hugo +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "premapped", "solidify"); +des.map([[ +-------------------------- +|........................| +|.......|---------------.| +-------.------ |.| + |...........| |.| + |...........| |.| +--------.----- |.| +|............| |.| +|............| |.| +-----.-------- ------|.| + |..........| --|.....|.| + |..........| |.+.....|.| + |.........|- |-|.....|.| +-------.---- |.+.....+.| +|........| |-|.....|-- +|........| |.+.....| +|...|----- --|.....| +----- ------- +]]); + +place = selection.new(); +place:set(16,11); +place:set(16,13); +place:set(16,15); + +des.stair("down", 01, 01); +des.region(selection.area(00,00,25,17),"lit"); +des.non_diggable(selection.area(00,00,25,17)); +des.non_passwall(selection.area(00,00,25,17)); + +-- Boulders +des.object("boulder", 03, 05); +des.object("boulder", 05, 05); +des.object("boulder", 07, 05); +des.object("boulder", 09, 05); +des.object("boulder", 11, 05); +-- +des.object("boulder", 04, 07); +des.object("boulder", 04, 08); +des.object("boulder", 06, 07); +des.object("boulder", 09, 07); +des.object("boulder", 11, 07); +-- +des.object("boulder", 03, 12); +des.object("boulder", 04, 10); +des.object("boulder", 05, 12); +des.object("boulder", 06, 10); +des.object("boulder", 07, 11); +des.object("boulder", 08, 10); +des.object("boulder", 09, 12); +-- +des.object("boulder", 03, 14); + +-- Traps +des.trap("hole", 08, 01); +des.trap("hole", 09, 01); +des.trap("hole", 10, 01); +des.trap("hole", 11, 01); +des.trap("hole", 12, 01); +des.trap("hole", 13, 01); +des.trap("hole", 14, 01); +des.trap("hole", 15, 01); +des.trap("hole", 16, 01); +des.trap("hole", 17, 01); +des.trap("hole", 18, 01); +des.trap("hole", 19, 01); +des.trap("hole", 20, 01); +des.trap("hole", 21, 01); +des.trap("hole", 22, 01); +des.trap("hole", 23, 01); + +des.monster({ id = "giant mimic", appear_as = "obj:boulder" }); +des.monster({ id = "giant mimic", appear_as = "obj:boulder" }); + +-- Random objects +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "=" }); +des.object({ class = "/" }); + +-- Rewards +des.door("locked", 23, 13); +des.door("closed", 17, 11); +des.door("closed", 17, 13); +des.door("closed", 17, 15); + +des.region({ region={18,10, 22,16}, lit = 1, type = "zoo", prefilled = 0, irregular = 1 }); + +px, py = selection.rndcoord(place); +if math.random(0, 99) < 50 then + des.object("bag of holding", px, py); +else + des.object("amulet of reflection", px, py); +end +des.engraving({ x = px, y = py, type = "burn", text = "Elbereth" }); +des.object({ id = "scare monster", x = px, y = py, buc = "cursed" }); + diff --git a/dat/soko1-2.lua b/dat/soko1-2.lua new file mode 100644 index 000000000..6a6361d53 --- /dev/null +++ b/dat/soko1-2.lua @@ -0,0 +1,108 @@ +-- NetHack 3.6 sokoban.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ +-- Copyright (c) 1998-1999 by Kevin Hugo +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "premapped", "solidify"); + +des.map([[ + ------------------------ + |......................| + |..-------------------.| +----.| ----- |.| +|..|.-- --...| |.| +|.....|--|....| |.| +|.....|..|....| |.| +--....|......-- |.| + |.......|...| ------|.| + |....|..|...| --|.....|.| + |....|--|...| |.+.....|.| + |.......|..-- |-|.....|.| + ----....|.-- |.+.....+.| + ---.--.| |-|.....|-- + |.....| |.+.....| + |..|..| --|.....| + ------- ------- +]]); + +local place = selection.new(); +place:set(16,10); +place:set(16,12); +place:set(16,14); + +des.stair("down", 06,15); +des.region(selection.area(00,00,25,16),"lit"); +des.non_diggable(selection.area(00,00,25,16)); +des.non_passwall(selection.area(00,00,25,16)); + +-- Boulders +des.object("boulder",04,04); +des.object("boulder",02,06); +des.object("boulder",03,06); +des.object("boulder",04,07); +des.object("boulder",05,07); +des.object("boulder",02,08); +des.object("boulder",05,08); +des.object("boulder",03,09); +des.object("boulder",04,09); +des.object("boulder",03,10); +des.object("boulder",05,10); +des.object("boulder",06,12); +-- +des.object("boulder",07,14); +-- +des.object("boulder",11,05); +des.object("boulder",12,06); +des.object("boulder",10,07); +des.object("boulder",11,07); +des.object("boulder",10,08); +des.object("boulder",12,09); +des.object("boulder",11,10); + +-- Traps +des.trap("hole",05,01) +des.trap("hole",06,01) +des.trap("hole",07,01) +des.trap("hole",08,01) +des.trap("hole",09,01) +des.trap("hole",10,01) +des.trap("hole",11,01) +des.trap("hole",12,01) +des.trap("hole",13,01) +des.trap("hole",14,01) +des.trap("hole",15,01) +des.trap("hole",16,01) +des.trap("hole",17,01) +des.trap("hole",18,01) +des.trap("hole",19,01) +des.trap("hole",20,01) +des.trap("hole",21,01) +des.trap("hole",22,01) + +des.monster({ id = "giant mimic", appear_as = "obj:boulder" }); +des.monster({ id = "giant mimic", appear_as = "obj:boulder" }); + +-- Random objects +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "=" }); +des.object({ class = "/" }); + +-- Rewards +des.door("locked",23,12) +des.door("closed",17,10) +des.door("closed",17,12) +des.door("closed",17,14) +des.region({ region={18,09, 22,15}, lit = 1, type = "zoo", prefilled = 0, irregular = 1 }); + +px, py = selection.rndcoord(place); +if math.random(0, 99) < 50 then + des.object("bag of holding",px,py); +else + des.object("amulet of reflection",px,py); +end +des.engraving({ x = px, y = py, type = "burn", text = "Elbereth" }); +des.object({ id = "scare monster", x = px, y = py, buc = "cursed" }); diff --git a/dat/soko2-1.lua b/dat/soko2-1.lua new file mode 100644 index 000000000..9934819f7 --- /dev/null +++ b/dat/soko2-1.lua @@ -0,0 +1,67 @@ +-- NetHack 3.6 sokoban.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ +-- Copyright (c) 1998-1999 by Kevin Hugo +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "premapped", "solidify"); + +des.map([[ +-------------------- +|........|...|.....| +|.....-..|.-.|.....| +|..|.....|...|.....| +|-.|..-..|.-.|.....| +|...--.......|.....| +|...|...-...-|.....| +|...|..|...--|.....| +|-..|..|----------+| +|..................| +|...|..|------------ +-------- +]]); +des.stair("down", 06,10); +des.stair("up", 16,04); +des.door("locked", 18,08); +des.region(selection.area(00,00, 19,11), "lit"); +des.non_diggable(selection.area(00,00,19,11)); +des.non_passwall(selection.area(00,00,19,11)); + +-- Boulders +des.object("boulder",02,02) +des.object("boulder",03,02) +-- +des.object("boulder",05,03) +des.object("boulder",07,03) +des.object("boulder",07,02) +des.object("boulder",08,02) +-- +des.object("boulder",10,03) +des.object("boulder",11,03) +-- +des.object("boulder",02,07) +des.object("boulder",02,08) +des.object("boulder",03,09) +-- +des.object("boulder",05,07) +des.object("boulder",06,06) + +-- Traps +des.trap("hole",08,09) +des.trap("hole",09,09) +des.trap("hole",10,09) +des.trap("hole",11,09) +des.trap("hole",12,09) +des.trap("hole",13,09) +des.trap("hole",14,09) +des.trap("hole",15,09) +des.trap("hole",16,09) +des.trap("hole",17,09) + +-- Random objects +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "=" }); +des.object({ class = "/" }); diff --git a/dat/soko2-2.lua b/dat/soko2-2.lua new file mode 100644 index 000000000..bb931c15f --- /dev/null +++ b/dat/soko2-2.lua @@ -0,0 +1,68 @@ +-- NetHack 3.6 sokoban.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ +-- Copyright (c) 1998-1999 by Kevin Hugo +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "premapped", "solidify"); + +des.map([[ + -------- +--|.|....| +|........|---------- +|.-...-..|.|.......| +|...-......|.......| +|.-....|...|.......| +|....-.--.-|.......| +|..........|.......| +|.--...|...|.......| +|....-.|---|.......| +--|....|----------+| + |................| + ------------------ +]]); +des.stair("down", 06,11) +des.stair("up", 15,06) +des.door("locked",18,10) +des.region(selection.area(00,00,19,12), "lit"); +des.non_diggable(selection.area(00,00,19,12)); +des.non_passwall(selection.area(00,00,19,12)); + +-- Boulders +des.object("boulder",04,02) +des.object("boulder",04,03) +des.object("boulder",05,03) +des.object("boulder",07,03) +des.object("boulder",08,03) +des.object("boulder",02,04) +des.object("boulder",03,04) +des.object("boulder",05,05) +des.object("boulder",06,06) +des.object("boulder",09,06) +des.object("boulder",03,07) +des.object("boulder",04,07) +des.object("boulder",07,07) +des.object("boulder",06,09) +des.object("boulder",05,10) +des.object("boulder",05,11) + +-- Traps +des.trap("hole",07,11) +des.trap("hole",08,11) +des.trap("hole",09,11) +des.trap("hole",10,11) +des.trap("hole",11,11) +des.trap("hole",12,11) +des.trap("hole",13,11) +des.trap("hole",14,11) +des.trap("hole",15,11) +des.trap("hole",16,11) +des.trap("hole",17,11) + +-- Random objects +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "=" }); +des.object({ class = "/" }); diff --git a/dat/soko3-1.lua b/dat/soko3-1.lua new file mode 100644 index 000000000..cec5eec8b --- /dev/null +++ b/dat/soko3-1.lua @@ -0,0 +1,79 @@ +-- NetHack 3.6 sokoban.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ +-- Copyright (c) 1998-1999 by Kevin Hugo +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "premapped", "solidify"); + +des.map([[ +----------- ----------- +|....|....|-- |.........| +|....|......| |.........| +|.........|-- |.........| +|....|....| |.........| +|-.--------- |.........| +|....|.....| |.........| +|....|.....| |.........| +|..........| |.........| +|....|.....|---------------+| +|....|......................| +----------------------------- +]]); +des.stair("down", 11,02) +des.stair("up", 23,04) +des.door("locked", 27,09) +des.region(selection.area(00,00,28,11), "lit") +des.non_diggable(selection.area(00,00,28,11)) +des.non_passwall(selection.area(00,00,28,11)) + +-- Boulders +des.object("boulder",03,02) +des.object("boulder",04,02) +-- +des.object("boulder",06,02) +des.object("boulder",06,03) +des.object("boulder",07,02) +-- +des.object("boulder",03,06) +des.object("boulder",02,07) +des.object("boulder",03,07) +des.object("boulder",03,08) +des.object("boulder",02,09) +des.object("boulder",03,09) +des.object("boulder",04,09) +-- +des.object("boulder",06,07) +des.object("boulder",06,09) +des.object("boulder",08,07) +des.object("boulder",08,10) +des.object("boulder",09,08) +des.object("boulder",09,09) +des.object("boulder",10,07) +des.object("boulder",10,10) + +-- Traps +des.trap("hole",12,10) +des.trap("hole",13,10) +des.trap("hole",14,10) +des.trap("hole",15,10) +des.trap("hole",16,10) +des.trap("hole",17,10) +des.trap("hole",18,10) +des.trap("hole",19,10) +des.trap("hole",20,10) +des.trap("hole",21,10) +des.trap("hole",22,10) +des.trap("hole",23,10) +des.trap("hole",24,10) +des.trap("hole",25,10) +des.trap("hole",26,10) + +-- Random objects +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "=" }); +des.object({ class = "/" }); + diff --git a/dat/soko3-2.lua b/dat/soko3-2.lua new file mode 100644 index 000000000..fa15d8ba6 --- /dev/null +++ b/dat/soko3-2.lua @@ -0,0 +1,71 @@ +-- NetHack 3.6 sokoban.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ +-- Copyright (c) 1998-1999 by Kevin Hugo +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "premapped", "solidify"); + +des.map([[ + ---- ----------- +-|..|------- |.........| +|..........| |.........| +|..-----.-.| |.........| +|..|...|...| |.........| +|.........-| |.........| +|.......|..| |.........| +|.----..--.| |.........| +|........|.-- |.........| +|.---.-.....------------+| +|...|...-................| +|.........---------------- +----|..|..| + ------- +]]); +des.stair("down", 03,01) +des.stair("up", 20,04) +des.door("locked",24,09) +des.region(selection.area(00,00,25,13), "lit") +des.non_diggable(selection.area(00,00,25,13)) +des.non_passwall(selection.area(00,00,25,13)) + +-- Boulders +des.object("boulder",02,03) +des.object("boulder",08,03) +des.object("boulder",09,04) +des.object("boulder",02,05) +des.object("boulder",04,05) +des.object("boulder",09,05) +des.object("boulder",02,06) +des.object("boulder",05,06) +des.object("boulder",06,07) +des.object("boulder",03,08) +des.object("boulder",07,08) +des.object("boulder",05,09) +des.object("boulder",10,09) +des.object("boulder",07,10) +des.object("boulder",10,10) +des.object("boulder",03,11) + +-- Traps +des.trap("hole",12,10) +des.trap("hole",13,10) +des.trap("hole",14,10) +des.trap("hole",15,10) +des.trap("hole",16,10) +des.trap("hole",17,10) +des.trap("hole",18,10) +des.trap("hole",19,10) +des.trap("hole",20,10) +des.trap("hole",21,10) +des.trap("hole",22,10) +des.trap("hole",23,10) + +-- Random objects +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "=" }); +des.object({ class = "/" }); + diff --git a/dat/soko4-1.lua b/dat/soko4-1.lua new file mode 100644 index 000000000..3257986de --- /dev/null +++ b/dat/soko4-1.lua @@ -0,0 +1,97 @@ +-- NetHack 3.6 sokoban.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ +-- Copyright (c) 1998-1999 by Kevin Hugo +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- In case you haven't played the game Sokoban, you'll learn +-- quickly. This branch isn't particularly difficult, just time +-- consuming. Some players may wish to skip this branch. +-- +-- The following actions are currently permitted without penalty: +-- Carrying or throwing a boulder already in inventory +-- (player or nonplayer). +-- Teleporting boulders. +-- Digging in the floor. +-- The following actions are permitted, but with a luck penalty: +-- Breaking boulders. +-- Stone-to-fleshing boulders. +-- Creating new boulders (e.g., with a scroll of earth). +-- Jumping. +-- Being pulled by a thrown iron ball. +-- Hurtling through the air from Newton's 3rd law. +-- Squeezing past boulders when naked or as a giant. +-- These actions are not permitted: +-- Moving diagonally between two boulders and/or walls. +-- Pushing a boulder diagonally. +-- Picking up boulders (player or nonplayer). +-- Digging or walking through walls. +-- Teleporting within levels or between levels of this branch. +-- Using cursed potions of gain level. +-- Escaping a pit/hole (e.g., by flying, levitation, or +-- passing a dexterity check). +-- Bones files are not permitted. + + +--## Bottom (first) level of Sokoban ### +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor", "premapped", "solidify"); + +des.map([[ +------ ----- +|....| |...| +|....----...| +|...........| +|..|-|.|-|..| +---------|.--- +|......|.....| +|..----|.....| +--.| |.....| + |.|---|.....| + |...........| + |..|--------- + ---- +]]); +des.levregion({ region = {06,04,06,04}, type = "branch" }) +des.stair("up", 06,06) +des.region(selection.area(00,00,13,12), "lit") +des.non_diggable(selection.area(00,00,13,12)) +des.non_passwall(selection.area(00,00,13,12)) + +-- Boulders +des.object("boulder",02,02) +des.object("boulder",02,03) +-- +des.object("boulder",10,02) +des.object("boulder",09,03) +des.object("boulder",10,04) +-- +des.object("boulder",08,07) +des.object("boulder",09,08) +des.object("boulder",09,09) +des.object("boulder",08,10) +des.object("boulder",10,10) + +-- Traps +des.trap("pit",03,06) +des.trap("pit",04,06) +des.trap("pit",05,06) +des.trap("pit",02,08) +des.trap("pit",02,09) +des.trap("pit",04,10) +des.trap("pit",05,10) +des.trap("pit",06,10) +des.trap("pit",07,10) + +-- A little help +des.object("earth",02,11) +des.object("earth",03,11) + +-- Random objects +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "=" }); +des.object({ class = "/" }); + diff --git a/dat/soko4-2.lua b/dat/soko4-2.lua new file mode 100644 index 000000000..e9df5c050 --- /dev/null +++ b/dat/soko4-2.lua @@ -0,0 +1,68 @@ +-- NetHack 3.6 sokoban.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ +-- Copyright (c) 1998-1999 by Kevin Hugo +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor", "premapped", "solidify"); + +des.map([[ +-------- ------ +|.|....|-|....| +|.|-..........| +|.||....|.....| +|.||....|.....| +|.|-----|.----- +|.| |......| +|.-----|......| +|.............| +|..|---|......| +---- -------- +]]); +des.levregion({ region = {03,01,03,01}, type = "branch" }) +des.stair("up", 01,01) +des.region(selection.area(00,00,14,10),"lit") +des.non_diggable(selection.area(00,00,14,10)) +des.non_passwall(selection.area(00,00,14,10)) + +-- Boulders +des.object("boulder",05,02) +des.object("boulder",06,02) +des.object("boulder",06,03) +des.object("boulder",07,03) +-- +des.object("boulder",09,05) +des.object("boulder",10,03) +des.object("boulder",11,02) +des.object("boulder",12,03) +-- +des.object("boulder",07,08) +des.object("boulder",08,08) +des.object("boulder",09,08) +des.object("boulder",10,08) + +-- Traps +des.trap("pit",01,02) +des.trap("pit",01,03) +des.trap("pit",01,04) +des.trap("pit",01,05) +des.trap("pit",01,06) +des.trap("pit",01,07) +des.trap("pit",03,08) +des.trap("pit",04,08) +des.trap("pit",05,08) +des.trap("pit",06,08) + +-- A little help +des.object("earth",01,09) +des.object("earth",02,09) + +-- Random objects +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "%" }); +des.object({ class = "=" }); +des.object({ class = "/" }); + + diff --git a/dat/sokoban.des b/dat/sokoban.des deleted file mode 100644 index c4983451d..000000000 --- a/dat/sokoban.des +++ /dev/null @@ -1,637 +0,0 @@ -# NetHack 3.6 sokoban.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ -# Copyright (c) 1998-1999 by Kevin Hugo -# NetHack may be freely redistributed. See license for details. -# -# In case you haven't played the game Sokoban, you'll learn -# quickly. This branch isn't particularly difficult, just time -# consuming. Some players may wish to skip this branch. -# -# The following actions are currently permitted without penalty: -# Carrying or throwing a boulder already in inventory -# (player or nonplayer). -# Teleporting boulders. -# Digging in the floor. -# The following actions are permitted, but with a luck penalty: -# Breaking boulders. -# Stone-to-fleshing boulders. -# Creating new boulders (e.g., with a scroll of earth). -# Jumping. -# Being pulled by a thrown iron ball. -# Hurtling through the air from Newton's 3rd law. -# Squeezing past boulders when naked or as a giant. -# These actions are not permitted: -# Moving diagonally between two boulders and/or walls. -# Pushing a boulder diagonally. -# Picking up boulders (player or nonplayer). -# Digging or walking through walls. -# Teleporting within levels or between levels of this branch. -# Using cursed potions of gain level. -# Escaping a pit/hole (e.g., by flying, levitation, or -# passing a dexterity check). -# Bones files are not permitted. - - -### Bottom (first) level of Sokoban ### -MAZE:"soko4-1",' ' -FLAGS:noteleport,hardfloor,premapped,solidify -GEOMETRY:center,center -#12345678901234567890123456789012345678901234567890 -MAP ------- ----- -|....| |...| -|....----...| -|...........| -|..|-|.|-|..| ----------|.--- -|......|.....| -|..----|.....| ---.| |.....| - |.|---|.....| - |...........| - |..|--------- - ---- -ENDMAP -BRANCH:(06,04,06,04),(0,0,0,0) -STAIR:(06,06),up -REGION:(00,00,13,12),lit,"ordinary" -NON_DIGGABLE:(00,00,13,12) -NON_PASSWALL:(00,00,13,12) - -# Boulders -OBJECT:('`',"boulder"),(02,02) -OBJECT:('`',"boulder"),(02,03) -# -OBJECT:('`',"boulder"),(10,02) -OBJECT:('`',"boulder"),(09,03) -OBJECT:('`',"boulder"),(10,04) -# -OBJECT:('`',"boulder"),(08,07) -OBJECT:('`',"boulder"),(09,08) -OBJECT:('`',"boulder"),(09,09) -OBJECT:('`',"boulder"),(08,10) -OBJECT:('`',"boulder"),(10,10) - -# Traps -TRAP:"pit",(03,06) -TRAP:"pit",(04,06) -TRAP:"pit",(05,06) -TRAP:"pit",(02,08) -TRAP:"pit",(02,09) -TRAP:"pit",(04,10) -TRAP:"pit",(05,10) -TRAP:"pit",(06,10) -TRAP:"pit",(07,10) - -# A little help -OBJECT:('?',"earth"),(02,11) -OBJECT:('?',"earth"),(03,11) - -# Random objects -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'=',random -OBJECT:'/',random - - -MAZE:"soko4-2",' ' -FLAGS:noteleport,hardfloor,premapped,solidify -GEOMETRY:center,center -#12345678901234567890123456789012345678901234567890 -MAP --------- ------ -|.|....|-|....| -|.|-..........| -|.||....|.....| -|.||....|.....| -|.|-----|.----- -|.| |......| -|.-----|......| -|.............| -|..|---|......| ----- -------- -ENDMAP -BRANCH:(03,01,03,01),(0,0,0,0) -STAIR:(01,01),up -REGION:(00,00,14,10),lit,"ordinary" -NON_DIGGABLE:(00,00,14,10) -NON_PASSWALL:(00,00,14,10) - -# Boulders -OBJECT:('`',"boulder"),(05,02) -OBJECT:('`',"boulder"),(06,02) -OBJECT:('`',"boulder"),(06,03) -OBJECT:('`',"boulder"),(07,03) -# -OBJECT:('`',"boulder"),(09,05) -OBJECT:('`',"boulder"),(10,03) -OBJECT:('`',"boulder"),(11,02) -OBJECT:('`',"boulder"),(12,03) -# -OBJECT:('`',"boulder"),(07,08) -OBJECT:('`',"boulder"),(08,08) -OBJECT:('`',"boulder"),(09,08) -OBJECT:('`',"boulder"),(10,08) - -# Traps -TRAP:"pit",(01,02) -TRAP:"pit",(01,03) -TRAP:"pit",(01,04) -TRAP:"pit",(01,05) -TRAP:"pit",(01,06) -TRAP:"pit",(01,07) -TRAP:"pit",(03,08) -TRAP:"pit",(04,08) -TRAP:"pit",(05,08) -TRAP:"pit",(06,08) - -# A little help -OBJECT:('?',"earth"),(01,09) -OBJECT:('?',"earth"),(02,09) - -# Random objects -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'=',random -OBJECT:'/',random - - -### Second level ### -MAZE:"soko3-1",' ' -FLAGS:noteleport,premapped,solidify -GEOMETRY:center,center -#12345678901234567890123456789012345678901234567890 -MAP ------------ ----------- -|....|....|-- |.........| -|....|......| |.........| -|.........|-- |.........| -|....|....| |.........| -|-.--------- |.........| -|....|.....| |.........| -|....|.....| |.........| -|..........| |.........| -|....|.....|---------------+| -|....|......................| ------------------------------ -ENDMAP -STAIR:(11,02),down -STAIR:(23,04),up -DOOR:locked,(27,09) -REGION:(00,00,28,11),lit,"ordinary" -NON_DIGGABLE:(00,00,28,11) -NON_PASSWALL:(00,00,28,11) - -# Boulders -OBJECT:('`',"boulder"),(03,02) -OBJECT:('`',"boulder"),(04,02) -# -OBJECT:('`',"boulder"),(06,02) -OBJECT:('`',"boulder"),(06,03) -OBJECT:('`',"boulder"),(07,02) -# -OBJECT:('`',"boulder"),(03,06) -OBJECT:('`',"boulder"),(02,07) -OBJECT:('`',"boulder"),(03,07) -OBJECT:('`',"boulder"),(03,08) -OBJECT:('`',"boulder"),(02,09) -OBJECT:('`',"boulder"),(03,09) -OBJECT:('`',"boulder"),(04,09) -# -OBJECT:('`',"boulder"),(06,07) -OBJECT:('`',"boulder"),(06,09) -OBJECT:('`',"boulder"),(08,07) -OBJECT:('`',"boulder"),(08,10) -OBJECT:('`',"boulder"),(09,08) -OBJECT:('`',"boulder"),(09,09) -OBJECT:('`',"boulder"),(10,07) -OBJECT:('`',"boulder"),(10,10) - -# Traps -TRAP:"hole",(12,10) -TRAP:"hole",(13,10) -TRAP:"hole",(14,10) -TRAP:"hole",(15,10) -TRAP:"hole",(16,10) -TRAP:"hole",(17,10) -TRAP:"hole",(18,10) -TRAP:"hole",(19,10) -TRAP:"hole",(20,10) -TRAP:"hole",(21,10) -TRAP:"hole",(22,10) -TRAP:"hole",(23,10) -TRAP:"hole",(24,10) -TRAP:"hole",(25,10) -TRAP:"hole",(26,10) - -# Random objects -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'=',random -OBJECT:'/',random - - -MAZE:"soko3-2",' ' -FLAGS:noteleport,premapped,solidify -GEOMETRY:center,center -#12345678901234567890123456789012345678901234567890 -MAP - ---- ----------- --|..|------- |.........| -|..........| |.........| -|..-----.-.| |.........| -|..|...|...| |.........| -|.........-| |.........| -|.......|..| |.........| -|.----..--.| |.........| -|........|.-- |.........| -|.---.-.....------------+| -|...|...-................| -|.........---------------- -----|..|..| - ------- -ENDMAP -STAIR:(03,01),down -STAIR:(20,04),up -DOOR:locked,(24,09) -REGION:(00,00,25,13),lit,"ordinary" -NON_DIGGABLE:(00,00,25,13) -NON_PASSWALL:(00,00,25,13) - -# Boulders -OBJECT:('`',"boulder"),(02,03) -OBJECT:('`',"boulder"),(08,03) -OBJECT:('`',"boulder"),(09,04) -OBJECT:('`',"boulder"),(02,05) -OBJECT:('`',"boulder"),(04,05) -OBJECT:('`',"boulder"),(09,05) -OBJECT:('`',"boulder"),(02,06) -OBJECT:('`',"boulder"),(05,06) -OBJECT:('`',"boulder"),(06,07) -OBJECT:('`',"boulder"),(03,08) -OBJECT:('`',"boulder"),(07,08) -OBJECT:('`',"boulder"),(05,09) -OBJECT:('`',"boulder"),(10,09) -OBJECT:('`',"boulder"),(07,10) -OBJECT:('`',"boulder"),(10,10) -OBJECT:('`',"boulder"),(03,11) - -# Traps -TRAP:"hole",(12,10) -TRAP:"hole",(13,10) -TRAP:"hole",(14,10) -TRAP:"hole",(15,10) -TRAP:"hole",(16,10) -TRAP:"hole",(17,10) -TRAP:"hole",(18,10) -TRAP:"hole",(19,10) -TRAP:"hole",(20,10) -TRAP:"hole",(21,10) -TRAP:"hole",(22,10) -TRAP:"hole",(23,10) - -# Random objects -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'=',random -OBJECT:'/',random - - -### Third level ### -MAZE:"soko2-1",' ' -FLAGS:noteleport,premapped,solidify -GEOMETRY:center,center -#12345678901234567890123456789012345678901234567890 -MAP --------------------- -|........|...|.....| -|.....-..|.-.|.....| -|..|.....|...|.....| -|-.|..-..|.-.|.....| -|...--.......|.....| -|...|...-...-|.....| -|...|..|...--|.....| -|-..|..|----------+| -|..................| -|...|..|------------ --------- -ENDMAP -STAIR:(06,10),down -STAIR:(16,04),up -DOOR:locked,(18,08) -REGION:(00,00,19,11),lit,"ordinary" -NON_DIGGABLE:(00,00,19,11) -NON_PASSWALL:(00,00,19,11) - -# Boulders -OBJECT:('`',"boulder"),(02,02) -OBJECT:('`',"boulder"),(03,02) -# -OBJECT:('`',"boulder"),(05,03) -OBJECT:('`',"boulder"),(07,03) -OBJECT:('`',"boulder"),(07,02) -OBJECT:('`',"boulder"),(08,02) -# -OBJECT:('`',"boulder"),(10,03) -OBJECT:('`',"boulder"),(11,03) -# -OBJECT:('`',"boulder"),(02,07) -OBJECT:('`',"boulder"),(02,08) -OBJECT:('`',"boulder"),(03,09) -# -OBJECT:('`',"boulder"),(05,07) -OBJECT:('`',"boulder"),(06,06) - -# Traps -TRAP:"hole",(08,09) -TRAP:"hole",(09,09) -TRAP:"hole",(10,09) -TRAP:"hole",(11,09) -TRAP:"hole",(12,09) -TRAP:"hole",(13,09) -TRAP:"hole",(14,09) -TRAP:"hole",(15,09) -TRAP:"hole",(16,09) -TRAP:"hole",(17,09) - -# Random objects -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'=',random -OBJECT:'/',random - - -MAZE:"soko2-2",' ' -FLAGS:noteleport,premapped,solidify -GEOMETRY:center,center -#12345678901234567890123456789012345678901234567890 -MAP - -------- ---|.|....| -|........|---------- -|.-...-..|.|.......| -|...-......|.......| -|.-....|...|.......| -|....-.--.-|.......| -|..........|.......| -|.--...|...|.......| -|....-.|---|.......| ---|....|----------+| - |................| - ------------------ -ENDMAP -STAIR:(06,11),down -STAIR:(15,06),up -DOOR:locked,(18,10) -REGION:(00,00,19,12),lit,"ordinary" -NON_DIGGABLE:(00,00,19,12) -NON_PASSWALL:(00,00,19,12) - -# Boulders -OBJECT:('`',"boulder"),(04,02) -OBJECT:('`',"boulder"),(04,03) -OBJECT:('`',"boulder"),(05,03) -OBJECT:('`',"boulder"),(07,03) -OBJECT:('`',"boulder"),(08,03) -OBJECT:('`',"boulder"),(02,04) -OBJECT:('`',"boulder"),(03,04) -OBJECT:('`',"boulder"),(05,05) -OBJECT:('`',"boulder"),(06,06) -OBJECT:('`',"boulder"),(09,06) -OBJECT:('`',"boulder"),(03,07) -OBJECT:('`',"boulder"),(04,07) -OBJECT:('`',"boulder"),(07,07) -OBJECT:('`',"boulder"),(06,09) -OBJECT:('`',"boulder"),(05,10) -OBJECT:('`',"boulder"),(05,11) - -# Traps -TRAP:"hole",(07,11) -TRAP:"hole",(08,11) -TRAP:"hole",(09,11) -TRAP:"hole",(10,11) -TRAP:"hole",(11,11) -TRAP:"hole",(12,11) -TRAP:"hole",(13,11) -TRAP:"hole",(14,11) -TRAP:"hole",(15,11) -TRAP:"hole",(16,11) -TRAP:"hole",(17,11) - -# Random objects -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'=',random -OBJECT:'/',random - - -### Top (last) level of Sokoban ### -MAZE:"soko1-1",' ' -FLAGS:noteleport,premapped,solidify -GEOMETRY:center,center -#12345678901234567890123456789012345678901234567890 -MAP --------------------------- -|........................| -|.......|---------------.| --------.------ |.| - |...........| |.| - |...........| |.| ---------.----- |.| -|............| |.| -|............| |.| ------.-------- ------|.| - |..........| --|.....|.| - |..........| |.+.....|.| - |.........|- |-|.....|.| --------.---- |.+.....+.| -|........| |-|.....|-- -|........| |.+.....| -|...|----- --|.....| ------ ------- -ENDMAP -$place = { (16,11),(16,13),(16,15) } -SHUFFLE: $place - -STAIR:(01,01),down -REGION:(00,00,25,17),lit,"ordinary" -NON_DIGGABLE:(00,00,25,17) -NON_PASSWALL:(00,00,25,17) - -# Boulders -OBJECT:('`',"boulder"),(03,05) -OBJECT:('`',"boulder"),(05,05) -OBJECT:('`',"boulder"),(07,05) -OBJECT:('`',"boulder"),(09,05) -OBJECT:('`',"boulder"),(11,05) -# -OBJECT:('`',"boulder"),(04,07) -OBJECT:('`',"boulder"),(04,08) -OBJECT:('`',"boulder"),(06,07) -OBJECT:('`',"boulder"),(09,07) -OBJECT:('`',"boulder"),(11,07) -# -OBJECT:('`',"boulder"),(03,12) -OBJECT:('`',"boulder"),(04,10) -OBJECT:('`',"boulder"),(05,12) -OBJECT:('`',"boulder"),(06,10) -OBJECT:('`',"boulder"),(07,11) -OBJECT:('`',"boulder"),(08,10) -OBJECT:('`',"boulder"),(09,12) -# -OBJECT:('`',"boulder"),(03,14) - -# Traps -TRAP:"hole",(08,01) -TRAP:"hole",(09,01) -TRAP:"hole",(10,01) -TRAP:"hole",(11,01) -TRAP:"hole",(12,01) -TRAP:"hole",(13,01) -TRAP:"hole",(14,01) -TRAP:"hole",(15,01) -TRAP:"hole",(16,01) -TRAP:"hole",(17,01) -TRAP:"hole",(18,01) -TRAP:"hole",(19,01) -TRAP:"hole",(20,01) -TRAP:"hole",(21,01) -TRAP:"hole",(22,01) -TRAP:"hole",(23,01) - -MONSTER:('m',"giant mimic"), random, m_object "boulder" -MONSTER:('m',"giant mimic"), random, m_object "boulder" - -# Random objects -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'=',random -OBJECT:'/',random - -# Rewards -DOOR:locked,(23,13) -DOOR:closed,(17,11) -DOOR:closed,(17,13) -DOOR:closed,(17,15) -REGION:(18,10,22,16),lit,"zoo",filled,irregular -IF [50%] { - OBJECT:('(',"bag of holding"),$place[0] -} ELSE { - OBJECT:('"',"amulet of reflection"),$place[0] -} -ENGRAVING:$place[0],burn,"Elbereth" -OBJECT:('?', "scare monster"),$place[0],cursed - - -MAZE:"soko1-2",' ' -FLAGS:noteleport,premapped,solidify -GEOMETRY:center,center -#12345678901234567890123456789012345678901234567890 -MAP - ------------------------ - |......................| - |..-------------------.| -----.| ----- |.| -|..|.-- --...| |.| -|.....|--|....| |.| -|.....|..|....| |.| ---....|......-- |.| - |.......|...| ------|.| - |....|..|...| --|.....|.| - |....|--|...| |.+.....|.| - |.......|..-- |-|.....|.| - ----....|.-- |.+.....+.| - ---.--.| |-|.....|-- - |.....| |.+.....| - |..|..| --|.....| - ------- ------- -ENDMAP -$place = { (16,10),(16,12),(16,14) } -SHUFFLE: $place - -STAIR:(06,15),down -REGION:(00,00,25,16),lit,"ordinary" -NON_DIGGABLE:(00,00,25,16) -NON_PASSWALL:(00,00,25,16) - -# Boulders -OBJECT:('`',"boulder"),(04,04) -OBJECT:('`',"boulder"),(02,06) -OBJECT:('`',"boulder"),(03,06) -OBJECT:('`',"boulder"),(04,07) -OBJECT:('`',"boulder"),(05,07) -OBJECT:('`',"boulder"),(02,08) -OBJECT:('`',"boulder"),(05,08) -OBJECT:('`',"boulder"),(03,09) -OBJECT:('`',"boulder"),(04,09) -OBJECT:('`',"boulder"),(03,10) -OBJECT:('`',"boulder"),(05,10) -OBJECT:('`',"boulder"),(06,12) -# -OBJECT:('`',"boulder"),(07,14) -# -OBJECT:('`',"boulder"),(11,05) -OBJECT:('`',"boulder"),(12,06) -OBJECT:('`',"boulder"),(10,07) -OBJECT:('`',"boulder"),(11,07) -OBJECT:('`',"boulder"),(10,08) -OBJECT:('`',"boulder"),(12,09) -OBJECT:('`',"boulder"),(11,10) - -# Traps -TRAP:"hole",(05,01) -TRAP:"hole",(06,01) -TRAP:"hole",(07,01) -TRAP:"hole",(08,01) -TRAP:"hole",(09,01) -TRAP:"hole",(10,01) -TRAP:"hole",(11,01) -TRAP:"hole",(12,01) -TRAP:"hole",(13,01) -TRAP:"hole",(14,01) -TRAP:"hole",(15,01) -TRAP:"hole",(16,01) -TRAP:"hole",(17,01) -TRAP:"hole",(18,01) -TRAP:"hole",(19,01) -TRAP:"hole",(20,01) -TRAP:"hole",(21,01) -TRAP:"hole",(22,01) - -MONSTER:('m',"giant mimic"), random, m_object "boulder" -MONSTER:('m',"giant mimic"), random, m_object "boulder" - -# Random objects -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'%',random -OBJECT:'=',random -OBJECT:'/',random - -# Rewards -DOOR:locked,(23,12) -DOOR:closed,(17,10) -DOOR:closed,(17,12) -DOOR:closed,(17,14) -REGION:(18,09,22,15),lit,"zoo",filled,irregular -IF [50%] { - OBJECT:('(',"bag of holding"),$place[0] -} ELSE { - OBJECT:('"',"amulet of reflection"),$place[0] -} -ENGRAVING:$place[0],burn,"Elbereth" -OBJECT:('?', "scare monster"),$place[0],cursed diff --git a/dat/symbols b/dat/symbols index d9e1ecef6..06aa31f66 100644 --- a/dat/symbols +++ b/dat/symbols @@ -1,4 +1,4 @@ -# NetHack 3.6 symbols $NHDT-Date: 1524689580 2018/04/25 20:53:00 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.16 $ +# NetHack 3.6 symbols $NHDT-Date: 1572892906 2019/11/04 18:41:46 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.21 $ # Copyright (c) 2006 by Michael Allison # NetHack may be freely redistributed. See license for details. # @@ -14,291 +14,35 @@ # of ordinary printable characters in the lowercase letter range. # NetHack encodes the request to use the alternate font here by # having the high bit set (in hexadecimal, \x80 is combined with -# a character code between \x60 and \x7f). +# a character code between \x5f and \x7e) (not 0x60 to 0x7f as was +# previously claimed). +# +# curses is an approximation of IBMgraphics which relies on DEC +# mode of operation, with a few characters missing. It is based +# on an old graphics mode for the Curses interface and is the default +# on that windowport if no symset is specified. The Curses interface +# can also use DECgraphics as-is; IBMgraphics probably won't work. -start: DECgraphics - Handling: DEC - S_vwall: \xf8 # meta-x, vertical rule - S_hwall: \xf1 # meta-q, horizontal rule - S_tlcorn: \xec # meta-l, top left corner - S_trcorn: \xeb # meta-k, top right corner - S_blcorn: \xed # meta-m, bottom left - S_brcorn: \xea # meta-j, bottom right - S_crwall: \xee # meta-n, cross - S_tuwall: \xf6 # meta-v, T up - S_tdwall: \xf7 # meta-w, T down - S_tlwall: \xf5 # meta-u, T left - S_trwall: \xf4 # meta-t, T right - S_ndoor: \xfe # meta-~, centered dot - S_vodoor: \xe1 # meta-a, solid block - S_hodoor: \xe1 # meta-a, solid block - S_bars: \xfb # meta-{, small pi - S_tree: \xe7 # meta-g, plus-or-minus - S_room: \xfe # meta-~, centered dot - S_upladder: \xf9 # meta-y, greater-than-or-equals - S_dnladder: \xfa # meta-z, less-than-or-equals - S_pool: \xe0 # meta-\, diamond - S_ice: \xfe # meta-~, centered dot - S_lava: \xe0 # meta-\, diamond - S_vodbridge: \xfe # meta-~, centered dot - S_hodbridge: \xfe # meta-~, centered dot - S_water: \xe0 # meta-\, diamond - S_vbeam: \xf8 # meta-x, vertical rule - S_hbeam: \xf1 # meta-q, horizontal rule - S_sw_tc: \xef # meta-o, high horizontal line - S_sw_ml: \xf8 # meta-x, vertical rule - S_sw_mr: \xf8 # meta-x, vertical rule - S_sw_bc: \xf3 # meta-s, low horizontal line - S_explode2: \xef # meta-o, high horizontal line - S_explode4: \xf8 # meta-x, vertical rule - S_explode6: \xf8 # meta-x, vertical rule - S_explode8: \xf3 # meta-s, low horizontal line -finish +# plain looks decent for room+corridor levels where there aren't a lot +# of wall corners and ones present tend to be spread out, but it looks +# awful for wallified mazes +start: plain + Description: same as default symbols, except '+' for corner walls + S_tlcorn: '+' + S_trcorn: '+' + S_blcorn: '+' + S_brcorn: '+' + S_crwall: '+' + S_tuwall: '+' + S_tdwall: '+' + S_tlwall: '+' + S_trwall: '+' +finish #plain -- other symbols implicitly retain their default values -start: IBMgraphics - Handling: IBM - S_vwall: \xb3 # meta-3, vertical rule - S_hwall: \xc4 # meta-D, horizontal rule - S_tlcorn: \xda # meta-Z, top left corner - S_trcorn: \xbf # meta-?, top right corner - S_blcorn: \xc0 # meta-@, bottom left - S_brcorn: \xd9 # meta-Y, bottom right - S_crwall: \xc5 # meta-E, cross - S_tuwall: \xc1 # meta-A, T up - S_tdwall: \xc2 # meta-B, T down - S_tlwall: \xb4 # meta-4, T left - S_trwall: \xc3 # meta-C, T right - S_ndoor: \xfa # meta-z, centered dot - S_vodoor: \xfe # meta-~, small centered square - S_hodoor: \xfe # meta-~, small centered square - S_bars: \xf0 # equivalence symbol - S_tree: \xf1 # plus or minus symbol - S_room: \xfa # meta-z, centered dot - S_corr: \xb0 # meta-0, light shading - S_litcorr: \xb1 # meta-1, medium shading - S_fountain: \xf4 # meta-t, integral top half - S_pool: \xf7 # meta-w, approx. equals - S_ice: \xfa # meta-z, centered dot - S_lava: \xf7 # meta-w, approx. equals - S_vodbridge: \xfa # meta-z, centered dot - S_hodbridge: \xfa # meta-z, centered dot - S_water: \xf7 # meta-w, approx. equals - S_vbeam: \xb3 # meta-3, vertical rule - S_hbeam: \xc4 # meta-D, horizontal rule - S_sw_ml: \xb3 # meta-3, vertical rule - S_sw_mr: \xb3 # meta-3, vertical rule - S_explode4: \xb3 # meta-3, vertical rule - S_explode6: \xb3 # meta-3, vertical rule -finish - -start: IBMGraphics_1 - Handling: IBM - S_vwall: \xb3 # meta-3, vertical rule - S_hwall: \xc4 # meta-D, horizontal rule - S_tlcorn: \xda # meta-Z, top left corner - S_trcorn: \xbf # meta-?, top right corner - S_blcorn: \xc0 # meta-@, bottom left - S_brcorn: \xd9 # meta-Y, bottom right - S_crwall: \xc5 # meta-E, cross - S_tuwall: \xc1 # meta-A, T up - S_tdwall: \xc2 # meta-B, T down - S_tlwall: \xb4 # meta-4, T left - S_trwall: \xc3 # meta-C, T right - S_vbeam: \xb3 # meta-3, vertical rule - S_hbeam: \xc4 # meta-D, horizontal rule - S_sw_ml: \xb3 # meta-3, vertical rule - S_sw_mr: \xb3 # meta-3, vertical rule - S_explode4: \xb3 # meta-3, vertical rule - S_explode6: \xb3 # meta-3, vertical rule -finish - -start: IBMGraphics_2 - Handling: IBM - S_vwall: \xb3 # meta-3, vertical rule - S_hwall: \xc4 # meta-D, horizontal rule - S_tlcorn: \xda # meta-Z, top left corner - S_trcorn: \xbf # meta-?, top right corner - S_blcorn: \xc0 # meta-@, bottom left - S_brcorn: \xd9 # meta-Y, bottom right - S_crwall: \xc5 # meta-E, cross - S_tuwall: \xc1 # meta-A, T up - S_tdwall: \xc2 # meta-B, T down - S_tlwall: \xb4 # meta-4, T left - S_trwall: \xc3 # meta-C, T right - S_vodoor: \xfe # meta-~, small centered square - S_hodoor: \xfe # meta-~, small centered square - S_corr: \xb0 # meta-0, light shading - S_litcorr: \xb1 # meta-1, medium shading - S_vbeam: \xb3 # meta-3, vertical rule - S_hbeam: \xc4 # meta-D, horizontal rule - S_sw_ml: \xb3 # meta-3, vertical rule - S_sw_mr: \xb3 # meta-3, vertical rule - S_explode4: \xb3 # meta-3, vertical rule - S_explode6: \xb3 # meta-3, vertical rule -finish - -start: MACgraphics - Handling: MAC - S_vwall: \xba - S_hwall: \xcd - S_tlcorn: \xc9 - S_trcorn: \xbb - S_blcorn: \xc8 - S_brcorn: \xbc - S_crwall: \xce - S_tuwall: \xca - S_tdwall: \xcb - S_tlwall: \xb9 - S_trwall: \xcc - S_ndoor: \xb0 - S_vodoor: \xee - S_hodoor: \xee - S_vcdoor: \xef - S_hcdoor: \xef - S_bars: \xf0 # equivalency symbol - S_tree: \xf1 # plus-or-minus - S_corr: \xb0 - S_grave: \xef # same as open door - S_pool: \xe0 -finish - -start: RogueIBM - Handling: IBM - Restrictions: rogue - S_weapon: \x29 - S_amulet: \x2c - S_food: \x3a - S_potion: \xad - S_scroll: \x3f - S_book: \x2b - S_wand: \xe7 - S_vwall: \xba # all walls now use - S_hwall: \xcd # double line graphics - S_tlcorn: \xc9 - S_trcorn: \xbb - S_blcorn: \xc8 - S_brcorn: \xbc - S_crwall: \xce - S_tuwall: \xca - S_tdwall: \xcb - S_tlwall: \xb9 - S_trwall: \xcc - S_ndoor: \xce - S_vodoor: \xce - S_hodoor: \xce - S_room: \xfa # centered dot - S_corr: \xb1 - S_litcorr: \xb2 - S_upstair: \xf0 # Greek Xi - S_dnstair: \xf0 -finish - -start: RogueEpyx - Description: Rogue level color symbol set like Epyx Rogue - Restrictions: rogue - Handling: IBM - Color: Yes - S_vwall: \xba # all walls now use - S_hwall: \xcd # double line graphics - S_tlcorn: \xc9 - S_trcorn: \xbb - S_blcorn: \xc8 - S_brcorn: \xbc - S_crwall: \xce - S_tuwall: \xca - S_tdwall: \xcb - S_tlwall: \xb9 - S_trwall: \xcc - S_ndoor: \xce - S_vodoor: \xce - S_hodoor: \xce - S_room: \xfa # centered dot - S_corr: \xb1 - S_litcorr: \xb2 - S_upstair: \xf0 # Greek Xi - S_dnstair: \xf0 - S_arrow_trap: \x04 # diamond (cards) - S_dart_trap: \x04 - S_falling_rock_trap: \x04 - S_squeaky_board: \x04 - S_bear_trap: \x04 - S_land_mine: \x04 - S_rolling_boulder_trap: \x04 - S_sleeping_gas_trap: \x04 - S_rust_trap: \x04 - S_fire_trap: \x04 - S_pit: \x04 - S_spiked_pit: \x04 - S_hole: \x04 - S_trap_door: \x04 - S_teleportation_trap: \x04 - S_level_teleporter: \x04 - S_magic_portal: \x04 - S_web: \x04 - S_statue_trap: \x04 - S_magic_trap: \x04 - S_anti_magic_trap: \x04 - S_polymorph_trap: \x04 - S_weapon: \x18 # up arrow -# ^J S_armor: \x0a # Vert rect with o - S_armor: \x5b # default: '[' -# ^I S_ring: \x09 # circle with arrow - S_ring: \x3d # default: '=' - S_amulet: \x0c # "female" symbol - S_tool: \x28 # default: '(' - S_food: \x05 # club (as in cards) - S_potion: \xad # upside down '!' - S_scroll: \x0e # musical note - S_book: \x2b # default: '+' - S_wand: \xe7 # greek tau - S_coin: \x0f # yes it's the same as gems - S_gem: \x0f # fancy '*' - S_rock: \x60 - S_ball: \x30 - S_chain: \x5f - S_venom: \x2e - S_rock: \x60 - S_ball: \x30 - S_chain: \x5f - S_venom: \x2e - S_human: \x01 -finish - -start: RogueWindows - Restrictions: rogue - Handling: IBM - S_weapon: \x29 - S_amulet: \x2c - S_food: \x3a - S_potion: \xad - S_scroll: \x3f - S_book: \x2b - S_wand: \xe7 - S_vwall: \xba # all walls now use - S_hwall: \xcd # double line graphics - S_tlcorn: \xc9 - S_trcorn: \xbb - S_blcorn: \xc8 - S_brcorn: \xbc - S_crwall: \xce - S_tuwall: \xca - S_tdwall: \xcb - S_tlwall: \xb9 - S_trwall: \xcc - S_ndoor: \xce - S_vodoor: \xce - S_hodoor: \xce - S_room: \xfa # centered dot - S_corr: \xb1 - S_litcorr: \xb2 - S_upstair: \xf0 # Greek Xi - S_dnstair: \xf0 -finish - -# Recommended symset for blind players +# Recommended symset for blind players # courtesy Michael Feir start: NHAccess - Description: Recommended for blind players + Description: recommended for blind players S_stone: \032 S_vwall: \124 S_hwall: \045 @@ -308,7 +52,7 @@ start: NHAccess S_brcorn: \124 S_crwall: \045 S_tuwall: \045 - S_tdwall: \045 + S_tdwall: \045 S_tlwall: \124 S_trwall: \124 S_ndoor: \046 @@ -320,7 +64,7 @@ start: NHAccess S_tree: \035 S_room: \035 S_corr: \060 - S_litcorr: \062 + S_litcorr: \062 S_upstair: \060 S_dnstair: \062 S_upladder: \095 @@ -329,35 +73,35 @@ start: NHAccess S_grave: \126 S_throne: \126 S_sink: \126 - S_fountain: \126 + S_fountain: \126 S_pool: \042 S_ice: \042 S_lava: \035 S_vodbridge: \035 - S_hodbridge: \032 + S_hodbridge: \032 S_vcdbridge: \035 S_hcdbridge: \126 S_arrow_trap: \094 S_dart_trap: \094 - S_falling_rock_trap: \094 + S_falling_rock_trap: \094 S_squeaky_board: \094 S_bear_trap: \094 S_land_mine: \094 - S_rolling_boulder_trap: \094 + S_rolling_boulder_trap: \094 S_sleeping_gas_trap: \094 S_rust_trap: \094 S_fire_trap: \094 S_pit: \094 S_spiked_pit: \094 S_hole: \094 - S_trap_door: \094 + S_trap_door: \094 S_teleportation_trap: \094 S_level_teleporter: \094 S_magic_portal: \094 S_web: \094 - S_statue_trap: \094 + S_statue_trap: \094 S_magic_trap: \094 - S_anti_magic_trap: \094 + S_anti_magic_trap: \094 S_polymorph_trap: \094 S_vbeam: \124 S_hbeam: \095 @@ -379,7 +123,7 @@ start: NHAccess S_sw_bl: \092 S_sw_bc: \045 S_sw_br: \047 - S_explode1: \047 + S_explode1: \047 S_explode2: \045 S_explode3: \092 S_explode4: \058 @@ -392,7 +136,7 @@ finish # All symbols are spaces start: Blank - Description: Completely blank symbols + Description: completely blank symbols S_air: \032 S_altar: \032 S_amulet: \032 @@ -569,15 +313,324 @@ start: Blank S_zruty: \032 finish -start: plain - Description: Same as Default symbols, except '+' for corner walls - S_tlcorn: '+' - S_trcorn: '+' - S_blcorn: '+' - S_brcorn: '+' - S_crwall: '+' - S_tuwall: '+' - S_tdwall: '+' - S_tlwall: '+' - S_trwall: '+' -finish #plain -- other symbols implicitly retain their default values +start: IBMgraphics + Description: special line-drawing characters used for walls +# Restrictions: primary + Handling: IBM + S_vwall: \xb3 # meta-3, vertical rule + S_hwall: \xc4 # meta-D, horizontal rule + S_tlcorn: \xda # meta-Z, top left corner + S_trcorn: \xbf # meta-?, top right corner + S_blcorn: \xc0 # meta-@, bottom left + S_brcorn: \xd9 # meta-Y, bottom right + S_crwall: \xc5 # meta-E, cross + S_tuwall: \xc1 # meta-A, T up + S_tdwall: \xc2 # meta-B, T down + S_tlwall: \xb4 # meta-4, T left + S_trwall: \xc3 # meta-C, T right + S_ndoor: \xfa # meta-z, centered dot + S_vodoor: \xfe # meta-~, small centered square + S_hodoor: \xfe # meta-~, small centered square + S_bars: \xf0 # equivalence symbol + S_tree: \xf1 # plus or minus symbol + S_room: \xfa # meta-z, centered dot + S_corr: \xb0 # meta-0, light shading + S_litcorr: \xb1 # meta-1, medium shading + S_fountain: \xf4 # meta-t, integral top half + S_pool: \xf7 # meta-w, approx. equals + S_ice: \xfa # meta-z, centered dot + S_lava: \xf7 # meta-w, approx. equals + S_vodbridge: \xfa # meta-z, centered dot + S_hodbridge: \xfa # meta-z, centered dot + S_water: \xf7 # meta-w, approx. equals + S_vbeam: \xb3 # meta-3, vertical rule + S_hbeam: \xc4 # meta-D, horizontal rule + S_sw_ml: \xb3 # meta-3, vertical rule + S_sw_mr: \xb3 # meta-3, vertical rule + S_explode4: \xb3 # meta-3, vertical rule + S_explode6: \xb3 # meta-3, vertical rule +finish + +start: IBMGraphics_1 +# Restrictions: primary + Handling: IBM + S_vwall: \xb3 # meta-3, vertical rule + S_hwall: \xc4 # meta-D, horizontal rule + S_tlcorn: \xda # meta-Z, top left corner + S_trcorn: \xbf # meta-?, top right corner + S_blcorn: \xc0 # meta-@, bottom left + S_brcorn: \xd9 # meta-Y, bottom right + S_crwall: \xc5 # meta-E, cross + S_tuwall: \xc1 # meta-A, T up + S_tdwall: \xc2 # meta-B, T down + S_tlwall: \xb4 # meta-4, T left + S_trwall: \xc3 # meta-C, T right + S_vbeam: \xb3 # meta-3, vertical rule + S_hbeam: \xc4 # meta-D, horizontal rule + S_sw_ml: \xb3 # meta-3, vertical rule + S_sw_mr: \xb3 # meta-3, vertical rule + S_explode4: \xb3 # meta-3, vertical rule + S_explode6: \xb3 # meta-3, vertical rule +finish + +start: IBMGraphics_2 +# Restrictions: primary + Handling: IBM + S_vwall: \xb3 # meta-3, vertical rule + S_hwall: \xc4 # meta-D, horizontal rule + S_tlcorn: \xda # meta-Z, top left corner + S_trcorn: \xbf # meta-?, top right corner + S_blcorn: \xc0 # meta-@, bottom left + S_brcorn: \xd9 # meta-Y, bottom right + S_crwall: \xc5 # meta-E, cross + S_tuwall: \xc1 # meta-A, T up + S_tdwall: \xc2 # meta-B, T down + S_tlwall: \xb4 # meta-4, T left + S_trwall: \xc3 # meta-C, T right + S_vodoor: \xfe # meta-~, small centered square + S_hodoor: \xfe # meta-~, small centered square + S_corr: \xb0 # meta-0, light shading + S_litcorr: \xb1 # meta-1, medium shading + S_vbeam: \xb3 # meta-3, vertical rule + S_hbeam: \xc4 # meta-D, horizontal rule + S_sw_ml: \xb3 # meta-3, vertical rule + S_sw_mr: \xb3 # meta-3, vertical rule + S_explode4: \xb3 # meta-3, vertical rule + S_explode6: \xb3 # meta-3, vertical rule +finish + +start: RogueIBM + Handling: IBM + Restrictions: rogue + S_weapon: \x29 + S_amulet: \x2c + S_food: \x3a + S_potion: \xad + S_scroll: \x3f + S_book: \x2b + S_wand: \xe7 + S_vwall: \xba # all walls now use + S_hwall: \xcd # double line graphics + S_tlcorn: \xc9 + S_trcorn: \xbb + S_blcorn: \xc8 + S_brcorn: \xbc + S_crwall: \xce + S_tuwall: \xca + S_tdwall: \xcb + S_tlwall: \xb9 + S_trwall: \xcc + S_ndoor: \xce + S_vodoor: \xce + S_hodoor: \xce + S_room: \xfa # centered dot + S_corr: \xb1 + S_litcorr: \xb2 + S_upstair: \xf0 # Greek Xi + S_dnstair: \xf0 +finish + +start: RogueEpyx + Description: rogue level color symbol set like Epyx Rogue + Restrictions: rogue + Handling: IBM + Color: Yes + S_vwall: \xba # all walls now use + S_hwall: \xcd # double line graphics + S_tlcorn: \xc9 + S_trcorn: \xbb + S_blcorn: \xc8 + S_brcorn: \xbc + S_crwall: \xce + S_tuwall: \xca + S_tdwall: \xcb + S_tlwall: \xb9 + S_trwall: \xcc + S_ndoor: \xce + S_vodoor: \xce + S_hodoor: \xce + S_room: \xfa # centered dot + S_corr: \xb1 + S_litcorr: \xb2 + S_upstair: \xf0 # Greek Xi + S_dnstair: \xf0 + S_arrow_trap: \x04 # diamond (cards) + S_dart_trap: \x04 + S_falling_rock_trap: \x04 + S_squeaky_board: \x04 + S_bear_trap: \x04 + S_land_mine: \x04 + S_rolling_boulder_trap: \x04 + S_sleeping_gas_trap: \x04 + S_rust_trap: \x04 + S_fire_trap: \x04 + S_pit: \x04 + S_spiked_pit: \x04 + S_hole: \x04 + S_trap_door: \x04 + S_teleportation_trap: \x04 + S_level_teleporter: \x04 + S_magic_portal: \x04 + S_web: \x04 + S_statue_trap: \x04 + S_magic_trap: \x04 + S_anti_magic_trap: \x04 + S_polymorph_trap: \x04 + S_weapon: \x18 # up arrow +# ^J S_armor: \x0a # Vert rect with o + S_armor: \x5b # default: '[' +# ^I S_ring: \x09 # circle with arrow + S_ring: \x3d # default: '=' + S_amulet: \x0c # "female" symbol + S_tool: \x28 # default: '(' + S_food: \x05 # club (as in cards) + S_potion: \xad # upside down '!' + S_scroll: \x0e # musical note + S_book: \x2b # default: '+' + S_wand: \xe7 # greek tau + S_coin: \x0f # yes it's the same as gems + S_gem: \x0f # fancy '*' + S_rock: \x60 + S_ball: \x30 + S_chain: \x5f + S_venom: \x2e + S_rock: \x60 + S_ball: \x30 + S_chain: \x5f + S_venom: \x2e + S_human: \x01 +finish + +start: RogueWindows + Restrictions: rogue + Handling: IBM + S_weapon: \x29 + S_amulet: \x2c + S_food: \x3a + S_potion: \xad + S_scroll: \x3f + S_book: \x2b + S_wand: \xe7 + S_vwall: \xba # all walls now use + S_hwall: \xcd # double line graphics + S_tlcorn: \xc9 + S_trcorn: \xbb + S_blcorn: \xc8 + S_brcorn: \xbc + S_crwall: \xce + S_tuwall: \xca + S_tdwall: \xcb + S_tlwall: \xb9 + S_trwall: \xcc + S_ndoor: \xce + S_vodoor: \xce + S_hodoor: \xce + S_room: \xfa # centered dot + S_corr: \xb1 + S_litcorr: \xb2 + S_upstair: \xf0 # Greek Xi + S_dnstair: \xf0 +finish + +start: curses + Description: approximation of IBMgraphics using DECgraphics + Restrictions: primary + Handling: DEC + S_vwall: \xf8 # meta-x, vertical rule + S_hwall: \xf1 # meta-q, horizontal rule + S_tlcorn: \xec # meta-l, top left corner + S_trcorn: \xeb # meta-k, top right corner + S_blcorn: \xed # meta-m, bottom left + S_brcorn: \xea # meta-j, bottom right + S_crwall: \xee # meta-n, cross + S_tuwall: \xf6 # meta-v, T up + S_tdwall: \xf7 # meta-w, T down + S_tlwall: \xf5 # meta-u, T left + S_trwall: \xf4 # meta-t, T right + S_ndoor: \xfe # meta-z, centered dot + S_bars: \xfc # meta-|, not-equals sign (was '#') + S_tree: \xe7 # meta-g, plus or minus sign + S_room: \xfe # meta-z, centered dot + S_corr: \xe1 # meta-a, solid block + S_litcorr: \xe1 # meta-a, solid block + S_ice: \xfe # meta-z, centered dot + S_vodbridge: \xfe # meta-z, centered dot + S_hodbridge: \xfe # meta-z, centered dot + S_vbeam: \xf8 # meta-3, vertical rule + S_hbeam: \xf1 # meta-D, horizontal rule + S_sw_ml: \xf8 # meta-3, vertical rule + S_sw_mr: \xf8 # meta-3, vertical rule + S_explode4: \xf8 # meta-3, vertical rule + S_explode6: \xf8 # meta-3, vertical rule +finish + +start: DECgraphics + Description: special line-drawing characters used for walls + Restrictions: primary + Handling: DEC + S_vwall: \xf8 # meta-x, vertical rule + S_hwall: \xf1 # meta-q, horizontal rule + S_tlcorn: \xec # meta-l, top left corner + S_trcorn: \xeb # meta-k, top right corner + S_blcorn: \xed # meta-m, bottom left + S_brcorn: \xea # meta-j, bottom right + S_crwall: \xee # meta-n, cross + S_tuwall: \xf6 # meta-v, T up + S_tdwall: \xf7 # meta-w, T down + S_tlwall: \xf5 # meta-u, T left + S_trwall: \xf4 # meta-t, T right + S_ndoor: \xfe # meta-~, centered dot + S_vodoor: \xe1 # meta-a, solid block + S_hodoor: \xe1 # meta-a, solid block + S_bars: \xfc # meta-|, not-equals (used to be pi) + S_tree: \xe7 # meta-g, plus-or-minus + S_room: \xfe # meta-~, centered dot + S_upladder: \xf9 # meta-y, less-than-or-equals + S_dnladder: \xfa # meta-z, greater-than-or-equals + S_altar: \xfb # meta-{, pi (used to default to '_') + S_pool: \xe0 # meta-\, diamond + S_ice: \xfe # meta-~, centered dot + S_lava: \xe0 # meta-\, diamond + S_vodbridge: \xfe # meta-~, centered dot + S_hodbridge: \xfe # meta-~, centered dot + S_water: \xe0 # meta-\, diamond + S_vbeam: \xf8 # meta-x, vertical rule + S_hbeam: \xf1 # meta-q, horizontal rule + S_sw_tc: \xef # meta-o, high horizontal line + S_sw_ml: \xf8 # meta-x, vertical rule + S_sw_mr: \xf8 # meta-x, vertical rule + S_sw_bc: \xf3 # meta-s, low horizontal line + S_explode2: \xef # meta-o, high horizontal line + S_explode4: \xf8 # meta-x, vertical rule + S_explode6: \xf8 # meta-x, vertical rule + S_explode8: \xf3 # meta-s, low horizontal line +finish + +start: MACgraphics +# Description: (pre-OSX: obsolete?) +# Restrictions: primary + Handling: MAC + S_vwall: \xba + S_hwall: \xcd + S_tlcorn: \xc9 + S_trcorn: \xbb + S_blcorn: \xc8 + S_brcorn: \xbc + S_crwall: \xce + S_tuwall: \xca + S_tdwall: \xcb + S_tlwall: \xb9 + S_trwall: \xcc + S_ndoor: \xb0 + S_vodoor: \xee + S_hodoor: \xee + S_vcdoor: \xef + S_hcdoor: \xef + S_bars: \xf0 # equivalency symbol + S_tree: \xf1 # plus-or-minus + S_corr: \xb0 + S_grave: \xef # same as open door + S_pool: \xe0 +finish + +# symbols EOF diff --git a/dat/tower.des b/dat/tower.des deleted file mode 100644 index c58fb8b5e..000000000 --- a/dat/tower.des +++ /dev/null @@ -1,147 +0,0 @@ -# NetHack 3.6 tower.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# NetHack may be freely redistributed. See license for details. -# -# Upper stage of Vlad's tower -MAZE:"tower1",' ' -FLAGS: noteleport,hardfloor,solidify -GEOMETRY:half-left,center -MAP - --- --- --- - |.| |.| |.| ----S---S---S--- -|.......+.+...| ----+-----.----- - |...\.|.+.| ----+-----.----- -|.......+.+...| ----S---S---S--- - |.| |.| |.| - --- --- --- -ENDMAP -$niches = { (03,01), (03,09), (07,01), (07,09), (11,01), (11,09) } -SHUFFLE: $niches -LADDER:(11,05),down -# The lord and his court -MONSTER:('V',"Vlad the Impaler"),(06,05) -MONSTER:'V',$niches[0] -MONSTER:'V',$niches[1] -MONSTER:'V',$niches[2] -MONSTER:'V',$niches[3] -MONSTER:'V',$niches[4] -MONSTER:'V',$niches[5] -# The doors -DOOR:closed,(08,03) -DOOR:closed,(10,03) -DOOR:closed,(03,04) -DOOR:locked,(10,05) -DOOR:locked,(08,07) -DOOR:locked,(10,07) -DOOR:closed,(03,06) -# treasures -OBJECT:('(',"chest"),(07,05) - -OBJECT:('(',"chest"),$niches[0] -OBJECT:('(',"chest"),$niches[1] -OBJECT:('(',"chest"),$niches[2] -OBJECT:('(',"chest"),$niches[3] -CONTAINER:('(',"chest"),$niches[4] { - OBJECT:('(', "wax candle"), quantity:4d2 -} -CONTAINER:('(',"chest"),$niches[5] { - OBJECT:('(', "tallow candle"), quantity:4d2 -} -# We have to protect the tower against outside attacks -NON_DIGGABLE:(00,00,14,10) - - -# Intermediate stage of Vlad's tower -MAZE:"tower2",' ' -FLAGS: noteleport,hardfloor,solidify -GEOMETRY:half-left,center -MAP - --- --- --- - |.| |.| |.| ----S---S---S--- -|.S.........S.| ----.------+---- - |......|..| ---------.------ -|.S......+..S.| ----S---S---S--- - |.| |.| |.| - --- --- --- -ENDMAP -# Random places are the 10 niches -$place = { (03,01),(07,01),(11,01),(01,03),(13,03), - (01,07),(13,07),(03,09),(07,09),(11,09) } -SHUFFLE: $place -LADDER:(11,05),up -LADDER:(03,07),down -DOOR:locked,(10,04) -DOOR:locked,(09,07) -MONSTER:'&',$place[0] -MONSTER:'&',$place[1] -MONSTER:('d',"hell hound pup"),$place[2] -MONSTER:('d',"hell hound pup"),$place[3] -MONSTER:('d',"winter wolf"),$place[4] -CONTAINER:('(',"chest"),$place[5] { - OBJECT:('"',"amulet of life saving") -} -CONTAINER:('(',"chest"),$place[6] { - OBJECT:('"',"amulet of strangulation") -} -OBJECT:('[',"water walking boots"),$place[7] -OBJECT:('[',"crystal plate mail"),$place[8] -OBJECT:('+',"invisibility"),$place[9] -# Walls in the tower are non diggable -NON_DIGGABLE:(00,00,14,10) - - -# Bottom most stage of Vlad's tower -MAZE:"tower3",' ' -FLAGS: noteleport,hardfloor,solidify -GEOMETRY:half-left,center -MAP - --- --- --- - |.| |.| |.| - ---S---S---S--- - |.S.........S.| ------.........----- -|...|.........+...| -|.---.........---.| -|.|.S.........S.|.| -|.---S---S---S---.| -|...|.|.|.|.|.|...| ----.---.---.---.--- - |.............| - --------------- -ENDMAP -# Random places are the 10 niches -$place = { (05,01),(09,01),(13,01),(03,03),(15,03), - (03,07),(15,07),(05,09),(09,09),(13,09) } -SHUFFLE: $place -BRANCH:(02,05,02,05),(00,00,00,00) -LADDER:(05,07),up -# Entry door is, of course, locked -DOOR:locked,(14,05) -# Let's put a dragon behind the door, just for the fun... -MONSTER:'D',(13,05) -MONSTER:random,(12,04) -MONSTER:random,(12,06) -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -MONSTER:random,random -OBJECT:(')',"long sword"),$place[0] -TRAP:random,$place[0] -OBJECT:('(',"lock pick"),$place[1] -TRAP:random,$place[1] -OBJECT:('[',"elven cloak"),$place[2] -TRAP:random,$place[2] -OBJECT:('(',"blindfold"),$place[3] -TRAP:random,$place[3] -# Walls in the tower are non diggable -NON_DIGGABLE:(00,00,18,12) diff --git a/dat/tower1.lua b/dat/tower1.lua new file mode 100644 index 000000000..dcd84f1f6 --- /dev/null +++ b/dat/tower1.lua @@ -0,0 +1,62 @@ +-- NetHack 3.6 tower.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- Upper stage of Vlad's tower +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor", "solidify") +des.map({ halign = "half-left", valign = "center", map = [[ + --- --- --- + |.| |.| |.| +---S---S---S--- +|.......+.+...| +---+-----.----- + |...\.|.+.| +---+-----.----- +|.......+.+...| +---S---S---S--- + |.| |.| |.| + --- --- --- +]] }); + +local niches = { {03,01}, {03,09}, {07,01}, {07,09}, {11,01}, {11,09} }; +shuffle(niches); + +des.ladder("down", 11,05) +-- The lord and his court +des.monster("Vlad the Impaler", 06, 05) +des.monster("V",niches[1]) +des.monster("V",niches[2]) +des.monster("V",niches[3]) +des.monster("V",niches[4]) +des.monster("V",niches[5]) +des.monster("V",niches[6]) +-- The doors +des.door("closed",08,03) +des.door("closed",10,03) +des.door("closed",03,04) +des.door("locked",10,05) +des.door("locked",08,07) +des.door("locked",10,07) +des.door("closed",03,06) +-- treasures +des.object("chest", 07,05) + +des.object("chest",niches[6]) +des.object("chest",niches[1]) +des.object("chest",niches[2]) +des.object("chest",niches[3]) +des.object({ id = "chest", coord=niches[4], + contents = function() + des.object({ id = "wax candle", quantity=math.random(4,8) }) + end +}); +des.object({ id = "chest", coord=niches[5], + contents = function() + des.object({ id = "tallow candle", quantity=math.random(4,8) }) + end +}); +-- We have to protect the tower against outside attacks +des.non_diggable(selection.area(00,00,14,10)) diff --git a/dat/tower2.lua b/dat/tower2.lua new file mode 100644 index 000000000..0376ec51c --- /dev/null +++ b/dat/tower2.lua @@ -0,0 +1,50 @@ +-- NetHack 3.6 tower.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor", "solidify") +des.map({ halign = "half-left", valign = "center", map = [[ + --- --- --- + |.| |.| |.| +---S---S---S--- +|.S.........S.| +---.------+---- + |......|..| +--------.------ +|.S......+..S.| +---S---S---S--- + |.| |.| |.| + --- --- --- +]] }); +-- Random places are the 10 niches +local place = { {03,01},{07,01},{11,01},{01,03},{13,03}, + {01,07},{13,07},{03,09},{07,09},{11,09} } +shuffle(place) + +des.ladder("up", 11,05) +des.ladder("down", 03,07) +des.door("locked",10,04) +des.door("locked",09,07) +des.monster("&",place[10]) +des.monster("&",place[1]) +des.monster("hell hound pup",place[2]) +des.monster("hell hound pup",place[3]) +des.monster("winter wolf",place[4]) +des.object({ id = "chest", coord = place[5], + contents = function() + des.object("amulet of life saving") + end +}); +des.object({ id = "chest", coord = place[6], + contents = function() + des.object("amulet of strangulation") + end +}); +des.object("water walking boots",place[7]) +des.object("crystal plate mail",place[8]) +des.object("invisibility",place[9]) +-- Walls in the tower are non diggable +des.non_diggable(selection.area(00,00,14,10)) + diff --git a/dat/tower3.lua b/dat/tower3.lua new file mode 100644 index 000000000..345c5a9c2 --- /dev/null +++ b/dat/tower3.lua @@ -0,0 +1,50 @@ +-- NetHack 3.6 tower.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor", "solidify") +des.map({ halign = "half-left", valign = "center", map = [[ + --- --- --- + |.| |.| |.| + ---S---S---S--- + |.S.........S.| +-----.........----- +|...|.........+...| +|.---.........---.| +|.|.S.........S.|.| +|.---S---S---S---.| +|...|.|.|.|.|.|...| +---.---.---.---.--- + |.............| + --------------- +]] }); +-- Random places are the 10 niches +local place = { {05,01},{09,01},{13,01},{03,03},{15,03}, + {03,07},{15,07},{05,09},{09,09},{13,09} } + +des.levregion({ type="branch", region={02,05,02,05} }) +des.ladder("up", 05,07) +-- Entry door is, of course, locked +des.door("locked",14,05) +-- Let's put a dragon behind the door, just for the fun... +des.monster("D", 13, 05) +des.monster({ x=12, y=04 }) +des.monster({ x=12, y=06 }) +des.monster() +des.monster() +des.monster() +des.monster() +des.monster() +des.monster() +des.object("long sword",place[4]) +des.trap({ coord = place[4] }) +des.object("lock pick",place[1]) +des.trap({ coord = place[1] }) +des.object("elven cloak",place[2]) +des.trap({ coord = place[2] }) +des.object("blindfold",place[3]) +des.trap({ coord = place[3] }) +-- Walls in the tower are non diggable +des.non_diggable(selection.area(00,00,18,12)) diff --git a/dat/tribute b/dat/tribute index bacde1efe..73a5a3815 100644 --- a/dat/tribute +++ b/dat/tribute @@ -1,4 +1,4 @@ -# NetHack 3.6 tribute $NHDT-Date: 1565090653 2019/08/06 11:24:13 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.83 $ +# NetHack 3.6 tribute $NHDT-Date: 1574107001 2019/11/18 19:56:41 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.86 $ # Copyright (c) 2017 by Robert Patrick Rankin # NetHack may be freely redistributed. See license for details. # A tribute introduced in NetHack 3.6.0 to: @@ -549,7 +549,7 @@ explain the observed facts, and they are completely and utterly wrong. %e passage # p. 205 %passage 11 -"Where to they all come from?" said Twoflower, as they fled yet another mob. +"Where do they all come from?" said Twoflower, as they fled yet another mob. "Inside every sane person there's a madman struggling to get out," said the shopkeeper, "That's what I've always thought. No one goes mad quicker than @@ -786,7 +786,7 @@ back of his skull. [Equal Rites, by Terry Pratchett] %e passage -# p. 185 (actually uses four periods to mark a sentence ending in a ellipsis) +# p. 185 (actually uses four periods to mark a sentence ending in an ellipsis) %passage 10 There may be universes where librarianship is considered a peaceful sort of occupation, and where the risks are limited to large volumes falling off @@ -2004,7 +2004,7 @@ road to Hell, and demons were, after all, traditionalists. %e passage # pp. 9-10 (passage has an interesting start but not much of a finish...) %passage 3 -"It's a haunting," he ventured. "Some short of ghost, maybe. A bell, book +"It's a haunting," he ventured. "Some sort of ghost, maybe. A bell, book and candle job." The Bursar sighed. "We tried that, Archchancellor." @@ -2816,8 +2816,8 @@ It carried on turning, pulling her with it. Blimey. Oh, well... -Then she did was neither Granny Weatherwax nor Magrat would have dreamed of -doing in the circumstances. But Nanny Ogg's voyages on the sea of +Then she did what neither Granny Weatherwax nor Magrat would have dreamed +of doing in the circumstances. But Nanny Ogg's voyages on the sea of intersexual dalliance had gone rather further than twice around the lighthouse, and she saw nothing demeaning in getting a man to help her. @@ -3694,7 +3694,7 @@ reader's brain. For example, the big volume open in front of him contained some of the collected drawings of Leonard of Quirm, skilled artist and certified -genious, with a mind that wandered so much it came back with souvenirs. +genius, with a mind that wandered so much it came back with souvenirs. Leonard's books were full of sketches--of kittens, of the way water flows, of the wives of influential Ankh-Morporkian merchants whose portraits had diff --git a/dat/valley.lua b/dat/valley.lua new file mode 100644 index 000000000..5e78e71be --- /dev/null +++ b/dat/valley.lua @@ -0,0 +1,174 @@ +-- NetHack 3.6 gehennom.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1992 by M. Stephenson and Izchak Miller +-- NetHack may be freely redistributed. See license for details. +-- +-- + +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor", "nommap"); + +des.map([[ +---------------------------------------------------------------------------- +|...S.|..|.....| |.....-| |................| |...............| |...| +|---|.|.--.---.| |......--- ----..........-----.-----....---........---.-.| +| |.|.|..| |.| --........| |.............| |.......---| |-...........--| +| |...S..| |.| |.......-----.......------| |--------..---......------- | +|----------- |.| |-......| |....|...-- |...-----................---- | +|.....S....---.| |.......| |....|...| |..............----------- | +|.....|.|......| |.....--- |......--- |....---.......| | +|.....|.|------| |....-- --....-- |-------- ----....--------------- | +|.....|--......---BBB-| |...-- |.......| |..................| | +|..........||........-| --...| |.......| |...||.............| | +|.....|...-||-........------....| |.......---- |...||.............-- | +|.....|--......---...........--------..........| |.......---------...-- | +|.....| |------| |--.......--| |..B......----- -----....| |.| |....--- | +|.....| |......--| ------..| |----..B......| |.--------.-- |-.....---| +|------ |........| |.|....| |.....----BBBB---------...........---.........| +| |........| |...|..| |.....| |-.............--------...........---| +| --.....-----------.| |....-----.....---------- |.........---- | +| |..|..B...........| |.|..........|.| |.|........| | +---------------------------------------------------------------------------- +]]); + +-- Make the path somewhat unpredictable +-- If you get "lucky", you may have to go through all three graveyards. +if math.random(0, 99) < 50 then + des.terrain(selection.line(50,8, 53,8), '-') + des.terrain(selection.line(40,8, 43,8), 'B') +end +if math.random(0, 99) < 50 then + des.terrain({ x=27, y=12, typ='|' }) + des.terrain(selection.line(27,3, 29,3), 'B') + des.terrain({ x=28, y=2, typ='-' }) +end +if math.random(0, 99) < 50 then + des.terrain(selection.line(16,10, 16,11), '|') + des.terrain(selection.line(9,13, 14,13), 'B') +end + + +-- Dungeon Description +-- The shrine to Moloch. +des.region({ region={01,06, 05,14},lit=1,type="temple" }) +-- The Morgues +des.region({ region={19,01, 24,08},lit=0,type="morgue",prefilled=0,irregular=1 }) +des.region({ region={09,14, 16,18},lit=0,type="morgue",prefilled=0,irregular=1 }) +des.region({ region={37,09, 43,14},lit=0,type="morgue",prefilled=0,irregular=1 }) +-- Stairs +des.stair("down", 01,01) +-- Branch location +des.levregion({ type="branch", region={66,17,66,17} }) +des.teleport_region({ region = {58,09,72,18}, dir="down" }) + +-- Secret Doors +des.door("locked",04,01) +des.door("locked",08,04) +des.door("locked",06,06) + +-- The altar of Moloch. +des.altar({ x=03,y=10,align="noalign", type="shrine" }) + +-- Non diggable walls - everywhere! +des.non_diggable(selection.area(00,00,75,19)) + +-- Objects +-- **LOTS** of dead bodies (all human). +-- note: no priest(esse)s or monks - maybe Moloch has a *special* +-- fate reserved for members of *those* classes. +-- +des.object({ id="corpse",montype="archeologist" }) +des.object({ id="corpse",montype="archeologist" }) +des.object({ id="corpse",montype="barbarian" }) +des.object({ id="corpse",montype="barbarian" }) +des.object({ id="corpse",montype="caveman" }) +des.object({ id="corpse",montype="cavewoman" }) +des.object({ id="corpse",montype="healer" }) +des.object({ id="corpse",montype="healer" }) +des.object({ id="corpse",montype="knight" }) +des.object({ id="corpse",montype="knight" }) +des.object({ id="corpse",montype="ranger" }) +des.object({ id="corpse",montype="ranger" }) +des.object({ id="corpse",montype="rogue" }) +des.object({ id="corpse",montype="rogue" }) +des.object({ id="corpse",montype="samurai" }) +des.object({ id="corpse",montype="samurai" }) +des.object({ id="corpse",montype="tourist" }) +des.object({ id="corpse",montype="tourist" }) +des.object({ id="corpse",montype="valkyrie" }) +des.object({ id="corpse",montype="valkyrie" }) +des.object({ id="corpse",montype="wizard" }) +des.object({ id="corpse",montype="wizard" }) +-- +-- Some random weapons and armor. +-- +des.object("[") +des.object("[") +des.object("[") +des.object("[") +des.object(")") +des.object(")") +des.object(")") +des.object(")") +-- +-- Some random loot. +-- +des.object("ruby") +des.object("*") +des.object("*") +des.object("!") +des.object("!") +des.object("!") +des.object("?") +des.object("?") +des.object("?") +des.object("/") +des.object("/") +des.object("=") +des.object("=") +des.object("+") +des.object("+") +des.object("(") +des.object("(") +des.object("(") + +-- (Not so) Random traps. +des.trap("spiked pit", 05,02) +des.trap("spiked pit", 14,05) +des.trap("sleep gas", 03,01) +des.trap("board", 21,12) +des.trap("board") +des.trap("dart", 60,01) +des.trap("dart", 26,17) +des.trap("anti magic") +des.trap("anti magic") +des.trap("magic") +des.trap("magic") + +-- Random monsters. +-- The ghosts. +des.monster("ghost") +des.monster("ghost") +des.monster("ghost") +des.monster("ghost") +des.monster("ghost") +des.monster("ghost") +-- Add a few bats for atmosphere. +des.monster("vampire bat") +des.monster("vampire bat") +des.monster("vampire bat") +-- And a lich for good measure. +des.monster("L") +-- Some undead nasties for good measure +des.monster("V") +des.monster("V") +des.monster("V") +des.monster("Z") +des.monster("Z") +des.monster("Z") +des.monster("Z") +des.monster("M") +des.monster("M") +des.monster("M") +des.monster("M") diff --git a/dat/water.lua b/dat/water.lua new file mode 100644 index 000000000..fdf6a5586 --- /dev/null +++ b/dat/water.lua @@ -0,0 +1,102 @@ +-- NetHack 3.6 endgame.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1992,1993 by Izchak Miller, David Cohrs, +-- and Timo Hakulinen +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style = "solidfill", fg = " " }); + +des.level_flags("mazelevel", "noteleport", "hardfloor", "shortsighted") +des.message("You find yourself suspended in an air bubble surrounded by water.") +-- The player lands upon arrival to an air bubble +-- within the leftmost third of the level. The +-- portal to the next level is randomly located in an air +-- bubble within the rightmost third of the level. +-- Bubbles are generated by special code in mkmaze.c for now. +des.map([[ +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW +]]); +des.teleport_region({ region = {0,0,25,19} }) +des.levregion({ type="portal", region={51,0,75,19}, name="astral" }) +-- A fisherman's dream... +des.monster("giant eel") +des.monster("giant eel") +des.monster("giant eel") +des.monster("giant eel") +des.monster("giant eel") +des.monster("giant eel") +des.monster("giant eel") +des.monster("giant eel") +des.monster("electric eel") +des.monster("electric eel") +des.monster("electric eel") +des.monster("electric eel") +des.monster("electric eel") +des.monster("electric eel") +des.monster("electric eel") +des.monster("electric eel") +des.monster("kraken") +des.monster("kraken") +des.monster("kraken") +des.monster("kraken") +des.monster("kraken") +des.monster("kraken") +des.monster("kraken") +des.monster("kraken") +des.monster("kraken") +des.monster("shark") +des.monster("shark") +des.monster("shark") +des.monster("shark") +des.monster("piranha") +des.monster("piranha") +des.monster("piranha") +des.monster("piranha") +des.monster("jellyfish") +des.monster("jellyfish") +des.monster("jellyfish") +des.monster("jellyfish") +des.monster(";") +des.monster(";") +des.monster(";") +des.monster(";") +-- These guys feel like home here +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) +des.monster({ id = "water elemental", peaceful = 0 }) + diff --git a/dat/wizard1.lua b/dat/wizard1.lua new file mode 100644 index 000000000..a34f20df5 --- /dev/null +++ b/dat/wizard1.lua @@ -0,0 +1,92 @@ +-- NetHack 3.6 yendor.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1992 by M. Stephenson and Izchak Miller +-- NetHack may be freely redistributed. See license for details. +-- +-- +-- The top (real) wizard level. +-- Keeping the Moat for old-time's sake +des.level_init({ style="mazegrid", bg ="-" }); + +des.level_flags("mazelevel", "noteleport", "hardfloor") +des.map([[ +----------------------------. +|.......|..|.........|.....|. +|.......S..|.}}}}}}}.|.....|. +|..--S--|..|.}}---}}.|---S-|. +|..|....|..|.}--.--}.|..|..|. +|..|....|..|.}|...|}.|..|..|. +|..--------|.}--.--}.|..|..|. +|..|.......|.}}---}}.|..|..|. +|..S.......|.}}}}}}}.|..|..|. +|..|.......|.........|..|..|. +|..|.......|-----------S-S-|. +|..|.......S...............|. +----------------------------. +]]); +des.levregion({ type="stair-up", region={01,00,79,20}, region_islev=1, exclude={0,0,28,12} }) +des.levregion({ type="stair-down", region={01,00,79,20}, region_islev=1, exclude={0,0,28,12} }) +des.levregion({ type="branch", region={01,00,79,20}, region_islev=1, exclude={0,0,28,12} }) +des.teleport_region({ region={01,00,79,20}, region_islev=1, exclude={0,0,27,12} }) +-- Make it a morgue for rm id in mkmaze.c +-- for the purpose of random sdoor placement +des.region({ region={12,01, 20,09}, lit=0, type="morgue", prefilled=1 }) +-- another region to constrain monster arrival +des.region({ region={01,01, 10,11}, lit=0, type="ordinary", prefilled=0 }) +des.mazewalk(28,05,"east") +des.ladder("down", 06,05) +-- Non diggable walls +-- Walls inside the moat stay diggable +des.non_diggable(selection.area(00,00,11,12)) +des.non_diggable(selection.area(11,00,21,00)) +des.non_diggable(selection.area(11,10,27,12)) +des.non_diggable(selection.area(21,00,27,10)) +-- Non passable walls +des.non_passwall(selection.area(00,00,11,12)) +des.non_passwall(selection.area(11,00,21,00)) +des.non_passwall(selection.area(11,10,27,12)) +des.non_passwall(selection.area(21,00,27,10)) +-- The wizard and his guards +des.monster({ id = "Wizard of Yendor", x=16, y=05, asleep=1 }) +des.monster("hell hound", 15, 05) +des.monster("vampire lord", 17, 05) +-- The local treasure +des.object("Book of the Dead", 16, 05) +-- Surrounding terror +des.monster("kraken", 14, 02) +des.monster("giant eel", 17, 02) +des.monster("kraken", 13, 04) +des.monster("giant eel", 13, 06) +des.monster("kraken", 19, 04) +des.monster("giant eel", 19, 06) +des.monster("kraken", 15, 08) +des.monster("giant eel", 17, 08) +des.monster("piranha", 15, 02) +des.monster("piranha", 19, 08) +-- Random monsters +des.monster("D") +des.monster("H") +des.monster("&") +des.monster("&") +des.monster("&") +des.monster("&") +-- And to make things a little harder. +des.trap("board",16,04) +des.trap("board",16,06) +des.trap("board",15,05) +des.trap("board",17,05) +-- Random traps. +des.trap("spiked pit") +des.trap("sleep gas") +des.trap("anti magic") +des.trap("magic") +-- Some random loot. +des.object("ruby") +des.object("!") +des.object("!") +des.object("?") +des.object("?") +des.object("+") +des.object("+") +des.object("+") + diff --git a/dat/wizard2.lua b/dat/wizard2.lua new file mode 100644 index 000000000..9bcd4ab3b --- /dev/null +++ b/dat/wizard2.lua @@ -0,0 +1,55 @@ +-- NetHack 3.6 yendor.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1992 by M. Stephenson and Izchak Miller +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style="mazegrid", bg ="-" }); + +des.level_flags("mazelevel", "noteleport", "hardfloor") +des.map([[ +----------------------------. +|.....|.S....|.............|. +|.....|.-------S--------S--|. +|.....|.|.........|........|. +|..-S--S|.........|........|. +|..|....|.........|------S-|. +|..|....|.........|.....|..|. +|-S-----|.........|.....|..|. +|.......|.........|S--S--..|. +|.......|.........|.|......|. +|-----S----S-------.|......|. +|............|....S.|......|. +----------------------------. +]]); +des.levregion({ type="stair-up", region={01,00,79,20}, region_islev=1, exclude={0,0,28,12} }) +des.levregion({ type="stair-down", region={01,00,79,20}, region_islev=1, exclude={0,0,28,12} }) +des.levregion({ type="branch", region={01,00,79,20}, region_islev=1, exclude={0,0,28,12} }) +des.teleport_region({ region={01,00,79,20}, region_islev=1, exclude={0,0,27,12} }) +-- entire tower in a region, constrains monster migration +des.region({ region={01,01, 26,11}, lit=0, type="ordinary", prefilled=1 }) +des.region({ region={09,03, 17,09}, lit=0, type="zoo", prefilled=0 }) +des.door("closed",15,02) +des.door("closed",11,10) +des.mazewalk(28,05,"east") +des.ladder("up", 12,01) +des.ladder("down", 14,11) +-- Non diggable walls everywhere +des.non_diggable(selection.area(00,00,27,12)) +-- +des.non_passwall(selection.area(00,00,06,12)) +des.non_passwall(selection.area(06,00,27,02)) +des.non_passwall(selection.area(16,02,27,12)) +des.non_passwall(selection.area(06,12,16,12)) +-- Random traps. +des.trap("spiked pit") +des.trap("sleep gas") +des.trap("anti magic") +des.trap("magic") +-- Some random loot. +des.object("!") +des.object("!") +des.object("?") +des.object("?") +des.object("+") +-- treasures +des.object("\"", 04, 06) diff --git a/dat/wizard3.lua b/dat/wizard3.lua new file mode 100644 index 000000000..f5da68944 --- /dev/null +++ b/dat/wizard3.lua @@ -0,0 +1,81 @@ +-- NetHack 3.6 yendor.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ +-- Copyright (c) 1989 by Jean-Christophe Collet +-- Copyright (c) 1992 by M. Stephenson and Izchak Miller +-- NetHack may be freely redistributed. See license for details. +-- +des.level_init({ style="mazegrid", bg ="-" }); + +des.level_flags("mazelevel", "noteleport", "hardfloor") +des.map([[ +----------------------------. +|..|............S..........|. +|..|..------------------S--|. +|..|..|.........|..........|. +|..S..|.}}}}}}}.|..........|. +|..|..|.}}---}}.|-S--------|. +|..|..|.}--.--}.|..|.......|. +|..|..|.}|...|}.|..|.......|. +|..---|.}--.--}.|..|.......|. +|.....|.}}---}}.|..|.......|. +|.....S.}}}}}}}.|..|.......|. +|.....|.........|..|.......|. +----------------------------. +]]); +des.levregion({ type="stair-up", region={01,00,79,20}, region_islev=1, exclude={0,0,28,12} }) +des.levregion({ type="stair-down", region={01,00,79,20}, region_islev=1, exclude={0,0,28,12} }) +des.levregion({ type="branch", region={01,00,79,20}, region_islev=1, exclude={0,0,28,12} }) +des.teleport_region({ region={01,00,79,20}, region_islev=1, exclude={0,0,27,12} }) +des.levregion({ region={25,11,25,11}, type="portal", name="fakewiz1" }); +des.mazewalk(28,09,"east") +des.region({ region={07,03, 15,11}, lit=0 ,type="morgue",prefilled=1 }) +des.region({ region={17,06, 18,11}, lit=0, type="beehive" }) +-- make the entry chamber a real room; it affects monster arrival; +-- `unfilled' is a kludge to force an ordinary room to remain a room +des.region({ region={20,06,26,11},lit=0,type="ordinary",prefilled=1, + contents = function() + local w = "north"; + if math.random(0,99) < 50 then w = "west" end + des.door({ state="secret", wall=w }) + end +}); +des.door("closed",18,05) +des.ladder("up", 11,07) +-- Non diggable walls +-- Walls inside the moat stay diggable +des.non_diggable(selection.area(00,00,06,12)) +des.non_diggable(selection.area(06,00,27,02)) +des.non_diggable(selection.area(16,02,27,12)) +des.non_diggable(selection.area(06,12,16,12)) +-- +des.non_passwall(selection.area(00,00,06,12)) +des.non_passwall(selection.area(06,00,27,02)) +des.non_passwall(selection.area(16,02,27,12)) +des.non_passwall(selection.area(06,12,16,12)) +-- +des.monster("L", 10, 07) +des.monster("vampire lord", 12, 07) +-- Some surrounding horrors +des.monster("kraken", 08, 05) +des.monster("giant eel", 08, 08) +des.monster("kraken", 14, 05) +des.monster("giant eel", 14, 08) +-- Other monsters +des.monster("L") +des.monster("D") +des.monster("D", 26, 09) +des.monster("&") +des.monster("&") +des.monster("&") +-- And to make things a little harder. +des.trap("board",10,07) +des.trap("board",12,07) +des.trap("board",11,06) +des.trap("board",11,08) +-- Some loot +des.object(")") +des.object("!") +des.object("?") +des.object("?") +des.object("(") +-- treasures +des.object("\"", 11, 07) diff --git a/dat/yendor.des b/dat/yendor.des deleted file mode 100644 index 34b780988..000000000 --- a/dat/yendor.des +++ /dev/null @@ -1,281 +0,0 @@ -# NetHack 3.6 yendor.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ -# Copyright (c) 1989 by Jean-Christophe Collet -# Copyright (c) 1992 by M. Stephenson and Izchak Miller -# NetHack may be freely redistributed. See license for details. -# -# The top (real) wizard level. -# Keeping the Moat for old-time's sake -MAZE:"wizard1",random -FLAGS:noteleport,hardfloor -GEOMETRY:center,center -MAP -----------------------------. -|.......|..|.........|.....|. -|.......S..|.}}}}}}}.|.....|. -|..--S--|..|.}}---}}.|---S-|. -|..|....|..|.}--.--}.|..|..|. -|..|....|..|.}|...|}.|..|..|. -|..--------|.}--.--}.|..|..|. -|..|.......|.}}---}}.|..|..|. -|..S.......|.}}}}}}}.|..|..|. -|..|.......|.........|..|..|. -|..|.......|-----------S-S-|. -|..|.......S...............|. -----------------------------. -ENDMAP -STAIR:levregion(01,00,79,20),(0,0,28,12),up -STAIR:levregion(01,00,79,20),(0,0,28,12),down -BRANCH:levregion(01,00,79,20),(0,0,28,12) -TELEPORT_REGION:levregion(01,00,79,20),(0,0,27,12) -# Make it a morgue for rm id in mkmaze.c -# for the purpose of random sdoor placement -REGION:(12,01,20,09),unlit,"morgue",unfilled -# another region to constrain monster arrival -REGION:(01,01,10,11),unlit,"ordinary",unfilled -MAZEWALK:(28,05),east -LADDER:(06,05),down -# Non diggable walls -# Walls inside the moat stay diggable -NON_DIGGABLE:(00,00,11,12) -NON_DIGGABLE:(11,00,21,00) -NON_DIGGABLE:(11,10,27,12) -NON_DIGGABLE:(21,00,27,10) -# Non passable walls -NON_PASSWALL:(00,00,11,12) -NON_PASSWALL:(11,00,21,00) -NON_PASSWALL:(11,10,27,12) -NON_PASSWALL:(21,00,27,10) -# The wizard and his guards -MONSTER:('@',"Wizard of Yendor"),(16,05),asleep -MONSTER:('d',"hell hound"),(15,05) -MONSTER:('V',"vampire lord"),(17,05) -# The local treasure -OBJECT:('+',"Book of the Dead"),(16,05) -# Surrounding terror -MONSTER:(';',"kraken"),(14,02) -MONSTER:(';',"giant eel"),(17,02) -MONSTER:(';',"kraken"),(13,04) -MONSTER:(';',"giant eel"),(13,06) -MONSTER:(';',"kraken"),(19,04) -MONSTER:(';',"giant eel"),(19,06) -MONSTER:(';',"kraken"),(15,08) -MONSTER:(';',"giant eel"),(17,08) -MONSTER:(';',"piranha"),(15,02) -MONSTER:(';',"piranha"),(19,08) -# Random monsters -MONSTER:'D',random -MONSTER:'H',random -MONSTER:'&',random -MONSTER:'&',random -MONSTER:'&',random -MONSTER:'&',random -# And to make things a little harder. -TRAP:"board",(16,04) -TRAP:"board",(16,06) -TRAP:"board",(15,05) -TRAP:"board",(17,05) -# Random traps. -TRAP:"spiked pit",random -TRAP:"sleep gas",random -TRAP:"anti magic",random -TRAP:"magic",random -# Some random loot. -OBJECT:('*',"ruby"),random -OBJECT:'!',random -OBJECT:'!',random -OBJECT:'?',random -OBJECT:'?',random -OBJECT:'+',random -OBJECT:'+',random -OBJECT:'+',random - - -# The middle wizard level. -MAZE:"wizard2",random -FLAGS:noteleport,hardfloor -GEOMETRY:center,center -MAP -----------------------------. -|.....|.S....|.............|. -|.....|.-------S--------S--|. -|.....|.|.........|........|. -|..-S--S|.........|........|. -|..|....|.........|------S-|. -|..|....|.........|.....|..|. -|-S-----|.........|.....|..|. -|.......|.........|S--S--..|. -|.......|.........|.|......|. -|-----S----S-------.|......|. -|............|....S.|......|. -----------------------------. -ENDMAP -STAIR:levregion(01,00,79,20),(0,0,28,12),up -STAIR:levregion(01,00,79,20),(0,0,28,12),down -BRANCH:levregion(01,00,79,20),(0,0,28,12) -TELEPORT_REGION:levregion(01,00,79,20),(0,0,27,12) -# entire tower in a region, constrains monster migration -REGION:(01,01,26,11),unlit,"ordinary",unfilled -REGION:(09,03,17,09),unlit,"zoo" -DOOR:closed,(15,02) -DOOR:closed,(11,10) -MAZEWALK:(28,05),east -LADDER:(12,01),up -LADDER:(14,11),down -# Non diggable walls everywhere -NON_DIGGABLE:(00,00,27,12) -# -NON_PASSWALL:(00,00,06,12) -NON_PASSWALL:(06,00,27,02) -NON_PASSWALL:(16,02,27,12) -NON_PASSWALL:(06,12,16,12) -# Random traps. -TRAP:"spiked pit",random -TRAP:"sleep gas",random -TRAP:"anti magic",random -TRAP:"magic",random -# Some random loot. -OBJECT:'!',random -OBJECT:'!',random -OBJECT:'?',random -OBJECT:'?',random -OBJECT:'+',random -# treasures -OBJECT:'"',(04,06) - - -# The bottom wizard level. -# Memorialize the fakewiz setup. -MAZE:"wizard3",random -FLAGS:noteleport,hardfloor -GEOMETRY:center,center -MAP -----------------------------. -|..|............S..........|. -|..|..------------------S--|. -|..|..|.........|..........|. -|..S..|.}}}}}}}.|..........|. -|..|..|.}}---}}.|-S--------|. -|..|..|.}--.--}.|..|.......|. -|..|..|.}|...|}.|..|.......|. -|..---|.}--.--}.|..|.......|. -|.....|.}}---}}.|..|.......|. -|.....S.}}}}}}}.|..|.......|. -|.....|.........|..|.......|. -----------------------------. -ENDMAP -STAIR:levregion(01,00,79,20),(0,0,28,12),up -STAIR:levregion(01,00,79,20),(0,0,28,12),down -BRANCH:levregion(01,00,79,20),(0,0,28,12) -TELEPORT_REGION:levregion(01,00,79,20),(0,0,27,12) -PORTAL:(25,11,25,11),(0,0,0,0),"fakewiz1" -MAZEWALK:(28,09),east -REGION:(07,03,15,11),unlit,"morgue",unfilled -REGION:(17,06,18,11),unlit,"beehive" -# make the entry chamber a real room; it affects monster arrival; -# `unfilled' is a kludge to force an ordinary room to remain a room -REGION:(20,06,26,11),unlit,"ordinary",unfilled { - ROOMDOOR:true, closed, north|west, random -} -DOOR:closed,(18,05) -LADDER:(11,07),up -# Non diggable walls -# Walls inside the moat stay diggable -NON_DIGGABLE:(00,00,06,12) -NON_DIGGABLE:(06,00,27,02) -NON_DIGGABLE:(16,02,27,12) -NON_DIGGABLE:(06,12,16,12) -# -NON_PASSWALL:(00,00,06,12) -NON_PASSWALL:(06,00,27,02) -NON_PASSWALL:(16,02,27,12) -NON_PASSWALL:(06,12,16,12) -# -MONSTER:'L',(10,07) -MONSTER:('V',"vampire lord"),(12,07) -# Some surrounding horrors -MONSTER:(';',"kraken"),(08,05) -MONSTER:(';',"giant eel"),(08,08) -MONSTER:(';',"kraken"),(14,05) -MONSTER:(';',"giant eel"),(14,08) -# Other monsters -MONSTER:'L',random -MONSTER:'D',random -MONSTER:'D',(26,09) -MONSTER:'&',random -MONSTER:'&',random -MONSTER:'&',random -# And to make things a little harder. -TRAP:"board",(10,07) -TRAP:"board",(12,07) -TRAP:"board",(11,06) -TRAP:"board",(11,08) -# Some loot -OBJECT:')',random -OBJECT:'!',random -OBJECT:'?',random -OBJECT:'?',random -OBJECT:'(',random -# treasures -OBJECT:'"',(11,07) - - -# The former decoy wizard levels. -# There are two of these, and we need to -# distinguish between them for the portal. -MAZE:"fakewiz1",random -GEOMETRY:center,center -MAP -......... -.}}}}}}}. -.}}---}}. -.}--.--}. -.}|...|}. -.}--.--}. -.}}---}}. -.}}}}}}}. -ENDMAP -STAIR:levregion(01,00,79,20),(0,0,8,7),up -STAIR:levregion(01,00,79,20),(0,0,8,7),down -BRANCH:levregion(01,00,79,20),(0,0,8,7) -TELEPORT_REGION:levregion(01,00,79,20),(2,2,6,6) -PORTAL:(4,4,4,4),(0,0,0,0),"wizard3" -MAZEWALK:(08,05),east -REGION:(04,03,06,06),unlit,"ordinary",unfilled,irregular -MONSTER:'L',(04,04) -MONSTER:('V',"vampire lord"),(03,04) -MONSTER:(';',"kraken"),(06,06) -# And to make things a little harder. -TRAP:"board",(04,03) -TRAP:"board",(04,05) -TRAP:"board",(03,04) -TRAP:"board",(05,04) - - -MAZE:"fakewiz2",random -GEOMETRY:center,center -MAP -......... -.}}}}}}}. -.}}---}}. -.}--.--}. -.}|...|}. -.}--.--}. -.}}---}}. -.}}}}}}}. -ENDMAP -STAIR:levregion(01,00,79,20),(0,0,8,7),up -STAIR:levregion(01,00,79,20),(0,0,8,7),down -BRANCH:levregion(01,00,79,20),(0,0,8,7) -TELEPORT_REGION:levregion(01,00,79,20),(2,2,6,6) -MAZEWALK:(08,05),east -REGION:(04,03,06,06),unlit,"ordinary",unfilled,irregular -MONSTER:'L',(04,04) -MONSTER:('V',"vampire lord"),(03,04) -MONSTER:(';',"kraken"),(06,06) -# And to make things a little harder. -TRAP:"board",(04,03) -TRAP:"board",(04,05) -TRAP:"board",(03,04) -TRAP:"board",(05,04) -# treasures -OBJECT:'"',(04,04) diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index d50b20b29..c85238f4d 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -1,4 +1,4 @@ -.\" $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.312 $ $NHDT-Date: 1562838836 2019/07/11 09:53:56 $ +.\" $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.337 $ $NHDT-Date: 1576431522 2019/12/15 17:38:42 $ .\" .\" This is an excerpt from the 'roff' man page from the 'groff' package. .\" NetHack's Guidebook.mn currently does *not* adhere to these guidelines. @@ -24,7 +24,7 @@ .ds vr "NetHack 3.7 .ds f0 "\*(vr .ds f1 -.ds f2 "October 1, 2019 +.ds f2 "December 18, 2019 . .\" A note on some special characters: .\" \(lq = left double quote @@ -45,6 +45,8 @@ A Guide to the Mazes of Menace .au Original version - Eric S. Raymond (Edited and expanded for 3.6 by Mike Stephenson and others) +.sp 1 +\*(f2 .hn 1 Introduction .pg @@ -511,8 +513,8 @@ information, then let you pick another location; you to choose another location to examine; \(oq:\(cq will show additional info, if any, without asking for confirmation. When picking a location, -pressing the ESC key will terminate this command, or pressing \(oq?\(cq -will give a brief reminder about how it works. +pressing the ESC key will terminate this command, or pressing \(oq?\(cq will +give a brief reminder about how it works. .lp "" If the .op autodescribe @@ -693,6 +695,14 @@ Normally checks for edible item(s) on the floor, then if none are found or none are chosen, checks for edible item(s) in inventory. Precede \(oqe\(cq with the \(oqm\(cq prefix to bypass attempting to eat anything off the floor. +.lp "" +If you attempt to eat while already satiated, you might choke to death. +If you risk it, you will be asked whether +to \(lqcontinue eating?\(rq \fIif you survive the first bite\fP. +You can set the +.op paranoid_confirmation:eating +option to require a response of \f(CRyes\fP instead of just \f(CRy\fP. +. .\" Make sure Elbereth is not hyphenated below, the exact spelling matters .hw Elbereth .lp E @@ -2617,8 +2627,7 @@ Using a configuration file .hw .nethackrc defaults.nh nethack.exe nethackW.exe The default name of the configuration file varies on different operating systems. -On MS-DOS and Windows, it is \(lqdefaults.nh\(rq -in the same folder as nethack.exe or nethackW.exe. +.pg On .UX , Linux, @@ -2626,6 +2635,18 @@ and Mac OS X it is \(lq.nethackrc\(rq in the user's home directory. The file may not exist, but it is a normal ASCII text file and can be created with any text editor. .pg +On Windows, it is \(lq.nethackrc\(rq in the folder +\(lq\\%USERPROFILE%\\NetHack\\3.6\(rq. The file may not exist, +but it is a normal ASCII text file can can be created with any +text editor. +After running NetHack for the first time, you should find a default +template for the configuration file named \(lq.nethackrc.template\(rq +in \(lq\\%USERPROFILE%\\NetHack\\3.6\(rq. +If you had not created the configuration file, NetHack will create +the configuration file for you using the default template file. +.pg +On MS-DOS, it is \(lqdefaults.nh\(rq in the same folder as nethack.exe. +.pg Any line in the configuration file starting with \(oq#\(cq is treated as a comment. Empty lines are ignored. @@ -2642,6 +2663,7 @@ of which can be used multiple times. In general, the statements are written in capital letters, followed by an equals sign, followed by settings particular to that statement. +.pg Here is a list of allowed statements: .lp OPTIONS There are two types of options, boolean and compound options. @@ -2653,7 +2675,7 @@ Some options are persistent, and apply only to new games. You can specify multiple OPTIONS statements, and multiple options separated by commas in a single OPTIONS statement. (Comma separated options are processed from right to left.) -.pg +.lp "" Example: .sd .ft CR @@ -2682,6 +2704,9 @@ HACKDIR, must be writable. .lp TROUBLEDIR The location that a record of game aborts and self-diagnosed game problems is kept. Defaults to HACKDIR, must be writable. +.\" +.\" config file entries beyond this point are shown alphabetically +.\" .lp AUTOCOMPLETE Enable or disable an extended command autocompletion. Autocompletion has no effect for the X11 windowport. @@ -2689,7 +2714,7 @@ You can specify multiple autocompletions. To enable autocompletion, list the extended command. Prefix the command with \(lq!\(rq to disable the autocompletion for that command. -.pg +.lp "" Example: .sd \f(CRAUTOCOMPLETE=zap,!annotate\fP @@ -2705,7 +2730,7 @@ extended commands. You can specify multiple bindings. Format is key followed by the command, separated by a colon. See the \(lqChanging Key Bindings\(rq section for more information. -.pg +.lp "" Example: .sd \f(CRBIND=\(haX:getpos.autodescribe\fP @@ -2713,7 +2738,7 @@ Example: .lp CHOOSE Chooses at random one of the comma-separated parameters as an active section name. Lines in other sections are ignored. -.pg +.lp "" Example: .sd .ft CR \" constant-width Roman @@ -2725,55 +2750,73 @@ OPTIONS=role:arc,race:dwa,align:law,gender:fem OPTIONS=role:wiz,race:elf,align:cha,gender:mal .ft \" revert to previous font .ed -.lp MSGTYPE -Change the way messages are shown in the top status line. -See the \(lqConfiguring Message Types\(rq section. .lp MENUCOLOR Highlight menu lines with different colors. See the \(lqConfiguring Menu Colors\(rq section. +.lp MSGTYPE +Change the way messages are shown in the top status line. +See the \(lqConfiguring Message Types\(rq section. +.lp ROGUESYMBOLS +Custom symbols for for the rogue level's symbol set. +See \fISYMBOLS\fP below. +.lp SOUND +Define a sound mapping. +See the \(lqConfiguring User Sounds\(rq section. +.lp SOUNDDIR +Define the directory that contains the sound files. +See the \(lqConfiguring User Sounds\(rq section. .lp SYMBOLS -Override one or more symbols in the symbols files. +Override one or more symbols in the symbol set used for all dungeon +levels except for the special rogue level. See the \(lqModifying NetHack Symbols\(rq section. -.pg +.lp "" Example: .sd -\f(CRSYMBOLS=S_boulder:0\fP +\f(CR# replace small punctuation (tick marks) with digits\fP +\f(CRSYMBOLS=S_boulder:0,S_golem:7\fP .ed .lp WIZKIT Debug mode only: extra items to add to initial inventory. Value is the name of a text file containing a list of item names, one per line, up to a maximum of 128 lines. Each line is processed by the function that handles wishing. -.pg +.lp "" Example: .sd \f(CRWIZKIT=\(ti/wizkit.txt\fP \" \(ti == '~' .ed -.lp SOUNDDIR -Define the directory that contains the sound files. -See the \(lqConfiguring User Sounds\(rq section. -.lp SOUND -Define a sound mapping. -See the \(lqConfiguring User Sounds\(rq section. +. .pg -Here is a short example of config file contents: -.sd +\ \" dummy paragraph to force some separation [.BR isn't working as intended] +.pg +.SD n \" suppress indentation +Here is an example of configuration file contents: +.ED +.\" [conditional indentation; see description of NETHACKOPTIONS below] +.ds sD i \" assume proportional, indentation acceptable and preferred +.\" Check for fixed-width font; 'f' will be same width as 'F'. +.if (\w'f'p)=(\w'F'p) .ds sD n \" if same width, suppress indentation +.SD \*(sD \" string variable sD will expand to either 'i' or 'n' .ft CR \" set font to constant-width Roman # Set your character's role, race, gender, and alignment. OPTIONS=role:Valkyrie, race:Human, gender:female, align:lawful # # Turn on autopickup, set automatically picked up object types OPTIONS=autopickup,pickup_types:$"=/!?+ -# Show colored text if possible -OPTIONS=color -# Show lit corridors differently -OPTIONS=lit_corridor +# +# Map customization +OPTIONS=color # Display things in color if possible +OPTIONS=lit_corridor # Show lit corridors differently +OPTIONS=hilite_pet,hilite_pile +# Replace small punctuation (tick marks) with digits +SYMBOLS=S_boulder:0,S_golem:7 # # No startup splash screen. Windows GUI only. OPTIONS=!splash_screen .ft \" revert to previous font -.ed -.BR 2 +.ED +.pg +\ \" another dummy paragraph [.BR 2] .hn 2 Using the NETHACKOPTIONS environment variable .pg @@ -3174,7 +3217,7 @@ Valid settings are: .sd .si .CC 0 "disabled" -.CC 1 "enabled and make OS adjustments to support mouse use in the game" +.CC 1 "enabled and make OS adjustments to support mouse use" .CC 2 "like 1 but does not make any OS adjustments" .ei .ed @@ -3274,6 +3317,8 @@ bones data when dying in debug mode; require \(lqyes\(rq rather than \(oqy\(cq to confirm attacking a peaceful monster; .PL wand-break require \(lqyes\(rq rather than \(oqy\(cq to confirm breaking a wand; +.PL eating +require \(lqyes\(rq rather than \(oqy\(cq to confirm whether to continue eating; .PL Were-change require \(lqyes\(rq rather than \(oqy\(cq to confirm changing form due to lycanthropy when hero has polymorph control; @@ -3591,7 +3636,7 @@ used to customize and change the characteristics of the windowtype that you have chosen. Character strings that are too long may be truncated. Not all window ports will adjust for all settings listed -here. You can safely add any of these options to your config +here. You can safely add any of these options to your configuration file, and if the window port is capable of adjusting to suit your preferences, it will attempt to do so. If it can't it will silently ignore it. You can find out if an @@ -3787,7 +3832,8 @@ May be used to alter the value of keystrokes that the operating system returns to NetHack to help compensate for international keyboard issues. OPTIONS=subkeyvalue:171/92 will return 92 to NetHack, if 171 was originally going to be returned. -You can use multiple subkeyvalue statements in the config file if needed. +You can use multiple subkeyvalue statements in the configuration file +if needed. Cannot be set with the \(oqO\(cq command. .lp video Set the video mode used (PC NetHack only). @@ -3851,12 +3897,12 @@ character in the pattern, specifically: .ed The .op autopickup_exception -rules are processed in the order in which they appear in your config file, -thus allowing a later rule to override an earlier rule. +rules are processed in the order in which they appear in your configuration +file, thus allowing a later rule to override an earlier rule. .lp "" Exceptions can be set with the \(oqO\(cq command, but because they are not -included in your config file, they won't be in effect if you save and then -restore your game. +included in your configuration file, they won't be in effect if you save +and then restore your game. .op autopickup_exception rules and not saved with the game. .\" end of ``.lp autopickup_exception'' entry; continue enclosing page... @@ -3899,8 +3945,8 @@ You can bind multiple keys to the same extended command. Unbind a key by using \(lqnothing\(rq as the extended command to bind to. You can also bind the \(lq\(rq, \(lq\(rq, and \(lq\(rq keys. .lp "Menu accelerator keys" -The menu control or accelerator keys can also be rebound via OPTIONS-lines -in the config file. +The menu control or accelerator keys can also be rebound via OPTIONS lines +in the configuration file. You cannot bind object symbols into menu accelerators. .lp "Special command keys" Below are the special commands you can rebind. @@ -4059,7 +4105,7 @@ Configuring Message Types You can change the way the messages are shown in the message area, when the message matches a user-defined pattern. .pg -In general, the config file entries to configure the message types +In general, the configuration file entries to describe the message types look like this: .si MSGTYPE=type "pattern" @@ -4099,16 +4145,17 @@ the user is prompted with more-prompt, and a message matching .\" historical trivia: "You displaced Fido." was the sort of message you .\" got when swapping places with your pet, but that was changed long ago... .lp "" -The order of the defined MSGTYPE-lines is important; the last matching +The order of the defined MSGTYPE lines is important; the last matching rule is used. Put the general case first, exceptions below them. .hn 2 Configuring Menu Colors .pg Some platforms allow you to define colors used in menu lines when the -line matches a user-defined pattern. At this time the tty, win32tty and -win32gui support this. +line matches a user-defined pattern. +At this time the tty, curses, win32tty and +win32gui interfaces support this. .pg -In general, the config file entries to configure the menu color mappings +In general, the configuration file entries to describe the menu color mappings look like this: .si .lp MENUCOLOR="pattern"=color&attribute @@ -4151,8 +4198,8 @@ in it will be shown in green color, lines with \(lq\ cursed\ \(rq will be shown in red, and lines with \(lq\ cursed\ \(rq followed by \(lq(being worn)\(rq on the same line will be shown in red color and underlined. -You can have multiple MENUCOLOR entries in your config file, -and the last MENUCOLOR-line in your config file that matches +You can have multiple MENUCOLOR entries in your configuration file, +and the last MENUCOLOR line that matches a menu line will be used for the line. .pg Note that if you intend to have one or more color specifications match @@ -4168,7 +4215,7 @@ that matches a user-defined pattern is delivered to the message window. At this time the Qt port and the win32tty and win32gui ports support the use of user sounds. .pg -The following config file entries are relevant to mapping user sounds +The following configuration file entries are relevant to mapping user sounds to messages: .lp SOUNDDIR The directory that houses the sound files to be played. @@ -4276,7 +4323,7 @@ text to match against. .lp "*" \(lqalways\(rq will set the default attributes for that field. .lp "*" -\(lqup\(rq and \(lqdown\(rq set the field attributes for when the field +\(lqup\(rq, \(lqdown\(rq set the field attributes for when the field value changes upwards or downwards. This attribute times out after .op statushilites @@ -4337,7 +4384,7 @@ is tested; the character's name is ignored. .ei .pg The in-game options menu can help you determine the correct syntax for a -config file. +configuration file. .pg The whole feature can be disabled by setting option .op statushilites @@ -4372,8 +4419,9 @@ Set the name of the symbol set that you want to load. Set the name of the symbol set that you want to load for display on the rogue level. .pg -You can also override one or more symbols using the SYMBOLS config -file option. Symbols are specified as name:value pairs. +You can also override one or more symbols using the SYMBOLS and +ROGUESYMBOLS configuration file options. +Symbols are specified as name:value pairs. Note that NetHack escape-processes the value string in conventional C fashion. This means that \\ is a prefix to take the following character literally. @@ -4382,16 +4430,23 @@ The special prefix form \\m switches on the meta bit in the symbol value, and the \(ha prefix causes the following character to be treated as a control character. .pg +.\" Table is centered. +.\" First line (title) is left justified and spans second and third columns; +.\" it used to be centered but tended to look as if too far to the right. +.\" Remaining lines are left justified in each of three columns. First +.\" line (second overall) contains column labels; the first column has a +.\" dummy label of two spaces. (That used to be "Default" but it made all +.\" the lines wider because of the label's width and caused several lines +.\" to be too wide when generating plain text output. Two spaces leaves +.\" some room between the symbol character and name.) Entries in first +.\" column now use constant-width Roman font to approximate TeX tt font. .TS S center; -c s s -c1 l1 l. +l s s +l1fCR l1 l. .\"TABLE_START -.\" because description is wide, centered title seems off, so pad it a bit -.\" note that each backslash precedes one space of padding (including the -.\" last one; in other words, there's a trailing space here) -NetHack Symbols\ \ \ \ \ \ \ -Default Symbol Name Description +NetHack Symbols +\ \ Symbol Name Description \_ \_ \_ \ S_air (air) \&_ S_altar (altar) @@ -4518,7 +4573,8 @@ s S_spider (arachnid or centipede) @ S_ss3 (magic shield 3 of 4) * S_ss4 (magic shield 4 of 4) \(ha S_statue_trap (statue trap) -\ S_stone (dark part of a room) +\ S_stone (solid rock or unexplored terrain +\ \ \ or dark part of a room) ] S_strange_obj (strange object) \- S_sw_bc (swallow bottom center) \\ S_sw_bl (swallow bottom left) @@ -4562,13 +4618,30 @@ v S_vortex (vortex) w S_worm (worm) \(ti S_worm_tail (long worm tail) W S_wraith (wraith) -x S_xan (xan or other mythical/fantastic insect) +x S_xan (xan or other extraordinary insect) X S_xorn (xorn) Y S_yeti (apelike creature) Z S_zombie (zombie) z S_zruty (zruty) +\ S_pet_override (any pet if ACCESSIBILITY=1 is set) +\ S_hero_override (hero if ACCESSIBILITY=1 is set) .\"TABLE_END Do not delete this line. .TE +.\" don't hyphenate file name across lines +.hw sysconf +.pg +.lp "Notes:" +.lp "*" +Several symbols in this table appear to be blank. +They are the space character, except for S_pet_override +and S_hero_override which don't have any default value +and can only be used if enabled in the \(lqsysconf\(rq file. +.lp "*" +S_rock is misleadingly named; rocks and stones use S_gem. +Statues and boulders are the rock being referred to, but since +version 3.6.0, statues are displayed as the monster they depict. +So S_rock is only used for boulders and not used at all if +overridden by the more specific S_boulder. .pg .hn 2 Configuring NetHack for Play by the Blind @@ -4609,8 +4682,14 @@ configuration file will cause the game to run in a manner accessible to the blind. After you have gained some experience with the game and with editing files, you may want to alter settings via \fBSYMBOLS=\fP +and \fBROGUESYMBOLS=\fP in your configuration file to better suit your preferences. -The most crucial settings to make the game accessible are: +See the previous section for the special symbols S_pet_override +to force a consistent symbol for all pets and +S_hero_override to force a unique symbol for the player character +if \fBaccessibility\fP is enabled in the sysconf file. +.pg +The most crucial settings to make the game more accessible are: .pg .lp symset:NHAccess Load a symbol set appropriate for use by blind players. @@ -4644,7 +4723,7 @@ of moving 8 units at a time. .lp nostatus_updates Prevent updates to the status lines at the bottom of the screen, if your screen-reader reads those lines. The same information can be -seen via the #attributes command. +seen via the \(lq#attributes\(rq command. .hn 2 Global Configuration for System Administrators .pg @@ -4721,6 +4800,13 @@ to identify unique people for the score file. MAX_STATUENAME_RANK\ =\ Maximum number of score file entries to use for random statue names (default is 10). .lp +ACCESSIBILITY\ =\ 0 or 1 to disable or enable, respectively, the ability for players +to set S_pet_override and S_hero_override symbols in their configuration file. +.lp +PORTABLE_DEVICE_PATHS\ =\ 0 or 1 Windows OS only, the game will look +for all of its external files, and write to all of its output files in one place +rather than at the standard locations. +.lp DUMPLOGFILE\ =\ A filename where the end-of-game dumplog is saved. Not defining this will prevent dumplog from being created. Only available if your game is compiled with DUMPLOG. Allows the following placeholders: @@ -4730,7 +4816,7 @@ if your game is compiled with DUMPLOG. Allows the following placeholders: .PL %% literal \(oq\f(CR%\fP\(cq .PL %v -version (eg. \(lq\f(CR3.6.2\-0\fP\(rq) +version (eg. \(lq\f(CR3.6.3\-0\fP\(rq) .PL %u game UID .PL %t @@ -4893,7 +4979,7 @@ and \fBPaul Winner\fP, ported NetHack 3.1 to the PC. \fBMike Engber\fP, \fBDavid Hairston\fP, \fBMichael Hamel\fP, \fBJonathan Handler\fP, \fBJohnny Lee\fP, \fBTim Lennan\fP, \fBRob Menke\fP, and \fBAndy Swanson\fP, developed NetHack 3.1 for the Macintosh, -porting it for MPW. Building on their development, \fBBarton House\fP +porting it for MPW. Building on their development, \fBBart House\fP added a Think C port. .pg \fBTimo Hakulinen\fP ported NetHack 3.1 to OS/2. \fBEric Smith\fP @@ -5052,7 +5138,7 @@ flavors and maintained the X11 interface. \fBKen Lorber\fP, \fBHaoyang Wang\fP, \fBPat Rankin\fP, and \fBDean Luick\fP maintained the port of NetHack 3.6 for Mac OSX. .pg -\fBMichael Allison\fP, \fBDavid Cohrs\fP, \fBBarton House\fP, +\fBMichael Allison\fP, \fBDavid Cohrs\fP, \fBBart House\fP, \fBPasi Kallinen\fP, \fBAlex Kompel\fP, \fBDion Nicolaas\fP, \fBDerek S. Ray\fP and \fBYitzhak Sapir\fP maintained the port of NetHack 3.6 for Microsoft Windows. @@ -5074,12 +5160,21 @@ The NetHack Development Team at the time of release of 3.6.1 consisted of \fBPat Rankin\fP, \fBDerek S. Ray\fP, \fBAlex Smith\fP, \fBMike Stephenson\fP, \fBJanet Walz\fP, and \fBPaul Winner\fP. .pg -In early May 2019, another 320 bug fixes along with some enhancements and +In early May 2019, another 320 bug fixes along with some enhancements and the adopted curses window port, were released as 3.6.2. .pg +\fBBart House\fP, who had contributed to the game as a porting team +participant for decades, joined the NetHack Development Team in late May 2019. +.pg +NetHack 3.6.3 was released on December 5, 2019 containing over 190 bug +fixes to NetHack 3.6.2. +.pg +NetHack 3.6.4 was released on December 18, 2019 containing a security fix +and a few bug fixes. +.pg The official NetHack web site is maintained by \fBKen Lorber\fP at -.UR http://www.nethack.org/ . +.UR https://www.nethack.org/ . .pg .hn 2 SPECIAL THANKS @@ -5089,7 +5184,7 @@ again to \fBM. Drew Streib\fP and \fBPasi Kallinen\fP for providing a public NetHack server at nethack.alt.org. Thanks to \fBKeith Simpson\fP and \fBAndy Thomson\fP for hardfought.org. Thanks to all those unnamed dungeoneers who invest their time and effort into annual -NetHack tournaments such as Junethack, The November NetHack Tournament +NetHack tournaments such as Junethack, The November NetHack Tournament and in days past, devnull.net (gone for now, but not forgotten). .pg .ce @@ -5103,49 +5198,50 @@ miscreants in this, the list of Dungeoneers: . .TS S center; -c c c. +c2 c2 c. .\"TABLE_START -Adam Aronow Janet Walz Nathan Eady -Alex Kompel Janne Salmijarvi Norm Meluch -Alex Smith Jean-Christophe Collet Olaf Seibert -Andreas Dorn Jeff Bailey Pasi Kallinen -Andy Church Jochen Erwied Pat Rankin -Andy Swanson John Kallen Patric Mueller +Adam Aronow J. Ali Harlow Mikko Juola +Alex Kompel Janet Walz Nathan Eady +Alex Smith Janne Salmijarvi Norm Meluch +Andreas Dorn Jean-Christophe Collet Olaf Seibert +Andy Church Jeff Bailey Pasi Kallinen +Andy Swanson Jochen Erwied Pat Rankin +Andy Thomson John Kallen Patric Mueller Ari Huttunen John Rupley Paul Winner -Barton House John S. Bien Pierre Martineau +Bart House John S. Bien Pierre Martineau Benson I. Margulies Johnny Lee Ralf Brown Bill Dyer Jon W{tte Ray Chason Boudewijn Waijers Jonathan Handler Richard Addison Bruce Cox Joshua Delahunty Richard Beigel Bruce Holloway Karl Garrison Richard P. Hughey Bruce Mewborne Keizo Yamamoto Rob Menke -Carl Schelin Ken Arnold Robin Bandy -Chris Russo Ken Arromdee Robin Johnson -David Cohrs Ken Lorber Roderick Schertler -David Damerell Ken Washikita Roland McGrath -David Gentzel Kevin Darcy Ron Van Iwaarden -David Hairston Kevin Hugo Ronnen Miller -Dean Luick Kevin Sitze Ross Brown -Del Lamb Kevin Smolkowski Sascha Wostmann -Derek S. Ray Kevin Sweet Scott Bigham -Deron Meranda Lars Huttar Scott R. Turner -Dion Nicolaas Leon Arnott Sean Hunt -Dylan O'Donnell M. Drew Streib Stephen Spackman -Eric Backus Malcolm Ryan Stefan Thielscher -Eric Hendrickson Mark Gooderum Stephen White -Eric R. Smith Mark Modrall Steve Creps -Eric S. Raymond Marvin Bressler Steve Linhart -Erik Andersen Matthew Day Steve VanDevender -Frederick Roeber Merlyn LeRoy Teemu Suikki -Gil Neiger Michael Allison Tim Lennan -Greg Laskin Michael Feir Timo Hakulinen -Greg Olson Michael Hamel Tom Almy -Gregg Wonderly Michael Sokolov Tom West -Hao-yang Wang Mike Engber Warren Cheung -Helge Hafting Mike Gallop Warwick Allison -Irina Rempt-Drijfhout Mike Passaretti Yitzhak Sapir +Carl Schelin Keith Simpson Robin Bandy +Chris Russo Ken Arnold Robin Johnson +David Cohrs Ken Arromdee Roderick Schertler +David Damerell Ken Lorber Roland McGrath +David Gentzel Ken Washikita Ron Van Iwaarden +David Hairston Kevin Darcy Ronnen Miller +Dean Luick Kevin Hugo Ross Brown +Del Lamb Kevin Sitze Sascha Wostmann +Derek S. Ray Kevin Smolkowski Scott Bigham +Deron Meranda Kevin Sweet Scott R. Turner +Dion Nicolaas Lars Huttar Sean Hunt +Dylan O'Donnell Leon Arnott Stephen Spackman +Eric Backus M. Drew Streib Stefan Thielscher +Eric Hendrickson Malcolm Ryan Stephen White +Eric R. Smith Mark Gooderum Steve Creps +Eric S. Raymond Mark Modrall Steve Linhart +Erik Andersen Marvin Bressler Steve VanDevender +Fredrik Ljungdahl Matthew Day Teemu Suikki +Frederick Roeber Merlyn LeRoy Tim Lennan +Gil Neiger Michael Allison Timo Hakulinen +Greg Laskin Michael Feir Tom Almy +Greg Olson Michael Hamel Tom West +Gregg Wonderly Michael Sokolov Warren Cheung +Hao-yang Wang Mike Engber Warwick Allison +Helge Hafting Mike Gallop Yitzhak Sapir +Irina Rempt-Drijfhout Mike Passaretti Izchak Miller Mike Stephenson -J. Ali Harlow Mikko Juola .\"TABLE_END Do not delete this line. .TE .pg @@ -5155,3 +5251,4 @@ J. Ali Harlow Mikko Juola .\"Amiga is a trademark of Commodore-Amiga, Inc .sm "Brand and product names are trademarks or registered trademarks \ of their respective holders." +.\"EOF diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index d5deecd4e..4e36344af 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -45,7 +45,7 @@ %.au \author{Original version - Eric S. Raymond\\ (Edited and expanded for 3.6 by Mike Stephenson and others)} -\date{October 1, 2019} +\date{December 18, 2019} \maketitle @@ -796,7 +796,14 @@ Eat food.\\ Normally checks for edible item(s) on the floor, then if none are found or none are chosen, checks for edible item(s) in inventory. Precede `{\tt e}' with the `{\tt m}' prefix to bypass attempting to eat -anything off the floor. +anything off the floor.\\ +%.lp "" +If you attempt to eat while already satiated, you might choke to death. +If you risk it, you will be asked whether +to ``continue eating?'' {\it if you survive the first bite\/}. +You can set the +{\it paranoid\verb+_+confirmation:eating\/} +option to require a response of ``{\tt yes}'' instead of just `{\tt y}'. %.lp % Make sure Elbereth is not hyphenated below, the exact spelling matters. % (Only specified here to parallel Guidebook.mn; use of \tt font implicity @@ -1130,7 +1137,7 @@ slot to another so that it has a letter which is more meaningful for you or that it will appear in a particular location when inventory listings are displayed. You can move to a currently empty slot, or if the destination is -occupied--and won't merge--the item there will swap slots with the one +occupied---and won't merge---the item there will swap slots with the one being moved. ``{\tt \#adjust}'' can also be used to split a stack of objects; when choosing the item to adjust, enter a count prior to its letter.\\ @@ -1333,7 +1340,7 @@ Autocompletes. Debug mode only.\\ %.lp "" Asks for confirmation; default is `{\tt n}' (no); continue playing. -To really panic, respond with `{\tt y}''. +To really panic, respond with `{\tt y}'. You can set the {\it paranoid\verb+_+confirmation:quit\/} option to require a response of ``{\tt yes}'' instead. @@ -2044,9 +2051,9 @@ will result in it disappearing from your map, similarly if it is the one who moved rather than you. %.pg -However, if you encounter a monster which you can't see or sense-- -perhaps it is invisible and has just tapped you on the noggin-- -a special ``remembered, unseen monster'' marker will be displayed at +However, if you encounter a monster which you can't see or +sense---perhaps it is invisible and has just tapped you on the +noggin---a special ``remembered, unseen monster'' marker will be displayed at the location where you think it is. That will persist until you have proven that there is no monster there, even if the unseen monster @@ -2326,7 +2333,7 @@ But first you need to have a weapon in each hand. (Note that your two weapons are not fully equal; the one in the hand you normally wield with is considered primary and the other one is considered secondary. The most noticeable difference is -after you stop--or before you begin, for that matter--wielding +after you stop---or before you begin, for that matter---wielding two weapons at once. The primary is your wielded weapon and the secondary is just an item in your inventory that's been designated as alternate weapon.) @@ -2558,7 +2565,7 @@ The commands to use rings are `{\tt P}' (put on) and `{\tt R}' (remove). %.pg Spellbooks are tomes of mighty magic. When studied with the `{\tt r}' (read) command, they transfer to the reader the knowledge of a spell (and -therefore eventually become unreadable) --- unless the attempt backfires. +therefore eventually become unreadable)---unless the attempt backfires. Reading a cursed spellbook or one with mystic runes beyond your ken can be harmful to your health! @@ -2701,9 +2708,9 @@ you are carrying (shopkeepers aside). Normally, if you have seen an object at a particular map location and move to another location where you can't directly see that object any more, if will continue to be displayed on your map. -That remains the case even if it is not actually there any more-- -perhaps a monster has picked it up or it has rotted away-- -until you can see or feel that location again. +That remains the case even if it is not actually there any +more---perhaps a monster has picked it up or it has rotted +away---until you can see or feel that location again. One notable exception is that if the object gets covered by the ``remembered, unseen monster'' marker. When that marker is later removed @@ -2866,19 +2873,32 @@ for system administrators. \subsection*{Using a configuration file} %.pg -The default name of the configuration file varies on different -operating systems. On MS-DOS and Windows, it is \mbox{``defaults.nh''} in -the same folder as \mbox{{\it nethack.exe\/}} or \mbox{{\it nethackW.exe\/}}. +The default name and location of the configuration file varies on different +operating systems.\\ + +%.lp "" On Unix, Linux and Mac OS X it is \mbox{``.nethackrc''} in the user's home directory. The file may not exist, but it is a normal ASCII text file and -can be created with any text editor. +can be created with any text editor.\\ -%.pg +%.lp "" +On Windows, it is \mbox{``.nethackrc''} in the folder +\mbox{{``\%USERPROFILE\%\textbackslash NetHack\textbackslash 3.6''}}. The +file may not exist, but it is a normal ASCII text file and can be created +with any text editor. +After runing {\it NetHack\/} for the first time, you should find a default +template for ths configuration file named \mbox{``.nethackrc.template''} in +\mbox{{``\%USERPROFILE\%\textbackslash NetHack\textbackslash 3.6''}}. +If you had not created the configuration file, {\it NetHack\/} will create +the configuration file for you using the default template file. + +%.lp "" +On MS-DOS it is \mbox{``defaults.nh''} in the same folder as +\mbox{{\it nethack.exe\/}}.\\ + +%.lp "" Any line in the configuration file starting with `{\tt \#}' is treated as a comment. -Empty lines are ignored. - -%.pg -Any line beginning with `{\tt [}' and ending in `{\tt ]}' is considered a section +Empty lines are ignored. Any line beginning with `{\tt [}' and ending in `{\tt ]}' is considered a section marker. The text between the square brackets is the section name. Lines after a section marker belong to that section, and are ignored unless a CHOOSE -statement was used to select that section. @@ -2886,9 +2906,13 @@ Section names are case insensitive. %.pg You can use different configuration statements in the file, some -of which can be used multiple times. In general, the statements are +of which can be used multiple times. +In general, the statements are written in capital letters, followed by an equals sign, followed by -settings particular to that statement. Here is a list of allowed statements: +settings particular to that statement. + +%.pg +Here is a list of allowed statements: %.lp \blist{} @@ -2903,7 +2927,7 @@ You can specify multiple OPTIONS statements, and multiple options separated by commas in a single OPTIONS statement. (Comma separated options are processed from right to left.) -%.pg +%.lp "" Example: %.sd \begin{verbatim} @@ -2937,6 +2961,9 @@ HACKDIR, must be writable. \item[\bb{TROUBLEDIR}] The location that a record of game aborts and self-diagnosed game problems is kept. Defaults to HACKDIR, must be writable. +% +% config file entries beyond this point are shown alphabetically +% %.lp \item[\bb{AUTOCOMPLETE}] Enable or disable an extended command autocompletion. @@ -2946,11 +2973,11 @@ autocompletion, list the extended command. Prefix the command with ``{{\tt !}}'' to disable the autocompletion for that command. -%.pg +%.lp "" Example: %.sd \begin{verbatim} - AUTOCOMPLETE=zap,!annotate + AUTOCOMPLETE=zap,!annotate \end{verbatim} %.ed @@ -2965,7 +2992,7 @@ extended commands. You can specify multiple bindings. Format is key followed by the command, separated by a colon. See the ``Changing Key Bindings`` section for more information. -%.pg +%.lp "" Example: %.sd \begin{verbatim} @@ -2978,7 +3005,7 @@ Example: Chooses at random one of the comma-separated parameters as an active section name. Lines in other sections are ignored. -%.pg +%.lp "" Example: %.sd \begin{verbatim} @@ -2991,23 +3018,39 @@ Example: \end{verbatim} %.ed -%.lp -\item[\bb{MSGTYPE}] -Change the way messages are shown in the top status line. -See the ``Configuring Message Types`` section. %.lp \item[\bb{MENUCOLOR}] Highlight menu lines with different colors. See the ``Configuring Menu Colors`` section. %.lp +\item[\bb{MSGTYPE}] +Change the way messages are shown in the top status line. +See the ``Configuring Message Types`` section. +%.lp +\item[\bb{ROGUESYMBOLS}] +Custom symbols for for the rogue level's symbol set. +See {\it SYMBOLS} below. +%.lp +\item[\bb{SOUND}] +Define a sound mapping. +See the ``Configuring User Sounds'' section. +%.lp +\item[\bb{SOUNDDIR}] +Define the directory that contains the sound files. +See the ``Configuring User Sounds'' section. +%.lp \item[\bb{SYMBOLS}] -Override one or more symbols in the symbols files. +Override one or more symbols in the symbol set used for all dungeon +levels except for the special rogue level. See the ``Modifying {\it NetHack\/} Symbols'' section. %.pg + +%.lp "" Example: %.sd \begin{verbatim} - SYMBOLS=S_boulder:0 + # replace small punctuation (tick marks) with digits + SYMBOLS=S_boulder:0,S_golem:7 \end{verbatim} %.ed @@ -3017,24 +3060,19 @@ Debug mode only: extra items to add to initial inventory. Value is the name of a text file containing a list of item names, one per line, up to a maximum of 128 lines. Each line is processed by the function that handles wishing. -%.pg + +%.lp "" Example: %.sd \begin{verbatim} - WIZKIT=~/wizkit.txt + WIZKIT=~/wizkit.txt \end{verbatim} %.ed -%.lp -\item[\bb{SOUNDDIR}] -Define the directory that contains the sound files. -See the ``Configuring User Sounds'' section. -%.lp -\item[\bb{SOUND}] -Define a sound mapping. See the ``Configuring User Sounds'' section. \elist +%.lp "" %.pg -Here is a short example of config file contents: +Here is an example of configuration file contents: %.sd \begin{verbatim} # Set your character's role, race, gender, and alignment. @@ -3042,10 +3080,13 @@ Here is a short example of config file contents: # Turn on autopickup, set automatically picked up object types OPTIONS=autopickup,pickup_types:$"=/!?+ - # Show colored text if possible - OPTIONS=color - # Show lit corridors differently - OPTIONS=lit_corridor + + # Map customization + OPTIONS=color # Display things in color if possible + OPTIONS=lit_corridor # Show lit corridors differently + OPTIONS=hilite_pet,hilite_pile + # Replace small punctuation (tick marks) with digits + SYMBOLS=S_boulder:0,S_golem:7 # No startup splash screen. Windows GUI only. OPTIONS=!splash_screen @@ -3487,7 +3528,7 @@ Valid settings are: %.sd %.si {\tt 0} --- disabled\\ -{\tt 1} --- enabled and make OS adjustment to support mouse use in the game\\ +{\tt 1} --- enabled and make OS adjustment to support mouse use\\ {\tt 2} --- enabled like {\tt 1}, but does not make any OS adjustments\\ %.ei %.ed @@ -3606,6 +3647,9 @@ a peaceful monster; \item[{\tt wand-break}] require ``{\tt yes}'' rather than `{\tt y}' to confirm breaking a wand; +\item[{\tt eating}] +require ``{\tt yes}'' rather than `{\tt y}' to confirm whether to +continue eating; \item[{\tt Were-change}] require ``{\tt yes}'' rather than `{\tt y}' to confirm changing form due to lycanthropy @@ -3966,7 +4010,7 @@ windowtype that you have chosen. Character strings that are too long may be truncated. Not all window ports will adjust for all settings listed here. You can safely add any of these options to your -config file, and if the window port is capable of adjusting +configuration file, and if the window port is capable of adjusting to suit your preferences, it will attempt to do so. If it can't it will silently ignore it. You can find out if an option is supported by the window port that you are currently @@ -4078,7 +4122,7 @@ Number of lines for traditional below-the-map status display. Acceptable values are 2 and 3 (default is 2). Curses and tty interfaces only. %.lp -\item[\ib{term\verb+_+cols}\ \ {\it and}]" +\item[\ib{term\verb+_+cols} {\normalfont and}] %.lp \item[\ib{term\verb+_+rows}] Curses interface only. @@ -4219,7 +4263,8 @@ returns to {\it NetHack\/} to help compensate for international keyboard issues. OPTIONS=subkeyvalue:171/92 will return 92 to {\it NetHack\/}, if 171 was originally going to be returned. -You can use multiple subkeyvalue statements in the config file if needed. +You can use multiple subkeyvalue statements in the configuration file +if needed. Cannot be set with the `{\tt O}' command. %.lp \item[\ib{video}] @@ -4289,13 +4334,14 @@ character in the pattern, specifically: %.ei %.ed -The {\it autopickup\verb+_+exception\/} rules are processed in the order -in which they appear in your config file, thus allowing a later rule to override -an earlier rule. +The {\it autopickup\verb+_+exception\/} rules are processed in the order +in which they appear in your configuration file, thus allowing a +later rule to override an earlier rule. %.lp "" -Exceptions can be set with the `{\tt O}' command, but because they are not included -in your config file, they won't be in effect if you save and then restore your game. +Exceptions can be set with the `{\tt O}' command, but because they are not +included in your configuration file, they won't be in effect if you save +and then restore your game. {\it autopickup\verb+_+exception\/} rules are not saved with the game. \elist @@ -4344,8 +4390,9 @@ the ``{\tt }'', ``{\tt }'', and ``{\tt }'' keys. %.lp "Menu accelerator keys" \item[\tb{Menu accelerator keys}] -The menu control or accelerator keys can also be rebound via OPTIONS-lines -in the config file. You cannot bind object symbols into menu accelerators. +The menu control or accelerator keys can also be rebound via OPTIONS lines +in the configuration file. +You cannot bind object symbols into menu accelerators. %.lp "Special command keys" \item[\tb{Special command keys}] @@ -4353,157 +4400,157 @@ Below are the special commands you can rebind. Some of them can be bound to same keys with no problems, others are in the same ``context'', and if bound to same keys, only one of those commands will be available. Special command can only be bound to a single key. +\elist %.pg -\blist{} +\blist{\itemindent 10mm \labelwidth 15mm \rightmargin 15mm} %.lp -\item{\bb{count}} +\item[{\bb{count}}] Prefix key to start a count, to repeat a command this many times. -With {\it number\verb+_+pad\/} only. Default is `{\tt n}'. +With {\it number\verb+_+pad\/} only. Default is~`{\tt n}'. %.lp -\item{\bb{doinv}} -Show inventory. With {\it number\verb+_+pad\/} only. Default is `{\tt 0}'. +\item[{\bb{doinv}}] +Show inventory. With {\it number\verb+_+pad\/} only. Default is~`{\tt 0}'. %.lp -\item{\bb{fight}} -Prefix key to force fight a direction. Default is `{\tt F}'. +\item[{\bb{fight}}] +Prefix key to force fight a direction. Default is~`{\tt F}'. %.lp -\item{\bb{fight.numpad}} +\item[{\bb{fight.numpad}}] Prefix key to force fight a direction. With {\it number\verb+_+pad\/} only. -Default is `{\tt -}'. +Default is~`{\tt -}'. %.lp -\item{\bb{getdir.help}} -When asked for a direction, the key to show the help. Default is `{\tt ?}'. +\item[{\bb{getdir.help}}] +When asked for a direction, the key to show the help. Default is~`{\tt ?}'. %.lp -\item{\bb{getdir.self}} -When asked for a direction, the key to target yourself. Default is `{\tt .}'. +\item[{\bb{getdir.self}}] +When asked for a direction, the key to target yourself. Default is~`{\tt .}'. %.lp -\item{\bb{getdir.self2}} -When asked for a direction, the key to target yourself. Default is `{\tt s}'. +\item[{\bb{getdir.self2}}] +When asked for a direction, the key to target yourself. Default is~`{\tt s}'. %.lp -\item{\bb{getpos.autodescribe}} +\item[{\bb{getpos.autodescribe}}] When asked for a location, the key to toggle {\it autodescribe\/}. -Default is `{\tt \#}'. +Default is~`{\tt \#}'. %.lp -\item{\bb{getpos.all.next}} +\item[{\bb{getpos.all.next}}] When asked for a location, the key to go to next closest interesting thing. -Default is `{\tt a}'. +Default is~`{\tt a}'. %.lp -\item{\bb{getpos.all.prev}} +\item[{\bb{getpos.all.prev}}] When asked for a location, the key to go to previous closest interesting thing. -Default is `{\tt A}'. +Default is~`{\tt A}'. %.lp -\item{\bb{getpos.door.next}} +\item[{\bb{getpos.door.next}}] When asked for a location, the key to go to next closest door or doorway. -Default is `{\tt d}'. +Default is~`{\tt d}'. %.lp -\item{\bb{getpos.door.prev}} +\item[{\bb{getpos.door.prev}}] When asked for a location, the key to go to previous closest door or doorway. -Default is `{\tt D}'. +Default is~`{\tt D}'. %.lp -\item{\bb{getpos.help}} -When asked for a location, the key to show help. Default is `{\tt ?}'. +\item[{\bb{getpos.help}}] +When asked for a location, the key to show help. Default is~`{\tt ?}'. %.lp -\item{\bb{getpos.mon.next}} +\item[{\bb{getpos.mon.next}}] When asked for a location, the key to go to next closest monster. -Default is `{\tt m}'. +Default is~`{\tt m}'. %.lp -\item{\bb{getpos.mon.prev}} +\item[{\bb{getpos.mon.prev}}] When asked for a location, the key to go to previous closest monster. -Default is `{\tt M}'. +Default is~`{\tt M}'. %.lp -\item{\bb{getpos.obj.next}} +\item[{\bb{getpos.obj.next}}] When asked for a location, the key to go to next closest object. -Default is `{\tt o}'. +Default is~`{\tt o}'. %.lp -\item{\bb{getpos.obj.prev}} +\item[{\bb{getpos.obj.prev}}] When asked for a location, the key to go to previous closest object. -Default is `{\tt O}'. +Default is~`{\tt O}'. %.lp -\item{\bb{getpos.menu}} +\item[{\bb{getpos.menu}}] When asked for a location, and using one of the next or previous keys to -cycle through targets, toggle showing a menu instead. Default is `{\tt !}'. +cycle through targets, toggle showing a menu instead. Default is~`{\tt !}'. %.lp -\item{\bb{getpos.moveskip}} +\item[{\bb{getpos.moveskip}}] When asked for a location, and using the shifted movement keys or meta-digit keys to fast-move around, move by skipping the same glyphs instead of by 8 units. -Default is `{\tt *}'. +Default is~`{\tt *}'. %.lp -\item{\bb{getpos.filter}} +\item[{\bb{getpos.filter}}] When asked for a location, change the filtering mode when using one of the next or previous keys to cycle through targets. Toggles between no -filtering, in view only, and in the same area only. Default is `{\tt "}'. +filtering, in view only, and in the same area only. Default is~`{\tt "}'. %.lp -\item{\bb{getpos.pick}} +\item[{\bb{getpos.pick}}] When asked for a location, the key to choose the location, and possibly -ask for more info. Default is `{\tt .}'. +ask for more info. Default is~`{\tt .}'. %.lp -\item{\bb{getpos.pick.once}} +\item[{\bb{getpos.pick.once}}] When asked for a location, the key to choose the location, and skip -asking for more info. Default is `{\tt ,}'. +asking for more info. Default is~`{\tt ,}'. %.lp -\item{\bb{getpos.pick.quick}} +\item[{\bb{getpos.pick.quick}}] When asked for a location, the key to choose the location, skip asking -for more info, and exit the location asking loop. Default is `{\tt ;}'. +for more info, and exit the location asking loop. Default is~`{\tt ;}'. %.lp -\item{\bb{getpos.pick.verbose}} +\item[{\bb{getpos.pick.verbose}}] When asked for a location, the key to choose the location, and show more -info without asking. Default is `{\tt :}'. +info without asking. Default is~`{\tt :}'. %.lp -\item{\bb{getpos.self}} +\item[{\bb{getpos.self}}] When asked for a location, the key to go to your location. -Default is `{\tt @}'. +Default is~`{\tt @}'. %.lp -\item{\bb{getpos.unexplored.next}} +\item[{\bb{getpos.unexplored.next}}] When asked for a location, the key to go to next closest unexplored location. -Default is `{\tt x}'. +Default is~`{\tt x}'. %.lp -\item{\bb{getpos.unexplored.prev}} +\item[{\bb{getpos.unexplored.prev}}] When asked for a location, the key to go to previous closest unexplored -location. Default is `{\tt X}'. +location. Default is~`{\tt X}'. %.lp -\item{\bb{getpos.valid}} +\item[{\bb{getpos.valid}}] When asked for a location, the key to go to show valid target locations. -Default is `{\tt \$}'. +Default is~`{\tt \$}'. %.lp -\item{\bb{getpos.valid.next}} +\item[{\bb{getpos.valid.next}}] When asked for a location, the key to go to next closest valid location. -Default is `{\tt z}'. +Default is~`{\tt z}'. %.lp -\item{\bb{getpos.valid.prev}} +\item[{\bb{getpos.valid.prev}}] When asked for a location, the key to go to previous closest valid location. -Default is `{\tt Z}'. +Default is~`{\tt Z}'. %.lp -\item{\bb{nopickup}} -Prefix key to move without picking up items. Default is `{\tt m}'. +\item[{\bb{nopickup}}] +Prefix key to move without picking up items. Default is~`{\tt m}'. %.lp -\item{\bb{redraw}} -Key to redraw the screen. Default is `{\tt \^{}R}'. +\item[{\bb{redraw}}] +Key to redraw the screen. Default is~`{\tt \^{}R}'. %.lp -\item{\bb{redraw.numpad}} +\item[{\bb{redraw.numpad}}] Key to redraw the screen. With {\it number\verb+_+pad\/} only. -Default is `{\tt \^{}L}'. +Default is~`{\tt \^{}L}'. %.lp -\item{\bb{repeat}} -Key to repeat previous command. Default is `{\tt \^{}A}'. +\item[{\bb{repeat}}] +Key to repeat previous command. Default is~`{\tt \^{}A}'. %.lp -\item{\bb{reqmenu}} -Prefix key to request menu from some commands. Default is `{\tt m}'. +\item[{\bb{reqmenu}}] +Prefix key to request menu from some commands. Default is~`{\tt m}'. %.lp -\item{\bb{run}} -Prefix key to run towards a direction. Default is `{\tt G}'. +\item[{\bb{run}}] +Prefix key to run towards a direction. Default is~`{\tt G}'. %.lp -\item{\bb{run.nopickup}} +\item[{\bb{run.nopickup}}] Prefix key to run towards a direction without picking up items on the way. -Default is `{\tt M}'. +Default is~`{\tt M}'. %.lp -\item{\bb{run.numpad}} +\item[{\bb{run.numpad}}] Prefix key to run towards a direction. With {\it number\verb+_+pad\/} only. -Default is `{\tt 5}'. +Default is~`{\tt 5}'. %.lp -\item{\bb{rush}} -Prefix key to rush towards a direction. Default is `{\tt g}'. -\elist +\item[{\bb{rush}}] +Prefix key to rush towards a direction. Default is~`{\tt g}'. \elist @@ -4515,7 +4562,7 @@ You can change the way the messages are shown in the message area, when the message matches a user-defined pattern. %.pg -In general, the config file entries to configure the message types +In general, the configuration file entries to describe the message types look like this: \begin{verbatim} MSGTYPE=type "pattern" @@ -4553,7 +4600,7 @@ the user is prompted with more-prompt, and a message matching ``You displaced \verb+<+something\verb+>+'' is not shown at all. %.lp -The order of the defined MSGTYPE-lines is important; the last matching +The order of the defined MSGTYPE lines is important; the last matching rule is used. Put the general case first, exceptions below them. %.pg @@ -4564,11 +4611,12 @@ rule is used. Put the general case first, exceptions below them. %.pg Some platforms allow you to define colors used in menu lines when the -line matches a user-defined pattern. At this time the tty, win32tty and -win32gui support this. +line matches a user-defined pattern. +At this time the tty, curses, win32tty and +win32gui interfaces support this. %.pg -In general, the config file entries to configure the menu color mappings +In general, the configuration file entries to describe the menu color mappings look like this: \begin{verbatim} MENUCOLOR="pattern"=color&attribute @@ -4620,8 +4668,8 @@ specifies that any menu line with ``~blessed~'' contained in it will be shown in green color, lines with ``~cursed~'' will be shown in red, and lines with ``~cursed~'' followed by ``(being worn)'' on the same line will be shown in red color and underlined. -You can have multiple MENUCOLOR entries in your config file, -and the last MENUCOLOR-line in your config file that matches +You can have multiple MENUCOLOR entries in your configuration file, +and the last MENUCOLOR line that matches a menu line will be used for the line. %.pg @@ -4642,7 +4690,7 @@ At this time the Qt port and the win32tty and win32gui ports support the use of user sounds. %.pg -The following config file entries are relevant to mapping user sounds +The following configuration file entries are relevant to mapping user sounds to messages: \blist{} @@ -4708,6 +4756,8 @@ combination with any of the other attributes. To specify both a color and an attribute, use `\&' to combine them. To specify multiple attributes, use `+' to combine those. + +%.lp "" For example: {\tt magenta\&inverse+dim}. Note that the display may substitute or ignore particular attributes @@ -4760,23 +4810,19 @@ percentage or absolute number threshold, or text to match against. \blist{} %.lp "*" -\item{\bb{}} -``{\tt always}'' will set the default attributes for that field. +\item[{\tt always}] will set the default attributes for that field. %.lp "*" -\item{\bb{}} -``{\tt up}'' and ``{\tt down}'' set the field attributes for when the field -value changes upwards or downwards. This attribute times out after -{\tt statushilites} turns. +\item[{\tt up}{\normalfont, }{\tt down}] set the field attributes +for when the field value changes upwards or downwards. This attribute +times out after {\tt statushilites} turns. %.lp "*" -\item{\bb{}} -``{\tt changed}'' sets the field attribute for when the field value +\item[{\tt changed}] sets the field attribute for when the field value changes. This attribute times out after {\tt statushilites} turns. (If a field has both a ``changed'' rule and an ``up'' or ``down'' rule which matches a change in the field's value, the ``up'' or ``down'' one takes precedence.) %.lp "*" -\item{\bb{}} -percentage sets the field attribute when the field value +\item[{\tt percentage}] sets the field attribute when the field value matches the percentage. It is specified as a number between 0 and 100, followed by `{\tt \%}' (percent sign). @@ -4790,7 +4836,7 @@ Percentages for ``{\it hitpoints\/}'' and ``{\it power\/}'' are straightforward; they're based on the corresponding maximum field. Percentage highlight rules are also allowed for ``{\it experience level\/}'' and ``{\it experience points\/}'' (valid when the -(\it showexp\/} +{\it showexp\/} option is enabled). For those, the percentage is based on the progress from the start of the current experience level to the start of the next level. @@ -4804,8 +4850,7 @@ exactly 1 experience point short of the next level. % percentage will remain at 0\% no matter have many additional experience % points you earn.) %.lp "*" -\item{\bb{}} -absolute value sets the attribute when the field value +\item[{\tt absolute}] value sets the attribute when the field value matches that number. The number must be 0 or higher, except for ``{\it armor-class\/} which allows negative values, and may optionally be preceded by `{\tt =}'. @@ -4814,8 +4859,7 @@ it also matches when value is below or above. If the prefix is `{\tt <}' or `{\tt >}', only match when strictly above or below. %.lp "*" -\item{\bb{}} -text match sets the attribute when the field value matches the text. +\item[{\tt text}] match sets the attribute when the field value matches the text. Text matches can only be used for ``{\it alignment\/}'', ``{\it carrying-capacity\/}'', ``{\it hunger\/}'', ``{\it dungeon-level\/}'', and ``{\it title\/}''. @@ -4825,7 +4869,7 @@ is tested; the character's name is ignored. \elist The in-game options menu can help you determine the correct syntax for a -config file. +configuration file. The whole feature can be disable by setting option {\it statushilites} to 0. @@ -4866,11 +4910,14 @@ Set the name of the symbol set that you want to load for display on the rogue level. \elist -You can also override one or more symbols using the {\it SYMBOLS\/} config -file option. Symbols are specified as {\it name:value\/} pairs. Note that -{\it NetHack\/} escape-processes the {\it value\/} string in conventional C -fashion. This means that `\verb+\+' is a prefix to take the following -character literally. Thus `\verb+\+' needs to be represented as `\verb+\\+'. +You can also override one or more symbols using the {\it SYMBOLS\/} and +{\it ROGUESYMBOLS\/} configuration file options. +Symbols are specified as {\it name:value\/} pairs. +Note that {\it NetHack\/} escape-processes +the {\it value\/} string in conventional C fashion. +This means that `\verb+\+' is a prefix to take the following character +literally. +Thus `\verb+\+' needs to be represented as `\verb+\\+'. The special prefix `\verb+\m+' switches on the meta bit in the symbol value, and the `{\tt \^{}}' prefix causes the following character to be treated as a control @@ -5008,7 +5055,8 @@ Default & Symbol Name & Description\\ \verb+@+ & S\verb+_+ss3 & (magic shield 3 of 4)\\ \verb@*@ & S\verb+_+ss4 & (magic shield 4 of 4)\\ \verb@^@ & S\verb+_+statue\verb+_+trap & (statue trap)\\ -\verb@ @ & S\verb+_+stone & (dark part of a room)\\ +\verb@ @ & S\verb+_+stone & (solid rock or unexplored terrain\\ + & & \,or dark part of a room)\\ \verb@]@ & S\verb+_+strange\verb+_+obj & (strange object)\\ \verb@-@ & S\verb+_+sw\verb+_+bc & (swallow bottom center)\\ \verb@\@ & S\verb+_+sw\verb+_+bl & (swallow bottom left)\\ @@ -5023,7 +5071,7 @@ Default & Symbol Name & Description\\ \verb@\@ & S\verb+_+throne & (opulent throne)\\ \verb@-@ & S\verb+_+tlcorn & (top left corner)\\ \verb@|@ & S\verb+_+tlwall & (wall)\\ -\verb@(@ & S\verb+_+tool & (useful item (pick-axe\, key\, lamp...))\\ +\verb@(@ & S\verb+_+tool & (useful item (pick-axe, key, lamp...))\\ \verb@^@ & S\verb+_+trap\verb+_+door & (trap door)\\ \verb@t@ & S\verb+_+trapper & (trapper or lurker above)\\ \verb@-@ & S\verb+_+trcorn & (top right corner)\\ @@ -5052,14 +5100,33 @@ Default & Symbol Name & Description\\ \verb@w@ & S\verb+_+worm & (worm)\\ \verb@~@ & S\verb+_+worm\verb+_+tail & (long worm tail)\\ \verb@W@ & S\verb+_+wraith & (wraith)\\ -\verb@x@ & S\verb+_+xan & (xan or other mythical/fantastic insect)\\ +\verb@x@ & S\verb+_+xan & (xan or other extraordinary insect)\\ \verb@X@ & S\verb+_+xorn & (xorn)\\ \verb@Y@ & S\verb+_+yeti & (apelike creature)\\ \verb@Z@ & S\verb+_+zombie & (zombie)\\ -\verb@z@ & S\verb+_+zruty & (zruty) +\verb@z@ & S\verb+_+zruty & (zruty)\\ +\verb@ @ & S\verb+_+pet\verb+_+override & (any pet if ACCESSIBILITY=1 is set)\\ +\verb@ @ & S\verb+_+hero\verb+_+override & (hero if ACCESSIBILITY=1 is set) \end{longtable}% } +\hyphenation{sysconf} %no syllable breaks => don't hyphenate file name +%.lp +Notes: + +%.lp "*" +Several symbols in this table appear to be blank. +They are the space character, except for S\verb+_+pet\verb+_+override +and S\verb+_+hero\verb+_+override which don't have any default value +and can only be used if enabled in the ``sysconf'' file. + +%.lp "*" +S\verb+_+rock is misleadingly named; rocks and stones use S\verb+_+gem. +Statues and boulders are the rock being referred to, but since +version 3.6.0, statues are displayed as the monster they depict. +So S\verb+_+rock is only used for boulders and not used at all if +overridden by the more specific S\verb+_+boulder. + %.pg %.hn 2 \subsection*{Configuring {\it NetHack\/} for Play by the Blind} @@ -5101,8 +5168,15 @@ is a symset called {\it NHAccess\/}. Selecting that symset in your configuration file will cause the game to run in a manner accessible to the blind. After you have gained some experience with the game and with editing files, you may want to alter settings via {\it SYMBOLS=\/} +and {\it ROGUESYMBOLS=\/} in your configuration file to better suit your preferences. -The most crucial settings to make the game accessible are: +See the previous section for the special symbols S\verb+_+pet\verb+_+override +to force a consistent symbol for all pets and S\verb+_+hero\verb+_+override +to force a unique symbol for the player character if {\it accessibility\/} +is enabled in the {\it sysconf\/} file. + +%.pg +The most crucial settings to make the game more accessible are: %.pg \blist{} %.lp @@ -5235,6 +5309,16 @@ Minimum number of points to get an entry in the score file. 0 or 1 to use user names or numeric userids, respectively, to identify unique people for the score file %.lp +\item[\ib{ACCESSIBILITY}] +0 or 1 to disable or enable, respectively, the ability for players +to set S\verb+_+pet\verb+_+override and S\verb+_+hero\verb+_+override +symbols in their configuration file. +%.lp +\item[\ib{PORTABLE\verb+_+DEVICE\verb+_+PATHS}] +0 or 1 Windows OS only, the game will look for all of its external +files, and write to all of its output files in one place +rather than at the standard locations. +%.lp \item[\ib{DUMPLOGFILE}] A filename where the end-of-game dumplog is saved. Not defining this will prevent dumplog from being created. Only available @@ -5242,7 +5326,7 @@ if your game is compiled with DUMPLOG. Allows the following placeholders: %.sd %.si {\tt \%\%} --- literal `{\tt \%}'\\ -{\tt \%v} --- version (eg. ``{\tt 3.6.2-0}'')\\ +{\tt \%v} --- version (eg. ``{\tt 3.6.3-0}'')\\ {\tt \%u} --- game UID\\ {\tt \%t} --- game start time, UNIX timestamp format\\ {\tt \%T} --- current time, UNIX timestamp format\\ @@ -5434,7 +5518,7 @@ with help from {\it Ross Brown}, {\it Mike Engber}, {\it David Hairston}, {\it Michael Hamel}, {\it Jonathan Handler}, {\it Johnny Lee}, {\it Tim Lennan}, {\it Rob Menke}, and {\it Andy Swanson}, developed {\it NetHack\/} 3.1 for the Macintosh, porting it for MPW. -Building on their development, {\it Barton House} added a Think C port. +Building on their development, {\it Bart House} added a Think C port. %.pg \medskip @@ -5647,7 +5731,7 @@ maintained the port of {\it NetHack\/} 3.6 for Mac OSX. %.pg \medskip -{\it Michael Allison}, {\it David Cohrs}, {\it Barton House}, +{\it Michael Allison}, {\it David Cohrs}, {\it Bart House}, {\it Pasi Kallinen}, {\it Alex Kompel}, {\it Dion Nicolaas}, {\it Derek S. Ray} and {\it Yitzhak Sapir} maintained the port of {\it NetHack\/} 3.6 for Microsoft Windows. @@ -5678,15 +5762,30 @@ time of release of 3.6.1 consisted of %.pg \medskip -In early May 2019, another 320 bug fixes along with some enhancements and +In early May 2019, another 320 bug fixes along with some enhancements and the adopted curses window port, were released as 3.6.2. +%.pg +\medskip +{\it Bart House}, who had contributed to the game as a porting team participant +for decades, joined the {\it NetHack Development Team} in late May 2019. + +%.pg +\medskip +NetHack 3.6.3 was released on December 5, 2019 containing over 190 bug +fixes to NetHack 3.6.2. + +%.pg +\medskip +NetHack 3.6.4 was released on December 18, 2019 containing a security fix and +a few bug fixes. + %.pg \medskip \nd The official {\it NetHack\/} web site is maintained by {\it Ken Lorber} at {\catcode`\#=11 -\special{html:}} -http:{\tt /}{\tt /}www.nethack.org{\tt /}. +\special{html:}} +https:{\tt /}{\tt /}www.nethack.org{\tt /}. {\catcode`\#=11 \special{html:}} @@ -5699,7 +5798,7 @@ again to {\it M. Drew Streib} and {\it Pasi Kallinen} for providing a public NetHack server at nethack.alt.org. Thanks to {\it Keith Simpson} and {\it Andy Thomson} for hardfought.org. Thanks to all those unnamed dungeoneers who invest their time and effort into annual -{\it NetHack\/} tournaments such as {\it Junethack}, +{\it NetHack\/} tournaments such as {\it Junethack}, {\it The November NetHack Tournament} and in days past, {\it devnull.net\/} (gone for now, but not forgotten). \clearpage @@ -5708,54 +5807,55 @@ unnamed dungeoneers who invest their time and effort into annual \section*{Dungeoneers} %.pg \nd From time to time, some depraved individual out there in netland sends a -particularly intriguing modification to help out with the game. The +particularly intriguing modification to help out with the game. The {\it NetHack Development Team} sometimes makes note of the names of the worst of these miscreants in this, the list of Dungeoneers: %.sd \begin{center} \begin{tabular}{llll} %TABLE_START -Adam Aronow & Janet Walz & Nathan Eady\\ -Alex Kompel & Janne Salmij\"{a}rvi & Norm Meluch\\ -Alex Smith & Jean-Christophe Collet & Olaf Seibert\\ -Andreas Dorn & Jeff Bailey & Pasi Kallinen\\ -Andy Church & Jochen Erwied & Pat Rankin\\ -Andy Swanson & John Kallen & Patric Mueller\\ +Adam Aronow & J. Ali Harlow & Mikko Juola\\ +Alex Kompel & Janet Walz & Nathan Eady\\ +Alex Smith & Janne Salmij\"{a}rvi & Norm Meluch\\ +Andreas Dorn & Jean-Christophe Collet & Olaf Seibert\\ +Andy Church & Jeff Bailey & Pasi Kallinen\\ +Andy Swanson & Jochen Erwied & Pat Rankin\\ +Andy Thomson & John Kallen & Patric Mueller\\ Ari Huttunen & John Rupley & Paul Winner\\ -Barton House & John S. Bien & Pierre Martineau\\ +Bart House & John S. Bien & Pierre Martineau\\ Benson I. Margulies & Johnny Lee & Ralf Brown\\ Bill Dyer & Jon W\{tte & Ray Chason\\ Boudewijn Waijers & Jonathan Handler & Richard Addison\\ Bruce Cox & Joshua Delahunty & Richard Beigel\\ Bruce Holloway & Karl Garrison & Richard P. Hughey\\ Bruce Mewborne & Keizo Yamamoto & Rob Menke\\ -Carl Schelin & Ken Arnold & Robin Bandy\\ -Chris Russo & Ken Arromdee & Robin Johnson\\ -David Cohrs & Ken Lorber & Roderick Schertler\\ -David Damerell & Ken Washikita & Roland McGrath\\ -David Gentzel & Kevin Darcy & Ron Van Iwaarden\\ -David Hairston & Kevin Hugo & Ronnen Miller\\ -Dean Luick & Kevin Sitze & Ross Brown\\ -Del Lamb & Kevin Smolkowski & Sascha Wostmann\\ -Derek S. Ray & Kevin Sweet & Scott Bigham\\ -Deron Meranda & Lars Huttar & Scott R. Turner\\ -Dion Nicolaas & Leon Arnott & Sean Hunt\\ -Dylan O'Donnell & M. Drew Streib & Stephen Spackman\\ -Eric Backus & Malcolm Ryan & Stefan Thielscher\\ -Eric Hendrickson & Mark Gooderum & Stephen White\\ -Eric R. Smith & Mark Modrall & Steve Creps\\ -Eric S. Raymond & Marvin Bressler & Steve Linhart\\ -Erik Andersen & Matthew Day & Steve VanDevender\\ -Frederick Roeber & Merlyn LeRoy & Teemu Suikki\\ -Gil Neiger & Michael Allison & Tim Lennan\\ -Greg Laskin & Michael Feir & Timo Hakulinen\\ -Greg Olson & Michael Hamel & Tom Almy\\ -Gregg Wonderly & Michael Sokolov & Tom West\\ -Hao-yang Wang & Mike Engber & Warren Cheung\\ -Helge Hafting & Mike Gallop & Warwick Allison\\ -Irina Rempt-Drijfhout & Mike Passaretti & Yitzhak Sapir\\ -Izchak Miller & Mike Stephenson\\ -J. Ali Harlow & Mikko Juola +Carl Schelin & Keith Simpson & Robin Bandy\\ +Chris Russo & Ken Arnold & Robin Johnson\\ +David Cohrs & Ken Arromdee & Roderick Schertler\\ +David Damerell & Ken Lorber & Roland McGrath\\ +David Gentzel & Ken Washikita & Ron Van Iwaarden\\ +David Hairston & Kevin Darcy & Ronnen Miller\\ +Dean Luick & Kevin Hugo & Ross Brown\\ +Del Lamb & Kevin Sitze & Sascha Wostmann\\ +Derek S. Ray & Kevin Smolkowski & Scott Bigham\\ +Deron Meranda & Kevin Sweet & Scott R. Turner\\ +Dion Nicolaas & Lars Huttar & Sean Hunt\\ +Dylan O'Donnell & Leon Arnott & Stephen Spackman\\ +Eric Backus & M. Drew Streib & Stefan Thielscher\\ +Eric Hendrickson & Malcolm Ryan & Stephen White\\ +Eric R. Smith & Mark Gooderum & Steve Creps\\ +Eric S. Raymond & Mark Modrall & Steve Linhart\\ +Erik Andersen & Marvin Bressler & Steve VanDevender\\ +Fredrik Ljungdahl & Matthew Day & Teemu Suikki\\ +Frederick Roeber & Merlyn LeRoy & Tim Lennan\\ +Gil Neiger & Michael Allison & Timo Hakulinen\\ +Greg Laskin & Michael Feir & Tom Almy\\ +Greg Olson & Michael Hamel & Tom West\\ +Gregg Wonderly & Michael Sokolov & Warren Cheung\\ +Hao-yang Wang & Mike Engber & Warwick Allison\\ +Helge Hafting & Mike Gallop & Yitzhak Sapir\\ +Irina Rempt-Drijfhout & Mike Passaretti\\ +Izchak Miller & Mike Stephenson %TABLE_END Do not delete this line. \end{tabular} \end{center} @@ -5776,7 +5876,3 @@ J. Ali Harlow & Mikko Juola %\end{flushleft} \end{document} - - - - diff --git a/doc/Guidebook.txt b/doc/Guidebook.txt index c622c832d..9abbba24b 100644 --- a/doc/Guidebook.txt +++ b/doc/Guidebook.txt @@ -15,6 +15,8 @@ Original version - Eric S. Raymond (Edited and expanded for 3.6 by Mike Stephenson and others) + December 18, 2019 + 1. Introduction @@ -58,8 +60,6 @@ posted on the inn's walls getting lower and lower. - - NetHack Guidebook 1 @@ -91,32 +91,32 @@ them to move quickly and sneak up on the local nasties. They start equipped with the tools for a proper scientific expedition. - Barbarians are warriors out of the hinterland, hardened to + Barbarians are warriors out of the hinterland, hardened to battle. They begin their quests with naught but uncommon strength, a trusty hauberk, and a great two-handed sword. - Cavemen and Cavewomen start with exceptional strength but, + Cavemen and Cavewomen start with exceptional strength but, unfortunately, with neolithic weapons. - Healers are wise in medicine and apothecary. They know the - herbs and simples that can restore vitality, ease pain, anes- + Healers are wise in medicine and apothecary. They know the + herbs and simples that can restore vitality, ease pain, anes- thetize, and neutralize poisons; and with their instruments, they - can divine a being's state of health or sickness. Their medical + can divine a being's state of health or sickness. Their medical practice earns them quite reasonable amounts of money, with which they enter the dungeon. - Knights are distinguished from the common skirmisher by - their devotion to the ideals of chivalry and by the surpassing + Knights are distinguished from the common skirmisher by + their devotion to the ideals of chivalry and by the surpassing excellence of their armor. Monks are ascetics, who by rigorous practice of physical and mental disciplines have become capable of fighting as effectively - without weapons as with. They wear no armor but make up for it + without weapons as with. They wear no armor but make up for it with increased mobility. - Priests and Priestesses are clerics militant, crusaders ad- - vancing the cause of righteousness with arms, armor, and arts - thaumaturgic. Their ability to commune with deities via prayer + Priests and Priestesses are clerics militant, crusaders ad- + vancing the cause of righteousness with arms, armor, and arts + thaumaturgic. Their ability to commune with deities via prayer occasionally extricates them from peril, but can also put them in it. @@ -126,7 +126,7 @@ - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -136,63 +136,63 @@ - Rogues are agile and stealthy thieves, with knowledge of - locks, traps, and poisons. Their advantage lies in surprise, + Rogues are agile and stealthy thieves, with knowledge of + locks, traps, and poisons. Their advantage lies in surprise, which they employ to great advantage. - Samurai are the elite warriors of feudal Nippon. They are - lightly armored and quick, and wear the dai-sho, two swords of + Samurai are the elite warriors of feudal Nippon. They are + lightly armored and quick, and wear the dai-sho, two swords of the deadliest keenness. - Tourists start out with lots of gold (suitable for shopping - with), a credit card, lots of food, some maps, and an expensive + Tourists start out with lots of gold (suitable for shopping + with), a credit card, lots of food, some maps, and an expensive camera. Most monsters don't like being photographed. - Valkyries are hardy warrior women. Their upbringing in the - harsh Northlands makes them strong, inures them to extremes of + Valkyries are hardy warrior women. Their upbringing in the + harsh Northlands makes them strong, inures them to extremes of cold, and instills in them stealth and cunning. - Wizards start out with a knowledge of magic, a selection of - magical items, and a particular affinity for dweomercraft. Al- + Wizards start out with a knowledge of magic, a selection of + magical items, and a particular affinity for dweomercraft. Al- though seemingly weak and easy to overcome at first sight, an ex- perienced Wizard is a deadly foe. - You may also choose the race of your character (within lim- + You may also choose the race of your character (within lim- its; most roles have restrictions on which races are eligible for them): Dwarves are smaller than humans or elves, but are stocky and - solid individuals. Dwarves' most notable trait is their great - expertise in mining and metalwork. Dwarvish armor is said to be + solid individuals. Dwarves' most notable trait is their great + expertise in mining and metalwork. Dwarvish armor is said to be second in quality not even to the mithril armor of the Elves. - Elves are agile, quick, and perceptive; very little of what - goes on will escape an Elf. The quality of Elven craftsmanship + Elves are agile, quick, and perceptive; very little of what + goes on will escape an Elf. The quality of Elven craftsmanship often gives them an advantage in arms and armor. - Gnomes are smaller than but generally similar to dwarves. - Gnomes are known to be expert miners, and it is known that a se- - cret underground mine complex built by this race exists within + Gnomes are smaller than but generally similar to dwarves. + Gnomes are known to be expert miners, and it is known that a se- + cret underground mine complex built by this race exists within the Mazes of Menace, filled with both riches and danger. Humans are by far the most common race of the surface world, - and are thus the norm to which other races are often compared. - Although they have no special abilities, they can succeed in any + and are thus the norm to which other races are often compared. + Although they have no special abilities, they can succeed in any role. - Orcs are a cruel and barbaric race that hate every living - thing (including other orcs). Above all others, Orcs hate Elves - with a passion unequalled, and will go out of their way to kill - one at any opportunity. The armor and weapons fashioned by the + Orcs are a cruel and barbaric race that hate every living + thing (including other orcs). Above all others, Orcs hate Elves + with a passion unequalled, and will go out of their way to kill + one at any opportunity. The armor and weapons fashioned by the Orcs are typically of inferior quality. 3. What do all those things on the screen mean? - On the screen is kept a map of where you have been and what - you have seen on the current dungeon level; as you explore more + On the screen is kept a map of where you have been and what + you have seen on the current dungeon level; as you explore more - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -204,47 +204,47 @@ of the level, it appears on the screen in front of you. - When NetHack's ancestor rogue first appeared, its screen - orientation was almost unique among computer fantasy games. - Since then, screen orientation has become the norm rather than - the exception; NetHack continues this fine tradition. Unlike - text adventure games that accept commands in pseudo-English sen- + When NetHack's ancestor rogue first appeared, its screen + orientation was almost unique among computer fantasy games. + Since then, screen orientation has become the norm rather than + the exception; NetHack continues this fine tradition. Unlike + text adventure games that accept commands in pseudo-English sen- tences and explain the results in words, NetHack commands are all - one or two keystrokes and the results are displayed graphically - on the screen. A minimum screen size of 24 lines by 80 columns - is recommended; if the screen is larger, only a 21x80 section + one or two keystrokes and the results are displayed graphically + on the screen. A minimum screen size of 24 lines by 80 columns + is recommended; if the screen is larger, only a 21x80 section will be used for the map. NetHack can even be played by blind players, with the assis- - tance of Braille readers or speech synthesisers. Instructions - for configuring NetHack for the blind are included later in this + tance of Braille readers or speech synthesisers. Instructions + for configuring NetHack for the blind are included later in this document. NetHack generates a new dungeon every time you play it; even - the authors still find it an entertaining and exciting game de- + the authors still find it an entertaining and exciting game de- spite having won several times. - NetHack offers a variety of display options. The options - available to you will vary from port to port, depending on the - capabilities of your hardware and software, and whether various + NetHack offers a variety of display options. The options + available to you will vary from port to port, depending on the + capabilities of your hardware and software, and whether various compile-time options were enabled when your executable was creat- ed. The three possible display options are: a monochrome charac- - ter interface, a color character interface, and a graphical in- + ter interface, a color character interface, and a graphical in- terface using small pictures called tiles. The two character in- terfaces allow fonts with other characters to be substituted, but - the default assignments use standard ASCII characters to repre- + the default assignments use standard ASCII characters to repre- sent everything. There is no difference between the various dis- play options with respect to game play. Because we cannot repro- duce the tiles or colors in the Guidebook, and because it is com- - mon to all ports, we will use the default ASCII characters from - the monochrome character display when referring to things you + mon to all ports, we will use the default ASCII characters from + the monochrome character display when referring to things you might see on the screen during your game. - In order to understand what is going on in NetHack, first - you must understand what NetHack is doing with the screen. The - NetHack screen replaces the "You see ..." descriptions of text - adventure games. Figure 1 is a sample of what a NetHack screen - might look like. The way the screen looks for you depends on + In order to understand what is going on in NetHack, first + you must understand what NetHack is doing with the screen. The + NetHack screen replaces the "You see ..." descriptions of text + adventure games. Figure 1 is a sample of what a NetHack screen + might look like. The way the screen looks for you depends on your platform. @@ -258,7 +258,7 @@ - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -286,9 +286,9 @@ 3.1. The status lines (bottom) - The bottom two lines of the screen contain several cryptic - pieces of information describing your current status. If either - status line becomes longer than the width of the screen, you + The bottom two lines of the screen contain several cryptic + pieces of information describing your current status. If either + status line becomes longer than the width of the screen, you might not see all of it. Here are explanations of what the vari- ous status items mean (though your configuration may not have all the status items listed below): @@ -298,33 +298,33 @@ experience level, see below). Strength - A measure of your character's strength; one of your six ba- - sic attributes. A human character's attributes can range - from 3 to 18 inclusive; non-humans may exceed these limits + A measure of your character's strength; one of your six ba- + sic attributes. A human character's attributes can range + from 3 to 18 inclusive; non-humans may exceed these limits (occasionally you may get super-strengths of the form 18/xx, - and magic can also cause attributes to exceed the normal - limits). The higher your strength, the stronger you are. + and magic can also cause attributes to exceed the normal + limits). The higher your strength, the stronger you are. Strength affects how successfully you perform physical - tasks, how much damage you do in combat, and how much loot + tasks, how much damage you do in combat, and how much loot you can carry. Dexterity - Dexterity affects your chances to hit in combat, to avoid - traps, and do other tasks requiring agility or manipulation + Dexterity affects your chances to hit in combat, to avoid + traps, and do other tasks requiring agility or manipulation of objects. Constitution - Constitution affects your ability to recover from injuries - and other strains on your stamina. When strength is low or - modest, constitution also affects how much you can carry. - With sufficiently high strength, the contribution to carry- + Constitution affects your ability to recover from injuries + and other strains on your stamina. When strength is low or + modest, constitution also affects how much you can carry. + With sufficiently high strength, the contribution to carry- ing capacity from your constitution no longer matters. Intelligence - Intelligence affects your ability to cast spells and read + Intelligence affects your ability to cast spells and read - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -342,7 +342,7 @@ Charisma Charisma affects how certain creatures react toward you. In - particular, it can affect the prices shopkeepers offer you. + particular, it can affect the prices shopkeepers offer you. Alignment Lawful, Neutral, or Chaotic. Often, Lawful is taken as good @@ -390,7 +390,7 @@ ical attacks. Many dungeons show only your experience level - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -456,7 +456,7 @@ - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -522,7 +522,7 @@ nasty and vicious. Sometimes, however, they can be helpful. - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -533,62 +533,62 @@ I This marks the last known location of an invisible or other- - wise unseen monster. Note that the monster could have + wise unseen monster. Note that the monster could have moved. The `F' and `m' commands may be useful here. - You need not memorize all these symbols; you can ask the - game what any symbol represents with the `/' command (see the + You need not memorize all these symbols; you can ask the + game what any symbol represents with the `/' command (see the next section for more info). 4. Commands Commands can be initiated by typing one or two characters to - which the command is bound to, or typing the command name in the - extended commands entry. Some commands, like "search", do not + which the command is bound to, or typing the command name in the + extended commands entry. Some commands, like "search", do not require that any more information be collected by NetHack. Other - commands might require additional information, for example a di- - rection, or an object to be used. For those commands that re- - quire additional information, NetHack will present you with ei- - ther a menu of choices or with a command line prompt requesting + commands might require additional information, for example a di- + rection, or an object to be used. For those commands that re- + quire additional information, NetHack will present you with ei- + ther a menu of choices or with a command line prompt requesting information. Which you are presented with will depend chiefly on how you have set the menustyle option. - For example, a common question, in the form "What do you - want to use? [a-zA-Z ?*]", asks you to choose an object you are - carrying. Here, "a-zA-Z" are the inventory letters of your pos- - sible choices. Typing `?' gives you an inventory list of these - items, so you can see what each letter refers to. In this exam- + For example, a common question, in the form "What do you + want to use? [a-zA-Z ?*]", asks you to choose an object you are + carrying. Here, "a-zA-Z" are the inventory letters of your pos- + sible choices. Typing `?' gives you an inventory list of these + items, so you can see what each letter refers to. In this exam- ple, there is also a `*' indicating that you may choose an object not on the list, if you wanted to use something unexpected. Typ- - ing a `*' lists your entire inventory, so you can see the inven- - tory letters of every object you're carrying. Finally, if you + ing a `*' lists your entire inventory, so you can see the inven- + tory letters of every object you're carrying. Finally, if you change your mind and decide you don't want to do this command af- ter all, you can press the ESC key to abort the command. - You can put a number before some commands to repeat them - that many times; for example, "10s" will search ten times. If + You can put a number before some commands to repeat them + that many times; for example, "10s" will search ten times. If you have the number_pad option set, you must type `n' to prefix a - count, so the example above would be typed "n10s" instead. Com- - mands for which counts make no sense ignore them. In addition, - movement commands can be prefixed for greater control (see be- + count, so the example above would be typed "n10s" instead. Com- + mands for which counts make no sense ignore them. In addition, + movement commands can be prefixed for greater control (see be- low). To cancel a count or a prefix, press the ESC key. - The list of commands is rather long, but it can be read at - any time during the game through the `?' command, which accesses - a menu of helpful texts. Here are the default key bindings for + The list of commands is rather long, but it can be read at + any time during the game through the `?' command, which accesses + a menu of helpful texts. Here are the default key bindings for your reference: ? Help menu: display one of several help texts available. / The "whatis" command, to tell what a symbol represents. You may choose to specify a location or type a symbol (or even a - whole word) to explain. Specifying a location is done by - moving the cursor to a particular spot on the map and then + whole word) to explain. Specifying a location is done by + moving the cursor to a particular spot on the map and then pressing one of `.', `,', `;', or `:'. `.' will explain the symbol at the chosen location, conditionally check for "More - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -598,43 +598,43 @@ - info?" depending upon whether the help option is on, and - then you will be asked to pick another location; `,' will + info?" depending upon whether the help option is on, and + then you will be asked to pick another location; `,' will explain the symbol but skip any additional information, then let you pick another location; `;' will skip additional info and also not bother asking you to choose another location to examine; `:' will show additional info, if any, without ask- ing for confirmation. When picking a location, pressing the - ESC key will terminate this command, or pressing `?' will + ESC key will terminate this command, or pressing `?' will give a brief reminder about how it works. - If the autodescribe option is on, a short description of - what you see at each location is shown as you move the cur- - sor. Typing `#' while picking a location will toggle that - option on or off. The whatis_coord option controls whether + If the autodescribe option is on, a short description of + what you see at each location is shown as you move the cur- + sor. Typing `#' while picking a location will toggle that + option on or off. The whatis_coord option controls whether the short description includes map coordinates. - Specifying a name rather than a location always gives any + Specifying a name rather than a location always gives any additional information available about that name. - You may also request a description of nearby monsters, all - monsters currently displayed, nearby objects, or all ob- + You may also request a description of nearby monsters, all + monsters currently displayed, nearby objects, or all ob- jects. The whatis_coord option controls which format of map coordinate is included with their descriptions. & Tell what a command does. - < Go up to the previous level (if you are on a staircase or + < Go up to the previous level (if you are on a staircase or ladder). > Go down to the next level (if you are on a staircase or lad- der). [yuhjklbn] - Go one step in the direction indicated (see Figure 2). If - you sense or remember a monster there, you will fight the - monster instead. Only these one-step movement commands - cause you to fight monsters; the others (below) are "safe." + Go one step in the direction indicated (see Figure 2). If + you sense or remember a monster there, you will fight the + monster instead. Only these one-step movement commands + cause you to fight monsters; the others (below) are "safe." y k u 7 8 9 \ | / \ | / @@ -654,7 +654,7 @@ if you remember a monster there). - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -720,7 +720,7 @@ - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -786,7 +786,7 @@ - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -803,6 +803,12 @@ in inventory. Precede `e' with the `m' prefix to bypass at- tempting to eat anything off the floor. + If you attempt to eat while already satiated, you might + choke to death. If you risk it, you will be asked whether + to "continue eating?" if you survive the first bite. You + can set the paranoid_confirmation:eating option to require a + response of yes instead of just y. + E Engrave a message on the floor. E- - write in the dust with your fingers. @@ -822,7 +828,7 @@ i List your inventory (everything you're carrying). I List selected parts of your inventory, usually be specifying - the character for a particular set of objects, like `[' for + the character for a particular set of objects, like `[' for armor or `!' for potions. I* - list all gems in inventory; @@ -838,21 +844,15 @@ O Set options. - A menu showing the current option values will be displayed. - You can change most values simply by selecting the menu en- + A menu showing the current option values will be displayed. + You can change most values simply by selecting the menu en- try for the given option (ie, by typing its letter or click- - ing upon it, depending on your user interface). For the - non-boolean choices, a further menu or prompt will appear - once you've closed this menu. The available options are - listed later in this Guidebook. Options are usually set be- - fore the game rather than with the `O' command; see the sec- - tion on options below. - - ^O Show overview. + ing upon it, depending on your user interface). For the + non-boolean choices, a further menu or prompt will appear + once you've closed this menu. The available options are - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -862,10 +862,16 @@ - Shortcut for "#overview": list interesting dungeon levels + listed later in this Guidebook. Options are usually set be- + fore the game rather than with the `O' command; see the sec- + tion on options below. + + ^O Show overview. + + Shortcut for "#overview": list interesting dungeon levels visited. - (Prior to 3.6.0, `^O' was a debug mode command which listed + (Prior to 3.6.0, `^O' was a debug mode command which listed the placement of all special levels. Use "#wizwhere" to run that command.) @@ -874,15 +880,15 @@ P Put on an accessory (ring, amulet, or blindfold). This command may also be used to wear armor. The prompt for - which inventory item to use will only list accessories, but - choosing an unlisted item of armor will attempt to wear it. + which inventory item to use will only list accessories, but + choosing an unlisted item of armor will attempt to wear it. (See the `W' command below. It lists armor as the inventory choices but will accept an accessory and attempt to put that on.) ^P Repeat previous message. - Subsequent `^P's repeat earlier messages. For some inter- + Subsequent `^P's repeat earlier messages. For some inter- faces, the behavior can be varied via the msg_window option. q Quaff (drink) something (potion, water, etc). @@ -910,15 +916,9 @@ `T' command below. It lists armor as the inventory choices but will accept an accessory and attempt to remove it.) - ^R Redraw the screen. - - s Search for secret doors and traps around you. It usually - takes several tries to find something. - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -928,6 +928,11 @@ + ^R Redraw the screen. + + s Search for secret doors and traps around you. It usually + takes several tries to find something. + Can also be used to figure out whether there is still a mon- ster at an adjacent "remembered, unseen monster" marker. @@ -959,32 +964,27 @@ T Take off armor. - If you're wearing more than one piece, you'll be prompted - for which one to take off. (Note that this treats a cloak - covering a suit and/or a shirt, or a suit covering a shirt, + If you're wearing more than one piece, you'll be prompted + for which one to take off. (Note that this treats a cloak + covering a suit and/or a shirt, or a suit covering a shirt, as if the underlying items weren't there.) When you're only - wearing one, then by default it will be taken off without - asking, but you can set the paranoid_confirmation option to + wearing one, then by default it will be taken off without + asking, but you can set the paranoid_confirmation option to require a prompt. - This command may also be used to remove accessories. The - prompt for which inventory item to take off only lists worn - armor, but a worn accessory can be chosen. (See the `R' + This command may also be used to remove accessories. The + prompt for which inventory item to take off only lists worn + armor, but a worn accessory can be chosen. (See the `R' command above. It lists accessories as the inventory choic- - es but will accept an item of armor and attempt to take it + es but will accept an item of armor and attempt to take it off.) ^T Teleport, if you have the ability. - v Display version number. - - V Display the game history. - - w Wield weapon. - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -994,46 +994,52 @@ + v Display version number. + + V Display the game history. + + w Wield weapon. + w- - wield nothing, use your bare (or gloved) hands. - Some characters can wield two weapons at once; use the `X' + Some characters can wield two weapons at once; use the `X' command (or the "#twoweapon" extended command) to do so. W Wear armor. - This command may also be used to put on an accessory (ring, - amulet, or blindfold). The prompt for which inventory item + This command may also be used to put on an accessory (ring, + amulet, or blindfold). The prompt for which inventory item to use will only list armor, but choosing an unlisted acces- sory will attempt to put it on. (See the `P' command above. - It lists accessories as the inventory choices but will ac- + It lists accessories as the inventory choices but will ac- cept an item of armor and attempt to wear it.) x Exchange your wielded weapon with the item in your alternate weapon slot. The latter is used as your secondary weapon when engaging in - two-weapon combat. Note that if one of these slots is emp- + two-weapon combat. Note that if one of these slots is emp- ty, the exchange still takes place. X Toggle two-weapon combat, if your character can do it. Also available via the "#twoweapon" extended command. - (In versions prior to 3.6 this was the command to switch + (In versions prior to 3.6 this was the command to switch from normal play to "explore mode", also known as "discovery mode", which has now been moved to "#exploremode".) ^X Display basic information about your character. - Displays name, role, race, gender (unless role name makes - that redundant, such as Caveman or Priestess), and align- - ment, along with your patron deity and his or her opposi- - tion. It also shows most of the various items of informa- + Displays name, role, race, gender (unless role name makes + that redundant, such as Caveman or Priestess), and align- + ment, along with your patron deity and his or her opposi- + tion. It also shows most of the various items of informa- tion from the status line(s) in a less terse form, including - several additional things which don't appear in the normal + several additional things which don't appear in the normal status display due to space considerations. - In normal play, that's all that `^X' displays. In explore - mode, the role and status feedback is augmented by the in- + In normal play, that's all that `^X' displays. In explore + mode, the role and status feedback is augmented by the in- formation provided by enlightenment magic. z Zap a wand. @@ -1042,15 +1048,9 @@ Z Zap (cast) a spell. - Z. - to cast at yourself, use `.' for the direction. - - __________ - (R)UNIX is a registered trademark of The Open Group. - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -1060,6 +1060,8 @@ + Z. - to cast at yourself, use `.' for the direction. + ^Z Suspend the game (UNIX(R) versions with job control only). : Look at what is here. @@ -1108,15 +1110,13 @@ ` Show discovered types for one class of objects. - ! Escape to a shell. - - # Perform an extended command. + __________ + (R)UNIX is a registered trademark of The Open Group. - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -1126,6 +1126,12 @@ + ! Escape to a shell. + + # Perform an extended command. + + + As you can see, the authors of NetHack used up all the let- ters, so this is a way to introduce the less frequently used com- mands. What extended commands are available depends on what fea- @@ -1174,15 +1180,9 @@ If the tool used acts on items on the floor, using the `m' prefix skips those items. - If used on a wand, that wand will be broken, releasing its - magic in the process. Confirmation is required. - - #attributes - Show your attributes. Default key is `^X'. - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -1192,6 +1192,12 @@ + If used on a wand, that wand will be broken, releasing its + magic in the process. Confirmation is required. + + #attributes + Show your attributes. Default key is `^X'. + #autopickup Toggle the autopickup option on/off. Default key is `@'. @@ -1240,15 +1246,9 @@ Advance or check weapon and spell skills. Autocompletes. Default key is `M-e'. - #exploremode - Enter the explore mode. - - #fire - Fire ammunition from quiver. Default key is `f'. - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -1258,15 +1258,26 @@ + #exploremode + Enter the explore mode. + + Requires confirmation; default response is n (no). To real- + ly switch to explore mode, respond with y. You can set the + paranoid_confirmation:quit option to require a response of + yes instead. + + #fire + Fire ammunition from quiver. Default key is `f'. + #force Force a lock. Autocompletes. Default key is `M-f'. #glance - Show what type of thing a map symbol corresponds to. De- + Show what type of thing a map symbol corresponds to. De- fault key is `;'. #help - Show the help menu. Default key is `?', and also `h' if + Show the help menu. Default key is `?', and also `h' if number_pad is on. #herecmdmenu @@ -1282,15 +1293,15 @@ Inventory specific item types. Default key is `I'. #invoke - Invoke an object's special powers. Autocompletes. Default + Invoke an object's special powers. Autocompletes. Default key is `M-i'. #jump - Jump to another location. Autocompletes. Default key is + Jump to another location. Autocompletes. Default key is `M-j', and also `j' if number_pad is on. #kick - Kick something. Default key is `^D', and `k' if number_pad + Kick something. Default key is `^D', and `k' if number_pad is on. #known @@ -1301,20 +1312,9 @@ Show discovered types for one class of objects. Default key is ``'. - #levelchange - Change your experience level. Autocompletes. Debug mode - only. - - #lightsources - Show mobile light sources. Autocompletes. Debug mode only. - - #look - Look at what is here, under you. Default key is `:'. - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -1324,6 +1324,16 @@ + #levelchange + Change your experience level. Autocompletes. Debug mode + only. + + #lightsources + Show mobile light sources. Autocompletes. Debug mode only. + + #look + Look at what is here, under you. Default key is `:'. + #loot Loot a box or bag on the floor beneath you, or the saddle from a steed standing next to you. Autocompletes. Precede @@ -1367,20 +1377,10 @@ ited level will be included regardless of annotations. Au- tocompletes. Default keys are `^O', and `M-O'. - #panic - Test the panic routine. Terminates the current game. Auto- - completes. Debug mode only. - - #pay - Pay your shopping bill. Default key is `p'. - - #pickup - Pick up things at the current location. Default key is `,'. - The `m' prefix forces use of a menu. - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -1390,63 +1390,63 @@ + #panic + Test the panic routine. Terminates the current game. Auto- + completes. Debug mode only. + + Asks for confirmation; default is n (no); continue playing. + To really panic, respond with y. You can set the para- + noid_confirmation:quit option to require a response of yes + instead. + + #pay + Pay your shopping bill. Default key is `p'. + + #pickup + Pick up things at the current location. Default key is `,'. + The `m' prefix forces use of a menu. + #polyself Polymorph self. Autocompletes. Debug mode only. #pray - Pray to the gods for help. Autocompletes. Default key is + Pray to the gods for help. Autocompletes. Default key is `M-p'. - Praying too soon after receiving prior help is a bad idea. - (Hint: entering the dungeon alive is treated as having re- + Praying too soon after receiving prior help is a bad idea. + (Hint: entering the dungeon alive is treated as having re- ceived help. You probably shouldn't start off a new game by - praying right away.) Since using this command by accident - can cause trouble, there is an option to make you confirm - your intent before praying. It is enabled by default, and - you can reset the paranoid_confirmation option to disable + praying right away.) Since using this command by accident + can cause trouble, there is an option to make you confirm + your intent before praying. It is enabled by default, and + you can reset the paranoid_confirmation option to disable it. #prevmsg - Show previously displayed game messages. Default key is + Show previously displayed game messages. Default key is `^P'. #puton - Put on an accessory (ring, amulet, etc). Default key is + Put on an accessory (ring, amulet, etc). Default key is `P'. #quaff Quaff (drink) something. Default key is `q'. #quit - Quit the program without saving your game. Autocompletes. + Quit the program without saving your game. Autocompletes. Default key is `M-q'. - Since using this command by accident would throw away the - current game, you are asked to confirm your intent before - quitting. By default a response of `y' acknowledges that - intent. You can set the paranoid_confirmation option to re- - quire a response of "yes" instead. - - #quiver - Select ammunition for quiver. Default key is `Q'. - - #read - Read a scroll, a spellbook, or something else. Default key - is `r'. - - #redraw - Redraw the screen. Default key is `^R', and also `^L' if - number_pad is on. - - #remove - Remove an accessory (ring, amulet, etc). Default key is - `R'. - - #ride - Ride (or stop riding) a saddled creature. Autocompletes. + Since using this command by accident would throw away the + current game, you are asked to confirm your intent before + quitting. Default response is n (no); continue playing. To + really quit, respond with y. You can set the paranoid_con- + firmation:quit option to require a response of yes instead. - NetHack 3.6 May 7, 2019 + + + NetHack 3.7 December 18, 2019 @@ -1456,17 +1456,34 @@ + #quiver + Select ammunition for quiver. Default key is `Q'. + + #read + Read a scroll, a spellbook, or something else. Default key + is `r'. + + #redraw + Redraw the screen. Default key is `^R', and also `^L' if + number_pad is on. + + #remove + Remove an accessory (ring, amulet, etc). Default key is + `R'. + + #ride + Ride (or stop riding) a saddled creature. Autocompletes. Default key is `M-R'. #rub - Rub a lamp or a stone. Autocompletes. Default key is `M- + Rub a lamp or a stone. Autocompletes. Default key is `M- r'. #save Save the game and exit the program. Default key is `S'. #search - Search for traps and secret doors around you. Default key + Search for traps and secret doors around you. Default key is `s'. #seeall @@ -1493,6 +1510,18 @@ #seetools Show the tools currently in use. Default key is `('. + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 24 + + + #seetrap Show the type of an adjacent trap. Default key is `^'. @@ -1506,22 +1535,9 @@ Sit down. Autocompletes. Default key is `M-s'. #stats - Show memory usage statistics. Autocompletes. Debug mode + Show memory usage statistics. Autocompletes. Debug mode only. - - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 24 - - - #suspend Suspend the game. Default key is `^Z'. @@ -1538,7 +1554,7 @@ Teleport around the level. Default key is `^T'. #terrain - Show bare map without displaying monsters, objects, or + Show bare map without displaying monsters, objects, or traps. Autocompletes. #therecmdmenu @@ -1559,8 +1575,20 @@ Travel to a specific location on the map. Default key is `_'. Using the "request menu" prefix shows a menu of inter- esting targets in sight without asking to move the cursor. - When picking a target with cursor and the autodescribe op- - tion is on, the top line will show "(no travel path)" if + When picking a target with cursor and the autodescribe + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 25 + + + + option is on, the top line will show "(no travel path)" if your character does not know of a path to that location. #turn @@ -1577,17 +1605,6 @@ Untrap something (trap, door, or chest). Default key is `M- u', and `u' if number_pad is on. - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 25 - - - In some circumstances it can also be used to rescue trapped monsters. @@ -1595,7 +1612,7 @@ Go up a staircase. Default key is `<'. #vanquished - List vanquished monsters. Autocompletes. Debug mode only. + List vanquished monsters. Autocompletes. Debug mode only. #version Print compile time options for this version of NetHack. Au- @@ -1608,7 +1625,7 @@ Show vision array. Autocompletes. Debug mode only. #wait - Rest one move while doing nothing. Default key is `.', and + Rest one move while doing nothing. Default key is `.', and also ` ' if rest_on_space is on. #wear @@ -1618,33 +1635,16 @@ Tell what a key does. Default key is `&'. #whatis - Show what type of thing a symbol corresponds to. Default + Show what type of thing a symbol corresponds to. Default key is `/'. #wield Wield a weapon. Default key is `w'. - #wipe - Wipe off your face. Autocompletes. Default key is `M-w'. - - #wizbury - Bury objects under and around you. Autocompletes. Debug - mode only. - - #wizdetect - Search for hidden things (secret doors or traps or unseen - monsters) within a modest radius. Autocompletes. Debug - mode only. Default key is `^E'. - - #wizgenesis - Create a monster. May be prefixed by a count to create more - than one. Autocompletes. Debug mode only. Default key is - `^G'. - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -1654,6 +1654,23 @@ + #wipe + Wipe off your face. Autocompletes. Default key is `M-w'. + + #wizbury + Bury objects under and around you. Autocompletes. Debug + mode only. + + #wizdetect + Search for hidden things (secret doors or traps or unseen + monsters) within a modest radius. Autocompletes. Debug + mode only. Default key is `^E'. + + #wizgenesis + Create a monster. May be prefixed by a count to create more + than one. Autocompletes. Debug mode only. Default key is + `^G'. + #wizidentify Identify all items in inventory. Autocompletes. Debug mode only. Default key is `^I'. @@ -1667,7 +1684,7 @@ Default key is `^V'. #wizmap - Map the level. Autocompletes. Debug mode only. Default + Map the level. Autocompletes. Debug mode only. Default key is `^F'. #wizrumorcheck @@ -1677,11 +1694,11 @@ Smell monster. Autocompletes. Debug mode only. #wizwhere - Show locations of special levels. Autocompletes. Debug + Show locations of special levels. Autocompletes. Debug mode only. #wizwish - Wish for something. Autocompletes. Debug mode only. De- + Wish for something. Autocompletes. Debug mode only. De- fault key is `^W'. #wmode @@ -1690,27 +1707,10 @@ #zap Zap a wand. Default key is `z'. - #? - Help menu: get the list of available extended commands. - If your keyboard has a meta key (which, when pressed in com- - bination with another key, modifies it by setting the "meta" - [8th, or "high"] bit), you can invoke many extended commands by - meta-ing the first letter of the command. - - In NT, OS/2, PC and ST NetHack, the "Alt" key can be used in - this fashion; on the Amiga, set the altmeta option to get this - behavior. On other systems, if typing "Alt" plus another key - transmits a two character sequence consisting of an Escape fol- - lowed by the other key, you may set the altmeta option to have - NetHack combine them into meta+key. - - - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -1720,6 +1720,23 @@ + #? + Help menu: get the list of available extended commands. + + + + If your keyboard has a meta key (which, when pressed in com- + bination with another key, modifies it by setting the "meta" + [8th, or "high"] bit), you can invoke many extended commands by + meta-ing the first letter of the command. + + In NT, OS/2, PC and ST NetHack, the "Alt" key can be used in + this fashion; on the Amiga, set the altmeta option to get this + behavior. On other systems, if typing "Alt" plus another key + transmits a two character sequence consisting of an Escape fol- + lowed by the other key, you may set the altmeta option to have + NetHack combine them into meta+key. + M-? #? (not supported by all platforms) M-2 #twoweapon (unless the number_pad option is enabled) @@ -1756,6 +1773,19 @@ M-q #quit + + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 28 + + + M-r #rub M-R #ride @@ -1774,19 +1804,7 @@ - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 28 - - - - If the number_pad option is on, some additional letter com- + If the number_pad option is on, some additional letter com- mands are available: h #help @@ -1803,9 +1821,9 @@ 5. Rooms and corridors - Rooms and corridors in the dungeon are either lit or dark. - Any lit areas within your line of sight will be displayed; dark - areas are only displayed if they are within one space of you. + Rooms and corridors in the dungeon are either lit or dark. + Any lit areas within your line of sight will be displayed; dark + areas are only displayed if they are within one space of you. Walls and corridors remain on the map as you explore them. Secret corridors are hidden. You can find them with the `s' @@ -1814,35 +1832,17 @@ 5.1. Doorways Doorways connect rooms and corridors. Some doorways have no - doors; you can walk right through. Others have doors in them, + doors; you can walk right through. Others have doors in them, which may be open, closed, or locked. To open a closed door, use - the `o' (open) command; to close it again, use the `c' (close) + the `o' (open) command; to close it again, use the `c' (close) command. - You can get through a locked door by using a tool to pick + You can get through a locked door by using a tool to pick the lock with the `a' (apply) command, or by kicking it open with the `^D' (kick) command. - Open doors cannot be entered diagonally; you must approach - them straight on, horizontally or vertically. Doorways without - doors are not restricted in this fashion. - Doors can be useful for shutting out monsters. Most mon- - sters cannot open doors, although a few don't need to (for exam- - ple, ghosts can walk through doors). - - Secret doors are hidden. You can find them with the `s' - (search) command. Once found they are in all ways equivalent to - normal doors. - - 5.2. Traps (`^') - - There are traps throughout the dungeon to snare the unwary - delver. For example, you may suddenly fall into a pit and be - stuck for a few turns trying to climb out. Traps don't appear on - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -1852,63 +1852,63 @@ + Open doors cannot be entered diagonally; you must approach + them straight on, horizontally or vertically. Doorways without + doors are not restricted in this fashion. + + Doors can be useful for shutting out monsters. Most mon- + sters cannot open doors, although a few don't need to (for exam- + ple, ghosts can walk through doors). + + Secret doors are hidden. You can find them with the `s' + (search) command. Once found they are in all ways equivalent to + normal doors. + + 5.2. Traps (`^') + + There are traps throughout the dungeon to snare the unwary + delver. For example, you may suddenly fall into a pit and be + stuck for a few turns trying to climb out. Traps don't appear on your map until you see one triggered by moving onto it, see some- thing fall into it, or you discover it with the `s' (search) com- - mand. Monsters can fall prey to traps, too, which can be a very + mand. Monsters can fall prey to traps, too, which can be a very useful defensive strategy. There is a special pre-mapped branch of the dungeon based on - the classic computer game "Sokoban." The goal is to push the - boulders into the pits or holes. With careful foresight, it is - possible to complete all of the levels according to the tradi- - tional rules of Sokoban. Some allowances are permitted in case + the classic computer game "Sokoban." The goal is to push the + boulders into the pits or holes. With careful foresight, it is + possible to complete all of the levels according to the tradi- + tional rules of Sokoban. Some allowances are permitted in case the player gets stuck; however, they will lower your luck. 5.3. Stairs and ladders (`<', `>') - In general, each level in the dungeon will have a staircase + In general, each level in the dungeon will have a staircase going up (`<') to the previous level and another going down (`>') - to the next level. There are some exceptions though. For in- - stance, fairly early in the dungeon you will find a level with + to the next level. There are some exceptions though. For in- + stance, fairly early in the dungeon you will find a level with two down staircases, one continuing into the dungeon and the oth- - er branching into an area known as the Gnomish Mines. Those - mines eventually hit a dead end, so after exploring them (if you - choose to do so), you'll need to climb back up to the main dun- + er branching into an area known as the Gnomish Mines. Those + mines eventually hit a dead end, so after exploring them (if you + choose to do so), you'll need to climb back up to the main dun- geon. - When you traverse a set of stairs, or trigger a trap which - sends you to another level, the level you're leaving will be de- - activated and stored in a file on disk. If you're moving to a + When you traverse a set of stairs, or trigger a trap which + sends you to another level, the level you're leaving will be de- + activated and stored in a file on disk. If you're moving to a previously visited level, it will be loaded from its file on disk - and reactivated. If you're moving to a level which has not yet - been visited, it will be created (from scratch for most random + and reactivated. If you're moving to a level which has not yet + been visited, it will be created (from scratch for most random levels, from a template for some "special" levels, or loaded from the remains of an earlier game for a "bones" level as briefly de- - scribed below). Monsters are only active on the current level; + scribed below). Monsters are only active on the current level; those on other levels are essentially placed into stasis. - Ordinarily when you climb a set of stairs, you will arrive - on the corresponding staircase at your destination. However, - pets (see below) and some other monsters will follow along if - they're close enough when you travel up or down stairs, and occa- - sionally one of these creatures will displace you during the - climb. When that occurs, the pet or other monster will arrive on - the staircase and you will end up nearby. - - Ladders serve the same purpose as staircases, and the two - types of inter-level connections are nearly indistinguishable - during game play. - - 5.4. Shops and shopping - - Occasionally you will run across a room with a shopkeeper - near the door and many items lying on the floor. You can buy - items by picking them up and then using the `p' command. You can - inquire about the price of an item prior to picking it up by us- - ing the "#chat" command while standing on it. Using an item + Ordinarily when you climb a set of stairs, you will arrive + on the corresponding staircase at your destination. However, - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -1918,9 +1918,25 @@ - prior to paying for it will incur a charge, and the shopkeeper - won't allow you to leave the shop until you have paid any debt - you owe. + pets (see below) and some other monsters will follow along if + they're close enough when you travel up or down stairs, and occa- + sionally one of these creatures will displace you during the + climb. When that occurs, the pet or other monster will arrive on + the staircase and you will end up nearby. + + Ladders serve the same purpose as staircases, and the two + types of inter-level connections are nearly indistinguishable + during game play. + + 5.4. Shops and shopping + + Occasionally you will run across a room with a shopkeeper + near the door and many items lying on the floor. You can buy + items by picking them up and then using the `p' command. You can + inquire about the price of an item prior to picking it up by us- + ing the "#chat" command while standing on it. Using an item pri- + or to paying for it will incur a charge, and the shopkeeper won't + allow you to leave the shop until you have paid any debt you owe. You can sell items to a shopkeeper by dropping them to the floor while inside a shop. You will either be offered an amount @@ -1955,26 +1971,10 @@ * The price of a given item can vary due to a variety of factors. - * A shopkeeper treats the spot immediately inside the door as if - it were outside the shop. - - * While the shopkeeper watches you like a hawk, he will generally - ignore any other customers. - - * If a shop is "closed for inventory," it will not open of its - own accord. - - * Shops do not get restocked with new items, regardless of inven- - tory depletion. - - 6. Monsters - - Monsters you cannot see are not displayed on the screen. - Beware! You may suddenly come upon one in a dark place. Some - magic items can help you locate them before they locate you - NetHack 3.6 May 7, 2019 + + NetHack 3.7 December 18, 2019 @@ -1984,25 +1984,42 @@ + * A shopkeeper treats the spot immediately inside the door as if + it were outside the shop. + + * While the shopkeeper watches you like a hawk, he will generally + ignore any other customers. + + * If a shop is "closed for inventory," it will not open of its + own accord. + + * Shops do not get restocked with new items, regardless of inven- + tory depletion. + + 6. Monsters + + Monsters you cannot see are not displayed on the screen. + Beware! You may suddenly come upon one in a dark place. Some + magic items can help you locate them before they locate you (which some monsters can do very well). - The commands `/' and `;' may be used to obtain information - about those monsters who are displayed on the screen. The com- - mand "#name" (by default bound to `C'), allows you to assign a - name to a monster, which may be useful to help distinguish one - from another when multiple monsters are present. Assigning a + The commands `/' and `;' may be used to obtain information + about those monsters who are displayed on the screen. The com- + mand "#name" (by default bound to `C'), allows you to assign a + name to a monster, which may be useful to help distinguish one + from another when multiple monsters are present. Assigning a name which is just a space will remove any prior name. The extended command "#chat" can be used to interact with an adjacent monster. There is no actual dialog (in other words, you don't get to choose what you'll say), but chatting with some mon- - sters such as a shopkeeper or the Oracle of Delphi can produce + sters such as a shopkeeper or the Oracle of Delphi can produce useful results. 6.1. Fighting - If you see a monster and you wish to fight it, just attempt - to walk into it. Many monsters you find will mind their own + If you see a monster and you wish to fight it, just attempt + to walk into it. Many monsters you find will mind their own business unless you attack them. Some of them are very dangerous when angered. Remember: discretion is the better part of valor. @@ -2021,6 +2038,18 @@ monster has moved and you don't wish to fight, you can use the `m' command to move without fighting; likewise, if you don't re- member a monster but want to try fighting anyway, you can use the + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 32 + + + `F' command. 6.2. Your pet @@ -2039,17 +2068,6 @@ Initially, your pet may even be better at killing things than you, which makes pets useful for low-level characters. - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 32 - - - Your pet will follow you up and down staircases if it is next to you when you move. Otherwise your pet will be stranded and may become wild. Similarly, when you trigger certain types @@ -2076,37 +2094,19 @@ Use the `a' (apply) command and pick a saddle in your inven- tory to attempt to put that saddle on an adjacent creature. If - successful, it will be transferred to that creature's inventory. + successful, it will be transferred to that creature's inventory. Use the "#loot" command while adjacent to a saddled creature - to try to remove the saddle from that creature. If successful, + to try to remove the saddle from that creature. If successful, it will be transferred to your inventory. 6.4. Bones levels - You may encounter the shades and corpses of other adventur- + You may encounter the shades and corpses of other adventur- ers (or even former incarnations of yourself!) and their personal - effects. Ghosts are hard to kill, but easy to avoid, since - they're slow and do little damage. You can plunder the deceased - adventurer's possessions; however, they are likely to be cursed. - Beware of whatever killed the former player; it is probably still - lurking around, gloating over its last victory. - - 6.5. Persistence of Monsters - - Monsters (a generic reference which also includes humans and - pets) are only shown while they can be seen or otherwise sensed. - Moving to a location where you can't see or sense a monster any - more will result in it disappearing from your map, similarly if - it is the one who moved rather than you. - - However, if you encounter a monster which you can't see or - sense -- perhaps it is invisible and has just tapped you on the - noggin -- a special "remembered, unseen monster" marker will be - displayed at the location where you think it is. That will - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -2116,63 +2116,63 @@ - persist until you have proven that there is no monster there, - even if the unseen monster moves to another location or you move - to a spot where the marker's location ordinarily wouldn't be seen - any more. + effects. Ghosts are hard to kill, but easy to avoid, since + they're slow and do little damage. You can plunder the deceased + adventurer's possessions; however, they are likely to be cursed. + Beware of whatever killed the former player; it is probably still + lurking around, gloating over its last victory. + + 6.5. Persistence of Monsters + + Monsters (a generic reference which also includes humans and + pets) are only shown while they can be seen or otherwise sensed. + Moving to a location where you can't see or sense a monster any + more will result in it disappearing from your map, similarly if + it is the one who moved rather than you. + + However, if you encounter a monster which you can't see or + sense -- perhaps it is invisible and has just tapped you on the + noggin -- a special "remembered, unseen monster" marker will be + displayed at the location where you think it is. That will per- + sist until you have proven that there is no monster there, even + if the unseen monster moves to another location or you move to a + spot where the marker's location ordinarily wouldn't be seen any + more. 7. Objects When you find something in the dungeon, it is common to want to pick it up. In NetHack, this is accomplished automatically by - walking over the object (unless you turn off the autopickup op- - tion (see below), or move with the `m' prefix (see above)), or + walking over the object (unless you turn off the autopickup op- + tion (see below), or move with the `m' prefix (see above)), or manually by using the `,' command. - If you're carrying too many items, NetHack will tell you so - and you won't be able to pick up anything more. Otherwise, it - will add the object(s) to your pack and tell you what you just + If you're carrying too many items, NetHack will tell you so + and you won't be able to pick up anything more. Otherwise, it + will add the object(s) to your pack and tell you what you just picked up. - As you add items to your inventory, you also add the weight - of that object to your load. The amount that you can carry de- - pends on your strength and your constitution. The stronger and - sturdier you are, the less the additional load will affect you. + As you add items to your inventory, you also add the weight + of that object to your load. The amount that you can carry de- + pends on your strength and your constitution. The stronger and + sturdier you are, the less the additional load will affect you. There comes a point, though, when the weight of all of that stuff - you are carrying around with you through the dungeon will encum- + you are carrying around with you through the dungeon will encum- ber you. Your reactions will get slower and you'll burn calories - faster, requiring food more frequently to cope with it. Eventu- - ally, you'll be so overloaded that you'll either have to discard + faster, requiring food more frequently to cope with it. Eventu- + ally, you'll be so overloaded that you'll either have to discard some of what you're carrying or collapse under its weight. - NetHack will tell you how badly you have loaded yourself. - If you are encumbered, one of the conditions "Burdened", + NetHack will tell you how badly you have loaded yourself. + If you are encumbered, one of the conditions "Burdened", "Stressed", "Strained", "Overtaxed" or "Overloaded" will be shown on the bottom line status display. When you pick up an object, it is assigned an inventory let- - ter. Many commands that operate on objects must ask you to find - out which object you want to use. When NetHack asks you to - choose a particular object you are carrying, you are usually pre- - sented with a list of inventory letters to choose from (see Com- - mands, above). - - Some objects, such as weapons, are easily differentiated. - Others, like scrolls and potions, are given descriptions which - vary according to type. During a game, any two objects with the - same description are the same type. However, the descriptions - will vary from game to game. - - When you use one of these objects, if its effect is obvious, - NetHack will remember what it is for you. If its effect isn't - extremely obvious, you will be asked what you want to call this - type of object so you will recognize it later. You can also use - the "#name" command, for the same purpose at any time, to name - all objects of a particular type or just an individual object. - When you use "#name" on an object which has already been named, + ter. Many commands that operate on objects must ask you to find - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -2182,63 +2182,63 @@ - specifying a space as the value will remove the prior name in- + out which object you want to use. When NetHack asks you to + choose a particular object you are carrying, you are usually pre- + sented with a list of inventory letters to choose from (see Com- + mands, above). + + Some objects, such as weapons, are easily differentiated. + Others, like scrolls and potions, are given descriptions which + vary according to type. During a game, any two objects with the + same description are the same type. However, the descriptions + will vary from game to game. + + When you use one of these objects, if its effect is obvious, + NetHack will remember what it is for you. If its effect isn't + extremely obvious, you will be asked what you want to call this + type of object so you will recognize it later. You can also use + the "#name" command, for the same purpose at any time, to name + all objects of a particular type or just an individual object. + When you use "#name" on an object which has already been named, + specifying a space as the value will remove the prior name in- stead of assigning a new one. 7.1. Curses and Blessings - Any object that you find may be cursed, even if the object + Any object that you find may be cursed, even if the object is otherwise helpful. The most common effect of a curse is being - stuck with (and to) the item. Cursed weapons weld themselves to - your hand when wielded, so you cannot unwield them. Any cursed - item you wear is not removable by ordinary means. In addition, - cursed arms and armor usually, but not always, bear negative en- + stuck with (and to) the item. Cursed weapons weld themselves to + your hand when wielded, so you cannot unwield them. Any cursed + item you wear is not removable by ordinary means. In addition, + cursed arms and armor usually, but not always, bear negative en- chantments that make them less effective in combat. Other cursed objects may act poorly or detrimentally in other ways. - Objects can also be blessed. Blessed items usually work - better or more beneficially than normal uncursed items. For ex- + Objects can also be blessed. Blessed items usually work + better or more beneficially than normal uncursed items. For ex- ample, a blessed weapon will do more damage against demons. Objects which are neither cursed nor blessed are referred to - as uncursed. They could just as easily have been described as - unblessed, but the uncursed designation is what you will see - within the game. A "glass half full versus glass half empty" + as uncursed. They could just as easily have been described as + unblessed, but the uncursed designation is what you will see + within the game. A "glass half full versus glass half empty" situation; make of that what you will. There are magical means of bestowing or removing curses upon - objects, so even if you are stuck with one, you can still have - the curse lifted and the item removed. Priests and Priestesses - have an innate sensitivity to this property in any object, so - they can more easily avoid cursed objects than other character + objects, so even if you are stuck with one, you can still have + the curse lifted and the item removed. Priests and Priestesses + have an innate sensitivity to this property in any object, so + they can more easily avoid cursed objects than other character roles. - An item with unknown status will be reported in your inven- + An item with unknown status will be reported in your inven- tory with no prefix. An item which you know the state of will be - distinguished in your inventory by the presence of the word + distinguished in your inventory by the presence of the word "cursed", "uncursed" or "blessed" in the description of the item. - In some cases "uncursed" will be omitted as being redundant when - enough other information is displayed. The implicit_uncursed op- - tion can be used to control this; toggle it off to have "un- - cursed" be displayed even when that can be deduced from other at- - tributes. - - 7.2. Weapons (`)') - - Given a chance, most monsters in the Mazes of Menace will - gratuitously try to kill you. You need weapons for self-defense - (killing them first). Without a weapon, you do only 1-2 hit - points of damage (plus bonuses, if any). Monk characters are an - exception; they normally do more damage with bare (or gloved) - hands than they do with weapons. - - There are wielded weapons, like maces and swords, and thrown - weapons, like arrows and spears. To hit monsters with a weapon, - you must wield it and attack them, or throw it at them. You can - simply elect to throw a spear. To shoot an arrow, you should + In some cases "uncursed" will be omitted as being redundant when - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -2248,63 +2248,63 @@ - first wield a bow, then throw the arrow. Crossbows shoot cross- + enough other information is displayed. The implicit_uncursed op- + tion can be used to control this; toggle it off to have "un- + cursed" be displayed even when that can be deduced from other at- + tributes. + + 7.2. Weapons (`)') + + Given a chance, most monsters in the Mazes of Menace will + gratuitously try to kill you. You need weapons for self-defense + (killing them first). Without a weapon, you do only 1-2 hit + points of damage (plus bonuses, if any). Monk characters are an + exception; they normally do more damage with bare (or gloved) + hands than they do with weapons. + + There are wielded weapons, like maces and swords, and thrown + weapons, like arrows and spears. To hit monsters with a weapon, + you must wield it and attack them, or throw it at them. You can + simply elect to throw a spear. To shoot an arrow, you should + first wield a bow, then throw the arrow. Crossbows shoot cross- bow bolts. Slings hurl rocks and (other) stones (like gems). - Enchanted weapons have a "plus" (or "to hit enhancement" - which can be either positive or negative) that adds to your - chance to hit and the damage you do to a monster. The only way + Enchanted weapons have a "plus" (or "to hit enhancement" + which can be either positive or negative) that adds to your + chance to hit and the damage you do to a monster. The only way to determine a weapon's enchantment is to have it magically iden- - tified somehow. Most weapons are subject to some type of damage + tified somehow. Most weapons are subject to some type of damage like rust. Such "erosion" damage can be repaired. - The chance that an attack will successfully hit a monster, - and the amount of damage such a hit will do, depends upon many - factors. Among them are: type of weapon, quality of weapon (en- + The chance that an attack will successfully hit a monster, + and the amount of damage such a hit will do, depends upon many + factors. Among them are: type of weapon, quality of weapon (en- chantment and/or erosion), experience level, strength, dexterity, - encumbrance, and proficiency (see below). The monster's armor + encumbrance, and proficiency (see below). The monster's armor class -- a general defense rating, not necessarily due to wearing of armor -- is a factor too; also, some monsters are particularly vulnerable to certain types of weapons. - Many weapons can be wielded in one hand; some require both - hands. When wielding a two-handed weapon, you can not wear a - shield, and vice versa. When wielding a one-handed weapon, you - can have another weapon ready to use by setting things up with - the `x' command, which exchanges your primary (the one being - wielded) and alternate weapons. And if you have proficiency in - the "two weapon combat" skill, you may wield both weapons simul- + Many weapons can be wielded in one hand; some require both + hands. When wielding a two-handed weapon, you can not wear a + shield, and vice versa. When wielding a one-handed weapon, you + can have another weapon ready to use by setting things up with + the `x' command, which exchanges your primary (the one being + wielded) and alternate weapons. And if you have proficiency in + the "two weapon combat" skill, you may wield both weapons simul- taneously as primary and secondary; use the `X' command to engage - or disengage that. Only some types of characters (barbarians, + or disengage that. Only some types of characters (barbarians, for instance) have the necessary skill available. Even with that - skill, using two weapons at once incurs a penalty in the chance + skill, using two weapons at once incurs a penalty in the chance to hit your target compared to using just one weapon at a time. - There might be times when you'd rather not wield any weapon - at all. To accomplish that, wield `-', or else use the `A' com- - mand which allows you to unwield the current weapon in addition + There might be times when you'd rather not wield any weapon + at all. To accomplish that, wield `-', or else use the `A' com- + mand which allows you to unwield the current weapon in addition to taking off other worn items. - Those of you in the audience who are AD&D players, be aware - that each weapon which existed in AD&D does roughly the same dam- - age to monsters in NetHack. Some of the more obscure weapons - (such as the aklys, lucern hammer, and bec-de-corbin) are defined - in an appendix to Unearthed Arcana, an AD&D supplement. - The commands to use weapons are `w' (wield), `t' (throw), - `f' (fire, an alternate way of throwing), `Q' (quiver), `x' (ex- - change), `X' (twoweapon), and "#enhance" (see below). - - 7.2.1. Throwing and shooting - - You can throw just about anything via the `t' command. It - will prompt for the item to throw; picking `?' will list things - in your inventory which are considered likely to be thrown, or - picking `*' will list your entire inventory. After you've chosen - what to throw, you will be prompted for a direction rather than - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -2314,63 +2314,63 @@ - for a specific target. The distance something can be thrown de- + Those of you in the audience who are AD&D players, be aware + that each weapon which existed in AD&D does roughly the same dam- + age to monsters in NetHack. Some of the more obscure weapons + (such as the aklys, lucern hammer, and bec-de-corbin) are defined + in an appendix to Unearthed Arcana, an AD&D supplement. + + The commands to use weapons are `w' (wield), `t' (throw), + `f' (fire, an alternate way of throwing), `Q' (quiver), `x' (ex- + change), `X' (twoweapon), and "#enhance" (see below). + + 7.2.1. Throwing and shooting + + You can throw just about anything via the `t' command. It + will prompt for the item to throw; picking `?' will list things + in your inventory which are considered likely to be thrown, or + picking `*' will list your entire inventory. After you've chosen + what to throw, you will be prompted for a direction rather than + for a specific target. The distance something can be thrown de- pends mainly on the type of object and your strength. Arrows can - be thrown by hand, but can be thrown much farther and will be + be thrown by hand, but can be thrown much farther and will be more likely to hit when thrown while you are wielding a bow. - You can simplify the throwing operation by using the `Q' - command to select your preferred "missile", then using the `f' - command to throw it. You'll be prompted for a direction as - above, but you don't have to specify which item to throw each + You can simplify the throwing operation by using the `Q' + command to select your preferred "missile", then using the `f' + command to throw it. You'll be prompted for a direction as + above, but you don't have to specify which item to throw each time you use `f'. There is also an option, autoquiver, which has NetHack choose another item to automatically fill your quiver (or - quiver sack, or have at the ready) when the inventory slot used + quiver sack, or have at the ready) when the inventory slot used for `Q' runs out. - Some characters have the ability to fire a volley of multi- - ple items in a single turn. Knowing how to load several rounds + Some characters have the ability to fire a volley of multi- + ple items in a single turn. Knowing how to load several rounds of ammunition at once -- or hold several missiles in your hand -- - and still hit a target is not an easy task. Rangers are among - those who are adept at this task, as are those with a high level - of proficiency in the relevant weapon skill (in bow skill if - you're wielding one to shoot arrows, in crossbow skill if you're + and still hit a target is not an easy task. Rangers are among + those who are adept at this task, as are those with a high level + of proficiency in the relevant weapon skill (in bow skill if + you're wielding one to shoot arrows, in crossbow skill if you're wielding one to shoot bolts, or in sling skill if you're wielding one to shoot stones). The number of items that the character has - a chance to fire varies from turn to turn. You can explicitly - limit the number of shots by using a numeric prefix before the - `t' or `f' command. For example, "2f" (or "n2f" if using num- + a chance to fire varies from turn to turn. You can explicitly + limit the number of shots by using a numeric prefix before the + `t' or `f' command. For example, "2f" (or "n2f" if using num- ber_pad mode) would ensure that at most 2 arrows are shot even if - you could have fired 3. If you specify a larger number than - would have been shot ("4f" in this example), you'll just end up + you could have fired 3. If you specify a larger number than + would have been shot ("4f" in this example), you'll just end up shooting the same number (3, here) as if no limit had been speci- fied. Once the volley is in motion, all of the items will travel in the same direction; if the first ones kill a monster, the oth- ers can still continue beyond that spot. - 7.2.2. Weapon proficiency - - You will have varying degrees of skill in the weapons avail- - able. Weapon proficiency, or weapon skills, affect how well you - can use particular types of weapons, and you'll be able to im- - prove your skills as you progress through a game, depending on - your role, your experience level, and use of the weapons. - - For the purposes of proficiency, weapons have been divided - up into various groups such as daggers, broadswords, and - polearms. Each role has a limit on what level of proficiency a - character can achieve for each group. For instance, wizards can - become highly skilled in daggers or staves but not in swords or - bows. - - The "#enhance" extended command is used to review current - weapons proficiency (also spell proficiency) and to choose which - skill(s) to improve when you've used one or more skills enough to - become eligible to do so. The skill rankings are "none" (some- - times also referred to as "restricted", because you won't be able - NetHack 3.6 May 7, 2019 + + + + NetHack 3.7 December 18, 2019 @@ -2380,63 +2380,63 @@ - to advance), "unskilled", "basic", "skilled", and "expert". Re- + 7.2.2. Weapon proficiency + + You will have varying degrees of skill in the weapons avail- + able. Weapon proficiency, or weapon skills, affect how well you + can use particular types of weapons, and you'll be able to im- + prove your skills as you progress through a game, depending on + your role, your experience level, and use of the weapons. + + For the purposes of proficiency, weapons have been divided + up into various groups such as daggers, broadswords, and + polearms. Each role has a limit on what level of proficiency a + character can achieve for each group. For instance, wizards can + become highly skilled in daggers or staves but not in swords or + bows. + + The "#enhance" extended command is used to review current + weapons proficiency (also spell proficiency) and to choose which + skill(s) to improve when you've used one or more skills enough to + become eligible to do so. The skill rankings are "none" (some- + times also referred to as "restricted", because you won't be able + to advance), "unskilled", "basic", "skilled", and "expert". Re- stricted skills simply will not appear in the list shown by "#en- hance". (Divine intervention might unrestrict a particular skill, in which case it will start at unskilled and be limited to - basic.) Some characters can enhance their barehanded combat or + basic.) Some characters can enhance their barehanded combat or martial arts skill beyond expert to "master" or "grand master". Use of a weapon in which you're restricted or unskilled will incur a modest penalty in the chance to hit a monster and also in - the amount of damage done when you do hit; at basic level, there - is no penalty or bonus; at skilled level, you receive a modest - bonus in the chance to hit and amount of damage done; at expert - level, the bonus is higher. A successful hit has a chance to - boost your training towards the next skill level (unless you've - already reached the limit for this skill). Once such training - reaches the threshold for that next level, you'll be told that - you feel more confident in your skills. At that point you can - use "#enhance" to increase one or more skills. Such skills are - not increased automatically because there is a limit to your to- - tal overall skills, so you need to actively choose which skills + the amount of damage done when you do hit; at basic level, there + is no penalty or bonus; at skilled level, you receive a modest + bonus in the chance to hit and amount of damage done; at expert + level, the bonus is higher. A successful hit has a chance to + boost your training towards the next skill level (unless you've + already reached the limit for this skill). Once such training + reaches the threshold for that next level, you'll be told that + you feel more confident in your skills. At that point you can + use "#enhance" to increase one or more skills. Such skills are + not increased automatically because there is a limit to your to- + tal overall skills, so you need to actively choose which skills to enhance and which to ignore. 7.2.3. Two-Weapon combat Some characters can use two weapons at once. Setting things - up to do so can seem cumbersome but becomes second nature with + up to do so can seem cumbersome but becomes second nature with use. To wield two weapons, you need to use the "#twoweapon" com- - mand. But first you need to have a weapon in each hand. (Note - that your two weapons are not fully equal; the one in the hand - you normally wield with is considered primary and the other one + mand. But first you need to have a weapon in each hand. (Note + that your two weapons are not fully equal; the one in the hand + you normally wield with is considered primary and the other one is considered secondary. The most noticeable difference is after - you stop -- or before you begin, for that matter -- wielding two + you stop -- or before you begin, for that matter -- wielding two weapons at once. The primary is your wielded weapon and the sec- - ondary is just an item in your inventory that's been designated - as alternate weapon.) - - If your primary weapon is wielded but your off hand is empty - or has the wrong weapon, use the sequence `x', `w', `x' to first - swap your primary into your off hand, wield whatever you want as - secondary weapon, then swap them both back into the intended - hands. If your secondary or alternate weapon is correct but your - primary one is not, simply use `w' to wield the primary. Lastly, - if neither hand holds the correct weapon, use `w', `x', `w' to - first wield the intended secondary, swap it to off hand, and then - wield the primary. - - The whole process can be simplified via use of the push- - weapon option. When it is enabled, then using `w' to wield some- - thing causes the currently wielded weapon to become your alter- - nate weapon. So the sequence `w', `w' can be used to first wield - the weapon you intend to be secondary, and then wield the one you - want as primary which will push the first into secondary posi- - tion. + ondary is just an item in your inventory that's been designated - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -2446,8 +2446,28 @@ - When in two-weapon combat mode, using the `X' command tog- - gles back to single-weapon mode. Throwing or dropping either of + as alternate weapon.) + + If your primary weapon is wielded but your off hand is empty + or has the wrong weapon, use the sequence `x', `w', `x' to first + swap your primary into your off hand, wield whatever you want as + secondary weapon, then swap them both back into the intended + hands. If your secondary or alternate weapon is correct but your + primary one is not, simply use `w' to wield the primary. Lastly, + if neither hand holds the correct weapon, use `w', `x', `w' to + first wield the intended secondary, swap it to off hand, and then + wield the primary. + + The whole process can be simplified via use of the push- + weapon option. When it is enabled, then using `w' to wield some- + thing causes the currently wielded weapon to become your alter- + nate weapon. So the sequence `w', `w' can be used to first wield + the weapon you intend to be secondary, and then wield the one you + want as primary which will push the first into secondary posi- + tion. + + When in two-weapon combat mode, using the `X' command tog- + gles back to single-weapon mode. Throwing or dropping either of the weapons or having one of them be stolen or destroyed will al- so make you revert to single-weapon combat. @@ -2455,10 +2475,10 @@ Lots of unfriendly things lurk about; you need armor to pro- tect yourself from their blows. Some types of armor offer better - protection than others. Your armor class is a measure of this + protection than others. Your armor class is a measure of this protection. Armor class (AC) is measured as in AD&D, with 10 be- - ing the equivalent of no armor, and lower numbers meaning better - armor. Each suit of armor which exists in AD&D gives the same + ing the equivalent of no armor, and lower numbers meaning better + armor. Each suit of armor which exists in AD&D gives the same protection in NetHack. Here is an (incomplete) list of the armor classes provided by various suits of armor: dragon scale mail 1 @@ -2480,29 +2500,9 @@ leather jacket 9 no armor 10 - You can also wear other pieces of armor (for example hel- - mets, boots, shields, cloaks) to lower your armor class even fur- - ther, but you can only wear one item of each category (one suit - of armor, one cloak, one helmet, one shield, and so on) at a - time. - - If a piece of armor is enchanted, its armor protection will - be better (or worse) than normal, and its "plus" (or minus) will - subtract from your armor class. For example, a +1 chain mail - would give you better protection than normal chain mail, lowering - your armor class one unit further to 4. When you put on a piece - of armor, you immediately find out the armor class and any - "plusses" it provides. Cursed pieces of armor usually have nega- - tive enchantments (minuses) in addition to being unremovable. - - Many types of armor are subject to some kind of damage like - rust. Such damage can be repaired. Some types of armor may in- - hibit spell casting. - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -2512,63 +2512,63 @@ + You can also wear other pieces of armor (for example hel- + mets, boots, shields, cloaks) to lower your armor class even fur- + ther, but you can only wear one item of each category (one suit + of armor, one cloak, one helmet, one shield, and so on) at a + time. + + If a piece of armor is enchanted, its armor protection will + be better (or worse) than normal, and its "plus" (or minus) will + subtract from your armor class. For example, a +1 chain mail + would give you better protection than normal chain mail, lowering + your armor class one unit further to 4. When you put on a piece + of armor, you immediately find out the armor class and any + "plusses" it provides. Cursed pieces of armor usually have nega- + tive enchantments (minuses) in addition to being unremovable. + + Many types of armor are subject to some kind of damage like + rust. Such damage can be repaired. Some types of armor may in- + hibit spell casting. + The commands to use armor are `W' (wear) and `T' (take off). - The `A' command can also be used to take off armor as well as + The `A' command can also be used to take off armor as well as other worn items. 7.4. Food (`%') - Food is necessary to survive. If you go too long without - eating you will faint, and eventually die of starvation. Some - types of food will spoil, and become unhealthy to eat, if not + Food is necessary to survive. If you go too long without + eating you will faint, and eventually die of starvation. Some + types of food will spoil, and become unhealthy to eat, if not protected. Food stored in ice boxes or tins ("cans") will usual- - ly stay fresh, but ice boxes are heavy, and tins take a while to + ly stay fresh, but ice boxes are heavy, and tins take a while to open. When you kill monsters, they usually leave corpses which are - also "food." Many, but not all, of these are edible; some also - give you special powers when you eat them. A good rule of thumb + also "food." Many, but not all, of these are edible; some also + give you special powers when you eat them. A good rule of thumb is "you are what you eat." Some character roles and some monsters are vegetarian. Veg- - etarian monsters will typically never eat animal corpses, while - vegetarian players can, but with some rather unpleasant side-ef- + etarian monsters will typically never eat animal corpses, while + vegetarian players can, but with some rather unpleasant side-ef- fects. - You can name one food item after something you like to eat + You can name one food item after something you like to eat with the fruit option. The command to eat food is `e'. 7.5. Scrolls (`?') - Scrolls are labeled with various titles, probably chosen by + Scrolls are labeled with various titles, probably chosen by ancient wizards for their amusement value (for example "READ ME," - or "THANX MAUD" backwards). Scrolls disappear after you read + or "THANX MAUD" backwards). Scrolls disappear after you read them (except for blank ones, without magic spells on them). - One of the most useful of these is the scroll of identify, - which can be used to determine what another object is, whether it - is cursed or blessed, and how many uses it has left. Some ob- - jects of subtle enchantment are difficult to identify without - these. - - A mail daemon may run up and deliver mail to you as a scroll - of mail (on versions compiled with this feature). To use this - feature on versions where NetHack mail delivery is triggered by - electronic mail appearing in your system mailbox, you must let - NetHack know where to look for new mail by setting the "MAIL" en- - vironment variable to the file name of your mailbox. You may al- - so want to set the "MAILREADER" environment variable to the file - name of your favorite reader, so NetHack can shell to it when you - read the scroll. On versions of NetHack where mail is randomly - generated internal to the game, these environment variables are - ignored. You can disable the mail daemon by turning off the mail - option. - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -2578,47 +2578,78 @@ + One of the most useful of these is the scroll of identify, + which can be used to determine what another object is, whether it + is cursed or blessed, and how many uses it has left. Some ob- + jects of subtle enchantment are difficult to identify without + these. + + A mail daemon may run up and deliver mail to you as a scroll + of mail (on versions compiled with this feature). To use this + feature on versions where NetHack mail delivery is triggered by + electronic mail appearing in your system mailbox, you must let + NetHack know where to look for new mail by setting the "MAIL" en- + vironment variable to the file name of your mailbox. You may al- + so want to set the "MAILREADER" environment variable to the file + name of your favorite reader, so NetHack can shell to it when you + read the scroll. On versions of NetHack where mail is randomly + generated internal to the game, these environment variables are + ignored. You can disable the mail daemon by turning off the mail + option. + The command to read a scroll is `r'. 7.6. Potions (`!') - Potions are distinguished by the color of the liquid inside + Potions are distinguished by the color of the liquid inside the flask. They disappear after you quaff them. - Clear potions are potions of water. Sometimes these are + Clear potions are potions of water. Sometimes these are blessed or cursed, resulting in holy or unholy water. Holy water - is the bane of the undead, so potions of holy water are good - things to throw (`t') at them. It is also sometimes very useful + is the bane of the undead, so potions of holy water are good + things to throw (`t') at them. It is also sometimes very useful to dip ("#dip") an object into a potion. The command to drink a potion is `q' (quaff). 7.7. Wands (`/') - Wands usually have multiple magical charges. Some types of + Wands usually have multiple magical charges. Some types of wands require a direction in which to zap them. You can also zap - them at yourself (just give a `.' or `s' for the direction). Be - warned, however, for this is often unwise. Other types of wands - don't require a direction. The number of charges in a wand is + them at yourself (just give a `.' or `s' for the direction). Be + warned, however, for this is often unwise. Other types of wands + don't require a direction. The number of charges in a wand is random and decreases by one whenever you use it. - When the number of charges left in a wand becomes zero, at- - tempts to use the wand will usually result in nothing happening. + When the number of charges left in a wand becomes zero, at- + tempts to use the wand will usually result in nothing happening. Occasionally, however, it may be possible to squeeze the last few - mana points from an otherwise spent wand, destroying it in the - process. A wand may be recharged by using suitable magic, but - doing so runs the risk of causing it to explode. The chance for - such an explosion starts out very small and increases each time + mana points from an otherwise spent wand, destroying it in the + process. A wand may be recharged by using suitable magic, but + doing so runs the risk of causing it to explode. The chance for + such an explosion starts out very small and increases each time the wand is recharged. In a truly desperate situation, when your back is up against - the wall, you might decide to go for broke and break your wand. - This is not for the faint of heart. Doing so will almost cer- + the wall, you might decide to go for broke and break your wand. + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 41 + + + + This is not for the faint of heart. Doing so will almost cer- tainly cause a catastrophic release of magical energies. - When you have fully identified a particular wand, inventory - display will include additional information in parentheses: the - number of times it has been recharged followed by a colon and + When you have fully identified a particular wand, inventory + display will include additional information in parentheses: the + number of times it has been recharged followed by a colon and then by its current number of charges. A current charge count of -1 is a special case indicating that the wand has been cancelled. @@ -2631,19 +2662,6 @@ manent magic, unlike the usually fleeting effects of potions, scrolls, and wands. - - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 41 - - - Putting on a ring activates its magic. You can wear only two rings, one on each ring finger. @@ -2655,52 +2673,34 @@ 7.9. Spellbooks (`+') Spellbooks are tomes of mighty magic. When studied with the - `r' (read) command, they transfer to the reader the knowledge of - a spell (and therefore eventually become unreadable) -- unless - the attempt backfires. Reading a cursed spellbook or one with + `r' (read) command, they transfer to the reader the knowledge of + a spell (and therefore eventually become unreadable) -- unless + the attempt backfires. Reading a cursed spellbook or one with mystic runes beyond your ken can be harmful to your health! - A spell (even when learned) can also backfire when you cast - it. If you attempt to cast a spell well above your experience - level, or if you have little skill with the appropriate spell - type, or cast it at a time when your luck is particularly bad, - you can end up wasting both the energy and the time required in + A spell (even when learned) can also backfire when you cast + it. If you attempt to cast a spell well above your experience + level, or if you have little skill with the appropriate spell + type, or cast it at a time when your luck is particularly bad, + you can end up wasting both the energy and the time required in casting. - Casting a spell calls forth magical energies and focuses - them with your naked mind. Some of the magical energy released - comes from within you. Casting temporarily drains your magical + Casting a spell calls forth magical energies and focuses + them with your naked mind. Some of the magical energy released + comes from within you. Casting temporarily drains your magical power, which will slowly be recovered, and causes you to need ad- - ditional food. Casting of spells also requires practice. With - practice, your skill in each category of spell casting will im- - prove. Over time, however, your memory of each spell will dim, + ditional food. Casting of spells also requires practice. With + practice, your skill in each category of spell casting will im- + prove. Over time, however, your memory of each spell will dim, and you will need to relearn it. Some spells require a direction in which to cast them, simi- - lar to wands. To cast one at yourself, just give a `.' or `s' + lar to wands. To cast one at yourself, just give a `.' or `s' for the direction. A few spells require you to pick a target lo- - cation rather than just specify a particular direction. Other - spells don't require any direction or target. - - Just as weapons are divided into groups in which a character - can become proficient (to varying degrees), spells are similarly - grouped. Successfully casting a spell exercises its skill group; - using the "#enhance" command to advance a sufficiently exercised - skill will affect all spells within the group. Advanced skill - may increase the potency of spells, reduce their risk of failure - during casting attempts, and improve the accuracy of the estimate - for how much longer they will be retained in your memory. Skill - slots are shared with weapons skills. (See also the section on - "Weapon proficiency".) - - Casting a spell also requires flexible movement, and wearing - various types of armor may interfere with that. - - The command to read a spellbook is the same as for scrolls, - `r' (read). The `+' command lists each spell you know along with + cation rather than just specify a particular direction. Other - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -2710,29 +2710,47 @@ + spells don't require any direction or target. + + Just as weapons are divided into groups in which a character + can become proficient (to varying degrees), spells are similarly + grouped. Successfully casting a spell exercises its skill group; + using the "#enhance" command to advance a sufficiently exercised + skill will affect all spells within the group. Advanced skill + may increase the potency of spells, reduce their risk of failure + during casting attempts, and improve the accuracy of the estimate + for how much longer they will be retained in your memory. Skill + slots are shared with weapons skills. (See also the section on + "Weapon proficiency".) + + Casting a spell also requires flexible movement, and wearing + various types of armor may interfere with that. + + The command to read a spellbook is the same as for scrolls, + `r' (read). The `+' command lists each spell you know along with its level, skill category, chance of failure when casting, and an - estimate of how strongly it is remembered. The `Z' (cast) com- + estimate of how strongly it is remembered. The `Z' (cast) com- mand casts a spell. 7.10. Tools (`(') Tools are miscellaneous objects with various purposes. Some - tools have a limited number of uses, akin to wand charges. For - example, lamps burn out after a while. Other tools are contain- + tools have a limited number of uses, akin to wand charges. For + example, lamps burn out after a while. Other tools are contain- ers, which objects can be placed into or taken out of. The command to use a tool is `a' (apply). 7.10.1. Containers - You may encounter bags, boxes, and chests in your travels. - A tool of this sort can be opened with the "#loot" extended com- - mand when you are standing on top of it (that is, on the same - floor spot), or with the `a' (apply) command when you are carry- - ing it. However, chests are often locked, and are in any case - unwieldy objects. You must set one down before unlocking it by + You may encounter bags, boxes, and chests in your travels. + A tool of this sort can be opened with the "#loot" extended com- + mand when you are standing on top of it (that is, on the same + floor spot), or with the `a' (apply) command when you are carry- + ing it. However, chests are often locked, and are in any case + unwieldy objects. You must set one down before unlocking it by using a key or lock-picking tool with the `a' (apply) command, by - kicking it with the `^D' command, or by using a weapon to force + kicking it with the `^D' command, or by using a weapon to force the lock with the "#force" extended command. Some chests are trapped, causing nasty things to happen when @@ -2741,32 +2759,14 @@ 7.11. Amulets (`"') - Amulets are very similar to rings, and often more powerful. + Amulets are very similar to rings, and often more powerful. Like rings, amulets have various magical properties, some benefi- cial, some harmful, which are activated by putting them on. - Only one amulet may be worn at a time, around your neck. - - The commands to use amulets are the same as for rings, `P' - (put on) and `R' (remove). - - 7.12. Gems (`*') - - Some gems are valuable, and can be sold for a lot of gold. - They are also a far more efficient way of carrying your riches. - Valuable gems increase your score if you bring them with you when - you exit. - - Other small rocks are also categorized as gems, but they are - much less valuable. All rocks, however, can be used as projec- - tile weapons (if you have a sling). In the most desperate of - cases, you can still throw them by hand. - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -2776,63 +2776,63 @@ + Only one amulet may be worn at a time, around your neck. + + The commands to use amulets are the same as for rings, `P' + (put on) and `R' (remove). + + 7.12. Gems (`*') + + Some gems are valuable, and can be sold for a lot of gold. + They are also a far more efficient way of carrying your riches. + Valuable gems increase your score if you bring them with you when + you exit. + + Other small rocks are also categorized as gems, but they are + much less valuable. All rocks, however, can be used as projec- + tile weapons (if you have a sling). In the most desperate of + cases, you can still throw them by hand. + 7.13. Large rocks (``') - Statues and boulders are not particularly useful, and are - generally heavy. It is rumored that some statues are not what + Statues and boulders are not particularly useful, and are + generally heavy. It is rumored that some statues are not what they seem. - Very large humanoids (giants and their ilk) have been known + Very large humanoids (giants and their ilk) have been known to use boulders as weapons. - For some configurations of the program, statues are no - longer shown as ``' but by the letter representing the monster + For some configurations of the program, statues are no + longer shown as ``' but by the letter representing the monster they depict instead. 7.14. Gold (`$') - Gold adds to your score, and you can buy things in shops - with it. There are a number of monsters in the dungeon that may + Gold adds to your score, and you can buy things in shops + with it. There are a number of monsters in the dungeon that may be influenced by the amount of gold you are carrying (shopkeepers aside). 7.15. Persistence of Objects Normally, if you have seen an object at a particular map lo- - cation and move to another location where you can't directly see - that object any more, if will continue to be displayed on your - map. That remains the case even if it is not actually there any - more -- perhaps a monster has picked it up or it has rotted away - -- until you can see or feel that location again. One notable - exception is that if the object gets covered by the "remembered, - unseen monster" marker. When that marker is later removed after - you've verified that no monster is there, you will forget that - there was any object there regardless of whether the unseen mon- - ster actually took the object. If the object is still there, + cation and move to another location where you can't directly see + that object any more, if will continue to be displayed on your + map. That remains the case even if it is not actually there any + more -- perhaps a monster has picked it up or it has rotted away + -- until you can see or feel that location again. One notable + exception is that if the object gets covered by the "remembered, + unseen monster" marker. When that marker is later removed after + you've verified that no monster is there, you will forget that + there was any object there regardless of whether the unseen mon- + ster actually took the object. If the object is still there, then once you see or feel that location again you will re-discov- er the object and resume remembering it. - The situation is the same for a pile of objects, except that - only the top item of the pile is displayed. The hilite_pile op- - tion can be enabled in order to show an item differently when it - is the top one of a pile. - - 8. Conduct - - As if winning NetHack were not difficult enough, certain - players seek to challenge themselves by imposing restrictions on - the way they play the game. The game automatically tracks some - of these challenges, which can be checked at any time with the - #conduct command or at the end of the game. When you perform an - action which breaks a challenge, it will no longer be listed. - This gives players extra "bragging rights" for winning the game - with these challenges. Note that it is perfectly acceptable to - win the game without resorting to these restrictions and that it - is unusual for players to adhere to challenges the first time - they win the game. - NetHack 3.6 May 7, 2019 + + NetHack 3.7 December 18, 2019 @@ -2842,63 +2842,63 @@ - Several of the challenges are related to eating behavior. - The most difficult of these is the foodless challenge. Although + The situation is the same for a pile of objects, except that + only the top item of the pile is displayed. The hilite_pile op- + tion can be enabled in order to show an item differently when it + is the top one of a pile. + + 8. Conduct + + As if winning NetHack were not difficult enough, certain + players seek to challenge themselves by imposing restrictions on + the way they play the game. The game automatically tracks some + of these challenges, which can be checked at any time with the + #conduct command or at the end of the game. When you perform an + action which breaks a challenge, it will no longer be listed. + This gives players extra "bragging rights" for winning the game + with these challenges. Note that it is perfectly acceptable to + win the game without resorting to these restrictions and that it + is unusual for players to adhere to challenges the first time + they win the game. + + Several of the challenges are related to eating behavior. + The most difficult of these is the foodless challenge. Although creatures can survive long periods of time without food, there is - a physiological need for water; thus there is no restriction on - drinking beverages, even if they provide some minor food bene- - fits. Calling upon your god for help with starvation does not + a physiological need for water; thus there is no restriction on + drinking beverages, even if they provide some minor food bene- + fits. Calling upon your god for help with starvation does not violate any food challenges either. - A strict vegan diet is one which avoids any food derived + A strict vegan diet is one which avoids any food derived from animals. The primary source of nutrition is fruits and veg- etables. The corpses and tins of blobs (`b'), jellies (`j'), and - fungi (`F') are also considered to be vegetable matter. Certain - human food is prepared without animal products; namely, lembas - wafers, cram rations, food rations (gunyoki), K-rations, and C- - rations. Metal or another normally indigestible material eaten + fungi (`F') are also considered to be vegetable matter. Certain + human food is prepared without animal products; namely, lembas + wafers, cram rations, food rations (gunyoki), K-rations, and C- + rations. Metal or another normally indigestible material eaten while polymorphed into a creature that can digest it is also con- - sidered vegan food. Note however that eating such items still + sidered vegan food. Note however that eating such items still counts against foodless conduct. - Vegetarians do not eat animals; however, they are less se- - lective about eating animal byproducts than vegans. In addition + Vegetarians do not eat animals; however, they are less se- + lective about eating animal byproducts than vegans. In addition to the vegan items listed above, they may eat any kind of pudding (`P') other than the black puddings, eggs and food made from eggs - (fortune cookies and pancakes), food made with milk (cream pies + (fortune cookies and pancakes), food made with milk (cream pies and candy bars), and lumps of royal jelly. Monks are expected to observe a vegetarian diet. - Eating any kind of meat violates the vegetarian, vegan, and - foodless conducts. This includes tripe rations, the corpses or - tins of any monsters not mentioned above, and the various other - chunks of meat found in the dungeon. Swallowing and digesting a + Eating any kind of meat violates the vegetarian, vegan, and + foodless conducts. This includes tripe rations, the corpses or + tins of any monsters not mentioned above, and the various other + chunks of meat found in the dungeon. Swallowing and digesting a monster while polymorphed is treated as if you ate the creature's - corpse. Eating leather, dragon hide, or bone items while poly- - morphed into a creature that can digest it, or eating monster + corpse. Eating leather, dragon hide, or bone items while poly- + morphed into a creature that can digest it, or eating monster brains while polymorphed into a mind flayer, is considered eating - an animal, although wax is only an animal byproduct. - - Regardless of conduct, there will be some items which are - indigestible, and others which are hazardous to eat. Using a - swallow-and-digest attack against a monster is equivalent to eat- - ing the monster's corpse. Please note that the term "vegan" is - used here only in the context of diet. You are still free to - choose not to use or wear items derived from animals (e.g. - leather, dragon hide, bone, horns, coral), but the game will not - keep track of this for you. Also note that "milky" potions may - be a translucent white, but they do not contain milk, so they are - compatible with a vegan diet. Slime molds or player-defined - "fruits", although they could be anything from "cherries" to - "pork chops", are also assumed to be vegan. - - An atheist is one who rejects religion. This means that you - cannot #pray, #offer sacrifices to any god, #turn undead, or - #chat with a priest. Particularly selective readers may argue - that playing Monk or Priest characters should violate this - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -2908,63 +2908,63 @@ - conduct; that is a choice left to the player. Offering the - Amulet of Yendor to your god is necessary to win the game and is - not counted against this conduct. You are also not penalized for - being spoken to by an angry god, priest(ess), or other religious + an animal, although wax is only an animal byproduct. + + Regardless of conduct, there will be some items which are + indigestible, and others which are hazardous to eat. Using a + swallow-and-digest attack against a monster is equivalent to eat- + ing the monster's corpse. Please note that the term "vegan" is + used here only in the context of diet. You are still free to + choose not to use or wear items derived from animals (e.g. + leather, dragon hide, bone, horns, coral), but the game will not + keep track of this for you. Also note that "milky" potions may + be a translucent white, but they do not contain milk, so they are + compatible with a vegan diet. Slime molds or player-defined + "fruits", although they could be anything from "cherries" to + "pork chops", are also assumed to be vegan. + + An atheist is one who rejects religion. This means that you + cannot #pray, #offer sacrifices to any god, #turn undead, or + #chat with a priest. Particularly selective readers may argue + that playing Monk or Priest characters should violate this con- + duct; that is a choice left to the player. Offering the Amulet + of Yendor to your god is necessary to win the game and is not + counted against this conduct. You are also not penalized for be- + ing spoken to by an angry god, priest(ess), or other religious figure; a true atheist would hear the words but attach no special meaning to them. - Most players fight with a wielded weapon (or tool intended + Most players fight with a wielded weapon (or tool intended to be wielded as a weapon). Another challenge is to win the game - without using such a wielded weapon. You are still permitted to - throw, fire, and kick weapons; use a wand, spell, or other type + without using such a wielded weapon. You are still permitted to + throw, fire, and kick weapons; use a wand, spell, or other type of item; or fight with your hands and feet. - In NetHack, a pacifist refuses to cause the death of any - other monster (i.e. if you would get experience for the death). - This is a particularly difficult challenge, although it is still + In NetHack, a pacifist refuses to cause the death of any + other monster (i.e. if you would get experience for the death). + This is a particularly difficult challenge, although it is still possible to gain experience by other means. An illiterate character cannot read or write. This includes - reading a scroll, spellbook, fortune cookie message, or t-shirt; + reading a scroll, spellbook, fortune cookie message, or t-shirt; writing a scroll; or making an engraving of anything other than a - single "X" (the traditional signature of an illiterate person). + single "X" (the traditional signature of an illiterate person). Reading an engraving, or any item that is absolutely necessary to - win the game, is not counted against this conduct. The identity - of scrolls and spellbooks (and knowledge of spells) in your - starting inventory is assumed to be learned from your teachers + win the game, is not counted against this conduct. The identity + of scrolls and spellbooks (and knowledge of spells) in your + starting inventory is assumed to be learned from your teachers prior to the start of the game and isn't counted. - There are several other challenges tracked by the game. It + There are several other challenges tracked by the game. It is possible to eliminate one or more species of monsters by geno- - cide; playing without this feature is considered a challenge. + cide; playing without this feature is considered a challenge. When the game offers you an opportunity to genocide monsters, you - may respond with the monster type "none" if you want to decline. - You can change the form of an item into another item of the same - type ("polypiling") or the form of your own body into another - creature ("polyself") by wand, spell, or potion of polymorph; - avoiding these effects are each considered challenges. Polymor- - phing monsters, including pets, does not break either of these - challenges. Finally, you may sometimes receive wishes; a game - without an attempt to wish for any items is a challenge, as is a - game without wishing for an artifact (even if the artifact imme- - diately disappears). When the game offers you an opportunity to - make a wish for an item, you may choose "nothing" if you want to - decline. - - 9. Options - - Due to variations in personal tastes and conceptions of how - NetHack should do things, there are options you can set to change - how NetHack behaves. + may respond with the monster type "none" if you want to decline. + You can change the form of an item into another item of the same + type ("polypiling") or the form of your own body into another - - - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -2974,39 +2974,80 @@ + creature ("polyself") by wand, spell, or potion of polymorph; + avoiding these effects are each considered challenges. Polymor- + phing monsters, including pets, does not break either of these + challenges. Finally, you may sometimes receive wishes; a game + without an attempt to wish for any items is a challenge, as is a + game without wishing for an artifact (even if the artifact imme- + diately disappears). When the game offers you an opportunity to + make a wish for an item, you may choose "nothing" if you want to + decline. + + 9. Options + + Due to variations in personal tastes and conceptions of how + NetHack should do things, there are options you can set to change + how NetHack behaves. + 9.1. Setting the options - Options may be set in a number of ways. Within the game, + Options may be set in a number of ways. Within the game, the `O' command allows you to view all options and change most of - them. You can also set options automatically by placing them in - a configuration file, or in the NETHACKOPTIONS environment vari- + them. You can also set options automatically by placing them in + a configuration file, or in the NETHACKOPTIONS environment vari- able. Some versions of NetHack also have front-end programs that - allow you to set options before starting the game or a global + allow you to set options before starting the game or a global configuration for system administrators. 9.2. Using a configuration file The default name of the configuration file varies on differ- - ent operating systems. On MS-DOS and Windows, it is - "defaults.nh" in the same folder as nethack.exe or nethackW.exe. - On UNIX, Linux, and Mac OS X it is ".nethackrc" in the user's - home directory. The file may not exist, but it is a normal ASCII - text file and can be created with any text editor. + ent operating systems. - Any line in the configuration file starting with `#' is + On UNIX, Linux, and Mac OS X it is ".nethackrc" in the us- + er's home directory. The file may not exist, but it is a normal + ASCII text file and can be created with any text editor. + + On Windows, it is ".nethackrc" in the folder "\%USERPRO- + FILE%\NetHack\3.6". The file may not exist, but it is a normal + ASCII text file can can be created with any text editor. After + running NetHack for the first time, you should find a default + template for the configuration file named ".nethackrc.template" + in "\%USERPROFILE%\NetHack\3.6". If you had not created the con- + figuration file, NetHack will create the configuration file for + you using the default template file. + + On MS-DOS, it is "defaults.nh" in the same folder as + nethack.exe. + + Any line in the configuration file starting with `#' is treated as a comment. Empty lines are ignored. - Any line beginning with `[' and ending in `]' is considered - a section marker. The text between the square brackets is the - section name. Lines after a section marker belong to that sec- - tion, and are ignored unless a CHOOSE statement was used to se- - lect that section. Section names are case insensitive. + Any line beginning with `[' and ending in `]' is considered + a section marker. The text between the square brackets is the + section name. Lines after a section marker belong to that sec- + tion, and are ignored unless a CHOOSE statement was used to - You can use different configuration statements in the file, + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 47 + + + + select that section. Section names are case insensitive. + + You can use different configuration statements in the file, some of which can be used multiple times. In general, the state- ments are written in capital letters, followed by an equals sign, - followed by settings particular to that statement. Here is a - list of allowed statements: + followed by settings particular to that statement. + + Here is a list of allowed statements: OPTIONS There are two types of options, boolean and compound options. @@ -3019,28 +3060,16 @@ a single OPTIONS statement. (Comma separated options are pro- cessed from right to left.) - Example: + Example: - OPTIONS=dogname:Fido - OPTIONS=!legacy,autopickup,pickup_types:$"=/!?+ + OPTIONS=dogname:Fido + OPTIONS=!legacy,autopickup,pickup_types:$"=/!?+ HACKDIR Default location of files NetHack needs. On Windows HACKDIR defaults to the location of the NetHack.exe or NetHackw.exe - file so setting HACKDIR to override that is not usually - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 47 - - - - necessary or recommended. + file so setting HACKDIR to override that is not usually neces- + sary or recommended. LEVELDIR The location that in-progress level files are stored. Defaults @@ -3065,13 +3094,25 @@ AUTOCOMPLETE Enable or disable an extended command autocompletion. Autocom- pletion has no effect for the X11 windowport. You can specify + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 48 + + + multiple autocompletions. To enable autocompletion, list the extended command. Prefix the command with "!" to disable the autocompletion for that command. - Example: + Example: - AUTOCOMPLETE=zap,!annotate + AUTOCOMPLETE=zap,!annotate AUTOPICKUP_EXCEPTION Set exceptions to the pickup_types option. See the "Configur- @@ -3083,86 +3124,45 @@ Format is key followed by the command, separated by a colon. See the "Changing Key Bindings" section for more information. - Example: + Example: - BIND=^X:getpos.autodescribe + BIND=^X:getpos.autodescribe CHOOSE Chooses at random one of the comma-separated parameters as an active section name. Lines in other sections are ignored. - Example: + Example: - - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 48 - - - - OPTIONS=color - CHOOSE=char A,char B - [char A] - OPTIONS=role:arc,race:dwa,align:law,gender:fem - [char B] - OPTIONS=role:wiz,race:elf,align:cha,gender:mal - - MSGTYPE - Change the way messages are shown in the top status line. See - the "Configuring Message Types" section. + OPTIONS=color + CHOOSE=char A,char B + [char A] + OPTIONS=role:arc,race:dwa,align:law,gender:fem + [char B] + OPTIONS=role:wiz,race:elf,align:cha,gender:mal MENUCOLOR Highlight menu lines with different colors. See the "Configur- ing Menu Colors" section. - SYMBOLS - Override one or more symbols in the symbols files. See the - "Modifying NetHack Symbols" section. + MSGTYPE + Change the way messages are shown in the top status line. See + the "Configuring Message Types" section. - Example: - - SYMBOLS=S_boulder:0 - - WIZKIT - Debug mode only: extra items to add to initial inventory. - Value is the name of a text file containing a list of item - names, one per line, up to a maximum of 128 lines. Each line - is processed by the function that handles wishing. - - Example: - - WIZKIT=~/wizkit.txt - - SOUNDDIR - Define the directory that contains the sound files. See the - "Configuring User Sounds" section. + ROGUESYMBOLS + Custom symbols for for the rogue level's symbol set. See SYM- + BOLS below. SOUND Define a sound mapping. See the "Configuring User Sounds" sec- tion. - Here is a short example of config file contents: + SOUNDDIR + Define the directory that contains the sound files. See the + "Configuring User Sounds" section. - - - - - - - - - - - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -3172,18 +3172,47 @@ - # Set your character's role, race, gender, and alignment. - OPTIONS=role:Valkyrie, race:Human, gender:female, align:lawful - # - # Turn on autopickup, set automatically picked up object types - OPTIONS=autopickup,pickup_types:$"=/!?+ - # Show colored text if possible - OPTIONS=color - # Show lit corridors differently - OPTIONS=lit_corridor - # - # No startup splash screen. Windows GUI only. - OPTIONS=!splash_screen + SYMBOLS + Override one or more symbols in the symbol set used for all + dungeon levels except for the special rogue level. See the + "Modifying NetHack Symbols" section. + + Example: + + # replace small punctuation (tick marks) with digits + SYMBOLS=S_boulder:0,S_golem:7 + + WIZKIT + Debug mode only: extra items to add to initial inventory. + Value is the name of a text file containing a list of item + names, one per line, up to a maximum of 128 lines. Each line + is processed by the function that handles wishing. + + Example: + + WIZKIT=~/wizkit.txt + + + + Here is an example of configuration file contents: + + # Set your character's role, race, gender, and alignment. + OPTIONS=role:Valkyrie, race:Human, gender:female, align:lawful + # + # Turn on autopickup, set automatically picked up object types + OPTIONS=autopickup,pickup_types:$"=/!?+ + # + # Map customization + OPTIONS=color # Display things in color if possible + OPTIONS=lit_corridor # Show lit corridors differently + OPTIONS=hilite_pet,hilite_pile + # Replace small punctuation (tick marks) with digits + SYMBOLS=S_boulder:0,S_golem:7 + # + # No startup splash screen. Windows GUI only. + OPTIONS=!splash_screen + + 9.3. Using the NETHACKOPTIONS environment variable @@ -3196,6 +3225,19 @@ equals sign, and then the value of the string. The value is ter- minated by the next comma or the end of string. + + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 50 + + + For example, to set up an environment variable so that color is on, legacy is off, character name is set to "Blue Meanie", and named fruit is set to "lime", you would enter the command @@ -3223,21 +3265,6 @@ as a file name. If it does start with `/', the at-sign is op- tional. - - - - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 50 - - - 9.4. Customization options Here are explanations of what the various options do. Char- @@ -3266,35 +3293,8 @@ get a location on the map (default true). The whatis_coord op- tion controls whether the description includes map coordinates. - autodig - Automatically dig if you are wielding a digging tool and moving - into a place that can be dug (default false). Persistent. - autoopen - Walking into a door attempts to open it (default true). Persis- - tent. - - autopickup - Automatically pick up things onto which you move (default on). - Persistent. See pickup_types to refine the behavior. - - autoquiver - This option controls what happens when you attempt the `f' - (fire) command when nothing is quivered or readied (default - false). When true, the computer will fill your quiver or - quiver sack or make ready some suitable weapon. Note that it - will not take into account the blessed/cursed status, enchant- - ment, damage, or quality of the weapon; you are free to manual- - ly fill your quiver or quiver sack or make ready with the `Q' - command instead. If no weapon is found or the option is false, - the `t' (throw) command is executed instead. Persistent. - - blind - Start the character permanently blind (default false). Persis- - tent. - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -3304,45 +3304,83 @@ + autodig + Automatically dig if you are wielding a digging tool and moving + into a place that can be dug (default false). Persistent. + + autoopen + Walking into a door attempts to open it (default true). Persis- + tent. + + autopickup + Automatically pick up things onto which you move (default on). + Persistent. See pickup_types to refine the behavior. + + autoquiver + This option controls what happens when you attempt the `f' + (fire) command when nothing is quivered or readied (default + false). When true, the computer will fill your quiver or + quiver sack or make ready some suitable weapon. Note that it + will not take into account the blessed/cursed status, enchant- + ment, damage, or quality of the weapon; you are free to manual- + ly fill your quiver or quiver sack or make ready with the `Q' + command instead. If no weapon is found or the option is false, + the `t' (throw) command is executed instead. Persistent. + + blind + Start the character permanently blind (default false). Persis- + tent. + bones - Allow saving and loading bones files (default true). Persis- + Allow saving and loading bones files (default true). Persis- tent. boulder - Set the character used to display boulders (default is the + Set the character used to display boulders (default is the "large rock" class symbol, ``'). catname - Name your starting cat (for example "catname:Morris"). Cannot + Name your starting cat (for example "catname:Morris"). Cannot be set with the `O' command. character - Synonym for "role" to pick the type of your character (for ex- + Synonym for "role" to pick the type of your character (for ex- ample "character:Monk"). See role for more details. checkpoint - Save game state after each level change, for possible recovery + Save game state after each level change, for possible recovery after program crash (default on). Persistent. checkspace - Check free disk space before writing files to disk (default - on). You may have to turn this off if you have more than 2 GB - free space on the partition used for your save and level files - (because too much space might overflow the calculation and end + Check free disk space before writing files to disk (default + on). You may have to turn this off if you have more than 2 GB + free space on the partition used for your save and level files + (because too much space might overflow the calculation and end up looking like insufficient space). Only applies when MFLOPPY was defined during compilation. + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 52 + + + clicklook - Allows looking at things on the screen by navigating the mouse + Allows looking at things on the screen by navigating the mouse over them and clicking the right mouse button (default off). cmdassist - Have the game provide some additional command assistance for - new players if it detects some anticipated mistakes (default + Have the game provide some additional command assistance for + new players if it detects some anticipated mistakes (default on). confirm - Have user confirm attacks on pets, shopkeepers, and other + Have user confirm attacks on pets, shopkeepers, and other peaceable creatures (default on). Persistent. dark_room @@ -3355,21 +3393,6 @@ sponse of `n' for each candidate). Persistent. The possibili- ties are: - - - - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 52 - - - i - disclose your inventory; a - disclose your attributes; v - summarize monsters that have been vanquished; @@ -3402,13 +3425,24 @@ Order of the disclosure categories does not matter, program display for end-of-game disclosure follows a set sequence. + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 53 + + + (for example "disclose:yi na +v -g o") The example sets inven- tory to prompt and default to yes, attributes to prompt and de- fault to no, vanquished to disclose without prompting, genocid- ed to not disclose and not prompt, conduct to implicitly prompt - and default to no, and overview to disclose without prompting. + and default to no, and overview to disclose without prompting. - Note that the vanquished monsters list includes all monsters + Note that the vanquished monsters list includes all monsters killed by traps and each other as well as by you. And the dun- geon overview shows all levels you had visited but does not re- veal things about them that you hadn't discovered. @@ -3418,23 +3452,10 @@ set with the `O' command. extmenu - Changes the extended commands interface to pop-up a menu of + Changes the extended commands interface to pop-up a menu of available commands. It is keystroke compatible with the tradi- - tional interface except that it does not require that you hit - Enter. It is implemented for the tty interface (default off). - - - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 53 - - + tional interface except that it does not require that you hit + Enter. It is implemented for the tty interface (default off). For the X11 interface, which always uses a menu for choosing an extended command, it controls whether the menu shows all avail- @@ -3469,6 +3490,18 @@ option will take precedence. The default is to randomly pick an appropriate gender. If you prefix the value with `!' or "no", you will exclude that gender from being picked randomly. + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 54 + + + Cannot be set with the `O' command. Persistent. goldX @@ -3490,18 +3523,6 @@ herecmd_menu When using a windowport that supports mouse and clicking on yourself or next to you, show a menu of possible actions for - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 54 - - - the location. Same as "#herecmdmenu" and "#therecmdmenu" com- mands. @@ -3536,29 +3557,8 @@ Ignore interrupt signals, including breaks (default off). Per- sistent. - implicit_uncursed - Omit "uncursed" from inventory lists, if possible (default on). - legacy - Display an introductory message when starting the game (default - on). Persistent. - - lit_corridor - Show corridor squares seen by night vision or a light source - held by your character as lit (default off). Persistent. - - lootabc - When using a menu to interact with a container, use the old - `a', `b', and `c' keyboard shortcuts rather than the mnemonics - `o', `i', and `b' (default off). Persistent. - - mail - Enable mail delivery during the game (default on). Persistent. - - - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -3568,6 +3568,25 @@ + implicit_uncursed + Omit "uncursed" from inventory lists, if possible (default on). + + legacy + Display an introductory message when starting the game (default + on). Persistent. + + lit_corridor + Show corridor squares seen by night vision or a light source + held by your character as lit (default off). Persistent. + + lootabc + When using a menu to interact with a container, use the old + `a', `b', and `c' keyboard shortcuts rather than the mnemonics + `o', `i', and `b' (default off). Persistent. + + mail + Enable mail delivery during the game (default on). Persistent. + male An obsolete synonym for "gender:male". Cannot be set with the `O' command. @@ -3600,31 +3619,12 @@ Implemented by the Amiga, Gem, X11 and tty ports. Default `-'. menu_deselect_page - Menu character accelerator to deselect all items on this page - of a menu. Implemented by the Amiga, Gem and tty ports. De- + Menu character accelerator to deselect all items on this page + of a menu. Implemented by the Amiga, Gem and tty ports. De- fault `\'. - menu_first_page - Menu character accelerator to jump to the first page in a menu. - Implemented by the Amiga, Gem and tty ports. Default `^'. - menu_headings - Controls how the headings in a menu are highlighted. Values - are "none", "bold", "dim", "underline", "blink", or "inverse". - Not all ports can actually display all types. - - menu_invert_all - Menu character accelerator to invert all items in a menu. Im- - plemented by the Amiga, Gem, X11 and tty ports. Default `@'. - - menu_invert_page - Menu character accelerator to invert all items on this page of - a menu. Implemented by the Amiga, Gem and tty ports. Default - `~'. - - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -3634,21 +3634,39 @@ + menu_first_page + Menu character accelerator to jump to the first page in a menu. + Implemented by the Amiga, Gem and tty ports. Default `^'. + + menu_headings + Controls how the headings in a menu are highlighted. Values + are "none", "bold", "dim", "underline", "blink", or "inverse". + Not all ports can actually display all types. + + menu_invert_all + Menu character accelerator to invert all items in a menu. Im- + plemented by the Amiga, Gem, X11 and tty ports. Default `@'. + + menu_invert_page + Menu character accelerator to invert all items on this page of + a menu. Implemented by the Amiga, Gem and tty ports. Default + `~'. + menu_last_page - Menu character accelerator to jump to the last page in a menu. + Menu character accelerator to jump to the last page in a menu. Implemented by the Amiga, Gem and tty ports. Default `|'. menu_next_page - Menu character accelerator to goto the next menu page. Imple- + Menu character accelerator to goto the next menu page. Imple- mented by the Amiga, Gem and tty ports. Default `>'. menu_objsyms - Show object symbols in menu headings in menus where the object + Show object symbols in menu headings in menus where the object symbols act as menu accelerators (default off). menu_overlay - Do not clear the screen before drawing menus, and align menus - to the right edge of the screen. Only for the tty port. (de- + Do not clear the screen before drawing menus, and align menus + to the right edge of the screen. Only for the tty port. (de- fault on) menu_previous_page @@ -3656,41 +3674,23 @@ plemented by the Amiga, Gem and tty ports. Default `<'. menu_search - Menu character accelerator to search for a menu item. Imple- + Menu character accelerator to search for a menu item. Imple- mented by the Amiga, Gem, X11 and tty ports. Default `:'. menu_select_all - Menu character accelerator to select all items in a menu. Im- + Menu character accelerator to select all items in a menu. Im- plemented by the Amiga, Gem, X11 and tty ports. Default `.'. menu_select_page - Menu character accelerator to select all items on this page of - a menu. Implemented by the Amiga, Gem and tty ports. Default + Menu character accelerator to select all items on this page of + a menu. Implemented by the Amiga, Gem and tty ports. Default `,'. monpolycontrol Prompt for new form whenever any monster changes shape (default - off). Debug mode only. - - mouse_support - Allow use of the mouse for input and travel. Valid settings - are: - - 0 - disabled - 1 - enabled and make OS adjustments to support mouse use in the game - 2 - like 1 but does not make any OS adjustments - - Omitting a value is the same as specifying 1 and negating - mouse_support is the same as specifying 0. - - msghistory - The number of top line messages to keep (and be able to recall - with `^P') (default 20). Cannot be set with the `O' command. - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -3700,10 +3700,27 @@ + off). Debug mode only. + + mouse_support + Allow use of the mouse for input and travel. Valid settings + are: + + 0 - disabled + 1 - enabled and make OS adjustments to support mouse use + 2 - like 1 but does not make any OS adjustments + + Omitting a value is the same as specifying 1 and negating + mouse_support is the same as specifying 0. + + msghistory + The number of top line messages to keep (and be able to recall + with `^P') (default 20). Cannot be set with the `O' command. + msg_window - Allows you to change the way recalled messages are displayed. - Currently it is only supported for tty (all four choices) and - for curses (`f' and `r' choices, default `r'). The possible + Allows you to change the way recalled messages are displayed. + Currently it is only supported for tty (all four choices) and + for curses (`f' and `r' choices, default `r'). The possible values are: s - single message (default; only choice prior to 3.4.0); @@ -3711,16 +3728,16 @@ f - full window, oldest message first; r - full window reversed, newest message first. - For backward compatibility, no value needs to be specified - (which defaults to "full"), or it can be negated (which + For backward compatibility, no value needs to be specified + (which defaults to "full"), or it can be negated (which defaults to "single"). name - Set your character's name (defaults to your user name). You - can also set your character's role by appending a dash and one + Set your character's name (defaults to your user name). You + can also set your character's role by appending a dash and one or more letters of the role (that is, by suffixing one of -A -B - -C -H -K -M -P -Ra -Ro -S -T -V -W). If -@ is used for the - role, then a random one will be automatically chosen. Cannot + -C -H -K -M -P -Ra -Ro -S -T -V -W). If -@ is used for the + role, then a random one will be automatically chosen. Cannot be set with the `O' command. news @@ -3738,6 +3755,17 @@ Use digit keys instead of letters to move (default 0 or off). Valid settings are: + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 58 + + + 0 - move by letters; "yuhjklbn" 1 - move by numbers; digit `5' acts as `G' movement prefix 2 - like 1 but `5' works as `g' prefix instead of as `G' @@ -3754,18 +3782,6 @@ and `z' keys swapped.) When moving by numbers, to enter a count prefix for those commands which accept one (such as "12s" to search twelve times), precede it with the letter `n' - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 58 - - - ("n12s"). packorder @@ -3794,35 +3810,19 @@ ing a peaceful monster; wand-break - require "yes" rather than `y' to confirm breaking a wand; + eating - require "yes" rather than `y' to confirm whether + to continue eating; Were-change - require "yes" rather than `y' to confirm changing - form due to lycanthropy when hero has polymorph + form due to lycanthropy when hero has polymorph control; - pray - require `y' to confirm an attempt to pray rather + pray - require `y' to confirm an attempt to pray rather than immediately praying; on by default; - Remove - require selection from inventory for `R' and `T' - commands even when wearing just one applicable + Remove - require selection from inventory for `R' and `T' + commands even when wearing just one applicable item. - all - turn on all of the above. - - By default, the pray choice is enabled, the others disabled. - To disable it without setting any of the other choices, use - "paranoid_confirmation:none". To keep it enabled while setting - any of the others, include it in the list, such as "para- - noid_confirmation:attack pray Remove". - - perm_invent - If true, always display your current inventory in a window. - This only makes sense for windowing system interfaces that im- - plement this feature. - - petattr - Specifies one or more text highlighting attributes to use when - showing pets on the map. Effectively a superset of the - hilite_pet boolean option. Curses interface only; value is one - or more of the following letters. - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -3832,6 +3832,25 @@ + all - turn on all of the above. + + By default, the pray choice is enabled, the others disabled. + To disable it without setting any of the other choices, use + "paranoid_confirmation:none". To keep it enabled while setting + any of the others, include it in the list, such as "para- + noid_confirmation:attack pray Remove". + + perm_invent + If true, always display your current inventory in a window. + This only makes sense for windowing system interfaces that im- + plement this feature. + + petattr + Specifies one or more text highlighting attributes to use when + showing pets on the map. Effectively a superset of the + hilite_pet boolean option. Curses interface only; value is one + or more of the following letters. + n - Normal text (no highlighting) i - Inverse video (default) b - Bold text @@ -3842,53 +3861,34 @@ l - Left line indicator r - Right line indicator - Some of those choices might not work, particularly the final - three, depending upon terminal hardware or terminal emulation + Some of those choices might not work, particularly the final + three, depending upon terminal hardware or terminal emulation software. - Currently multiple highlight-style letters can be combined by - simply stringing them together (for example, "bk"), but in the - future they might require being separated by plus signs (such - as "b+k", which works already). When using the `n' choice, it - should be specified on its own, not in combination with any of + Currently multiple highlight-style letters can be combined by + simply stringing them together (for example, "bk"), but in the + future they might require being separated by plus signs (such + as "b+k", which works already). When using the `n' choice, it + should be specified on its own, not in combination with any of the other letters. pettype - Specify the type of your initial pet, if you are playing a - character class that uses multiple types of pets; or choose to - have no initial pet at all. Possible values are "cat", "dog", + Specify the type of your initial pet, if you are playing a + character class that uses multiple types of pets; or choose to + have no initial pet at all. Possible values are "cat", "dog", "horse", and "none". If the choice is not allowed for the role - you are currently playing, it will be silently ignored. For - example, "horse" will only be honored when playing a knight. + you are currently playing, it will be silently ignored. For + example, "horse" will only be honored when playing a knight. Cannot be set with the `O' command. pickup_burden - When you pick up an item that would exceed this encumbrance - level (Unencumbered, Burdened, streSsed, straiNed, overTaxed, - or overLoaded), you will be asked if you want to continue. + When you pick up an item that would exceed this encumbrance + level (Unencumbered, Burdened, streSsed, straiNed, overTaxed, + or overLoaded), you will be asked if you want to continue. (Default `S'). Persistent. - pickup_thrown - If this option is on and autopickup is also on, try to pick up - things that you threw, even if they aren't in pickup_types or - match an autopickup exception. Default is on. Persistent. - pickup_types - Specify the object types to be picked up when autopickup is on. - Default is all types. You can use autopickup_exception config- - uration file lines to further refine autopickup behavior. Per- - sistent. - - pile_limit - When walking across a pile of objects on the floor, threshold - at which the message "there are few/several/many objects here" - is given instead of showing a popup list of those objects. A - value of 0 means "no limit" (always list the objects); a value - of 1 effectively means "never show the objects" since the pile - size will always be at least that big; default value is 5. - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -3898,63 +3898,63 @@ + pickup_thrown + If this option is on and autopickup is also on, try to pick up + things that you threw, even if they aren't in pickup_types or + match an autopickup exception. Default is on. Persistent. + + pickup_types + Specify the object types to be picked up when autopickup is on. + Default is all types. You can use autopickup_exception config- + uration file lines to further refine autopickup behavior. Per- + sistent. + + pile_limit + When walking across a pile of objects on the floor, threshold + at which the message "there are few/several/many objects here" + is given instead of showing a popup list of those objects. A + value of 0 means "no limit" (always list the objects); a value + of 1 effectively means "never show the objects" since the pile + size will always be at least that big; default value is 5. Persistent. playmode - Values are "normal", "explore", or "debug". Allows selection - of explore mode (also known as discovery mode) or debug mode + Values are "normal", "explore", or "debug". Allows selection + of explore mode (also known as discovery mode) or debug mode (also known as wizard mode) instead of normal play. Debug mode - might only be allowed for someone logged in under a particular - user name (on multi-user systems) or specifying a particular + might only be allowed for someone logged in under a particular + user name (on multi-user systems) or specifying a particular character name (on single-user systems) or it might be disabled - entirely. Requesting it when not allowed or not possible re- + entirely. Requesting it when not allowed or not possible re- sults in explore mode instead. Default is normal play. pushweapon - Using the `w' (wield) command when already wielding something - pushes the old item into your alternate weapon slot (default - off). Likewise for the `a' (apply) command if it causes the + Using the `w' (wield) command when already wielding something + pushes the old item into your alternate weapon slot (default + off). Likewise for the `a' (apply) command if it causes the applied item to become wielded. Persistent. race Selects your race (for example, "race:human"). Default is ran- - dom. If you prefix the value with `!' or "no", you will ex- + dom. If you prefix the value with `!' or "no", you will ex- clude that race from being picked randomly. Cannot be set with the `O' command. Persistent. rest_on_space - Make the space bar a synonym for the `.' (#wait) command (de- + Make the space bar a synonym for the `.' (#wait) command (de- fault off). Persistent. role - Pick your type of character (for example "role:Samurai"); syn- - onym for "character". See "name" for an alternate method of - specifying your role. Normally only the first letter of the - value is examined; `r' is an exception with "Rogue", "Ranger", + Pick your type of character (for example "role:Samurai"); syn- + onym for "character". See "name" for an alternate method of + specifying your role. Normally only the first letter of the + value is examined; `r' is an exception with "Rogue", "Ranger", and "random" values. If you prefix the value with `!' or "no", - you will exclude that role from being picked randomly. Cannot + you will exclude that role from being picked randomly. Cannot be set with the `O' command. Persistent. - roguesymset - This option may be used to select one of the named symbol sets - found within "symbols" to alter the symbols displayed on the - screen on the rogue level. - rlecomp - When writing out a save file, perform run length compression of - the map. Not all ports support run length compression. It has - no effect on reading an existing save file. - - runmode - Controls the amount of screen updating for the map window when - engaged in multi-turn movement (running via shift+direction or - control+direction and so forth, or via the travel command or - mouse click). The possible values are: - - teleport - update the map after movement has finished; - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -3964,18 +3964,35 @@ + roguesymset + This option may be used to select one of the named symbol sets + found within "symbols" to alter the symbols displayed on the + screen on the rogue level. + + rlecomp + When writing out a save file, perform run length compression of + the map. Not all ports support run length compression. It has + no effect on reading an existing save file. + + runmode + Controls the amount of screen updating for the map window when + engaged in multi-turn movement (running via shift+direction or + control+direction and so forth, or via the travel command or + mouse click). The possible values are: + + teleport - update the map after movement has finished; run - update the map after every seven or so steps; walk - update the map after each step; crawl - like walk, but pause briefly after each step. This option only affects the game's screen display, not the ac- - tual results of moving. The default is "run"; versions prior - to 3.4.1 used "teleport" only. Whether or not the effect is + tual results of moving. The default is "run"; versions prior + to 3.4.1 used "teleport" only. Whether or not the effect is noticeable will depend upon the window port used or on the type of terminal. Persistent. safe_pet - Prevent you from (knowingly) attacking your pets (default on). + Prevent you from (knowingly) attacking your pets (default on). Persistent. sanity_check @@ -3983,8 +4000,8 @@ off). Debug mode only. scores - Control what parts of the score list you are shown at the end - (for example "scores:5 top scores/4 around my score/own + Control what parts of the score list you are shown at the end + (for example "scores:5 top scores/4 around my score/own scores"). Only the first letter of each category (`t', `a', or `o') is necessary. Persistent. @@ -3993,34 +4010,17 @@ off). Persistent. showrace - Display yourself as the glyph for your race, rather than the - glyph for your role (default off). Note that this setting af- - fects only the appearance of the display, not the way the game + Display yourself as the glyph for your race, rather than the + glyph for your role (default off). Note that this setting af- + fects only the appearance of the display, not the way the game treats you. Persistent. showscore Show your approximate accumulated score on bottom line (default off). Persistent. - silent - Suppress terminal beeps (default on). Persistent. - sortloot - Controls the sorting behavior of the pickup lists for inventory - and #loot commands and some others. Persistent. The possible - values are: - - full - always sort the lists; - loot - only sort the lists that don't use inventory letters, - like with the #loot and pickup commands; - none - show lists the traditional way without sorting. - - sortpack - Sort the pack contents by type when displaying inventory (de- - fault on). Persistent. - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -4030,63 +4030,63 @@ + silent + Suppress terminal beeps (default on). Persistent. + + sortloot + Controls the sorting behavior of the pickup lists for inventory + and #loot commands and some others. Persistent. The possible + values are: + + full - always sort the lists; + loot - only sort the lists that don't use inventory letters, + like with the #loot and pickup commands; + none - show lists the traditional way without sorting. + + sortpack + Sort the pack contents by type when displaying inventory (de- + fault on). Persistent. + sparkle Display a sparkly effect when a monster (including yourself) is - hit by an attack to which it is resistant (default on). Per- + hit by an attack to which it is resistant (default on). Per- sistent. standout Boldface monsters and "--More--" (default off). Persistent. statushilites - Controls how many turns status hilite behaviors highlight the - field. If negated or set to zero, disables status hiliting. + Controls how many turns status hilite behaviors highlight the + field. If negated or set to zero, disables status hiliting. See "Configuring Status Hilites" for further information. status_updates - Allow updates to the status lines at the bottom of the screen + Allow updates to the status lines at the bottom of the screen (default true). suppress_alert - This option may be set to a NetHack version level to suppress - alert notification messages about feature changes for that and + This option may be set to a NetHack version level to suppress + alert notification messages about feature changes for that and prior versions (for example "suppress_alert:3.3.1"). symset - This option may be used to select one of the named symbol sets - found within "symbols" to alter the symbols displayed on the - screen. Use "symset:default" to explicitly select the default + This option may be used to select one of the named symbol sets + found within "symbols" to alter the symbols displayed on the + screen. Use "symset:default" to explicitly select the default symbols. time - Show the elapsed game time in turns on bottom line (default + Show the elapsed game time in turns on bottom line (default off). Persistent. timed_delay - When pausing momentarily for display effect, such as with ex- - plosions and moving objects, use a timer rather than sending - extra characters to the screen. (Applies to "tty" interface - only; "X11" interface always uses a timer based delay. The de- - fault is on if configured into the program.) Persistent. - - tombstone - Draw a tombstone graphic upon your death (default on). Persis- - tent. - - toptenwin - Put the ending display in a NetHack window instead of on stdout - (default off). Setting this option makes the score list visi- - ble when a windowing version of NetHack is started without a - parent window, but it no longer leaves the score list around - after game end on a terminal or emulating window. - - travel - Allow the travel command (default on). Turning this option off - will prevent the game from attempting unintended moves if you - make inadvertent mouse clicks on the map window. Persistent. + When pausing momentarily for display effect, such as with ex- + plosions and moving objects, use a timer rather than sending + extra characters to the screen. (Applies to "tty" interface + only; "X11" interface always uses a timer based delay. The - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -4096,14 +4096,32 @@ + default is on if configured into the program.) Persistent. + + tombstone + Draw a tombstone graphic upon your death (default on). Persis- + tent. + + toptenwin + Put the ending display in a NetHack window instead of on stdout + (default off). Setting this option makes the score list visi- + ble when a windowing version of NetHack is started without a + parent window, but it no longer leaves the score list around + after game end on a terminal or emulating window. + + travel + Allow the travel command (default on). Turning this option off + will prevent the game from attempting unintended moves if you + make inadvertent mouse clicks on the map window. Persistent. + verbose - Provide more commentary during the game (default on). Persis- + Provide more commentary during the game (default on). Persis- tent. whatis_coord - When using the `/' or `;' commands to look around on the map - with autodescribe on, display coordinates after the descrip- - tion. Also works in other situations where you are asked to + When using the `/' or `;' commands to look around on the map + with autodescribe on, display coordinates after the descrip- + tion. Also works in other situations where you are asked to pick a location. The possible settings are: @@ -4120,39 +4138,21 @@ whatis_filter When getting a location on the map, and using the keys to cycle - through next and previous targets, allows filtering the possi- + through next and previous targets, allows filtering the possi- ble targets. n - no filtering [default] v - in view only a - in same area only - The area-filter tries to be slightly predictive -- if you're + The area-filter tries to be slightly predictive -- if you're standing on a doorway, it will consider the area on the side of the door you were last moving towards. - Filtering can also be changed when getting a location with the - "getpos.filter" key. - - whatis_menu - When getting a location on the map, and using a key to cycle - through next and previous targets, use a menu instead to pick a - target. (default off) - - whatis_moveskip - When getting a location on the map, and using shifted movement - keys or meta-digit keys to fast-move, instead of moving 8 units - at a time, move by skipping the same glyphs. (default off) - - windowtype - When the program has been built to support multiple interfaces, - select which one to use, such as "tty" or "X11" (default de- - pends on build-time settings; use "#version" to check). Cannot - be set with the `O' command. - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -4162,10 +4162,29 @@ - When used, it should be the first option set since its value - might enable or disable the availability of various other op- - tions. For multiple lines in a configuration file, that would - be the first non-comment line. For a comma-separated list in + Filtering can also be changed when getting a location with the + "getpos.filter" key. + + whatis_menu + When getting a location on the map, and using a key to cycle + through next and previous targets, use a menu instead to pick a + target. (default off) + + whatis_moveskip + When getting a location on the map, and using shifted movement + keys or meta-digit keys to fast-move, instead of moving 8 units + at a time, move by skipping the same glyphs. (default off) + + windowtype + When the program has been built to support multiple interfaces, + select which one to use, such as "tty" or "X11" (default de- + pends on build-time settings; use "#version" to check). Cannot + be set with the `O' command. + + When used, it should be the first option set since its value + might enable or disable the availability of various other op- + tions. For multiple lines in a configuration file, that would + be the first non-comment line. For a comma-separated list in NETHACKOPTIONS or an OPTIONS line in a configuration file, that would be the rightmost option in the list. @@ -4174,51 +4193,32 @@ off). Debug mode only. zerocomp - When writing out a save file, perform zero-comp compression of - the contents. Not all ports support zero-comp compression. It + When writing out a save file, perform zero-comp compression of + the contents. Not all ports support zero-comp compression. It has no effect on reading an existing save file. 9.5. Window Port Customization options - Here are explanations of the various options that are used - to customize and change the characteristics of the windowtype + Here are explanations of the various options that are used + to customize and change the characteristics of the windowtype that you have chosen. Character strings that are too long may be - truncated. Not all window ports will adjust for all settings - listed here. You can safely add any of these options to your - config file, and if the window port is capable of adjusting to - suit your preferences, it will attempt to do so. If it can't it - will silently ignore it. You can find out if an option is sup- - ported by the window port that you are currently using by check- - ing to see if it shows up in the Options list. Some options are - dynamic and can be specified during the game with the `O' com- - mand. + truncated. Not all window ports will adjust for all settings + listed here. You can safely add any of these options to your + configuration file, and if the window port is capable of adjust- + ing to suit your preferences, it will attempt to do so. If it + can't it will silently ignore it. You can find out if an option + is supported by the window port that you are currently using by + checking to see if it shows up in the Options list. Some options + are dynamic and can be specified during the game with the `O' + command. align_message - Where to align or place the message window (top, bottom, left, + Where to align or place the message window (top, bottom, left, or right) - align_status - Where to align or place the status window (top, bottom, left, - or right). - - ascii_map - If NetHack can, it should display an ascii character map if it - can. - - color - If NetHack can, it should display color if it can for different - monsters, objects, and dungeon features. - - eight_bit_tty - If NetHack can, it should pass eight-bit character values (for - example, specified with the traps option) straight through to - your terminal (default off). - - font_map - if NetHack can, it should use a font by the chosen name for the - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -4228,10 +4228,29 @@ + align_status + Where to align or place the status window (top, bottom, left, + or right). + + ascii_map + If NetHack can, it should display an ascii character map if it + can. + + color + If NetHack can, it should display color if it can for different + monsters, objects, and dungeon features. + + eight_bit_tty + If NetHack can, it should pass eight-bit character values (for + example, specified with the traps option) straight through to + your terminal (default off). + + font_map + if NetHack can, it should use a font by the chosen name for the map window. font_menu - If NetHack can, it should use a font by the chosen name for + If NetHack can, it should use a font by the chosen name for menu windows. font_message @@ -4243,15 +4262,15 @@ status window. font_text - If NetHack can, it should use a font by the chosen name for + If NetHack can, it should use a font by the chosen name for text windows. font_size_map - If NetHack can, it should use this size font for the map win- + If NetHack can, it should use this size font for the map win- dow. font_size_menu - If NetHack can, it should use this size font for menu windows. + If NetHack can, it should use this size font for menu windows. font_size_message If NetHack can, it should use this size font for the message @@ -4262,29 +4281,10 @@ window. font_size_text - If NetHack can, it should use this size font for text windows. - - fullscreen - If NetHack can, it should try and display on the entire screen - rather than in a window. - - guicolor - Use color text and/or highlighting attributes when displaying - some non-map data (such as menu selector letters). Curses in- - terface only; default is on. - - large_font - If NetHack can, it should use a large font. - - map_mode - If NetHack can, it should display the map in the manner speci- - fied. - - player_selection - If NetHack can, it should pop up dialog boxes, or use prompts + If NetHack can, it should use this size font for text windows. - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -4294,6 +4294,24 @@ + fullscreen + If NetHack can, it should try and display on the entire screen + rather than in a window. + + guicolor + Use color text and/or highlighting attributes when displaying + some non-map data (such as menu selector letters). Curses in- + terface only; default is on. + + large_font + If NetHack can, it should use a large font. + + map_mode + If NetHack can, it should display the map in the manner speci- + fied. + + player_selection + If NetHack can, it should pop up dialog boxes, or use prompts for character selection. popup_dialog @@ -4301,27 +4319,27 @@ preload_tiles If NetHack can, it should preload tiles into memory. For exam- - ple, in the protected mode MS-DOS version, control whether - tiles get pre-loaded into RAM at the start of the game. Doing - so enhances performance of the tile graphics, but uses more + ple, in the protected mode MS-DOS version, control whether + tiles get pre-loaded into RAM at the start of the game. Doing + so enhances performance of the tile graphics, but uses more memory. (default on). Cannot be set with the `O' command. scroll_amount - If NetHack can, it should scroll the display by this number of + If NetHack can, it should scroll the display by this number of cells when the hero reaches the scroll_margin. scroll_margin - If NetHack can, it should scroll the display when the hero or - cursor is this number of cells away from the edge of the win- + If NetHack can, it should scroll the display when the hero or + cursor is this number of cells away from the edge of the win- dow. selectsaved - If NetHack can, it should display a menu of existing saved + If NetHack can, it should display a menu of existing saved games for the player to choose from at game startup, if it can. Not all ports support this option. softkeyboard - Display an onscreen keyboard. Handhelds are most likely to + Display an onscreen keyboard. Handhelds are most likely to support this option. splash_screen @@ -4329,28 +4347,10 @@ it starts up (default yes). statuslines - Number of lines for traditional below-the-map status display. - Acceptable values are 2 and 3 (default is 2). Curses and tty - interfaces only. - - term_cols and - - term_rows - Curses interface only. Number of columns and rows to use for - the display. Curses will attempt to resize to the values spec- - ified but will settle for smaller sizes if they are too big. - Default is the current window size. - - tiled_map - If NetHack can, it should display a tiled map if it can. - - tile_file - Specify the name of an alternative tile file to override the - default. + Number of lines for traditional below-the-map status display. - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -4360,8 +4360,26 @@ + Acceptable values are 2 and 3 (default is 2). Curses and tty + interfaces only. + + term_cols and + + term_rows + Curses interface only. Number of columns and rows to use for + the display. Curses will attempt to resize to the values spec- + ified but will settle for smaller sizes if they are too big. + Default is the current window size. + + tiled_map + If NetHack can, it should display a tiled map if it can. + + tile_file + Specify the name of an alternative tile file to override the + default. + tile_height - Specify the preferred height of each tile in a tile capable + Specify the preferred height of each tile in a tile capable port. tile_width @@ -4395,6 +4413,19 @@ If NetHack can, it should display windows with the specified foreground/background colors. Windows GUI only. The format is + + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 68 + + + OPTION=windowcolors:wintype foreground/background where wintype is one of "menu", "message", "status", or @@ -4413,19 +4444,6 @@ If NetHack can, it should wrap long lines of text if they don't fit in the visible area of the window. - - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 68 - - - 9.6. Platform-specific Customization options Here are explanations of options that are used by specific @@ -4462,6 +4480,18 @@ chines with an IBM PC compatible BIOS ROM (default off, OS/2, PC, and ST NetHack only). + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 69 + + + flush (default off, Amiga NetHack only). @@ -4478,77 +4508,47 @@ Note: DEC Rainbows hang if this is turned on. Cannot be set with the `O' command. - soundcard - (default on, PC NetHack only). Cannot be set with the `O' - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 69 - - - - command. - subkeyvalue - (Win32 tty NetHack only). May be used to alter the value of + (Win32 tty NetHack only). May be used to alter the value of keystrokes that the operating system returns to NetHack to help - compensate for international keyboard issues. OPTIONS=subkey- - value:171/92 will return 92 to NetHack, if 171 was originally - going to be returned. You can use multiple subkeyvalue state- - ments in the config file if needed. Cannot be set with the `O' - command. + compensate for international keyboard issues. OPTIONS=subkey- + value:171/92 will return 92 to NetHack, if 171 was originally + going to be returned. You can use multiple subkeyvalue state- + ments in the configuration file if needed. Cannot be set with + the `O' command. video Set the video mode used (PC NetHack only). Values are "autode- - tect", "default", or "vga". Setting "vga" (or "autodetect" - with vga hardware present) will cause the game to display + tect", "default", or "vga". Setting "vga" (or "autodetect" + with vga hardware present) will cause the game to display tiles. Cannot be set with the `O' command. videocolors - Set the color palette for PC systems using NO_TERMS (default - 4-2-6-1-5-3-15-12-10-14-9-13-11, (PC NetHack only). The order - of colors is red, green, brown, blue, magenta, cyan, - bright.white, bright.red, bright.green, yellow, bright.blue, - bright.magenta, and bright.cyan. Cannot be set with the `O' + Set the color palette for PC systems using NO_TERMS (default + 4-2-6-1-5-3-15-12-10-14-9-13-11, (PC NetHack only). The order + of colors is red, green, brown, blue, magenta, cyan, + bright.white, bright.red, bright.green, yellow, bright.blue, + bright.magenta, and bright.cyan. Cannot be set with the `O' command. videoshades Set the intensity level of the three gray scales available (de- fault dark normal light, PC NetHack only). If the game display - is difficult to read, try adjusting these scales; if this does - not correct the problem, try !color. Cannot be set with the + is difficult to read, try adjusting these scales; if this does + not correct the problem, try !color. Cannot be set with the `O' command. 9.7. Regular Expressions - Regular expressions are normally POSIX extended regular ex- - pressions. It is possible to compile NetHack without regular ex- - pression support on a platform where there is no regular expres- - sion library. While this is not true of any modern platform, if - your NetHack was built this way, patterns are instead glob pat- + Regular expressions are normally POSIX extended regular ex- + pressions. It is possible to compile NetHack without regular ex- + pression support on a platform where there is no regular expres- + sion library. While this is not true of any modern platform, if + your NetHack was built this way, patterns are instead glob pat- terns. This applies to Autopickup exceptions, Message types, Menu - colors, and User sounds. - - 9.8. Configuring Autopickup Exceptions - - You can further refine the behavior of the autopickup option - beyond what is available through the pickup_types option. - - By placing autopickup_exception lines in your configuration - file, you can define patterns to be checked when the game is - about to autopickup something. - - autopickup_exception - Sets an exception to the pickup_types option. The autopick- - up_exception option should be followed by a regular expression - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -4558,20 +4558,37 @@ - to be used as a pattern to match against the singular form of + colors, and User sounds. + + 9.8. Configuring Autopickup Exceptions + + You can further refine the behavior of the autopickup option + beyond what is available through the pickup_types option. + + By placing autopickup_exception lines in your configuration + file, you can define patterns to be checked when the game is + about to autopickup something. + + autopickup_exception + Sets an exception to the pickup_types option. The autopick- + up_exception option should be followed by a regular expression + to be used as a pattern to match against the singular form of the description of an object at your location. - In addition, some characters are treated specially if they oc- + In addition, some characters are treated specially if they oc- cur as the first character in the pattern, specifically: < - always pickup an object that matches rest of pattern; > - never pickup an object that matches rest of pattern. - A "never pickup" rule takes precedence over an "always pickup" - rule if both match. + The autopickup_exception rules are processed in the order in + which they appear in your configuration file, thus allowing a + later rule to override an earlier rule. - Exceptions can be set with the `O' command, but ones set that - way will not be preserved across saves and restores. + Exceptions can be set with the `O' command, but because they + are not included in your configuration file, they won't be in + effect if you save and then restore your game. autopickup_ex- + ception rules and not saved with the game. Here are some examples: @@ -4595,6 +4612,18 @@ For example: + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 71 + + + BIND=^X:getpos.autodescribe BIND={:menu_first_page BIND=v:loot @@ -4607,23 +4636,11 @@ Menu accelerator keys The menu control or accelerator keys can also be rebound via - OPTIONS-lines in the config file. You cannot bind object sym- - bols into menu accelerators. + OPTIONS lines in the configuration file. You cannot bind ob- + ject symbols into menu accelerators. Special command keys Below are the special commands you can rebind. Some of them - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 71 - - - can be bound to same keys with no problems, others are in the same "context", and if bound to same keys, only one of those commands will be available. Special command can only be bound @@ -4660,8 +4677,20 @@ fault is `#'. getpos.all.next - When asked for a location, the key to go to next closest inter- - esting thing. Default is `a'. + When asked for a location, the key to go to next closest + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 72 + + + + interesting thing. Default is `a'. getpos.all.prev When asked for a location, the key to go to previous closest @@ -4679,17 +4708,6 @@ When asked for a location, the key to show help. Default is `?'. - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 72 - - - getpos.mon.next When asked for a location, the key to go to next closest mon- ster. Default is `m'. @@ -4726,6 +4744,18 @@ When asked for a location, the key to choose the location, and possibly ask for more info. Default is `.'. + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 73 + + + getpos.pick.once When asked for a location, the key to choose the location, and skip asking for more info. Default is `,'. @@ -4743,19 +4773,6 @@ When asked for a location, the key to go to your location. De- fault is `@'. - - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 73 - - - getpos.unexplored.next When asked for a location, the key to go to next closest unex- plored location. Default is `x'. @@ -4792,15 +4809,28 @@ reqmenu Prefix key to request menu from some commands. Default is `m'. + + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 74 + + + run Prefix key to run towards a direction. Default is `G'. run.nopickup - Prefix key to run towards a direction without picking up items + Prefix key to run towards a direction without picking up items on the way. Default is `M'. run.numpad - Prefix key to run towards a direction. With number_pad only. + Prefix key to run towards a direction. With number_pad only. Default is `5'. rush @@ -4811,19 +4841,8 @@ You can change the way the messages are shown in the message area, when the message matches a user-defined pattern. - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 74 - - - - In general, the config file entries to configure the message - types look like this: MSGTYPE=type "pattern" + In general, the configuration file entries to describe the + message types look like this: MSGTYPE=type "pattern" type - how the message should be shown; pattern - the pattern to match. @@ -4835,50 +4854,31 @@ show - show message normally; hide - never show the message; stop - wait for user with more-prompt; - norep - show the message once, but not again if no other mes- + norep - show the message once, but not again if no other mes- sage is shown in between. - Here's an example of message types using NetHack's internal + Here's an example of message types using NetHack's internal pattern matching facility: MSGTYPE=stop "You feel hungry." MSGTYPE=hide "You displaced *." - specifies that whenever a message "You feel hungry" is shown, - the user is prompted with more-prompt, and a message matching + specifies that whenever a message "You feel hungry" is shown, + the user is prompted with more-prompt, and a message matching "You displaced ." is not shown at all. - The order of the defined MSGTYPE-lines is important; the last - matching rule is used. Put the general case first, exceptions + The order of the defined MSGTYPE lines is important; the last + matching rule is used. Put the general case first, exceptions below them. 9.11. Configuring Menu Colors Some platforms allow you to define colors used in menu lines - when the line matches a user-defined pattern. At this time the - tty, win32tty and win32gui support this. - - In general, the config file entries to configure the menu - color mappings look like this: - - MENUCOLOR="pattern"=color&attribute - - pattern - the pattern to match; - color - the color to use for lines matching the pat- - tern; - attribute - the attribute to use for lines matching the - pattern. The attribute is optional, and if - left out, you must also leave out the preced- - ing ampersand. If no attribute is defined, - no attribute is used. - - The pattern should be a regular expression. - - Allowed colors are black, red, green, brown, blue, magenta, - cyan, gray, orange, light-green, yellow, light-blue, light- + when the line matches a user-defined pattern. At this time the + tty, curses, win32tty and win32gui interfaces support this. - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -4888,63 +4888,63 @@ - magenta, light-cyan, and white. And no-color, the default - foreground color, which isn't necessarily the same as any of - the other colors. + In general, the configuration file entries to describe the + menu color mappings look like this: - Allowed attributes are none, bold, dim, underline, blink, and - inverse. "Normal" is a synonym for "none". Note that the + MENUCOLOR="pattern"=color&attribute + + pattern - the pattern to match; + color - the color to use for lines matching the pat- + tern; + attribute - the attribute to use for lines matching the + pattern. The attribute is optional, and if + left out, you must also leave out the preced- + ing ampersand. If no attribute is defined, + no attribute is used. + + The pattern should be a regular expression. + + Allowed colors are black, red, green, brown, blue, magenta, + cyan, gray, orange, light-green, yellow, light-blue, light-ma- + genta, light-cyan, and white. And no-color, the default fore- + ground color, which isn't necessarily the same as any of the + other colors. + + Allowed attributes are none, bold, dim, underline, blink, and + inverse. "Normal" is a synonym for "none". Note that the platform used may interpret the attributes any way it wants. - Here's an example of menu colors using NetHack's internal pat- + Here's an example of menu colors using NetHack's internal pat- tern matching facility: MENUCOLOR="* blessed *"=green MENUCOLOR="* cursed *"=red MENUCOLOR="* cursed *(being worn)"=red&underline - specifies that any menu line with " blessed " contained in it - will be shown in green color, lines with " cursed " will be - shown in red, and lines with " cursed " followed by "(being - worn)" on the same line will be shown in red color and under- - lined. You can have multiple MENUCOLOR entries in your config - file, and the last MENUCOLOR-line in your config file that - matches a menu line will be used for the line. + specifies that any menu line with " blessed " contained in it + will be shown in green color, lines with " cursed " will be + shown in red, and lines with " cursed " followed by "(being + worn)" on the same line will be shown in red color and under- + lined. You can have multiple MENUCOLOR entries in your config- + uration file, and the last MENUCOLOR line that matches a menu + line will be used for the line. Note that if you intend to have one or more color specifica- - tions match " uncursed ", you will probably want to turn the im- + tions match " uncursed ", you will probably want to turn the im- plicit_uncursed option off so that all items known to be uncursed are actually displayed with the "uncursed" description. 9.12. Configuring User Sounds - Some platforms allow you to define sound files to be played - when a message that matches a user-defined pattern is delivered + Some platforms allow you to define sound files to be played + when a message that matches a user-defined pattern is delivered to the message window. At this time the Qt port and the win32tty and win32gui ports support the use of user sounds. - The following config file entries are relevant to mapping - user sounds to messages: - - SOUNDDIR - The directory that houses the sound files to be played. - - SOUND - An entry that maps a sound file to a user-specified message - pattern. Each SOUND entry is broken down into the following - parts: - - MESG - message window mapping (the only one supported in - 3.6); - pattern - the pattern to match; - sound file - the sound file to play; - volume - the volume to be set while playing the sound file. - - The pattern should be a POSIX extended regular expression. - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -4954,6 +4954,25 @@ + The following configuration file entries are relevant to + mapping user sounds to messages: + + SOUNDDIR + The directory that houses the sound files to be played. + + SOUND + An entry that maps a sound file to a user-specified message + pattern. Each SOUND entry is broken down into the following + parts: + + MESG - message window mapping (the only one supported in + 3.6); + pattern - the pattern to match; + sound file - the sound file to play; + volume - the volume to be set while playing the sound file. + + The pattern should be a POSIX extended regular expression. + 9.13. Configuring Status Hilites Your copy of NetHack may have been compiled with support for @@ -4990,6 +5009,17 @@ and inverse. "Normal" is a synonym for "none"; they should not be used in combination with any of the other attributes. + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 77 + + + To specify both a color and an attribute, use `&' to combine them. To specify multiple attributes, use `+' to combine those. For example: "magenta&inverse+dim". @@ -5007,19 +5037,6 @@ You can adjust the appearance of the following status fields: - - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 77 - - - title dungeon-level experience-level strength gold experience dexterity hitpoints HD @@ -5047,36 +5064,19 @@ * "always" will set the default attributes for that field. - * "up" and "down" set the field attributes for when the - field value changes upwards or downwards. This attribute - times out after statushilites turns. + * "up", "down" set the field attributes for when the field + value changes upwards or downwards. This attribute times + out after statushilites turns. * "changed" sets the field attribute for when the field val- - ue changes. This attribute times out after statushilites - turns. (If a field has both a "changed" rule and an "up" - or "down" rule which matches a change in the field's val- + ue changes. This attribute times out after statushilites + turns. (If a field has both a "changed" rule and an "up" + or "down" rule which matches a change in the field's val- ue, the "up" or "down" one takes precedence.) - * percentage sets the field attribute when the field value - matches the percentage. It is specified as a number be- - tween 0 and 100, followed by `%' (percent sign). If the - percentage is prefixed with `<=' or `>=', it also matches - when value is below or above the percentage. Use prefix - `<' or `>' to match when strictly below or above. (The - numeric limit is relaxed slightly for those: >-1% and - <101% are allowed.) Only valid for "hitpoints" and "pow- - er" fields. - - * absolute value sets the attribute when the field value - matches that number. The number must be 0 or higher, ex- - cept for "armor-class' which allows negative values, and - may optionally be preceded by `='. If the number is pre- - ceded by `<=' or `>=' instead, it also matches when value - is below or above. If the prefix is `<' or `>', only - match when strictly above or below. - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -5086,6 +5086,37 @@ + * percentage sets the field attribute when the field value + matches the percentage. It is specified as a number be- + tween 0 and 100, followed by `%' (percent sign). If the + percentage is prefixed with `<=' or `>=', it also matches + when value is below or above the percentage. Use prefix + `<' or `>' to match when strictly below or above. (The + numeric limit is relaxed slightly for those: >-1% and + <101% are allowed.) Only four fields support percentage + rules. Percentages for "hitpoints" and "power" are + straightforward; they're based on the corresponding maxi- + mum field. Percentage highlight rules are also allowed + for "experience level" and "experience points" (valid when + the showexp option is enabled). For those, the percentage + is based on the progress from the start of the current ex- + perience level to the start of the next level. So if lev- + el 2 starts at 20 points and level 3 starts at 40 points, + having 30 points is 50% and 35 points is 75%. 100% is + unattainable for experience because you'll gain a level + and the calculations will be reset for that new level, but + a rule for =100% is allowed and matches the special case + of being exactly 1 experience point short of the next lev- + el. + + * absolute value sets the attribute when the field value + matches that number. The number must be 0 or higher, ex- + cept for "armor-class' which allows negative values, and + may optionally be preceded by `='. If the number is pre- + ceded by `<=' or `>=' instead, it also matches when value + is below or above. If the prefix is `<' or `>', only + match when strictly above or below. + * text match sets the attribute when the field value matches the text. Text matches can only be used for "alignment", "carrying-capacity", "hunger", "dungeon-level", and "ti- @@ -5093,13 +5124,34 @@ the character's name is ignored. The in-game options menu can help you determine the correct - syntax for a config file. + syntax for a configuration file. The whole feature can be disabled by setting option sta- tushilites to 0. Example hilites: + + + + + + + + + + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 79 + + + OPTION=hilite_status: gold/up/yellow/down/brown OPTION=hilite_status: characteristics/up/green/down/red OPTION=hilite_status: hitpoints/100%/gray&normal @@ -5126,89 +5178,37 @@ play on the rogue level. You can also override one or more symbols using the SYMBOLS - config file option. Symbols are specified as name:value pairs. - Note that NetHack escape-processes the value string in conven- - tional C fashion. This means that \ is a prefix to take the fol- - lowing character literally. Thus \ needs to be represented as - \\. The special prefix form \m switches on the meta bit in the - symbol value, and the ^ prefix causes the following character to - be treated as a control character. + and ROGUESYMBOLS configuration file options. Symbols are speci- + fied as name:value pairs. Note that NetHack escape-processes the + value string in conventional C fashion. This means that \ is a + prefix to take the following character literally. Thus \ needs + to be represented as \\. The special prefix form \m switches on + the meta bit in the symbol value, and the ^ prefix causes the + following character to be treated as a control character. - NetHack Symbols - Default Symbol Name Description - ------------------------------------------------------------------------ - S_air (air) - _ S_altar (altar) + NetHack Symbols + Symbol Name Description + ----------------------------------------------------------------- + S_air (air) + _ S_altar (altar) + " S_amulet (amulet) + A S_angel (angelic being) + a S_ant (ant or other insect) + ^ S_anti_magic_trap (anti-magic field) + [ S_armor (suit or piece of armor) + [ S_armour (suit or piece of armor) + ^ S_arrow_trap (arrow trap) + 0 S_ball (iron ball) + # S_bars (iron bars) + B S_bat (bat or bird) + ^ S_bear_trap (bear trap) + - S_blcorn (bottom left corner) + b S_blob (blob) + + S_book (spellbook) - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 79 - - - - " S_amulet (amulet) - A S_angel (angelic being) - a S_ant (ant or other insect) - ^ S_anti_magic_trap (anti-magic field) - [ S_armor (suit or piece of armor) - [ S_armour (suit or piece of armor) - ^ S_arrow_trap (arrow trap) - 0 S_ball (iron ball) - # S_bars (iron bars) - B S_bat (bat or bird) - ^ S_bear_trap (bear trap) - - S_blcorn (bottom left corner) - b S_blob (blob) - + S_book (spellbook) - ) S_boomleft (boomerang open left) - ( S_boomright (boomerang open right) - ` S_boulder (boulder) - - S_brcorn (bottom right corner) - C S_centaur (centaur) - _ S_chain (iron chain) - # S_cloud (cloud) - c S_cockatrice (cockatrice) - $ S_coin (pile of coins) - # S_corr (corridor) - - S_crwall (wall) - # S_darkroom (dark room) - ^ S_dart_trap (dart trap) - & S_demon (major demon) - * S_digbeam (dig beam) - > S_dnladder (ladder down) - > S_dnstair (staircase down) - d S_dog (dog or other canine) - D S_dragon (dragon) - ; S_eel (sea monster) - E S_elemental (elemental) - / S_explode1 (explosion top left) - - S_explode2 (explosion top center) - \ S_explode3 (explosion top right) - | S_explode4 (explosion middle left) - S_explode5 (explosion middle center) - | S_explode6 (explosion middle right) - \ S_explode7 (explosion bottom left) - - S_explode8 (explosion bottom center) - / S_explode9 (explosion bottom right) - e S_eye (eye or sphere) - ^ S_falling_rock_trap (falling rock trap) - f S_feline (cat or other feline) - ^ S_fire_trap (fire trap) - ! S_flashbeam (flash beam) - % S_food (piece of food) - { S_fountain (fountain) - F S_fungus (fungus or mold) - * S_gem (gem or rock) - - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -5218,63 +5218,63 @@ - S_ghost (ghost) - H S_giant (giant humanoid) - G S_gnome (gnome) - ' S_golem (golem) - | S_grave (grave) - g S_gremlin (gremlin) - - S_hbeam (horizontal beam [zap animation]) - # S_hcdbridge (horizontal raised drawbridge) - + S_hcdoor (closed door in horizontal wall) - . S_hodbridge (horizontal lowered drawbridge) - | S_hodoor (open door in horizontal wall) - ^ S_hole (hole) - @ S_human (human or elf) - h S_humanoid (humanoid) - - S_hwall (horizontal wall) - . S_ice (ice) - i S_imp (imp or minor demon) - I S_invisible (invisible monster) - J S_jabberwock (jabberwock) - j S_jelly (jelly) - k S_kobold (kobold) - K S_kop (Keystone Kop) - ^ S_land_mine (land mine) - } S_lava (molten lava) - l S_leprechaun (leprechaun) - ^ S_level_teleporter (level teleporter) - L S_lich (lich) - y S_light (light) - # S_litcorr (lit corridor) - : S_lizard (lizard) - \ S_lslant (diagonal beam [zap animation]) - ^ S_magic_portal (magic portal) - ^ S_magic_trap (magic trap) - m S_mimic (mimic) - ] S_mimic_def (mimic) - M S_mummy (mummy) - N S_naga (naga) - . S_ndoor (doorway without door) - n S_nymph (nymph) - O S_ogre (ogre) - o S_orc (orc) - p S_piercer (piercer) - ^ S_pit (pit) - # S_poisoncloud (poison cloud) - ^ S_polymorph_trap (polymorph trap) - } S_pool (water) - ! S_potion (potion) - P S_pudding (pudding or ooze) - q S_quadruped (quadruped) - Q S_quantmech (quantum mechanic) - = S_ring (ring) - ` S_rock (boulder or statue) - r S_rodent (rodent) + ) S_boomleft (boomerang open left) + ( S_boomright (boomerang open right) + ` S_boulder (boulder) + - S_brcorn (bottom right corner) + C S_centaur (centaur) + _ S_chain (iron chain) + # S_cloud (cloud) + c S_cockatrice (cockatrice) + $ S_coin (pile of coins) + # S_corr (corridor) + - S_crwall (wall) + # S_darkroom (dark room) + ^ S_dart_trap (dart trap) + & S_demon (major demon) + * S_digbeam (dig beam) + > S_dnladder (ladder down) + > S_dnstair (staircase down) + d S_dog (dog or other canine) + D S_dragon (dragon) + ; S_eel (sea monster) + E S_elemental (elemental) + / S_explode1 (explosion top left) + - S_explode2 (explosion top center) + \ S_explode3 (explosion top right) + | S_explode4 (explosion middle left) + S_explode5 (explosion middle center) + | S_explode6 (explosion middle right) + \ S_explode7 (explosion bottom left) + - S_explode8 (explosion bottom center) + / S_explode9 (explosion bottom right) + e S_eye (eye or sphere) + ^ S_falling_rock_trap (falling rock trap) + f S_feline (cat or other feline) + ^ S_fire_trap (fire trap) + ! S_flashbeam (flash beam) + % S_food (piece of food) + { S_fountain (fountain) + F S_fungus (fungus or mold) + * S_gem (gem or rock) + S_ghost (ghost) + H S_giant (giant humanoid) + G S_gnome (gnome) + ' S_golem (golem) + | S_grave (grave) + g S_gremlin (gremlin) + - S_hbeam (horizontal beam [zap animation]) + # S_hcdbridge (horizontal raised drawbridge) + + S_hcdoor (closed door in horizontal wall) + . S_hodbridge (horizontal lowered drawbridge) + | S_hodoor (open door in horizontal wall) + ^ S_hole (hole) + @ S_human (human or elf) + h S_humanoid (humanoid) - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -5284,63 +5284,63 @@ - ^ S_rolling_boulder_trap (rolling boulder trap) - . S_room (floor of a room) - / S_rslant (diagonal beam [zap animation]) - ^ S_rust_trap (rust trap) - R S_rustmonst (rust monster or disenchanter) - ? S_scroll (scroll) - # S_sink (sink) - ^ S_sleeping_gas_trap (sleeping gas trap) - S S_snake (snake) - s S_spider (arachnid or centipede) - ^ S_spiked_pit (spiked pit) - ^ S_squeaky_board (squeaky board) - 0 S_ss1 (magic shield 1 of 4) - # S_ss2 (magic shield 2 of 4) - @ S_ss3 (magic shield 3 of 4) - * S_ss4 (magic shield 4 of 4) - ^ S_statue_trap (statue trap) - S_stone (dark part of a room) - ] S_strange_obj (strange object) - - S_sw_bc (swallow bottom center) - \ S_sw_bl (swallow bottom left) - / S_sw_br (swallow bottom right) - | S_sw_ml (swallow middle left) - | S_sw_mr (swallow middle right) - - S_sw_tc (swallow top center) - / S_sw_tl (swallow top left) - \ S_sw_tr (swallow top right) - - S_tdwall (wall) - ^ S_teleportation_trap (teleportation trap) - \ S_throne (opulent throne) - - S_tlcorn (top left corner) - | S_tlwall (wall) - ( S_tool (useful item (pick-axe, key, lamp...)) - ^ S_trap_door (trap door) - t S_trapper (trapper or lurker above) - - S_trcorn (top right corner) - # S_tree (tree) - T S_troll (troll) - | S_trwall (wall) - - S_tuwall (wall) - U S_umber (umber hulk) - u S_unicorn (unicorn or horse) - < S_upladder (ladder up) - < S_upstair (staircase up) - V S_vampire (vampire) - | S_vbeam (vertical beam [zap animation]) - # S_vcdbridge (vertical raised drawbridge) - + S_vcdoor (closed door in vertical wall) - . S_venom (splash of venom) - ^ S_vibrating_square (vibrating square) - . S_vodbridge (vertical lowered drawbridge) - - S_vodoor (open door in vertical wall) - v S_vortex (vortex) + - S_hwall (horizontal wall) + . S_ice (ice) + i S_imp (imp or minor demon) + I S_invisible (invisible monster) + J S_jabberwock (jabberwock) + j S_jelly (jelly) + k S_kobold (kobold) + K S_kop (Keystone Kop) + ^ S_land_mine (land mine) + } S_lava (molten lava) + l S_leprechaun (leprechaun) + ^ S_level_teleporter (level teleporter) + L S_lich (lich) + y S_light (light) + # S_litcorr (lit corridor) + : S_lizard (lizard) + \ S_lslant (diagonal beam [zap animation]) + ^ S_magic_portal (magic portal) + ^ S_magic_trap (magic trap) + m S_mimic (mimic) + ] S_mimic_def (mimic) + M S_mummy (mummy) + N S_naga (naga) + . S_ndoor (doorway without door) + n S_nymph (nymph) + O S_ogre (ogre) + o S_orc (orc) + p S_piercer (piercer) + ^ S_pit (pit) + # S_poisoncloud (poison cloud) + ^ S_polymorph_trap (polymorph trap) + } S_pool (water) + ! S_potion (potion) + P S_pudding (pudding or ooze) + q S_quadruped (quadruped) + Q S_quantmech (quantum mechanic) + = S_ring (ring) + ` S_rock (boulder or statue) + r S_rodent (rodent) + ^ S_rolling_boulder_trap (rolling boulder trap) + . S_room (floor of a room) + / S_rslant (diagonal beam [zap animation]) + ^ S_rust_trap (rust trap) + R S_rustmonst (rust monster or disenchanter) + ? S_scroll (scroll) + # S_sink (sink) + ^ S_sleeping_gas_trap (sleeping gas trap) + S S_snake (snake) + s S_spider (arachnid or centipede) + ^ S_spiked_pit (spiked pit) + ^ S_squeaky_board (squeaky board) + 0 S_ss1 (magic shield 1 of 4) + # S_ss2 (magic shield 2 of 4) - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -5350,63 +5350,63 @@ - | S_vwall (vertical wall) - / S_wand (wand) - } S_water (water) - ) S_weapon (weapon) - " S_web (web) - w S_worm (worm) - ~ S_worm_tail (long worm tail) - W S_wraith (wraith) - x S_xan (xan or other mythical/fantastic insect) - X S_xorn (xorn) - Y S_yeti (apelike creature) - Z S_zombie (zombie) - z S_zruty (zruty) - - There is one additional class of object, described as - "strange object", which will occasionally be the shape taken on - by mimics and shown as `]' for maps displayed as text characters. - Although the displayed character is the same as the default value - for "S_mimic_def", it is a different symbol and there is no cor- - responding "S_strange_object" symbol nor any way to assign an al- - ternate value for it. - - 9.15. Configuring NetHack for Play by the Blind - - NetHack can be set up to use only standard ASCII characters - for making maps of the dungeons. This makes the MS-DOS versions - of NetHack completely accessible to the blind who use speech - and/or Braille access technologies. Players will require a good - working knowledge of their screen-reader's review features, and - will have to know how to navigate horizontally and vertically - character by character. They will also find the search capabili- - ties of their screen-readers to be quite valuable. Be certain to - examine this Guidebook before playing so you have an idea what - the screen layout is like. You'll also need to be able to locate - the PC cursor. It is always where your character is located. - Merely searching for an @-sign will not always find your charac- - ter since there are other humanoids represented by the same sign. - Your screen-reader should also have a function which gives you - the row and column of your review cursor and the PC cursor. - These co-ordinates are often useful in giving players a better - sense of the overall location of items on the screen. - - NetHack can also be compiled with support for sending the - game messages to an external program, such as a text-to-speech - synthesizer. If the "#version" extended command shows "external - program as a message handler", your NetHack has been compiled - with the capability. When compiling NetHack from source on Linux - and other POSIX systems, define MSGHANDLER to enable it. To use - the capability, set the environment variable NETHACK_MSGHANDLER - to an executable, which will be executed with the game message as - the program's only parameter. - - While it is not difficult for experienced users to edit the - defaults.nh file to accomplish this, novices may find this task + @ S_ss3 (magic shield 3 of 4) + * S_ss4 (magic shield 4 of 4) + ^ S_statue_trap (statue trap) + S_stone (solid rock or unexplored terrain + or dark part of a room) + ] S_strange_obj (strange object) + - S_sw_bc (swallow bottom center) + \ S_sw_bl (swallow bottom left) + / S_sw_br (swallow bottom right) + | S_sw_ml (swallow middle left) + | S_sw_mr (swallow middle right) + - S_sw_tc (swallow top center) + / S_sw_tl (swallow top left) + \ S_sw_tr (swallow top right) + - S_tdwall (wall) + ^ S_teleportation_trap (teleportation trap) + \ S_throne (opulent throne) + - S_tlcorn (top left corner) + | S_tlwall (wall) + ( S_tool (useful item (pick-axe, key, lamp...)) + ^ S_trap_door (trap door) + t S_trapper (trapper or lurker above) + - S_trcorn (top right corner) + # S_tree (tree) + T S_troll (troll) + | S_trwall (wall) + - S_tuwall (wall) + U S_umber (umber hulk) + u S_unicorn (unicorn or horse) + < S_upladder (ladder up) + < S_upstair (staircase up) + V S_vampire (vampire) + | S_vbeam (vertical beam [zap animation]) + # S_vcdbridge (vertical raised drawbridge) + + S_vcdoor (closed door in vertical wall) + . S_venom (splash of venom) + ^ S_vibrating_square (vibrating square) + . S_vodbridge (vertical lowered drawbridge) + - S_vodoor (open door in vertical wall) + v S_vortex (vortex) + | S_vwall (vertical wall) + / S_wand (wand) + } S_water (water) + ) S_weapon (weapon) + " S_web (web) + w S_worm (worm) + ~ S_worm_tail (long worm tail) + W S_wraith (wraith) + x S_xan (xan or other extraordinary insect) + X S_xorn (xorn) + Y S_yeti (apelike creature) + Z S_zombie (zombie) + z S_zruty (zruty) - NetHack 3.6 May 7, 2019 + + NetHack 3.7 December 18, 2019 @@ -5416,63 +5416,63 @@ + S_pet_override (any pet if ACCESSIBILITY=1 is set) + S_hero_override (hero if ACCESSIBILITY=1 is set) + + Notes: + + * Several symbols in this table appear to be blank. They are the + space character, except for S_pet_override and S_hero_override + which don't have any default value and can only be used if en- + abled in the "sysconf" file. + + * S_rock is misleadingly named; rocks and stones use S_gem. + Statues and boulders are the rock being referred to, but since + version 3.6.0, statues are displayed as the monster they de- + pict. So S_rock is only used for boulders and not used at all + if overridden by the more specific S_boulder. + + 9.15. Configuring NetHack for Play by the Blind + + NetHack can be set up to use only standard ASCII characters + for making maps of the dungeons. This makes the MS-DOS versions + of NetHack completely accessible to the blind who use speech + and/or Braille access technologies. Players will require a good + working knowledge of their screen-reader's review features, and + will have to know how to navigate horizontally and vertically + character by character. They will also find the search capabili- + ties of their screen-readers to be quite valuable. Be certain to + examine this Guidebook before playing so you have an idea what + the screen layout is like. You'll also need to be able to locate + the PC cursor. It is always where your character is located. + Merely searching for an @-sign will not always find your charac- + ter since there are other humanoids represented by the same sign. + Your screen-reader should also have a function which gives you + the row and column of your review cursor and the PC cursor. + These co-ordinates are often useful in giving players a better + sense of the overall location of items on the screen. + + NetHack can also be compiled with support for sending the + game messages to an external program, such as a text-to-speech + synthesizer. If the "#version" extended command shows "external + program as a message handler", your NetHack has been compiled + with the capability. When compiling NetHack from source on Linux + and other POSIX systems, define MSGHANDLER to enable it. To use + the capability, set the environment variable NETHACK_MSGHANDLER + to an executable, which will be executed with the game message as + the program's only parameter. + + While it is not difficult for experienced users to edit the + defaults.nh file to accomplish this, novices may find this task somewhat daunting. Included within the "symbols" file of all of- ficial distributions of NetHack is a symset called NHAccess. Se- - lecting that symset in your configuration file will cause the - game to run in a manner accessible to the blind. After you have - gained some experience with the game and with editing files, you - may want to alter settings via SYMBOLS= in your configuration - file to better suit your preferences. The most crucial settings - to make the game accessible are: - - symset:NHAccess - Load a symbol set appropriate for use by blind players. - - roguesymset:NHAccess - Load a symbol set for the rogue level that is appropriate for - use by blind players. - - menustyle:traditional - This will assist in the interface to speech synthesizers. - - nomenu_overlay - Show menus on a cleared screen and aligned to the left edge. - - number_pad - A lot of speech access programs use the number-pad to review - the screen. If this is the case, disable the number_pad option - and use the traditional Rogue-like commands. - - autodescribe - Automatically describe the terrain under the cursor when tar- - geting. - - mention_walls - Give feedback messages when walking towards a wall or when - travel command was interrupted. - - whatis_coord:compass - When targeting with cursor, describe the cursor position with - coordinates relative to your character. - - whatis_filter:area - When targeting with cursor, filter possible locations so only - those in the same area (eg. same room, or same corridor) are - considered. - - whatis_moveskip - When targeting with cursor and using fast-move, skip the same - glyphs instead of moving 8 units at a time. - - nostatus_updates - Prevent updates to the status lines at the bottom of the - screen, if your screen-reader reads those lines. The same in- - formation can be seen via the #attributes command. + lecting that symset in your configuration file will cause the + game to run in a manner accessible to the blind. After you have + gained some experience with the game and with editing files, you + may want to alter settings via SYMBOLS= and ROGUESYMBOLS= in your - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -5482,18 +5482,84 @@ + configuration file to better suit your preferences. See the pre- + vious section for the special symbols S_pet_override to force a + consistent symbol for all pets and S_hero_override to force a + unique symbol for the player character if accessibility is en- + abled in the sysconf file. + + The most crucial settings to make the game more accessible + are: + + symset:NHAccess + Load a symbol set appropriate for use by blind players. + + roguesymset:NHAccess + Load a symbol set for the rogue level that is appropriate for + use by blind players. + + menustyle:traditional + This will assist in the interface to speech synthesizers. + + nomenu_overlay + Show menus on a cleared screen and aligned to the left edge. + + number_pad + A lot of speech access programs use the number-pad to review + the screen. If this is the case, disable the number_pad option + and use the traditional Rogue-like commands. + + autodescribe + Automatically describe the terrain under the cursor when tar- + geting. + + mention_walls + Give feedback messages when walking towards a wall or when + travel command was interrupted. + + whatis_coord:compass + When targeting with cursor, describe the cursor position with + coordinates relative to your character. + + whatis_filter:area + When targeting with cursor, filter possible locations so only + those in the same area (eg. same room, or same corridor) are + considered. + + whatis_moveskip + When targeting with cursor and using fast-move, skip the same + glyphs instead of moving 8 units at a time. + + nostatus_updates + Prevent updates to the status lines at the bottom of the + screen, if your screen-reader reads those lines. The same in- + formation can be seen via the "#attributes" command. + + + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 85 + + + 9.16. Global Configuration for System Administrators - If NetHack is compiled with the SYSCF option, a system ad- - ministrator should set up a global configuration; this is a file + If NetHack is compiled with the SYSCF option, a system ad- + ministrator should set up a global configuration; this is a file in the same format as the traditional per-user configuration file (see above). This file should be named sysconf and placed in the - same directory as the other NetHack support files. The options + same directory as the other NetHack support files. The options recognized in this file are listed below. Any option not set us- - es a compiled-in default (which may not be appropriate for your + es a compiled-in default (which may not be appropriate for your system). - WIZARDS = A space-separated list of user names who are allowed + WIZARDS = A space-separated list of user names who are allowed to play in debug mode (commonly referred to as wizard mode). A value of a single asterisk (*) allows anyone to start a game in debug mode. @@ -5501,25 +5567,53 @@ SHELLERS = A list of users who are allowed to use the shell es- cape command (!). The syntax is the same as WIZARDS. - EXPLORERS = A list of users who are allowed to use the explore + EXPLORERS = A list of users who are allowed to use the explore mode. The syntax is the same as WIZARDS. MAXPLAYERS = Limit the maximum number of games that can be run- ning at the same time. - SUPPORT = A string explaining how to get local support (no de- + SAVEFORMAT = A list of up to two save file formats separated by + space. The first format in the list will written as well as + read. The second format will be read only if no save file in + the first format exists. Valid choices are "historical" for + binary writing of entire structs, "lendian" for binary writing + of each field in little-endian order, "ascii" for writing the + save file content in ascii text. + + BONESFORMAT = A list of up to two bones file formats separated + by space. The first format in the list will written as well as + read. The second format will be read only if no bones files in + the first format exist. Valid choices are "historical" for bi- + nary writing of entire structs, "lendian" for binary writing of + each field in little-endian order, "ascii" for writing the + bones file content in ascii text. + + SUPPORT = A string explaining how to get local support (no de- fault value). - RECOVER = A string explaining how to recover a game on this + RECOVER = A string explaining how to recover a game on this system (no default value). - SEDUCE = 0 or 1 to disable or enable, respectively, the SEDUCE - option. When disabled, incubi and succubi behave like nymphs. + SEDUCE = 0 or 1 to disable or enable, respectively, the SEDUCE + option. When disabled, incubi and succubi behave like nymphs. CHECK_PLNAME = Setting this to 1 will make the EXPLORERS, WIZ- ARDS, and SHELLERS check for the player name instead of the us- er's login name. + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 86 + + + CHECK_SAVE_UID = 0 or 1 to disable or enable, respectively, the UID (used identification number) checking for save files (to verify that the user who is restoring is the same one who @@ -5537,27 +5631,25 @@ PERS_IS_UID = 0 or 1 to use user names or numeric userids, re- spectively, to identify unique people for the score file. - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 85 - - - MAX_STATUENAME_RANK = Maximum number of score file entries to use for random statue names (default is 10). + ACCESSIBILITY = 0 or 1 to disable or enable, respectively, the + ability for players to set S_pet_override and S_hero_override + symbols in their configuration file. + + PORTABLE_DEVICE_PATHS = 0 or 1 Windows OS only, the game will + look for all of its external files, and write to all of its + output files in one place rather than at the standard loca- + tions. + DUMPLOGFILE = A filename where the end-of-game dumplog is - saved. Not defining this will prevent dumplog from being cre- + saved. Not defining this will prevent dumplog from being cre- ated. Only available if your game is compiled with DUMPLOG. Al- lows the following placeholders: %% - literal `%' - %v - version (eg. "3.6.2-0") + %v - version (eg. "3.6.3-0") %u - game UID %t - game start time, UNIX timestamp format %T - current time, UNIX timestamp format @@ -5568,109 +5660,17 @@ 10. Scoring - NetHack maintains a list of the top scores or scorers on + NetHack maintains a list of the top scores or scorers on your machine, depending on how it is set up. In the latter case, - each account on the machine can post only one non-winning score - on this list. If you score higher than someone else on this - list, or better your previous score, you will be inserted in the - proper place under your current name. How many scores are kept + each account on the machine can post only one non-winning score + on this list. If you score higher than someone else on this + list, or better your previous score, you will be inserted in the + proper place under your current name. How many scores are kept can also be set up when NetHack is compiled. - Your score is chiefly based upon how much experience you - gained, how much loot you accumulated, how deep you explored, and - how the game ended. If you quit the game, you escape with all of - your gold intact. If, however, you get killed in the Mazes of - Menace, the guild will only hear about 90% of your gold when your - corpse is discovered (adventurers have been known to collect - finder's fees). So, consider whether you want to take one last - hit at that monster and possibly live, or quit and stop with - whatever you have. If you quit, you keep all your gold, but if - you swing and live, you might find more. - - If you just want to see what the current top players/games - list is, you can type nethack -s all on most versions. - - 11. Explore mode - - NetHack is an intricate and difficult game. Novices might - falter in fear, aware of their ignorance of the means to survive. - Well, fear not. Your dungeon comes equipped with an "explore" or - "discovery" mode that enables you to keep old save files and - cheat death, at the paltry cost of not getting on the high score - list. - - There are two ways of enabling explore mode. One is to - start the game with the -X command-line switch or with the play- - mode:explore option. The other is to issue the "#exploremode" - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 86 - - - - extended command while already playing the game. Starting a new - game in explore mode provides your character with a wand of wish- - ing in initial inventory; switching during play does not. The - other benefits of explore mode are left for the trepid reader to - discover. - - 11.1. Debug mode - - Debug mode, also known as wizard mode, is undocumented aside - from this brief description and the various "debug mode only" - commands listed among the command descriptions. It is intended - for tracking down problems within the program rather than to pro- - vide god-like powers to your character, and players who attempt - debugging are expected to figure out how to use it themselves. - It is initiated by starting the game with the -D command-line - switch or with the playmode:debug option. - - For some systems, the player must be logged in under a par- - ticular user name to be allowed to use debug mode; for others, - the hero must be given a particular character name (but may be - any role; there's no connection between "wizard mode" and the - Wizard role). Attempting to start a game in debug mode when not - allowed or not available will result in falling back to explore - mode instead. - - 12. Credits - - The original hack game was modeled on the Berkeley UNIX - rogue game. Large portions of this paper were shamelessly - cribbed from A Guide to the Dungeons of Doom, by Michael C. Toy - and Kenneth C. R. C. Arnold. Small portions were adapted from - Further Exploration of the Dungeons of Doom, by Ken Arromdee. - - NetHack is the product of literally dozens of people's work. - Main events in the course of the game development are described - below: - - Jay Fenlason wrote the original Hack, with help from Kenny - Woodland, Mike Thome and Jon Payne. - - Andries Brouwer did a major re-write, transforming Hack into - a very different game, and published (at least) three versions - (1.0.1, 1.0.2, and 1.0.3) for UNIX machines to the Usenet. - - Don G. Kneller ported Hack 1.0.3 to Microsoft C and MS-DOS, - producing PC HACK 1.01e, added support for DEC Rainbow graphics - in version 1.03g, and went on to produce at least four more ver- - sions (3.0, 3.2, 3.51, and 3.6). - - R. Black ported PC HACK 3.51 to Lattice C and the Atari - 520/1040ST, producing ST Hack 1.03. - - Mike Stephenson merged these various versions back together, - incorporating many of the added features, and produced NetHack - - - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 @@ -5680,8 +5680,103 @@ - 1.4. He then coordinated a cast of thousands in enhancing and - debugging NetHack 1.4 and released NetHack versions 2.2 and 2.3. + Your score is chiefly based upon how much experience you + gained, how much loot you accumulated, how deep you explored, and + how the game ended. If you quit the game, you escape with all of + your gold intact. If, however, you get killed in the Mazes of + Menace, the guild will only hear about 90% of your gold when your + corpse is discovered (adventurers have been known to collect + finder's fees). So, consider whether you want to take one last + hit at that monster and possibly live, or quit and stop with + whatever you have. If you quit, you keep all your gold, but if + you swing and live, you might find more. + + If you just want to see what the current top players/games + list is, you can type nethack -s all on most versions. + + 11. Explore mode + + NetHack is an intricate and difficult game. Novices might + falter in fear, aware of their ignorance of the means to survive. + Well, fear not. Your dungeon comes equipped with an "explore" or + "discovery" mode that enables you to keep old save files and + cheat death, at the paltry cost of not getting on the high score + list. + + There are two ways of enabling explore mode. One is to + start the game with the -X command-line switch or with the play- + mode:explore option. The other is to issue the "#exploremode" + extended command while already playing the game. Starting a new + game in explore mode provides your character with a wand of wish- + ing in initial inventory; switching during play does not. The + other benefits of explore mode are left for the trepid reader to + discover. + + 11.1. Debug mode + + Debug mode, also known as wizard mode, is undocumented aside + from this brief description and the various "debug mode only" + commands listed among the command descriptions. It is intended + for tracking down problems within the program rather than to pro- + vide god-like powers to your character, and players who attempt + debugging are expected to figure out how to use it themselves. + It is initiated by starting the game with the -D command-line + switch or with the playmode:debug option. + + For some systems, the player must be logged in under a par- + ticular user name to be allowed to use debug mode; for others, + the hero must be given a particular character name (but may be + any role; there's no connection between "wizard mode" and the + Wizard role). Attempting to start a game in debug mode when not + allowed or not available will result in falling back to explore + mode instead. + + + + + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 88 + + + + 12. Credits + + The original hack game was modeled on the Berkeley UNIX + rogue game. Large portions of this paper were shamelessly + cribbed from A Guide to the Dungeons of Doom, by Michael C. Toy + and Kenneth C. R. C. Arnold. Small portions were adapted from + Further Exploration of the Dungeons of Doom, by Ken Arromdee. + + NetHack is the product of literally dozens of people's work. + Main events in the course of the game development are described + below: + + Jay Fenlason wrote the original Hack, with help from Kenny + Woodland, Mike Thome and Jon Payne. + + Andries Brouwer did a major re-write, transforming Hack into + a very different game, and published (at least) three versions + (1.0.1, 1.0.2, and 1.0.3) for UNIX machines to the Usenet. + + Don G. Kneller ported Hack 1.0.3 to Microsoft C and MS-DOS, + producing PC HACK 1.01e, added support for DEC Rainbow graphics + in version 1.03g, and went on to produce at least four more ver- + sions (3.0, 3.2, 3.51, and 3.6). + + R. Black ported PC HACK 3.51 to Lattice C and the Atari + 520/1040ST, producing ST Hack 1.03. + + Mike Stephenson merged these various versions back together, + incorporating many of the added features, and produced NetHack + 1.4. He then coordinated a cast of thousands in enhancing and + debugging NetHack 1.4 and released NetHack versions 2.2 and 2.3. Later, Mike coordinated a major rewrite of the game, heading a team which included Ken Arromdee, Jean-Christophe Collet, Steve @@ -5705,6 +5800,18 @@ Ken Arromdee, David Cohrs, Jean-Christophe Collet, Kevin Darcy, Matt Day, Timo Hakulinen, Steve Linhart, Dean Luick, Pat Rankin, Eric Raymond, and Eric Smith undertook a radical revision of 3.0. + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 89 + + + They re-structured the game's design, and re-wrote major parts of the code. They added multiple dungeons, a new display, special individual character quests, a new endgame and many other new @@ -5722,7 +5829,7 @@ Engber, David Hairston, Michael Hamel, Jonathan Handler, Johnny Lee, Tim Lennan, Rob Menke, and Andy Swanson, developed NetHack 3.1 for the Macintosh, porting it for MPW. Building on their de- - velopment, Barton House added a Think C port. + velopment, Bart House added a Think C port. Timo Hakulinen ported NetHack 3.1 to OS/2. Eric Smith port- ed NetHack 3.1 to the Atari. Pat Rankin, with help from Joshua @@ -5735,17 +5842,6 @@ velopment Team and tile support was then added to other plat- forms. - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 88 - - - The 3.2 NetHack Development Team, comprised of Michael Alli- son, Ken Arromdee, David Cohrs, Jessie Collet, Steve Creps, Kevin Darcy, Timo Hakulinen, Steve Linhart, Dean Luick, Pat Rankin, Er- @@ -5769,8 +5865,20 @@ Tom Proudfoot and Yuval Oren created NetHack++, which was quickly renamed NetHack--. Working independently, Stephen White wrote NetHack Plus. Tom Proudfoot later merged NetHack Plus and - his own NetHack-- to produce SLASH. Larry Stewart-Zerba and War- - wick Allison improved the spell casting system with the Wizard + his own NetHack-- to produce SLASH. Larry Stewart-Zerba and + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 90 + + + + Warwick Allison improved the spell casting system with the Wizard Patch. Warwick Allison also ported NetHack to use the Qt inter- face. @@ -5800,18 +5908,6 @@ first version to allow you to ride a steed, and was the first version to have a publicly available web-site listing all the bugs that had been discovered. Despite that constantly growing - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 89 - - - bug list, 3.3 proved stable enough to last for more than a year and a half. @@ -5835,9 +5931,21 @@ Michael Allison, David Cohrs, Alex Kompel, Dion Nicolaas, and Yitzhak Sapir maintained and enhanced 3.4 for the Microsoft - Windows platform. Alex Kompel contributed a new graphical inter- - face for the Windows port. Alex Kompel also contributed a Win- - dows CE port for 3.4.1. + Windows platform. Alex Kompel contributed a new graphical + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 91 + + + + interface for the Windows port. Alex Kompel also contributed a + Windows CE port for 3.4.1. Ron Van Iwaarden was the sole maintainer of NetHack for OS/2 the past several releases. Unfortunately Ron's last OS/2 machine @@ -5866,18 +5974,6 @@ In September 2014, an interim snapshot of the code under de- velopment was released publicly by other parties. Since that code - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 90 - - - was a work-in-progress and had not gone through the process of debugging it as a suitable release, it was decided that the ver- sion numbers present on that code snapshot would be retired and @@ -5902,6 +5998,18 @@ found in the game, author Terry Pratchett, passed away. NetHack 3.6.0 introduced a tribute to him. + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 92 + + + 3.6.0 was released in December 2015, and merged work done by the development team since the release of 3.4.3 with some of the beloved community patches. Many bugs were fixed and some code was @@ -5914,7 +6022,7 @@ Ken Lorber, Haoyang Wang, Pat Rankin, and Dean Luick main- tained the port of NetHack 3.6 for Mac OSX. - Michael Allison, David Cohrs, Barton House, Pasi Kallinen, + Michael Allison, David Cohrs, Bart House, Pasi Kallinen, Alex Kompel, Dion Nicolaas, Derek S. Ray and Yitzhak Sapir main- tained the port of NetHack 3.6 for Microsoft Windows. @@ -5932,18 +6040,6 @@ The NetHack Development Team at the time of release of 3.6.1 con- sisted of Warwick Allison, Michael Allison, Ken Arromdee, David Cohrs, Jessie Collet, Pasi Kallinen, Ken Lorber, Dean Luick, - - - NetHack 3.6 May 7, 2019 - - - - - - NetHack Guidebook 91 - - - Patric Mueller, Pat Rankin, Derek S. Ray, Alex Smith, Mike Stephenson, Janet Walz, and Paul Winner. @@ -5951,82 +6047,105 @@ hancements and the adopted curses window port, were released as 3.6.2. + Bart House, who had contributed to the game as a porting + team participant for decades, joined the NetHack Development Team + in late May 2019. + + NetHack 3.6.3 was released on December 5, 2019 containing + over 190 bug fixes to NetHack 3.6.2. + + NetHack 3.6.4 was released on December 18, 2019 containing a + security fix and a few bug fixes. + The official NetHack web site is maintained by Ken Lorber at - http://www.nethack.org/. + https://www.nethack.org/. 12.1. SPECIAL THANKS On behalf of the NetHack community, thank you very much once again to M. Drew Streib and Pasi Kallinen for providing a public + + + NetHack 3.7 December 18, 2019 + + + + + + NetHack Guidebook 93 + + + NetHack server at nethack.alt.org. Thanks to Keith Simpson and Andy Thomson for hardfought.org. Thanks to all those unnamed dun- geoneers who invest their time and effort into annual NetHack tournaments such as Junethack, The November NetHack Tournament - and in days past, devnull.net (gone for now, but not forgotten). + and in days past, devnull.net (gone for now, but not forgotten). - - - - - - - - - - - From time to time, some depraved individual out there in - netland sends a particularly intriguing modification to help out + From time to time, some depraved individual out there in + netland sends a particularly intriguing modification to help out with the game. The NetHack Development Team sometimes makes note - of the names of the worst of these miscreants in this, the list + of the names of the worst of these miscreants in this, the list of Dungeoneers: - Adam Aronow Janet Walz Nathan Eady - Alex Kompel Janne Salmijarvi Norm Meluch - Alex Smith Jean-Christophe Collet Olaf Seibert - Andreas Dorn Jeff Bailey Pasi Kallinen - Andy Church Jochen Erwied Pat Rankin - Andy Swanson John Kallen Patric Mueller - Ari Huttunen John Rupley Paul Winner - Barton House John S. Bien Pierre Martineau - Benson I. Margulies Johnny Lee Ralf Brown - Bill Dyer Jon W{tte Ray Chason - Boudewijn Waijers Jonathan Handler Richard Addison - Bruce Cox Joshua Delahunty Richard Beigel - Bruce Holloway Karl Garrison Richard P. Hughey - Bruce Mewborne Keizo Yamamoto Rob Menke - Carl Schelin Ken Arnold Robin Bandy - Chris Russo Ken Arromdee Robin Johnson - David Cohrs Ken Lorber Roderick Schertler - David Damerell Ken Washikita Roland McGrath - David Gentzel Kevin Darcy Ron Van Iwaarden - David Hairston Kevin Hugo Ronnen Miller - Dean Luick Kevin Sitze Ross Brown - Del Lamb Kevin Smolkowski Sascha Wostmann - Derek S. Ray Kevin Sweet Scott Bigham - Deron Meranda Lars Huttar Scott R. Turner - Dion Nicolaas Leon Arnott Sean Hunt - Dylan O'Donnell M. Drew Streib Stephen Spackman + Adam Aronow J. Ali Harlow Mikko Juola + Alex Kompel Janet Walz Nathan Eady + Alex Smith Janne Salmijarvi Norm Meluch + Andreas Dorn Jean-Christophe Collet Olaf Seibert + Andy Church Jeff Bailey Pasi Kallinen + Andy Swanson Jochen Erwied Pat Rankin + Andy Thomson John Kallen Patric Mueller + Ari Huttunen John Rupley Paul Winner + Bart House John S. Bien Pierre Martineau + Benson I. Margulies Johnny Lee Ralf Brown + Bill Dyer Jon W{tte Ray Chason + Boudewijn Waijers Jonathan Handler Richard Addison + Bruce Cox Joshua Delahunty Richard Beigel + Bruce Holloway Karl Garrison Richard P. Hughey + Bruce Mewborne Keizo Yamamoto Rob Menke + Carl Schelin Keith Simpson Robin Bandy + Chris Russo Ken Arnold Robin Johnson + David Cohrs Ken Arromdee Roderick Schertler + David Damerell Ken Lorber Roland McGrath + David Gentzel Ken Washikita Ron Van Iwaarden + David Hairston Kevin Darcy Ronnen Miller + Dean Luick Kevin Hugo Ross Brown + Del Lamb Kevin Sitze Sascha Wostmann + Derek S. Ray Kevin Smolkowski Scott Bigham + Deron Meranda Kevin Sweet Scott R. Turner + Dion Nicolaas Lars Huttar Sean Hunt + Dylan O'Donnell Leon Arnott Stephen Spackman + Eric Backus M. Drew Streib Stefan Thielscher + Eric Hendrickson Malcolm Ryan Stephen White + Eric R. Smith Mark Gooderum Steve Creps + Eric S. Raymond Mark Modrall Steve Linhart + Erik Andersen Marvin Bressler Steve VanDevender + Fredrik Ljungdahl Matthew Day Teemu Suikki + Frederick Roeber Merlyn LeRoy Tim Lennan + Gil Neiger Michael Allison Timo Hakulinen + Greg Laskin Michael Feir Tom Almy + Greg Olson Michael Hamel Tom West + Gregg Wonderly Michael Sokolov Warren Cheung + Hao-yang Wang Mike Engber Warwick Allison + Helge Hafting Mike Gallop Yitzhak Sapir - NetHack 3.6 May 7, 2019 + NetHack 3.7 December 18, 2019 - NetHack Guidebook 92 + NetHack Guidebook 94 - Eric Backus Malcolm Ryan Stefan Thielscher - Eric Hendrickson Mark Gooderum Stephen White - Eric R. Smith Mark Modrall Steve Creps - Eric S. Raymond Marvin Bressler Steve Linhart - Erik Andersen Matthew Day Steve VanDevender - Frederick Roeber Merlyn LeRoy Teemu Suikki - Gil Neiger Michael Allison Tim Lennan - Greg Laskin Michael Feir Timo Hakulinen - Greg Olson Michael Hamel Tom Almy - Gregg Wonderly Michael Sokolov Tom West - Hao-yang Wang Mike Engber Warren Cheung - Helge Hafting Mike Gallop Warwick Allison - Irina Rempt-Drijfhout Mike Passaretti Yitzhak Sapir - Izchak Miller Mike Stephenson - J. Ali Harlow Mikko Juola + Irina Rempt-Drijfhout Mike Passaretti + Izchak Miller Mike Stephenson - Brand and product names are trademarks or registered trade- + Brand and product names are trademarks or registered trade- marks of their respective holders. @@ -6066,7 +6185,20 @@ - NetHack 3.6 May 7, 2019 + + + + + + + + + + + + + + NetHack 3.7 December 18, 2019 diff --git a/doc/config.nh b/doc/config.nh index ce5410382..437158250 100644 --- a/doc/config.nh +++ b/doc/config.nh @@ -347,7 +347,8 @@ # How the map window is shown? Windows GUI only. # possible map_mode options include: tiles, ascii4x6, # ascii6x8, ascii8x8, ascii16x8, ascii7x12, ascii8x12, ascii16x12, -# ascii12x16, ascii10x18, fit_to_screen +# ascii12x16, ascii10x18, fit_to_screen, ascii_fit_to_screen, +# tiles_fit_to_screen #OPTIONS=map_mode:tiles # Define alternative file for the files, and the tile size diff --git a/doc/dgn_comp.6 b/doc/dgn_comp.6 deleted file mode 100644 index 7b311831c..000000000 --- a/doc/dgn_comp.6 +++ /dev/null @@ -1,419 +0,0 @@ -.TH DGN_COMP 6 "25 May 2015" NETHACK -.de ND -.ds Nd \\$3 -.. -.de NB -.ds Nb \\$2 -.. -.de NR -.ds Nr \\$2 -.. -.ND $NHDT-Date: 1524689548 2018/04/25 20:52:28 $ -.NB $NHDT-Branch: NetHack-3.6.0 $ -.NR $NHDT-Revision: 1.6 $ -.ds Na Kenneth Lorber - -.SH NAME -dgn_comp \- NetHack dungeon compiler -.SH SYNOPSIS -.B dgn_comp -[ -.I file -] -.PP -If no arguments are given, it reads standard input. -.SH DESCRIPTION -.PP -.I Dgn_comp -is a dungeon compiler for NetHack version 3.2 and higher. It -takes a description file as an argument and produces a dungeon "script" -that is to be loaded by NetHack at runtime. -.PP -The purpose of this tool is to provide NetHack administrators and -implementors with a convenient way to create a custom dungeon for the -game, without having to recompile the entire world. -.SH GRAMMAR -.PP -DUNGEON: -.B name -.B bonesmarker -( -.B base -, -.B rand -) [ -.B %age -] -.PP -where -.B name -is the dungeon name, -.B bonesmarker -is a letter for marking bones files, ( -.B base -, -.B rand -) is the number of levels, and -.B %age -is its percentage chance of being generated (if absent, 100% chance). - -DESCRIPTION: -.B tag -.PP -where -.B tag -is currently one of -.BR HELLISH , -.BR MAZELIKE , -or -.BR ROGUELIKE . - -ALIGNMENT | LEVALIGN: [ -.B lawful -| -.B neutral -| -.B chaotic -| -.B unaligned -] -.PP -gives the alignment of the dungeon/level (default is unaligned). - -ENTRY: -.B level -.PP -the dungeon entry point. The dungeon connection attaches at this -level of the given dungeon. -If the value of -.B level -is negative, the entry level is calculated from the bottom of the -dungeon, with -1 being the last level. -If this line is not present in a dungeon description, the entry level -defaults to 1. - -PROTOFILE: -.B name -.PP -the prototypical name for dungeon level files in this dungeon. -For example, the PROTOFILE name for the dungeon -.I Vlad's Tower -is -.IR tower . - -LEVEL: -.B name -.B bonesmarker -@ ( -.B base -, -.B rand -) [ -.B %age -] -.PP -where -.B name -is the level name, -.B bonesmarker -is a letter for marking bones files, ( -.B base -, -.B rand -) is the location and -.B %age -is the generation percentage, as above. - -RNDLEVEL: -.B name -.B bonesmarker -@ ( -.B base -, -.B rand -) -[ -.B %age -] -.B rndlevs -.PP -where -.B name -is the level name, -.B bonesmarker -is a letter for marking bones files, ( -.B base -, -.B rand -) is the location, -.B %age -is the generation percentage, as above, and -.B rndlevs -is the number of similar levels available to choose from. - -CHAINLEVEL: -.B name -.B bonesmarker -.B prev_name -+ ( -.B base -, -.B rand -) [ -.B %age -] -.PP -where -.B name -is the level name, -.B bonesmarker -is a letter for marking bones files, -.B prev_name -is the name of a level defined previously, ( -.B base -, -.B rand -) is the -.I offset -from the level being chained from, and -.B %age -is the generation percentage. - -RNDCHAINLEVEL: -.B name -.B bonesmarker -.B prev_name -+ ( -.B base -, -.B rand -) [ -.B %age -] -.B rndlevs -.PP -where -.B name -is the level name, -.B bonesmarker -is a letter for marking bones files, -.B prev_name -is the name of a level defined previously, ( -.B base -, -.B rand -) is the -.I offset -from the level being chained from, -.B %age -is the generation percentage, and -.B rndlevs -is the number of similar levels available to choose from. - -LEVELDESC: -.B type -.PP -where -.B type -is the level type, (see DESCRIPTION, above). The -.B type -is used to override any pre-set value used to describe the entire dungeon, -for this level only. - -BRANCH: -.B name -@ ( -.B base -, -.B rand -) [ -.B stair -| -.B no_up -| -.B no_down -| -.B portal -] [ -.B up -| -.B down -] -.PP -where -.B name -is the name of the dungeon to branch to, and ( -.B base -, -.B rand -) is the location of the branch. -The last two optional arguments are -the branch type and branch direction. -The type of a branch can be a two-way stair connection, -a one-way stair connection, or a magic portal. -A one-way stair is described by the types -.B no_up -and -.B no_down -which specify which stair direction is missing. -The default branch type is -.BR stair . -The direction for a stair can be either up or down; direction is not -applicable to portals. The default direction is -.BR down . - -CHAINBRANCH: -.B name -.B prev_name -+ ( -.B base -, -.B rand -) [ -.B stair -| -.B no_up -| -.B no_down -| -.B portal -] [ -.B up -| -.B down -] -.PP -where -.B name -is the name of the dungeon to branch to, -.B prev_name -is the name of a previously defined -.B level -and ( -.B base -, -.B rand -) is the -.I offset -from the level being chained from. -The optional branch type and direction are the same as described above. -.SH GENERIC RULES -.PP -Each dungeon must have a unique -.B bonesmarker , -and each special level must have a -.B bonesmarker -unique within its dungeon (letters may be reused in different dungeons). -If the -.B bonesmarker -has the special value "none", no bones files will be created for that -level or dungeon. -.PP -The value -.B base -may be in the range of 1 to -.B MAXLEVEL -(as defined in -.I global.h -). -.PP -The value -.B rand -may be in the range of -1 to -.BR MAXLEVEL . -.PP -If -.B rand -is -1 it will be replaced with the value (num_dunlevs(dungeon) - base) -during the load process (ie. from here to the end of the dungeon). -.PP -If -.B rand -is 0 the level is located absolutely at -.BR base . -.PP -Branches don't have a probability. Dungeons do. If a dungeon fails -to be generated during load, all its levels and branches are skipped. -.PP -No level or branch may be chained from a level with a percentage generation -probability. This is to prevent non-resolution during the load. -In addition, no branch may be made from a dungeon with a percentage -generation probability for the same reason. -.PP -As a general rule using the dungeon compiler: -.PP -If a dungeon has a -.B protofile -name associated with it -.RI ( eg. -.BR tower ) -that file will be used. -.PP -If a special level is present, it will override the above rule and -the appropriate file will be loaded. -.PP -If neither of the above are present, the standard generator will -take over and make a "normal" level. -.PP -A level alignment, if present, will override -the alignment of the dungeon that it exists within. -.SH EXAMPLE -.PP -Here is the current syntax of the dungeon compiler's "language": - -.LP -.nf -.ta +8n +8n +8n -# -# The dungeon description file for the "standard" original -# 3.0 NetHack. -# -DUNGEON: "The Dungeons of Doom" "D" (25, 5) -LEVEL: "rogue" "none" @ (15, 4) -LEVEL: "oracle" "none" @ (5, 7) -LEVEL: "bigroom" "B" @ (12, 3) 15 -LEVEL: "medusa" "none" @ (20, 5) -CHAINLEVEL: "castle" "medusa" + (1, 4) -CHAINBRANCH: "Hell" "castle" + (0, 0) no_down -BRANCH: "The Astral Plane" @ (1, 0) no_down up - -DUNGEON: "Hell" "H" (25, 5) -DESCRIPTION: mazelike -DESCRIPTION: hellish -BRANCH: "Vlad's Tower" @ (13, 5) up -LEVEL: "wizard" "none" @ (15, 10) -LEVEL: "fakewiz" "A" @ (5, 5) -LEVEL: "fakewiz" "B" @ (10, 5) -LEVEL: "fakewiz" "C" @ (15, 5) -LEVEL: "fakewiz" "D" @ (20, 5) -LEVEL: "fakewiz" "E" @ (25, 5) - -DUNGEON: "Vlad's Tower" "T" (3, 0) -PROTOFILE: "tower" -DESCRIPTION: mazelike -ENTRY: -1 - -DUNGEON: "The Astral Plane" "A" (1, 0) -DESCRIPTION: mazelike -PROTOFILE: "endgame" -.fi -.PP -.I NOTES: -.br -Lines beginning with '#' are considered comments. -.br -A special level must be explicitly aligned. The alignment of the dungeon -it is in only applies to non-special levels within that dungeon. -.SH AUTHOR -.PP -M. Stephenson (from the level compiler by Jean-Christophe Collet). -.SH "SEE ALSO" -.PP -lev_comp(6), nethack(6) -.SH BUGS -.PP -Probably infinite. -.SH COPYRIGHT -This file is Copyright (C) \*(Na and was last modified \*(Nd (version -\*(Nb:\*(Nr). -NetHack may be freely redistributed. See license for details. diff --git a/doc/dgn_comp.txt b/doc/dgn_comp.txt deleted file mode 100644 index 907a4f0a6..000000000 --- a/doc/dgn_comp.txt +++ /dev/null @@ -1,330 +0,0 @@ - - - -DGN_COMP(6) 1995 DGN_COMP(6) - - - -NAME - dgn_comp - NetHack dungeon compiler - -SYNOPSIS - dgn_comp [ file ] - - If no arguments are given, it reads standard input. - -DESCRIPTION - Dgn_comp is a dungeon compiler for NetHack version 3.2 and - higher. It takes a description file as an argument and pro- - duces a dungeon "script" that is to be loaded by NetHack at - runtime. - - The purpose of this tool is to provide NetHack administra- - tors and implementors with a convenient way to create a cus- - tom dungeon for the game, without having to recompile the - entire world. - -GRAMMAR - DUNGEON: name bonesmarker ( base , rand ) [ %age ] - - where name is the dungeon name, bonesmarker is a letter for - marking bones files, ( base , rand ) is the number of lev- - els, and %age is its percentage chance of being generated - (if absent, 100% chance). - - DESCRIPTION: tag - - where tag is currently one of HELLISH, MAZELIKE, or ROGUE- - LIKE. - - ALIGNMENT | LEVALIGN: [ lawful | neutral | chaotic | - unaligned ] - - gives the alignment of the dungeon/level (default is - unaligned). - - ENTRY: level - - the dungeon entry point. The dungeon connection attaches at - this level of the given dungeon. If the value of level is - negative, the entry level is calculated from the bottom of - the dungeon, with -1 being the last level. If this line is - not present in a dungeon description, the entry level - defaults to 1. - - PROTOFILE: name - - the prototypical name for dungeon level files in this - dungeon. For example, the PROTOFILE name for the dungeon - Vlad's Tower is tower. - - - -Dec Last change: 12 1 - - - - - - -DGN_COMP(6) 1995 DGN_COMP(6) - - - - LEVEL: name bonesmarker @ ( base , rand ) [ %age ] - - where name is the level name, bonesmarker is a letter for - marking bones files, ( base , rand ) is the location and - %age is the generation percentage, as above. - - RNDLEVEL: name bonesmarker @ ( base , rand ) [ %age ] - rndlevs - - where name is the level name, bonesmarker is a letter for - marking bones files, ( base , rand ) is the location, %age - is the generation percentage, as above, and rndlevs is the - number of similar levels available to choose from. - - CHAINLEVEL: name bonesmarker prev_name + ( base , rand ) [ - %age ] - - where name is the level name, bonesmarker is a letter for - marking bones files, prev_name is the name of a level - defined previously, ( base , rand ) is the offset from the - level being chained from, and %age is the generation percen- - tage. - - RNDCHAINLEVEL: name bonesmarker prev_name + ( base , rand ) - [ %age ] rndlevs - - where name is the level name, bonesmarker is a letter for - marking bones files, prev_name is the name of a level - defined previously, ( base , rand ) is the offset from the - level being chained from, %age is the generation percentage, - and rndlevs is the number of similar levels available to - choose from. - - LEVELDESC: type - - where type is the level type, (see DESCRIPTION, above). The - type is used to override any pre-set value used to describe - the entire dungeon, for this level only. - - BRANCH: name @ ( base , rand ) [ stair | no_up | no_down | - portal ] [ up | down ] - - where name is the name of the dungeon to branch to, and ( - base , rand ) is the location of the branch. The last two - optional arguments are the branch type and branch direction. - The type of a branch can be a two-way stair connection, a - one-way stair connection, or a magic portal. A one-way - stair is described by the types no_up and no_down which - specify which stair direction is missing. The default - branch type is stair. The direction for a stair can be - either up or down; direction is not applicable to portals. - The default direction is down. - - - -Dec Last change: 12 2 - - - - - - -DGN_COMP(6) 1995 DGN_COMP(6) - - - - CHAINBRANCH: name prev_name + ( base , rand ) [ stair | - no_up | no_down | portal ] [ up | down ] - - where name is the name of the dungeon to branch to, - prev_name is the name of a previously defined level and ( - base , rand ) is the offset from the level being chained - from. The optional branch type and direction are the same - as described above. - -GENERIC RULES - Each dungeon must have a unique bonesmarker , and each spe- - cial level must have a bonesmarker unique within its dungeon - (letters may be reused in different dungeons). If the - bonesmarker has the special value "none", no bones files - will be created for that level or dungeon. - - The value base may be in the range of 1 to MAXLEVEL (as - defined in global.h ). - - The value rand may be in the range of -1 to MAXLEVEL. - - If rand is -1 it will be replaced with the value - (num_dunlevs(dungeon) - base) during the load process (ie. - from here to the end of the dungeon). - - If rand is 0 the level is located absolutely at base. - - Branches don't have a probability. Dungeons do. If a - dungeon fails to be generated during load, all its levels - and branches are skipped. - - No level or branch may be chained from a level with a per- - centage generation probability. This is to prevent non- - resolution during the load. In addition, no branch may be - made from a dungeon with a percentage generation probability - for the same reason. - - As a general rule using the dungeon compiler: - - If a dungeon has a protofile name associated with it (eg. - tower) that file will be used. - - If a special level is present, it will override the above - rule and the appropriate file will be loaded. - - If neither of the above are present, the standard generator - will take over and make a "normal" level. - - A level alignment, if present, will override the alignment - of the dungeon that it exists within. - - - - - -Dec Last change: 12 3 - - - - - - -DGN_COMP(6) 1995 DGN_COMP(6) - - - -EXAMPLE - Here is the current syntax of the dungeon compiler's - "language": - - - # - # The dungeon description file for the "standard" original - # 3.0 NetHack. - # - DUNGEON: "The Dungeons of Doom" "D" (25, 5) - LEVEL: "rogue" "none" @ (15, 4) - LEVEL: "oracle" "none" @ (5, 7) - LEVEL: "bigroom" "B" @ (12, 3) 15 - LEVEL: "medusa" "none" @ (20, 5) - CHAINLEVEL: "castle" "medusa" + (1, 4) - CHAINBRANCH: "Hell" "castle" + (0, 0) no_down - BRANCH: "The Astral Plane" @ (1, 0) no_down up - - DUNGEON: "Hell" "H" (25, 5) - DESCRIPTION: mazelike - DESCRIPTION: hellish - BRANCH: "Vlad's Tower" @ (13, 5) up - LEVEL: "wizard" "none" @ (15, 10) - LEVEL: "fakewiz" "A" @ (5, 5) - LEVEL: "fakewiz" "B" @ (10, 5) - LEVEL: "fakewiz" "C" @ (15, 5) - LEVEL: "fakewiz" "D" @ (20, 5) - LEVEL: "fakewiz" "E" @ (25, 5) - - DUNGEON: "Vlad's Tower" "T" (3, 0) - PROTOFILE: "tower" - DESCRIPTION: mazelike - ENTRY: -1 - - DUNGEON: "The Astral Plane" "A" (1, 0) - DESCRIPTION: mazelike - PROTOFILE: "endgame" - - NOTES: - Lines beginning with '#' are considered comments. - A special level must be explicitly aligned. The alignment - of the dungeon it is in only applies to non-special levels - within that dungeon. - -AUTHOR - M. Stephenson (from the level compiler by Jean-Christophe - Collet). - -SEE ALSO - lev_comp(6), nethack(6) - - - - - -Dec Last change: 12 4 - - - - - - -DGN_COMP(6) 1995 DGN_COMP(6) - - - -BUGS - Probably infinite. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Dec Last change: 12 5 - - - diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 55d8d28a9..d0b52cd5d 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.116 $ $NHDT-Date: 1569276988 2019/09/23 22:16:28 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.197 $ $NHDT-Date: 1575173931 2019/12/01 04:18:51 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -115,7 +115,11 @@ for multi-shot shooting by monsters, a typo checked hero's weapon for when a boulder was teleported, if it landed in a pit or trap door or hole its former location wasn't updated to show that it wasn't there anymore (noticed in Sokoban but not limited to there) -Terry Pratchett tribute, fix typo in passage #4 for Mort ("the" -> "they") +Terry Pratchett tribute, fix typo in passage #4 for Mort ("the" -> "they"); + also passage #7 for Soul Music ("genious" -> "genius"); + and passage #11 for The Light Fantastic ("to" -> "do"); + passage #3 for Eric ("short" -> "sort"); + passage #10 for Witches Abroad ("was" -> "what") fix typo in end_of_input() present since 3.6.0 that would prevent compilation for NOSAVEONHANGUP+INSURANCE configuration when a status condition becomes fatal, keep it listed as an active condition @@ -152,11 +156,91 @@ zapping self with wand of opening or spell of knock to escape from a pit trap wielded aklys that returned to hero when thrown while inside an engulfer left a stale 'thrownobj' pointer that triggered "add_to_minv: obj not free" panic if same weapon killed any engulfer via melee from inside -uarmh null pointer dereference if a helm of opposite alignment came off due +uarmh null pointer dereference if a helm of opposite alignment came off due to being polymorphed -verb tense was inappropriate in some messages when a mon/pet had a name +verb tense was inappropriate in some messages when a mon/pet had a name ending in 's' orctown booty items should have been initialized in mksobj() +query_category() and whatdoes_help() had early returns which could each leave + a temporary window around, which in turn might eventually lead to a + panic due to lack of window slots [probably moot for unmodified 3.6.x; + the query one couldn't happen unless there is a coding error for + object classes somewhere and the help one couldn't happen unless the + installed data files left 'keyhelp' missing] +ball and chain could end up too far from punished hero (triggering b&c warning + for wizard mode with sanity checking active) when crawling out of + water failed because dropping stuff left hero overly encumbered and + hero was life saved--or player declined to die--if the hero got + teleported one step further from ball and chain's current location +avoid 'object lost' panic when polymorph causes loss of levitation boots or + water walking boots which dumps hero into water where emergency + disrobing/dropping in order to crawl out chooses to drop those boots +'sortloot's attempt to group musical instruments separately from other tools + didn't work as intended due to missing 'break' in sortloot_classify() + running told player about engravings as they were being moved + over but buffered output didn't show it until hero stopped, so it + wasn't possible to tell where they were, unlike all other forms of + multiple movement; so stop running if/when an engraving is reached +fix exploding land mine moving ball or chain and causing a sanity error +fix firing attached iron ball when swallowed causing a sanity error +fix vault guard impossible when he could not relocate in certain situation +fix temple priests or shopkeepers moving over other monsters +fix hero still hiding under a statue shattered by a land mine +fix helping a monster out of a pit addressing a deleted trap +fix launched rolling boulder code accessing deleted trap +fix monster stepping on a land mine code accessing deleted trap +revise 'O' to show symbol sets in the same order they appear in the symbols + file and order the sets in dat/symbols to yield a sensible symset menu +yellow dragons had green breath +partly eaten food in a bones level shop would show a non-zero sale price + while on the floor but not be placed on shop bill if picked up; + sale price should have been "no charge" +when non-empty container is dropped in shop and hero is asked whether to sell, + counting the subset of contents owned by hero vs those owned by shk + could obtain wrong answer because the container had been placed on + the floor but the 'unpaid' and 'no_charge' flags of its contents + hadn't been updated yet, they were still set for when it was carried +in a shop which doesn't care about tools: You drop a containing 1 item. + offers you for your items in your . Sell them? + [plural 'items' and 'them' were including the box along with the one + item in it even though shk was only offering to buy its contents] +grammar correction for "That walking shoes is really a small mimic" when + applying a stethoscope +mimic immitating a slime mold would change fruit type when player assigned new + named fruit +parsing for the argument to 'scores' option was sloppy; "3a/o" (slash) and + "3a 1o" (space and digit one, not lowercase L) both worked but "3a o" + (just space) was supposed to but didn't +wizmakemap could leave genocided monsters on map +when entering Astral level, initial rendering of guardian angel didn't show + it as tame; noticeable if the level was entered with 'hilite_pet' On +fix a leashed pet polymorphed into a long worm staying leashed +prevent leashing unsolid monsters and monsters with no extremities +playing musical instruments gave feedback which ignored deafness +some other deafness-related message corrections +when dipping into holy/unholy water while blind (where the glow message is + suppressed), clear dipped item's bknown flag unless water potion's + bless/curse state is known +playing music while hallucinating: message misspelled "butterflies" +putting on gloves while having slippery fingers transfered slipperiness to + those gloves; taking off slippery gloves directly was disallowed but + losing them in other ways transfered slipperiness to bare fingers +when a monster reads a scroll of fire to cure sliming, don't access that + scroll's memory after it has been used up (bcsign) +monster vs monster attacks didn't handle shades or silver weapon feedback +successful alchemy would show new potion's description (color) even when blind +dipping some types of objects into oil would yield " gleams with an + oily sheen" even when blind +dipping into an undiscovered potion would offer chance to give a name to the + potion even when its description wasn't known (picked up while blind) +dipping lichen corpse into acid when not blind and acid was undicovered would + not offer a chance to give a name to the potion after lichen feedback +pluralization improvement for words ending in a k-sound like "biotech" +check for whether a monster was entering a region (gas cloud) erroneously + depended upon whether or not the hero was inside the same region +all Is_*_level tests during early startup would test as true until + dungeon_topology was initialized in a new game or restored from + a save file Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository @@ -164,7 +248,7 @@ Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository elemental_clog() loop needed to guard against obliteration of the monster that was trying to be placed using ^G to create "hidden mimic" shouldn't have marked it as undetected since - mimics 'hide' be appearing to be something else; honor "hidden" for + mimics 'hide' by appearing to be something else; honor "hidden" for 'hides_under' creatures if/when created at location with object(s), also for eels and other fish if/when created at water location for wizard mode 'wizweight' option, glob weight wasn't shown unless glob had @@ -177,6 +261,17 @@ monster throwing from stack of missiles (darts, daggers, spears) would cause crash if it wasn't wielding a weapon (bug in multi-shot shooting fix) surviving death while polymorphed would yield "You are a " without terminating period +'mksobj failure' commit resulted in wrong corpse types for dying monsters +a recent intended sanity check fix inadvertently bypassed placing a thrown + chained ball back onto the floor +in symset:curses, symbol S_tree was accidentally set to horizontal line where + plus-or-minus sign was meant; also, change S_bars to not-equals sign +percentage highlighting for Xp broke up/down/changed highlighting for it; + it was flagged as having gone up every time the percentage changed +deaf change to zap_over_floor needed to be restricted to player actions only +monster vs shade attack inflicted damage despite "passes harmlessly through" +fix for feedback from musical instruments played while deaf ignored whistles +special map display symbol S_player_override renamed to S_hero_override curses: sometimes the message window would show a blank line after a prompt curses: the change to show map in columns 1..79 instead of 2..80 made the highlight for '@' show up in the wrong place if clipped map had been @@ -191,6 +286,50 @@ tty: revert the attempt to fix "message line anomaly: if autodecribe feedback prompts that spanned more than one line, a more significant issue +Fixes post-beta1 +------------------------------------------------------------------ +fix several tribute typos +pluralization correction for unlikely epoch and loch +ensure that --showpaths displays the personal configuration file last +don't strip leading slash from hallucinatory monster name "/b/tard" +quaffing unknown potion of see invisible resulted in asking what to call the + potion while updated monster display was buffered so not yet shown, + hence potentially noticeable effect was concealed from player +when Riders use their bargethrough capability, don't let them swap places with + something located at a spot where corpses can't be created (their + door opening ability was letting them exchange places with something + co-located with a closed door without opening it; if killed there, + there'd be no corpse so no auto-revive) +putting on levitation boots while on sink would crash when attempting to set + the enchantment known flag on Null 'uarmf' pointer +look-at of mimics mimicking altars got an arbitary alignment from misuse of + underlying terrain +polymorph_sink creating an altar passed a call to rn2() as an argument to a + macro which evaluates its parameter more than once +if a monster (presumably sensed but not seen) was displayed at a location + showing "remembered, unseen monster", remove that since hero now knows + something else is there (3.6.1 had similar fix for warned-of monsters) +clairvoyance showed all monsters in range, then after player viewed the map, + replaced them with "remembered, unseen monster" glyph and finally + did a normal monster refresh; the 'I' glyph step clobbers remembered + object at same spot, so skip it for locations where monster refresh + is going to immediately redisplay a monster +take holes that you avoided into consideration when you're on the brink +update window port spec to include a color-availability table that the window + port can set; merge all has_color() implementations into one central + function in src/windows.c which uses a few data checks only and + elminates multiple string function calls for each map cell update + that were being done in some cases previously +taking off a fedora or dented pot (no-delay helmets) left the helmet stuck + and took off hero's suit +unix: fix double DLB definition in linux hints file +windows: fix --showpaths output for the data file which relies on being + constructed programmatically to incorporate the version suffix +windows+tty: add code to make keypad support for swap_yz behave (currently + commented out in include/ntconf.h) +windows: fix self-recover user prompting (tty, curses, mswin) + + Platform- and/or Interface-Specific Fixes or Features ----------------------------------------------------- EDIT_GETLIN: wizard mode 'monpolycontrol' was using the getlin() answer buffer @@ -201,6 +340,9 @@ EDIT_GETLIN: when naming an object or a monster use the existing name, if EDIT_GETLIN: using 'O' to set message types or menu colors was overloading the answer buffer with other stuff, resulting in bogus default response during repeat prompting +EDIT_GETLIN: for paranoid confirmation, if answer was neither "yes" nor "no", + don't supply the rejected answer as the default when retrying +USE_FCNTL: nethack wasn't closing lock file 'perm' curses: very tall menus tried to use selector characters a-z, A-Z, and 0-9, but 0-9 should be reserved for counts and if the display was tall enough for more than 62 entries, arbitrary ASCII punctuation got used @@ -215,10 +357,10 @@ curses: support EDIT_GETLIN (but like with tty, it's disabled by default) to (however, it's skipped if the 'popup_dialog' option is On) curses: when display windows get reconfigured (after setting align_status, align_message, statuslines, windowborders or due to external resize), - the message window was being refreshed with the oldest available N - messages rather than most recent N. [Still room for improvement; - when feasible it combines short lines, resulting in N messages on - fewer than N lines and leaving some of the available lines blank.] + the message window was being refreshed with most recent message and + the oldest available N-1 messages rather than next to most recent N-1. + [Still room for improvement when short lines are combined or long + ones are wrapped, where it still shows a subset of N original lines.] curses: plug memory leak when getting a line of input is cancelled by ESC curses: after requesting a line of input from player, next line of message window could end up being skipped @@ -229,10 +371,10 @@ curses: don't convert ^M (or or key) into ^J; both ^J and ^M cause the hero to try to move curses: draw map in screen columns 1..79 like tty, rather than in 2..80 curses: make text windows wider so that help feedback is more readable -curses: using ':' for search string matching to toggle menu items in a multple - page menu would highlight arbitrary items on the currently visible - page in sync with the lines that matching items had on other pages -curses: when map window was clipped, the 'scrollbars' shown to indicate which +curses: using ':' for toggling menu items which match a search string, in a + multi-page menu it would highlight arbitrary items on the currently + visible page in sync with lines that matched items have on other pages +curses: when map window was clipped, position bars shown to indicate which part of the map was in view didn't work as intended, always drawing "*--------------" for horizontal (and comparable '*' with multiple '|' underneath for vertical) when it meant to show "---******------" if @@ -246,7 +388,14 @@ curses: disable the attempt to support Ctrl+Left_click as an alternate way the mouse data passed to nethack didn't match the curses (ncurses on OSX 10.11) documentation and things didn't work as intended curses: menu coloring required that both 'menucolors' and 'guicolor' be On; - for menus, override guicolor with more-specific menucolors + for menus, ignore 'guicolor' and honor more-specific 'menucolors' +curses: support symset:curses and symset:DECgraphics for map display +curses: enable the 'use_inverse' boolean option (via wincap WC_INVERSE flag) + for extended monster detection and black&white lava; forced to True + to override default of False (for tty's benefit) +curses: force 'O' command's menus for 'symset' and 'roguesymset' options to + be wider so that fewer entries with set descriptions will wrap +curses: stop restricting menu width to half the display width curses+'perm_invent': entries were wrapping without any control; usually not noticeable because next entry overwrote, but visible for final entry when whole inventory fit within the available height; looked ok with @@ -270,6 +419,13 @@ curses+EDIT_GETLIN: the preceding fix handled an answer which spanned more than one line but didn't remove the answer properly if the prompt portion of prompt+answer spanned more than one line msdos: code fixes to allow a build with curses and PDCurses +msdos: added Makefile1.cross (host portion) and Makefile2.cross (target + platform portion) to assist in moving this port toward a cross-compiled + build hosted on linux/OSX/Windows with recent C dialect support; that + will also pave the way for CI automation and testing of the msdos port + build in future should the port remain on the radar; currently only + useful for testing the msdos port compile as it cannot yet build a + complete game tty: re-do one optimization used when status conditions have all been removed and remove another that tried to check whether condition text to be displayed next was the same as the existing value; sometimes new @@ -279,7 +435,15 @@ tty: take two, if/when autodecribe feedback wraps past top line, clear ['exposed by git' section has an entry for reversal of 'take one'] tty: video attributes (bold, inverse, &c) for status highlighting sometimes were scrambled +unix: sysconf CHECK_PLNAME=1 wouldn't work if attempt to obtain unix username + failed even though it didn't need that to check player character name +unix+curses: startup error only reset terminal for tty; one noticeable + example was answering 'n' to "Destroy old game?" +vms: update install.com to include overlooked file bigrm-10.lev in nh-data.dlb Windows: some startup error messages were not being delivered successfully +WindowsGUI: player selection dialog box layout was not being adjusted for DPI +Windows: significant changes to default directory choices; see documentation + for details General New Features @@ -303,23 +467,37 @@ status highlighting using percentage rules now supported for experience level the start of the current Xp level to the start of the next Xp level; 100% isn't possible so used as special case for next_Xp_lvl - 1 Exp_pt wizard-mode: display effect to show where an unseen wished-for monster landed +for 'O's symset and roguesymset menus, mark current symbol set as preselected curses: enable latent mouse support curses: give menus and text windows a minimum size of 5x25 since tiny ones can sometimes be overlooked when shown over old messages rather than map curses+'perm_invent': since persistent inventory is narrow, strip off "a", "an", or "the" prefix on inventory entries shown there so that a tiny bit more of the interesting portion is visible +curses+'curses': change the curses map display to use new symbol set 'curses' + instead of hard-coded values; it attempts to show IBMgraphics-style + map using DECgraphics characters; DECgraphics can also be used as-is +fulfill a request from a blind player to have a unique overriding SYMBOL for + pets and for the player +ROGUESYMBOLS can be overridden in config files like SYMBOLS can +in symset:DECgraphics, set S_altar to 'pi' (was default '_'), S_bars to + not-equals sign (was 'pi') NetHack Community Patches (or Variation) Included ------------------------------------------------- add a couple of engraving suggestions in pull request #79 chasonr's faster method to write characters to msdos VGA in pull request #220 +chasonr's msdos Makefile.gcc pdcurses build changes in pull request #243 autopickup exception priority change in pull request #226 +FIQ's curses (PDCurses) number pad changes in pull request #247 Code Cleanup and Reorganization ------------------------------- began to add some function caller BREADCRUMBS to aid debugging +flag existing occurrences of "You hear" as "Deaf-aware" to aid in + future maintenance + diff --git a/doc/fixes36.4 b/doc/fixes36.4 new file mode 100644 index 000000000..c199560c4 --- /dev/null +++ b/doc/fixes36.4 @@ -0,0 +1,38 @@ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.12 $ $NHDT-Date: 1576638499 2019/12/18 03:08:19 $ + +fixes36.4 contains a terse summary of changes made to 3.6.3 in order to +produce 3.6.4. + + +General Fixes and Modified Features +----------------------------------- +GDBPATH and GREPPATH from sysconf or -D... on compilation command line were + being processed even if PANICTRACE was disabled but only being freed + at end of game when that was enabled +fix the article used in the message when your steed encounters a polymorph trap +allow teleporting onto the vibrating square +message "your knapsack can't accomodate any more items" when picking stuff up + or removing such from container was inaccurate if there was some gold + pending; vary the message rather than add more convoluted pickup code +dozen-ish assorted spelling/typo fixes in messages and source comments +fix potential buffer overflow when parsing run-time configuration file +wizard mode wishing for terrain would leave it unmapped if done while blind +wizard mode terrain wish could leave hero in water (severe vision limits) or + in lava (trapped, sinking) which wasn't there any more +flying hero can go down (via '>') holes or trap doors instead of escaping trap +polymorphed hero hiding on the ceiling can now use '>' to unhide instead of + being told "you can't go down here" + + +Platform- and/or Interface-Specific Fixes or Features +----------------------------------------------------- +fix compilation on platforms that split the ncurses and tinfo libraries +Windows: allow all game files to be on a portable device via the sysconf + option 'portable_device_paths' + + +General New Features +-------------------- +none + + diff --git a/doc/fixes36.5 b/doc/fixes36.5 new file mode 100644 index 000000000..d3e45ff39 --- /dev/null +++ b/doc/fixes36.5 @@ -0,0 +1,30 @@ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.0 $ $NHDT-Date: 1576705788 2019/12/18 21:49:48 $ + +This fixes36.5 file is here to capture information about updates in the 3.6.x +lineage following the release of 3.6.4 in December 2019. Please note, however, +that another 3.6.x release is not anticipated, and most developer +focus will shift to the next major release. + +General Fixes and Modified Features +----------------------------------- + + +Fixes to Post-3.6.4 Problems that Were Exposed Via git Repository +------------------------------------------------------------------ + + +Platform- and/or Interface-Specific Fixes or Features +----------------------------------------------------- + + +General New Features +-------------------- + + +NetHack Community Patches (or Variation) Included +------------------------------------------------- + + +Code Cleanup and Reorganization +------------------------------- + diff --git a/doc/fixes37.0 b/doc/fixes37.0 index d5e47aaf6..43e042d95 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.8 $ $NHDT-Date: 1557663358 2019/05/12 12:15:58 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.22 $ $NHDT-Date: 1576288434 2019/12/14 01:53:54 $ General Fixes and Modified Features ----------------------------------- @@ -7,6 +7,11 @@ hero polymorphed into a vampire can use #monster to shape-shift rather than just do a one-shot polymorph into bat/cloud/wolf and shifted vampire hero can use #monster again to take on another form (randomly chosen among the shiftable shapes and true vampire form) +adjust bones filename buffer sizes to accommodate suffix +fix internal self-recover to work with recent fields added to checkpoint file +improvements to pronoun usage when hallucinating +function calls made from mapglyph based on dungeon level are now called once + per level Fixes to Pre-3.7.0 Problems that Were Exposed Via git Repository @@ -24,6 +29,17 @@ if a killer bee encounters a lump of royal jelly and there is no queen bee on automatic annotation "gateway to Moloch's Sanctum" for vibrating square level once that square's location becomes known (found or magic mapped); goes away once sanctum temple is found (entered or high altar mapped) +savefile: add support to deconstruct internal data structures down into their + individual fields and save those fields instead of the entire struct +savefile: use little-endian format for fields where that makes a difference +replace build-time level compiler and dungeon compiler with run-time loading of + the dungeon and level descriptions and interpreting them via LUA +split off some of the functionality that was in makedefs (compiled-in options + build date/time, etc) so that it can be built by a cross-compiler + and accessed on the target platform +replace quest.txt and associated conversion to quest.dat via makedefs with + lua quest texts loaded at runtime +some altars are displayed in different colors (for tty and curses at least) Platform- and/or Interface-Specific New Features @@ -40,4 +56,7 @@ Code Cleanup and Reorganization move majority of global variables into instance_globals struct g move zeroobj, zeromonst, zeroany into const_globals struct cg remove STATIC_DCL, STATIC_OVL, STATIC_VAR, STATIC_PTR +old Qt moved from win/Qt to win/Qt3 +more current Qt for Qt version 4 and 5 moved from win/Qt4 to win/Qt; qt4 + moniker changed to qt_ diff --git a/doc/lev_comp.6 b/doc/lev_comp.6 deleted file mode 100644 index fdb1945a7..000000000 --- a/doc/lev_comp.6 +++ /dev/null @@ -1,588 +0,0 @@ -.TH LEV_COMP 6 "25 May 2015" NETHACK -.de ND -.ds Nd \\$3 -.. -.de NB -.ds Nb \\$2 -.. -.de NR -.ds Nr \\$2 -.. -.ND $NHDT-Date: 1524689549 2018/04/25 20:52:29 $ -.NB $NHDT-Branch: NetHack-3.6.0 $ -.NR $NHDT-Revision: 1.7 $ -.ds Na Kenneth Lorber -.SH NAME -lev_comp \- NetHack special levels compiler -.SH SYNOPSIS -.B lev_comp -[ -.B \-w -] -[ -.I files -] -.PP -If no arguments are given, it reads standard input. -.SH DESCRIPTION -.PP -.I Lev_comp -is a special level compiler for NetHack version 3.2 and higher. It -takes description files as arguments and produces level files that can -be loaded by NetHack at runtime. -.PP -The purpose of this tool is to provide NetHack administrators and -implementors with a convenient way for adding special levels to the -game, or modifying existing ones, without having to recompile the -entire world. -.PP -The -.B \-w -option causes -.I lev_comp -to perform extra checks on the level and display extra warnings, however -these warnings are sometimes superfluous, so they are not normally displayed. - -.SH GRAMMAR -.PP -.LP -.nf -.ta +8n +8n +8n +8n - -file : /* nothing */ - | levels - ; - -levels : level - | level levels - ; - -level : maze_level - | room_level - ; - -maze_level : maze_def flags lev_init messages regions - ; - -room_level : level_def flags lev_init messages rreg_init rooms corridors_def - ; - -level_def : LEVEL_ID ':' string - ; - -lev_init : /* nothing */ - | LEV_INIT_ID ':' CHAR ',' CHAR ',' BOOLEAN ',' BOOLEAN ',' light_state ',' walled - ; - -walled : BOOLEAN - | RANDOM_TYPE - ; - -flags : /* nothing */ - | FLAGS_ID ':' flag_list - ; - -flag_list : FLAG_TYPE ',' flag_list - | FLAG_TYPE - ; - -messages : /* nothing */ - | message messages - ; - -message : MESSAGE_ID ':' STRING - ; - -rreg_init : /* nothing */ - | rreg_init init_rreg - ; - -init_rreg : RANDOM_OBJECTS_ID ':' object_list - | RANDOM_MONSTERS_ID ':' monster_list - ; - -rooms : /* Nothing - dummy room for use with INIT_MAP */ - | roomlist - ; - -roomlist : aroom - | aroom roomlist - ; - -corridors_def : random_corridors - | corridors - ; - -random_corridors: RAND_CORRIDOR_ID - ; - -corridors : /* nothing */ - | corridors corridor - ; - -corridor : CORRIDOR_ID ':' corr_spec ',' corr_spec - | CORRIDOR_ID ':' corr_spec ',' INTEGER - ; - -corr_spec : '(' INTEGER ',' DIRECTION ',' door_pos ')' - ; - -aroom : room_def room_details - | subroom_def room_details - ; - -subroom_def : SUBROOM_ID ':' room_type ',' light_state ',' subroom_pos ',' room_size ',' string roomfill - ; - -room_def : ROOM_ID ':' room_type ',' light_state ',' room_pos ',' room_align ',' room_size roomfill - ; - -roomfill : /* nothing */ - | ',' BOOLEAN - ; - -room_pos : '(' INTEGER ',' INTEGER ')' - | RANDOM_TYPE - ; - -subroom_pos : '(' INTEGER ',' INTEGER ')' - | RANDOM_TYPE - ; - -room_align : '(' h_justif ',' v_justif ')' - | RANDOM_TYPE - ; - -room_size : '(' INTEGER ',' INTEGER ')' - | RANDOM_TYPE - ; - -room_details : /* nothing */ - | room_details room_detail - ; - -room_detail : room_name - | room_chance - | room_door - | monster_detail - | object_detail - | trap_detail - | altar_detail - | fountain_detail - | sink_detail - | pool_detail - | gold_detail - | engraving_detail - | stair_detail - ; - -room_name : NAME_ID ':' string - ; - -room_chance : CHANCE_ID ':' INTEGER - ; - -room_door : DOOR_ID ':' secret ',' door_state ',' door_wall ',' door_pos - ; - -secret : BOOLEAN - | RANDOM_TYPE - ; - -door_wall : DIRECTION - | RANDOM_TYPE - ; - -door_pos : INTEGER - | RANDOM_TYPE - ; - -maze_def : MAZE_ID ':' string ',' filling - ; - -filling : CHAR - | RANDOM_TYPE - ; - -regions : aregion - | aregion regions - ; - -aregion : map_definition reg_init map_details - ; - -map_definition : NOMAP_ID - | map_geometry MAP_ID - ; - -map_geometry : GEOMETRY_ID ':' h_justif ',' v_justif - ; - -h_justif : LEFT_OR_RIGHT - | CENTER - ; - -v_justif : TOP_OR_BOT - | CENTER - ; - -reg_init : /* nothing */ - | reg_init init_reg - ; - -init_reg : RANDOM_OBJECTS_ID ':' object_list - | RANDOM_PLACES_ID ':' place_list - | RANDOM_MONSTERS_ID ':' monster_list - ; - -object_list : object - | object ',' object_list - ; - -monster_list : monster - | monster ',' monster_list - ; - -place_list : place - | place ',' place_list - ; - -map_details : /* nothing */ - | map_details map_detail - ; - -map_detail : monster_detail - | object_detail - | door_detail - | trap_detail - | drawbridge_detail - | region_detail - | stair_region - | portal_region - | teleprt_region - | branch_region - | altar_detail - | fountain_detail - | mazewalk_detail - | wallify_detail - | ladder_detail - | stair_detail - | gold_detail - | engraving_detail - | diggable_detail - | passwall_detail - ; - -monster_detail : MONSTER_ID chance ':' monster_c ',' m_name ',' coordinate - monster_infos - ; - -monster_infos : /* nothing */ - | monster_infos monster_info - ; - -monster_info : ',' string - | ',' MON_ATTITUDE - | ',' MON_ALERTNESS - | ',' alignment - | ',' MON_APPEARANCE string - ; - -object_detail : OBJECT_ID object_desc - | COBJECT_ID object_desc - ; - -object_desc : chance ':' object_c ',' o_name ',' object_where object_infos - ; - -object_where : coordinate - | CONTAINED - ; - -object_infos : /* nothing */ - | ',' curse_state ',' monster_id ',' enchantment optional_name - | ',' curse_state ',' enchantment optional_name - | ',' monster_id ',' enchantment optional_name - ; - -curse_state : RANDOM_TYPE - | CURSE_TYPE - ; - -monster_id : STRING - ; - -enchantment : RANDOM_TYPE - | INTEGER - ; - -optional_name : /* nothing */ - | ',' NONE - | ',' STRING - ; - -door_detail : DOOR_ID ':' door_state ',' coordinate - ; - -trap_detail : TRAP_ID chance ':' trap_name ',' coordinate - ; - -drawbridge_detail: DRAWBRIDGE_ID ':' coordinate ',' DIRECTION ',' door_state - ; - -mazewalk_detail : MAZEWALK_ID ':' coordinate ',' DIRECTION - ; - -wallify_detail : WALLIFY_ID - ; - -ladder_detail : LADDER_ID ':' coordinate ',' UP_OR_DOWN - ; - -stair_detail : STAIR_ID ':' coordinate ',' UP_OR_DOWN - ; - -stair_region : STAIR_ID ':' lev_region ',' lev_region ',' UP_OR_DOWN - ; - -portal_region : PORTAL_ID ':' lev_region ',' lev_region ',' string - ; - -teleprt_region : TELEPRT_ID ':' lev_region ',' lev_region teleprt_detail - ; - -branch_region : BRANCH_ID ':' lev_region ',' lev_region - ; - -teleprt_detail : /* empty */ - | ',' UP_OR_DOWN - ; - -lev_region : region - | LEV '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')' - ; - -fountain_detail : FOUNTAIN_ID ':' coordinate - ; - -sink_detail : SINK_ID ':' coordinate - ; - -pool_detail : POOL_ID ':' coordinate - ; - -diggable_detail : NON_DIGGABLE_ID ':' region - ; - -passwall_detail : NON_PASSWALL_ID ':' region - ; - -region_detail : REGION_ID ':' region ',' light_state ',' room_type prefilled - ; - -altar_detail : ALTAR_ID ':' coordinate ',' alignment ',' altar_type - ; - -gold_detail : GOLD_ID ':' amount ',' coordinate - ; - -engraving_detail: ENGRAVING_ID ':' coordinate ',' engraving_type ',' string - ; - -monster_c : monster - | RANDOM_TYPE - | m_register - ; - -object_c : object - | RANDOM_TYPE - | o_register - ; - -m_name : string - | RANDOM_TYPE - ; - -o_name : string - | RANDOM_TYPE - ; - -trap_name : string - | RANDOM_TYPE - ; - -room_type : string - | RANDOM_TYPE - ; - -prefilled : /* empty */ - | ',' FILLING - | ',' FILLING ',' BOOLEAN - ; - -coordinate : coord - | p_register - | RANDOM_TYPE - ; - -door_state : DOOR_STATE - | RANDOM_TYPE - ; - -light_state : LIGHT_STATE - | RANDOM_TYPE - ; - -alignment : ALIGNMENT - | a_register - | RANDOM_TYPE - ; - -altar_type : ALTAR_TYPE - | RANDOM_TYPE - ; - -p_register : P_REGISTER '[' INTEGER ']' - ; - -o_register : O_REGISTER '[' INTEGER ']' - ; - -m_register : M_REGISTER '[' INTEGER ']' - ; - -a_register : A_REGISTER '[' INTEGER ']' - ; - -place : coord - ; - -monster : CHAR - ; - -object : CHAR - ; - -string : STRING - ; - -amount : INTEGER - | RANDOM_TYPE - ; - -chance : /* empty */ - | PERCENT - ; - -engraving_type : ENGRAVING_TYPE - | RANDOM_TYPE - ; - -coord : '(' INTEGER ',' INTEGER ')' - ; - -region : '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')' - ; -.fi -.PP -.I NOTE: -.br -Lines beginning with '#' are considered comments. -.PP -The contents of a "MAP" description of a maze is a rectangle showing the exact -level map that should be used for the given part of a maze. -Each character in the map corresponds to a location on the screen. -Different location types are denoted using different ASCII characters. -The following characters are recognized. -To give an idea of how these are used, see the EXAMPLE, below. -The maximum size of a map is normally 76 columns by 21 rows. -.LP -.nf -.ta +8n +8n +8n -\&'-' horizontal wall -\&'|' vertical wall -\&'+' a doorway (state is specified in a DOOR declaration) -\&'A' open air -\&'B' boundary room location (for bounding unwalled irregular regions) -\&'C' cloudy air -\&'I' ice -\&'S' a secret door -\&'H' a secret corridor -\&'{' a fountain -\&'\\' a throne -\&'K' a sink -\&'}' a part of a moat or other deep water -\&'P' a pool -\&'L' lava -\&'W' water (yes, different from a pool) -\&'T' a tree -\&'F' iron bars -\&'#' a corridor -\&'.' a normal room location (unlit unless lit in a REGION declaration) -\&' ' stone -.fi -.SH EXAMPLE -.PP -Here is an example of a description file (a very simple one): -.LP -.nf -.ta +8n +8n +8n -MAZE : "fortress", random -GEOMETRY : center , center -MAP -}}}}}}}}} -}}}|-|}}} -}}|-.-|}} -}|-...-|} -}|.....|} -}|-...-|} -}}|-.-|}} -}}}|-|}}} -}}}}}}}}} -ENDMAP -MONSTER: '@', "Wizard of Yendor", (4,4) -OBJECT: '"', "Amulet of Yendor", (4,4) -# a hell hound flanking the Wiz on a random side -RANDOM_PLACES: (4,3), (4,5), (3,4), (5,4) -MONSTER: 'd', "hell hound", place[0] -# a chest on another random side -OBJECT: '(', "chest", place[1] -# a sack on a random side, with a diamond and maybe a ruby in it -CONTAINER: '(', "sack", place[2] -OBJECT: '*', "diamond", contained -OBJECT[50%]: '*', "ruby", contained -# a random dragon somewhere -MONSTER: 'D', random, random -# 3 out of 4 chance for a random trap in the EAST end -TRAP[75%]: random, (6,4) -# an electric eel below the SOUTH end -MONSTER: ';', "electric eel", (4,8) -# make the walls non-diggable -NON_DIGGABLE: (0,0,8,8) -TELEPORT_REGION: levregion(0,0,79,20), (0,0,8,8) -.fi -.PP -This example will produce a file named "fortress" that can be integrated into -one of the numerous mazes of the game. -.PP -Note especially the final, TELEPORT_REGION specification. This says -that level teleports or other non-stairway arrivals on this level can -land anywhere on the level except the area of the map. This shows the -use of the ``levregion'' prefix allowed in certain region specifications. -Normally, regions apply only to the most recent MAP specification, but -when prefixed with ``levregion'', one can refer to any area of the -level, regardless of the placement of the current MAP in the level. -.SH AUTHOR -.PP -Jean-Christophe Collet, David Cohrs. -.SH "SEE ALSO" -.PP -dgn_comp(6), nethack(6) -.SH BUGS -.PP -Probably infinite. -Most importantly, still needs additional bounds checking. -.SH COPYRIGHT -This file is Copyright (C) \*(Na and was last modified \*(Nd (version -\*(Nb:\*(Nr). -NetHack may be freely redistributed. See license for details. diff --git a/doc/lev_comp.txt b/doc/lev_comp.txt deleted file mode 100644 index 4a28fcea6..000000000 --- a/doc/lev_comp.txt +++ /dev/null @@ -1,726 +0,0 @@ - - - -LEV_COMP(6) 1996 LEV_COMP(6) - - - -NAME - lev_comp - NetHack special levels compiler - -SYNOPSIS - lev_comp [ -w ] [ files ] - - If no arguments are given, it reads standard input. - -DESCRIPTION - Lev_comp is a special level compiler for NetHack version 3.2 - and higher. It takes description files as arguments and - produces level files that can be loaded by NetHack at run- - time. - - The purpose of this tool is to provide NetHack administra- - tors and implementors with a convenient way for adding spe- - cial levels to the game, or modifying existing ones, without - having to recompile the entire world. - - The -w option causes lev_comp to perform extra checks on the - level and display extra warnings, however these warnings are - sometimes superfluous, so they are not normally displayed. - - -GRAMMAR - file : /* nothing */ - | levels - ; - - levels : level - | level levels - ; - - level : maze_level - | room_level - ; - - maze_level : maze_def flags lev_init messages regions - ; - - room_level : level_def flags lev_init messages rreg_init rooms corridors_def - ; - - level_def : LEVEL_ID ':' string - ; - - lev_init : /* nothing */ - | LEV_INIT_ID ':' CHAR ',' CHAR ',' BOOLEAN ',' BOOLEAN ',' light_state ',' walled - ; - - walled : BOOLEAN - | RANDOM_TYPE - - - -May Last change: 16 1 - - - - - - -LEV_COMP(6) 1996 LEV_COMP(6) - - - - ; - - flags : /* nothing */ - | FLAGS_ID ':' flag_list - ; - - flag_list : FLAG_TYPE ',' flag_list - | FLAG_TYPE - ; - - messages : /* nothing */ - | message messages - ; - - message : MESSAGE_ID ':' STRING - ; - - rreg_init : /* nothing */ - | rreg_init init_rreg - ; - - init_rreg : RANDOM_OBJECTS_ID ':' object_list - | RANDOM_MONSTERS_ID ':' monster_list - ; - - rooms : /* Nothing - dummy room for use with INIT_MAP */ - | roomlist - ; - - roomlist : aroom - | aroom roomlist - ; - - corridors_def : random_corridors - | corridors - ; - - random_corridors: RAND_CORRIDOR_ID - ; - - corridors : /* nothing */ - | corridors corridor - ; - - corridor : CORRIDOR_ID ':' corr_spec ',' corr_spec - | CORRIDOR_ID ':' corr_spec ',' INTEGER - ; - - corr_spec : '(' INTEGER ',' DIRECTION ',' door_pos ')' - ; - - aroom : room_def room_details - - - -May Last change: 16 2 - - - - - - -LEV_COMP(6) 1996 LEV_COMP(6) - - - - | subroom_def room_details - ; - - subroom_def : SUBROOM_ID ':' room_type ',' light_state ',' subroom_pos ',' room_size ',' string roomfill - ; - - room_def : ROOM_ID ':' room_type ',' light_state ',' room_pos ',' room_align ',' room_size roomfill - ; - - roomfill : /* nothing */ - | ',' BOOLEAN - ; - - room_pos : '(' INTEGER ',' INTEGER ')' - | RANDOM_TYPE - ; - - subroom_pos : '(' INTEGER ',' INTEGER ')' - | RANDOM_TYPE - ; - - room_align : '(' h_justif ',' v_justif ')' - | RANDOM_TYPE - ; - - room_size : '(' INTEGER ',' INTEGER ')' - | RANDOM_TYPE - ; - - room_details : /* nothing */ - | room_details room_detail - ; - - room_detail : room_name - | room_chance - | room_door - | monster_detail - | object_detail - | trap_detail - | altar_detail - | fountain_detail - | sink_detail - | pool_detail - | gold_detail - | engraving_detail - | stair_detail - ; - - room_name : NAME_ID ':' string - ; - - room_chance : CHANCE_ID ':' INTEGER - - - -May Last change: 16 3 - - - - - - -LEV_COMP(6) 1996 LEV_COMP(6) - - - - ; - - room_door : DOOR_ID ':' secret ',' door_state ',' door_wall ',' door_pos - ; - - secret : BOOLEAN - | RANDOM_TYPE - ; - - door_wall : DIRECTION - | RANDOM_TYPE - ; - - door_pos : INTEGER - | RANDOM_TYPE - ; - - maze_def : MAZE_ID ':' string ',' filling - ; - - filling : CHAR - | RANDOM_TYPE - ; - - regions : aregion - | aregion regions - ; - - aregion : map_definition reg_init map_details - ; - - map_definition : NOMAP_ID - | map_geometry MAP_ID - ; - - map_geometry : GEOMETRY_ID ':' h_justif ',' v_justif - ; - - h_justif : LEFT_OR_RIGHT - | CENTER - ; - - v_justif : TOP_OR_BOT - | CENTER - ; - - reg_init : /* nothing */ - | reg_init init_reg - ; - - init_reg : RANDOM_OBJECTS_ID ':' object_list - | RANDOM_PLACES_ID ':' place_list - - - -May Last change: 16 4 - - - - - - -LEV_COMP(6) 1996 LEV_COMP(6) - - - - | RANDOM_MONSTERS_ID ':' monster_list - ; - - object_list : object - | object ',' object_list - ; - - monster_list : monster - | monster ',' monster_list - ; - - place_list : place - | place ',' place_list - ; - - map_details : /* nothing */ - | map_details map_detail - ; - - map_detail : monster_detail - | object_detail - | door_detail - | trap_detail - | drawbridge_detail - | region_detail - | stair_region - | portal_region - | teleprt_region - | branch_region - | altar_detail - | fountain_detail - | mazewalk_detail - | wallify_detail - | ladder_detail - | stair_detail - | gold_detail - | engraving_detail - | diggable_detail - | passwall_detail - ; - - monster_detail : MONSTER_ID chance ':' monster_c ',' m_name ',' coordinate - monster_infos - ; - - monster_infos : /* nothing */ - | monster_infos monster_info - ; - - monster_info : ',' string - | ',' MON_ATTITUDE - | ',' MON_ALERTNESS - - - -May Last change: 16 5 - - - - - - -LEV_COMP(6) 1996 LEV_COMP(6) - - - - | ',' alignment - | ',' MON_APPEARANCE string - ; - - object_detail : OBJECT_ID object_desc - | COBJECT_ID object_desc - ; - - object_desc : chance ':' object_c ',' o_name ',' object_where object_infos - ; - - object_where : coordinate - | CONTAINED - ; - - object_infos : /* nothing */ - | ',' curse_state ',' monster_id ',' enchantment optional_name - | ',' curse_state ',' enchantment optional_name - | ',' monster_id ',' enchantment optional_name - ; - - curse_state : RANDOM_TYPE - | CURSE_TYPE - ; - - monster_id : STRING - ; - - enchantment : RANDOM_TYPE - | INTEGER - ; - - optional_name : /* nothing */ - | ',' NONE - | ',' STRING - ; - - door_detail : DOOR_ID ':' door_state ',' coordinate - ; - - trap_detail : TRAP_ID chance ':' trap_name ',' coordinate - ; - - drawbridge_detail: DRAWBRIDGE_ID ':' coordinate ',' DIRECTION ',' door_state - ; - - mazewalk_detail : MAZEWALK_ID ':' coordinate ',' DIRECTION - ; - - wallify_detail : WALLIFY_ID - ; - - - - -May Last change: 16 6 - - - - - - -LEV_COMP(6) 1996 LEV_COMP(6) - - - - ladder_detail : LADDER_ID ':' coordinate ',' UP_OR_DOWN - ; - - stair_detail : STAIR_ID ':' coordinate ',' UP_OR_DOWN - ; - - stair_region : STAIR_ID ':' lev_region ',' lev_region ',' UP_OR_DOWN - ; - - portal_region : PORTAL_ID ':' lev_region ',' lev_region ',' string - ; - - teleprt_region : TELEPRT_ID ':' lev_region ',' lev_region teleprt_detail - ; - - branch_region : BRANCH_ID ':' lev_region ',' lev_region - ; - - teleprt_detail : /* empty */ - | ',' UP_OR_DOWN - ; - - lev_region : region - | LEV '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')' - ; - - fountain_detail : FOUNTAIN_ID ':' coordinate - ; - - sink_detail : SINK_ID ':' coordinate - ; - - pool_detail : POOL_ID ':' coordinate - ; - - diggable_detail : NON_DIGGABLE_ID ':' region - ; - - passwall_detail : NON_PASSWALL_ID ':' region - ; - - region_detail : REGION_ID ':' region ',' light_state ',' room_type prefilled - ; - - altar_detail : ALTAR_ID ':' coordinate ',' alignment ',' altar_type - ; - - gold_detail : GOLD_ID ':' amount ',' coordinate - ; - - engraving_detail: ENGRAVING_ID ':' coordinate ',' engraving_type ',' string - ; - - - -May Last change: 16 7 - - - - - - -LEV_COMP(6) 1996 LEV_COMP(6) - - - - monster_c : monster - | RANDOM_TYPE - | m_register - ; - - object_c : object - | RANDOM_TYPE - | o_register - ; - - m_name : string - | RANDOM_TYPE - ; - - o_name : string - | RANDOM_TYPE - ; - - trap_name : string - | RANDOM_TYPE - ; - - room_type : string - | RANDOM_TYPE - ; - - prefilled : /* empty */ - | ',' FILLING - | ',' FILLING ',' BOOLEAN - ; - - coordinate : coord - | p_register - | RANDOM_TYPE - ; - - door_state : DOOR_STATE - | RANDOM_TYPE - ; - - light_state : LIGHT_STATE - | RANDOM_TYPE - ; - - alignment : ALIGNMENT - | a_register - | RANDOM_TYPE - ; - - altar_type : ALTAR_TYPE - | RANDOM_TYPE - ; - - - -May Last change: 16 8 - - - - - - -LEV_COMP(6) 1996 LEV_COMP(6) - - - - p_register : P_REGISTER '[' INTEGER ']' - ; - - o_register : O_REGISTER '[' INTEGER ']' - ; - - m_register : M_REGISTER '[' INTEGER ']' - ; - - a_register : A_REGISTER '[' INTEGER ']' - ; - - place : coord - ; - - monster : CHAR - ; - - object : CHAR - ; - - string : STRING - ; - - amount : INTEGER - | RANDOM_TYPE - ; - - chance : /* empty */ - | PERCENT - ; - - engraving_type : ENGRAVING_TYPE - | RANDOM_TYPE - ; - - coord : '(' INTEGER ',' INTEGER ')' - ; - - region : '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')' - ; - - NOTE: - Lines beginning with '#' are considered comments. - - The contents of a "MAP" description of a maze is a rectangle - showing the exact level map that should be used for the - given part of a maze. Each character in the map corresponds - to a location on the screen. Different location types are - denoted using different ASCII characters. The following - characters are recognized. To give an idea of how these are - used, see the EXAMPLE, below. The maximum size of a map is - - - -May Last change: 16 9 - - - - - - -LEV_COMP(6) 1996 LEV_COMP(6) - - - - normally 76 columns by 21 rows. - - '-' horizontal wall - '|' vertical wall - '+' a doorway (state is specified in a DOOR declaration) - 'A' open air - 'B' boundary room location (for bounding unwalled irregular regions) - 'C' cloudy air - 'I' ice - 'S' a secret door - 'H' a secret corridor - '{' a fountain - '\' a throne - 'K' a sink (if SINKS is defined, else a room location) - '}' a part of a moat or other deep water - 'P' a pool - 'L' lava - 'W' water (yes, different from a pool) - 'T' a tree - 'F' iron bars - '#' a corridor - '.' a normal room location (unlit unless lit in a REGION declaration) - ' ' stone - -EXAMPLE - Here is an example of a description file (a very simple - one): - - MAZE : "fortress", random - GEOMETRY : center , center - MAP - }}}}}}}}} - }}}|-|}}} - }}|-.-|}} - }|-...-|} - }|.....|} - }|-...-|} - }}|-.-|}} - }}}|-|}}} - }}}}}}}}} - ENDMAP - MONSTER: '@', "Wizard of Yendor", (4,4) - OBJECT: '"', "Amulet of Yendor", (4,4) - # a hell hound flanking the Wiz on a random side - RANDOM_PLACES: (4,3), (4,5), (3,4), (5,4) - MONSTER: 'd', "hell hound", place[0] - # a chest on another random side - OBJECT: '(', "chest", place[1] - # a sack on a random side, with a diamond and maybe a ruby in it - CONTAINER: '(', "sack", place[2] - OBJECT: '*', "diamond", contained - OBJECT[50%]: '*', "ruby", contained - - - -May Last change: 16 10 - - - - - - -LEV_COMP(6) 1996 LEV_COMP(6) - - - - # a random dragon somewhere - MONSTER: 'D', random, random - # 3 out of 4 chance for a random trap in the EAST end - TRAP[75%]: random, (6,4) - # an electric eel below the SOUTH end - MONSTER: ';', "electric eel", (4,8) - # make the walls non-diggable - NON_DIGGABLE: (0,0,8,8) - TELEPORT_REGION: levregion(0,0,79,20), (0,0,8,8) - - This example will produce a file named "fortress" that can - be integrated into one of the numerous mazes of the game. - - Note especially the final, TELEPORT_REGION specification. - This says that level teleports or other non-stairway - arrivals on this level can land anywhere on the level except - the area of the map. This shows the use of the ``levre- - gion'' prefix allowed in certain region specifications. - Normally, regions apply only to the most recent MAP specifi- - cation, but when prefixed with ``levregion'', one can refer - to any area of the level, regardless of the placement of the - current MAP in the level. - -AUTHOR - Jean-Christophe Collet, David Cohrs. - -SEE ALSO - dgn_comp(6), nethack(6) - -BUGS - Probably infinite. Most importantly, still needs additional - bounds checking. - - - - - - - - - - - - - - - - - - - - - - - -May Last change: 16 11 - - - diff --git a/doc/nethack.6 b/doc/nethack.6 index ea704bb2f..446568ffb 100644 --- a/doc/nethack.6 +++ b/doc/nethack.6 @@ -47,6 +47,9 @@ nethack \- Exploring The Mazes of Menace .B \-ibm ] [ +.BR \-\-showpaths +] +[ .BR \-\-version [ :paste ] ] .PP @@ -223,6 +226,10 @@ the list of top scorers, and a subdirectory .I save where games are saved. .PP +.B \-\-showpaths +can be used to cause NetHack to show where it is expecting +to find various configuration files. +.PP .B \-\-version can be used to cause NetHack to show the version information it was compiled with, then exit. That will include the @@ -270,7 +277,7 @@ nethack The program itself. .br data, oracles, rumors Data files used by NetHack. .br -quest.dat, bogusmon More data files. +bogusmon another data file. .br engrave, epitaph, tribute Still more data files. .br @@ -287,9 +294,8 @@ help, hh Help data files. .br cmdhelp, opthelp, wizhelp More help data files. .br -*.lev Predefined special levels. -.br -dungeon Control file for special levels. +*.lua Predefined special levels, dungeon control for + special levels, quest texts .br history A short history of NetHack. .br @@ -386,7 +392,7 @@ SHOPTYPE and SPLEVTYPE can be used in debugging (wizard) mode. DEBUGFILES can be used if the program was built with 'DEBUG' enabled. .SH "SEE ALSO" .PP -dgn_comp(6), lev_comp(6), recover(6) +recover(6) .SH BUGS .PP Probably infinite. diff --git a/doc/tmac.nh b/doc/tmac.nh index 6165c6c82..5a1bd0a60 100644 --- a/doc/tmac.nh +++ b/doc/tmac.nh @@ -117,10 +117,10 @@ .\" .BR - hard line break with vertical padding inserted .\" $1 - repeat count for amount of padding (optional; default is 1) .de BR -.nr bR (\\$1-0) -.if \\n(bR<1 .nr bR 1 -.nr bR \\n(bR*\\n(pd -.sn \\n(bRu +.ie \\.$==0 .nr bR 1v +.el .nr bR (\\$1-0)v +\0 +.sp \\n(bR .br .. .\" .UR url diff --git a/doc/window.doc b/doc/window.doc index 0b7cbf52f..3758bf55b 100644 --- a/doc/window.doc +++ b/doc/window.doc @@ -663,6 +663,10 @@ port can access the fields directly. Your window port identifies what options it will react to and support by setting bits in the window_procs wincap mask and/or wincap2 mask. +Your window port can also fill in the color-availability table for +the window port, has_color[CLR_MAX] to flag the colors it supports +1 it does, or 0 it doesn't. [CLR_MAX is 16 as of 3.6.3.] + See section IX for details of where the wincap masks reside. Two things control whether any preference setting appears in the @@ -926,7 +930,8 @@ These are not part of the interface. They may be called by your window port routines to perform the desired task, instead of duplicating the necessary code in each window port. -int mapglyph(int glyph, int *ochar, int *ocolor, unsigned *special, int x, int y) +int mapglyph(int glyph, int *ochar, int *ocolor, unsigned *special, + int x, int y, unsigned mgflags) -- Maps glyph at x,y to NetHack ascii character and color. The return value is an index into the showsyms[] array, in case a port wants to index into its own alternative diff --git a/include/.gitignore b/include/.gitignore index 4906e6ce8..a08c9d752 100644 --- a/include/.gitignore +++ b/include/.gitignore @@ -7,3 +7,4 @@ dgn_comp.h lev_comp.h tile.h win32api.h +nhlua.h diff --git a/include/align.h b/include/align.h index 1c5d40872..47ad97f5d 100644 --- a/include/align.h +++ b/include/align.h @@ -33,6 +33,7 @@ typedef struct align { /* alignment & record */ #define AM_SPLEV_CO 3 #define AM_SPLEV_NONCO 7 +#define AM_SPLEV_RANDOM 8 #define Amask2align(x) \ ((aligntyp)((!(x)) ? A_NONE : ((x) == AM_LAWFUL) ? A_LAWFUL \ diff --git a/include/artilist.h b/include/artilist.h index 4a8b40554..d7b8f250c 100644 --- a/include/artilist.h +++ b/include/artilist.h @@ -3,7 +3,7 @@ /*-Copyright (c) Robert Patrick Rankin, 2017. */ /* NetHack may be freely redistributed. See license for details. */ -#ifdef MAKEDEFS_C +#if defined(MAKEDEFS_C) || defined (MDLIB_C) /* in makedefs.c, all we care about is the list of names */ #define A(nam, typ, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, cost, clr) nam @@ -32,7 +32,7 @@ static const char *artifact_names[] = { /* clang-format on */ static NEARDATA struct artifact artilist[] = { -#endif /* MAKEDEFS_C */ +#endif /* MAKEDEFS_C || MDLIB_C */ /* Artifact cost rationale: * 1. The more useful the artifact, the better its cost. @@ -256,7 +256,7 @@ A("The Palantir of Westernesse", CRYSTAL_BALL, #undef A -#ifndef MAKEDEFS_C +#if !defined(MAKEDEFS_C) && !defined(MDLIB_C) #undef NO_ATTK #undef NO_DFNS #undef DFNS diff --git a/include/config.h b/include/config.h index d12576f9d..b606b5db1 100644 --- a/include/config.h +++ b/include/config.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 config.h $NHDT-Date: 1559601008 2019/06/03 22:30:08 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.123 $ */ +/* NetHack 3.6 config.h $NHDT-Date: 1575245033 2019/12/02 00:03:53 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.126 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -554,7 +554,7 @@ typedef unsigned char uchar; #define DUMPLOG_FILE "/tmp/nethack.%n.%d.log" /* DUMPLOG_FILE allows following placeholders: %% literal '%' - %v version (eg. "3.6.2-0") + %v version (eg. "3.6.3-0") %u game UID %t game start time, UNIX timestamp format %T current time, UNIX timestamp format diff --git a/include/context.h b/include/context.h index 6209a5e82..4e20f3bdc 100644 --- a/include/context.h +++ b/include/context.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 context.h $NHDT-Date: 1455907260 2016/02/19 18:41:00 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.30 $ */ +/* NetHack 3.6 context.h $NHDT-Date: 1575775592 2019/12/08 03:26:32 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.35 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -115,6 +115,7 @@ struct context_info { int current_fruit; /* fruit->fid corresponding to g.pl_fruit[] */ int warnlevel; int rndencode; /* randomized escape sequence introducer */ + int mysteryforce; long next_attrib_check; /* next attribute check */ long stethoscope_move; short stethoscope_movement; diff --git a/include/decl.h b/include/decl.h index 66ada6cae..d6100e241 100644 --- a/include/decl.h +++ b/include/decl.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 decl.h $NHDT-Date: 1559601011 2019/06/03 22:30:11 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.150 $ */ +/* NetHack 3.6 decl.h $NHDT-Date: 1573869061 2019/11/16 01:51:01 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.165 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2007. */ /* NetHack may be freely redistributed. See license for details. */ @@ -10,7 +10,7 @@ #if !defined(MICRO) && !defined(VMS) && !defined(WIN32) #define LOCKNAMESIZE (PL_NSIZ + 14) /* long enough for uid+name+.99 */ #define LOCKNAMEINIT "1lock" -#define BONESINIT "bonesnn.xxx" +#define BONESINIT "bonesnn.xxx.le" #define BONESSIZE sizeof(BONESINIT) #else #if defined(MICRO) @@ -22,13 +22,13 @@ #if defined(VMS) #define LOCKNAMESIZE (PL_NSIZ + 17) /* long enough for _uid+name+.99;1 */ #define LOCKNAMEINIT "1lock" -#define BONESINIT "bonesnn.xxx;1" +#define BONESINIT "bonesnn.xxx_le;1" #define BONESSIZE sizeof(BONESINIT) #endif #if defined(WIN32) #define LOCKNAMESIZE (PL_NSIZ + 25) /* long enough for username+-+name+.99 */ #define LOCKNAMEINIT "" -#define BONESINIT "bonesnn.xxx" +#define BONESINIT "bonesnn.xxx.le" #define BONESSIZE sizeof(BONESINIT) #endif #endif @@ -170,6 +170,7 @@ struct sinfo { int exiting; /* an exit handler is executing */ int in_moveloop; int in_impossible; + int in_self_recover; #ifdef PANICLOG int in_paniclog; #endif @@ -339,6 +340,9 @@ E const struct c_common_strings c_common_strings; /* material strings */ E const char *materialnm[]; +/* empty string that is non-const for parameter use */ +E char emptystr[]; + /* Monster name articles */ #define ARTICLE_NONE 0 #define ARTICLE_THE 1 @@ -409,6 +413,9 @@ E const char *const monexplain[], invisexplain[], *const oclass_names[]; #define PREFIXES_IN_USE #endif +#ifdef WIN32 +E boolean fqn_prefix_locked[PREFIX_COUNT]; +#endif #ifdef PREFIXES_IN_USE E const char *fqn_prefix_names[PREFIX_COUNT]; #endif @@ -421,12 +428,9 @@ E struct restore_info restoreinfo; E NEARDATA struct savefile_info sfcap, sfrestinfo, sfsaveinfo; -struct opvar { - xchar spovartyp; /* one of SPOVAR_foo */ - union { - char *str; - long l; - } vardata; +struct selectionvar { + int wid, hei; + char *map; }; struct autopickup_exception { @@ -461,7 +465,7 @@ struct breadcrumbs { E const char *ARGV0; #endif -enum earlyarg {ARG_DEBUG, ARG_VERSION +enum earlyarg {ARG_DEBUG, ARG_VERSION, ARG_SHOWPATHS #ifdef WIN32 ,ARG_WINDOWS #endif @@ -696,6 +700,9 @@ struct role_filter { #define WIZKIT_MAX 128 #define CVT_BUF_SIZE 64 +#define LUA_VER_BUFSIZ 20 +#define LUA_COPYRIGHT_BUFSIZ 120 + struct instance_globals { /* apply.c */ @@ -871,7 +878,7 @@ struct instance_globals { d_level save_dlevel; /* do_name.c */ - struct opvar *gloc_filter_map; + struct selectionvar *gloc_filter_map; int gloc_filter_floodfill_match_glyph; int via_naming; @@ -903,8 +910,10 @@ struct instance_globals { struct symsetentry symset[NUM_GRAPHICS]; int currentgraphics; nhsym showsyms[SYM_MAX]; /* symbols to be displayed */ - nhsym l_syms[SYM_MAX]; /* loaded symbols */ - nhsym r_syms[SYM_MAX]; /* rogue symbols */ + nhsym primary_syms[SYM_MAX]; /* loaded primary symbols */ + nhsym rogue_syms[SYM_MAX]; /* loaded rogue symbols */ + nhsym ov_primary_syms[SYM_MAX]; /* loaded primary symbols */ + nhsym ov_rogue_syms[SYM_MAX]; /* loaded rogue symbols */ nhsym warnsyms[WARNCOUNT]; /* the current warning display symbols */ /* dungeon.c */ @@ -1113,12 +1122,6 @@ struct instance_globals { /* questpgr.c */ char cvt_buf[CVT_BUF_SIZE]; - struct qtlists qt_list; -#ifdef DLB - struct dlb_handle *msg_file; -#else - FILE *msg_file; -#endif /* used by ldrname() and neminame(), then copied into cvt_buf */ char nambuf[CVT_BUF_SIZE]; @@ -1183,6 +1186,7 @@ struct instance_globals { int num_lregions; /* positions touched by level elements explicitly defined in the des-file */ char SpLev_Map[COLNO][ROWNO]; + struct sp_coder *coder; xchar xstart, ystart; char xsize, ysize; boolean splev_init_present; @@ -1192,7 +1196,6 @@ struct instance_globals { struct obj *container_obj[MAX_CONTAINMENT]; int container_idx; struct monst *invent_carrying_monster; - aligntyp ralign[3]; /* spells.c */ int spl_sortmode; /* index into spl_sortchoices[] */ @@ -1253,6 +1256,13 @@ struct instance_globals { int poly_zapped; boolean obj_zapped; + /* new stuff */ + char lua_ver[LUA_VER_BUFSIZ]; + char lua_copyright[LUA_COPYRIGHT_BUFSIZ]; + + /* per-level glyph mapping flags */ + long glyphmap_perlevel_flags; + unsigned long magic; /* validate that structure layout is preserved */ }; diff --git a/include/dgn_file.h b/include/dgn_file.h index 9e20de9c8..442905cfb 100644 --- a/include/dgn_file.h +++ b/include/dgn_file.h @@ -18,22 +18,24 @@ struct couple { }; struct tmpdungeon { - char name[24], protoname[24]; + char *name, *protoname; struct couple lev; int flags, chance, levels, branches, entry_lev; /* entry level for this dungeon */ char boneschar; + int align; }; struct tmplevel { - char name[24]; + char *name; + char *chainlvl; struct couple lev; int chance, rndlevs, chain, flags; char boneschar; }; struct tmpbranch { - char name[24]; /* destination dungeon name */ + char *name; /* destination dungeon name */ struct couple lev; int chain; /* index into tmplevel array (chained branch)*/ int type; /* branch type (see below) */ diff --git a/include/dungeon.h b/include/dungeon.h index 4037511e4..c25494001 100644 --- a/include/dungeon.h +++ b/include/dungeon.h @@ -98,31 +98,36 @@ typedef struct branch { * * Depth corresponds to the number of floors below the surface. */ -#define Is_astralevel(x) (on_level(x, &astral_level)) -#define Is_earthlevel(x) (on_level(x, &earth_level)) -#define Is_waterlevel(x) (on_level(x, &water_level)) -#define Is_firelevel(x) (on_level(x, &fire_level)) -#define Is_airlevel(x) (on_level(x, &air_level)) -#define Is_medusa_level(x) (on_level(x, &medusa_level)) -#define Is_oracle_level(x) (on_level(x, &oracle_level)) -#define Is_valley(x) (on_level(x, &valley_level)) -#define Is_juiblex_level(x) (on_level(x, &juiblex_level)) -#define Is_asmo_level(x) (on_level(x, &asmodeus_level)) -#define Is_baal_level(x) (on_level(x, &baalzebub_level)) -#define Is_wiz1_level(x) (on_level(x, &wiz1_level)) -#define Is_wiz2_level(x) (on_level(x, &wiz2_level)) -#define Is_wiz3_level(x) (on_level(x, &wiz3_level)) -#define Is_sanctum(x) (on_level(x, &sanctum_level)) -#define Is_portal_level(x) (on_level(x, &portal_level)) -#define Is_rogue_level(x) (on_level(x, &rogue_level)) -#define Is_stronghold(x) (on_level(x, &stronghold_level)) -#define Is_bigroom(x) (on_level(x, &bigroom_level)) -#define Is_qstart(x) (on_level(x, &qstart_level)) -#define Is_qlocate(x) (on_level(x, &qlocate_level)) -#define Is_nemesis(x) (on_level(x, &nemesis_level)) -#define Is_knox(x) (on_level(x, &knox_level)) -#define Is_mineend_level(x) (on_level(x, &mineend_level)) -#define Is_sokoend_level(x) (on_level(x, &sokoend_level)) + +/* These both can't be zero, or dungeon_topology isn't init'd / restored */ +#define Lassigned(y) ((y)->dlevel || (y)->dnum) +#define Lcheck(x,z) (Lassigned(z) && on_level(x, z)) + +#define Is_astralevel(x) (Lcheck(x, &astral_level)) +#define Is_earthlevel(x) (Lcheck(x, &earth_level)) +#define Is_waterlevel(x) (Lcheck(x, &water_level)) +#define Is_firelevel(x) (Lcheck(x, &fire_level)) +#define Is_airlevel(x) (Lcheck(x, &air_level)) +#define Is_medusa_level(x) (Lcheck(x, &medusa_level)) +#define Is_oracle_level(x) (Lcheck(x, &oracle_level)) +#define Is_valley(x) (Lcheck(x, &valley_level)) +#define Is_juiblex_level(x) (Lcheck(x, &juiblex_level)) +#define Is_asmo_level(x) (Lcheck(x, &asmodeus_level)) +#define Is_baal_level(x) (Lcheck(x, &baalzebub_level)) +#define Is_wiz1_level(x) (Lcheck(x, &wiz1_level)) +#define Is_wiz2_level(x) (Lcheck(x, &wiz2_level)) +#define Is_wiz3_level(x) (Lcheck(x, &wiz3_level)) +#define Is_sanctum(x) (Lcheck(x, &sanctum_level)) +#define Is_portal_level(x) (Lcheck(x, &portal_level)) +#define Is_rogue_level(x) (Lcheck(x, &rogue_level)) +#define Is_stronghold(x) (Lcheck(x, &stronghold_level)) +#define Is_bigroom(x) (Lcheck(x, &bigroom_level)) +#define Is_qstart(x) (Lcheck(x, &qstart_level)) +#define Is_qlocate(x) (Lcheck(x, &qlocate_level)) +#define Is_nemesis(x) (Lcheck(x, &nemesis_level)) +#define Is_knox(x) (Lcheck(x, &knox_level)) +#define Is_mineend_level(x) (Lcheck(x, &mineend_level)) +#define Is_sokoend_level(x) (Lcheck(x, &sokoend_level)) #define In_sokoban(x) ((x)->dnum == sokoban_dnum) #define Inhell In_hell(&u.uz) /* now gehennom */ diff --git a/include/extern.h b/include/extern.h index 50db404bc..853965b7a 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1567213888 2019/08/31 01:11:28 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.728 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1575830178 2019/12/08 18:36:18 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.767 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -16,7 +16,7 @@ E char *FDECL(fmt_ptr, (const genericptr)); /* This next pre-processor directive covers almost the entire file, * interrupted only occasionally to pick up specific functions as needed. */ -#if !defined(MAKEDEFS_C) && !defined(LEV_LEX_C) +#if !defined(MAKEDEFS_C) && !defined(MDLIB_C) && !defined(LEV_LEX_C) /* ### allmain.c ### */ @@ -39,6 +39,7 @@ E int NDECL(number_leashed); E void FDECL(o_unleash, (struct obj *)); E void FDECL(m_unleash, (struct monst *, BOOLEAN_P)); E void NDECL(unleash_all); +E boolean FDECL(leashable, (struct monst *)); E boolean NDECL(next_to_u); E struct obj *FDECL(get_mleash, (struct monst *)); E const char *NDECL(beautiful); @@ -201,6 +202,7 @@ E int NDECL(doconduct); E int NDECL(domonability); E char FDECL(cmd_from_func, (int NDECL((*)))); E boolean FDECL(redraw_cmd, (CHAR_P)); +E const char *FDECL(levltyp_to_name, (int)); #ifdef USE_TRAMPOLI E int NDECL(doextcmd); E int NDECL(domonability); @@ -255,6 +257,7 @@ E void NDECL(sanity_check); E char* FDECL(key2txt, (UCHAR_P, char *)); E char FDECL(yn_function, (const char *, const char *, CHAR_P)); E boolean FDECL(paranoid_query, (BOOLEAN_P, const char *)); +E void FDECL(makemap_prepost, (BOOLEAN_P, BOOLEAN_P)); /* ### dbridge.c ### */ @@ -450,6 +453,9 @@ E char *FDECL(Amonnam, (struct monst *)); E char *FDECL(a_monnam, (struct monst *)); E char *FDECL(distant_monnam, (struct monst *, int, char *)); E char *FDECL(mon_nam_too, (struct monst *, struct monst *)); +E char *FDECL(monverbself, (struct monst *, char *, + const char *, const char *)); +E char *FDECL(minimal_monnam, (struct monst *, BOOLEAN_P)); E char *FDECL(rndmonnam, (char *)); E const char *FDECL(hcolor, (const char *)); E const char *NDECL(rndcolor); @@ -474,6 +480,7 @@ E int NDECL(Helmet_on); E int FDECL(select_off, (struct obj *)); E int NDECL(take_off); #endif +E const char *FDECL(fingers_or_gloves, (BOOLEAN_P)); E void FDECL(off_msg, (struct obj *)); E void FDECL(set_wear, (struct obj *)); E boolean FDECL(donning, (struct obj *)); @@ -579,21 +586,25 @@ E boolean FDECL(hurtle_jump, (genericptr_t, int, int)); E boolean FDECL(hurtle_step, (genericptr_t, int, int)); /* ### drawing.c ### */ -#endif /* !MAKEDEFS_C && !LEV_LEX_C */ +#endif /* !MAKEDEFS_C && !MDLIB_C && !LEV_LEX_C */ E int FDECL(def_char_to_objclass, (CHAR_P)); E int FDECL(def_char_to_monclass, (CHAR_P)); -#if !defined(MAKEDEFS_C) && !defined(LEV_LEX_C) +#if !defined(MAKEDEFS_C) && !defined(MDLIB_C) && !defined(LEV_LEX_C) E void FDECL(switch_symbols, (int)); E void FDECL(assign_graphics, (int)); -E void NDECL(init_r_symbols); E void NDECL(init_symbols); -E void NDECL(update_bouldersym); E void NDECL(init_showsyms); -E void NDECL(init_l_symbols); +E void NDECL(init_primary_symbols); +E void NDECL(init_rogue_symbols); +E void NDECL(init_ov_primary_symbols); +E void NDECL(init_ov_rogue_symbols); E void FDECL(clear_symsetentry, (int, BOOLEAN_P)); -E void FDECL(update_l_symset, (struct symparse *, int)); -E void FDECL(update_r_symset, (struct symparse *, int)); +E void FDECL(update_primary_symset, (struct symparse *, int)); +E void FDECL(update_rogue_symset, (struct symparse *, int)); +E void FDECL(update_ov_primary_symset, (struct symparse *, int)); +E void FDECL(update_ov_rogue_symset, (struct symparse *, int)); E boolean FDECL(cursed_object_at, (int, int)); +E nhsym FDECL(get_othersym, (int, int)); /* ### dungeon.c ### */ @@ -705,9 +716,9 @@ E int NDECL(done2); E void FDECL(done_intr, (int)); #endif E void FDECL(done_in_by, (struct monst *, int)); -#endif /* !MAKEDEFS_C && !LEV_LEX_C */ +#endif /* !MAKEDEFS_C && MDLIB_C && !LEV_LEX_C */ E void VDECL(panic, (const char *, ...)) PRINTF_F(1, 2) NORETURN; -#if !defined(MAKEDEFS_C) && !defined(LEV_LEX_C) +#if !defined(MAKEDEFS_C) && !defined(MDLIB_C) && !defined(LEV_LEX_C) E void FDECL(done, (int)); E void FDECL(container_contents, (struct obj *, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P)); @@ -842,6 +853,7 @@ E int FDECL(nhclose, (int)); #ifdef DEBUG E boolean FDECL(debugcore, (const char *, BOOLEAN_P)); #endif +E void NDECL(reveal_paths); E boolean FDECL(read_tribute, (const char *, const char *, int, char *, int, unsigned)); E boolean FDECL(Death_quote, (char *, int)); @@ -916,8 +928,10 @@ E char *FDECL(mungspaces, (char *)); E char *FDECL(trimspaces, (char *)); E char *FDECL(strip_newline, (char *)); E char *FDECL(stripchars, (char *, const char *, const char *)); +E char *FDECL(stripdigits, (char *)); E char *FDECL(eos, (char *)); E boolean FDECL(str_end_is, (const char *, const char *)); +E int FDECL(str_lines_maxlen, (const char *)); E char *FDECL(strkitten, (char *, CHAR_P)); E void FDECL(copynchars, (char *, const char *, int)); E char FDECL(chrcasecpy, (int, int)); @@ -969,6 +983,7 @@ E void FDECL(strbuf_append, (strbuf_t *, const char *)); E void FDECL(strbuf_reserve, (strbuf_t *, int)); E void FDECL(strbuf_empty, (strbuf_t *)); E void FDECL(strbuf_nl_to_crlf, (strbuf_t *)); +E char *FDECL(nonconst, (const char *, char *)); /* ### invent.c ### */ @@ -1048,7 +1063,8 @@ E int FDECL(count_unpaid, (struct obj *)); E int FDECL(count_buc, (struct obj *, int, boolean (*)(OBJ_P))); E void FDECL(tally_BUCX, (struct obj *, BOOLEAN_P, int *, int *, int *, int *, int *)); -E long FDECL(count_contents, (struct obj *, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P)); +E long FDECL(count_contents, (struct obj *, + BOOLEAN_P, BOOLEAN_P, BOOLEAN_P, BOOLEAN_P)); E void FDECL(carry_obj_effects, (struct obj *)); E const char *FDECL(currency, (long)); E void FDECL(silly_thing, (const char *, struct obj *)); @@ -1197,7 +1213,7 @@ E boolean FDECL(usmellmon, (struct permonst *)); /* ### mapglyph.c ### */ -E int FDECL(mapglyph, (int, int *, int *, unsigned *, int, int)); +E int FDECL(mapglyph, (int, int *, int *, unsigned *, int, int, unsigned)); E char *FDECL(encglyph, (int)); E char *FDECL(decode_mixed, (char *, const char *)); E void FDECL(genl_putmixed, (winid, int, const char *)); @@ -1264,6 +1280,7 @@ E void FDECL(add_subroom, (struct mkroom *, int, int, int, int, BOOLEAN_P, SCHAR_P, BOOLEAN_P)); E void NDECL(makecorridors); E void FDECL(add_door, (int, int, struct mkroom *)); +E void NDECL(clear_level_structures); E void NDECL(mklev); #ifdef SPECIALIZATION E void FDECL(topologize, (struct mkroom *, BOOLEAN_P)); @@ -1375,6 +1392,7 @@ E struct obj *FDECL(obj_nexto_xy, (struct obj *, int, int, BOOLEAN_P)); E struct obj *FDECL(obj_absorb, (struct obj **, struct obj **)); E struct obj *FDECL(obj_meld, (struct obj **, struct obj **)); E void FDECL(pudding_merge_message, (struct obj *, struct obj *)); +E struct obj *FDECL(init_dummyobj, (struct obj *, SHORT_P, long)); /* ### mkroom.c ### */ @@ -1497,7 +1515,7 @@ E int FDECL(monsndx, (struct permonst *)); E int FDECL(name_to_mon, (const char *)); E int FDECL(name_to_monclass, (const char *, int *)); E int FDECL(gender, (struct monst *)); -E int FDECL(pronoun_gender, (struct monst *, BOOLEAN_P)); +E int FDECL(pronoun_gender, (struct monst *, unsigned)); E boolean FDECL(levl_follower, (struct monst *)); E int FDECL(little_to_big, (int)); E int FDECL(big_to_little, (int)); @@ -1648,13 +1666,57 @@ E void NDECL(init_lan_features); E char *NDECL(lan_username); #endif +/* ### nhlsel.c ### */ +#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) +E struct selectionvar *FDECL(l_selection_check, (lua_State *, int)); +E int FDECL(l_selection_register, (lua_State *)); +#endif + +/* ### nhlobj.c ### */ +#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) +E int FDECL(l_obj_register, (lua_State *)); +#endif + +/* ### nhlua.c ### */ + +#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) +E lua_State * NDECL(nhl_init); +E boolean FDECL(nhl_loadlua, (lua_State *, const char *)); +E boolean FDECL(load_lua, (const char *)); +E void FDECL(nhl_error, (lua_State *, const char *)) NORETURN; +E void FDECL(lcheck_param_table, (lua_State *)); +E schar FDECL(get_table_mapchr, (lua_State *, const char *)); +E schar FDECL(get_table_mapchr_opt, (lua_State *, const char *, SCHAR_P)); +E void FDECL(nhl_add_table_entry_int, (lua_State *, const char *, int)); +E void FDECL(nhl_add_table_entry_char, (lua_State *, const char *, CHAR_P)); +E void FDECL(nhl_add_table_entry_str, (lua_State *, const char *, const char *)); +E schar FDECL(splev_chr2typ, (CHAR_P)); +E schar FDECL(check_mapchr, (const char *)); +E int FDECL(get_table_int, (lua_State *, const char *)); +E int FDECL(get_table_int_opt, (lua_State *, const char *, int)); +E char *FDECL(get_table_str, (lua_State *, const char *)); +E char *FDECL(get_table_str_opt, (lua_State *, const char *, char *)); +E int FDECL(get_table_boolean, (lua_State *, const char *)); +E int FDECL(get_table_boolean_opt, (lua_State *, const char *, int)); +E int FDECL(get_table_option, (lua_State *, const char *, const char *, const char *const *)); +E int FDECL(str_lines_max_width, (const char *)); +E char *FDECL(stripdigits, (char *)); +E const char *NDECL(get_lua_version); +#endif /* !CROSSCOMPILE || CROSSCOMPILE_TARGET */ + /* ### nhregex.c ### */ + E struct nhregex *NDECL(regex_init); E boolean FDECL(regex_compile, (const char *, struct nhregex *)); E const char *FDECL(regex_error_desc, (struct nhregex *)); E boolean FDECL(regex_match, (const char *, struct nhregex *)); E void FDECL(regex_free, (struct nhregex *)); +/* ### mdlib.c ### */ + +E void NDECL(runtime_info_init); +E const char *FDECL(do_runtime_info, (int *)); + /* ### nttty.c ### */ #ifdef WIN32 @@ -1742,6 +1804,10 @@ E int FDECL(rnd_class, (int, int)); E const char *FDECL(suit_simple_name, (struct obj *)); E const char *FDECL(cloak_simple_name, (struct obj *)); E const char *FDECL(helm_simple_name, (struct obj *)); +E const char *FDECL(gloves_simple_name, (struct obj *)); +E const char *FDECL(boots_simple_name, (struct obj *)); +E const char *FDECL(shield_simple_name, (struct obj *)); +E const char *FDECL(shirt_simple_name, (struct obj *)); E const char *FDECL(mimic_obj_name, (struct monst *)); E char *FDECL(safe_qbuf, (char *, const char *, const char *, struct obj *, char *(*)(OBJ_P), char *(*)(OBJ_P), const char *)); @@ -1778,7 +1844,7 @@ E int FDECL(add_autopickup_exception, (const char *)); E void NDECL(free_autopickup_exceptions); E int FDECL(load_symset, (const char *, int)); E void NDECL(free_symsets); -E boolean FDECL(parsesymbols, (char *)); +E boolean FDECL(parsesymbols, (char *, int)); E struct symparse *FDECL(match_sym, (char *)); E void NDECL(set_playmode); E int FDECL(sym_val, (const char *)); @@ -1811,7 +1877,7 @@ E char *FDECL(dowhatdoes_core, (CHAR_P, char *)); E int NDECL(dohelp); E int NDECL(dohistory); -/* ### pcmain.c ### */ +/* ### xxmain.c ### */ #if defined(MICRO) || defined(WIN32) #ifdef CHDIR @@ -1819,6 +1885,10 @@ E void FDECL(chdirx, (char *, BOOLEAN_P)); #endif /* CHDIR */ E boolean NDECL(authorize_wizard_mode); #endif /* MICRO || WIN32 */ +#if defined(WIN32) +E int NDECL(getlock); +E const char *NDECL(get_portable_device); +#endif /* ### pcsys.c ### */ @@ -1856,10 +1926,10 @@ E void FDECL(msleep, (unsigned)); #if defined(MICRO) E void FDECL(regularize, (char *)); -#endif /* MICRO */ #if defined(PC_LOCKING) E void NDECL(getlock); #endif +#endif /* MICRO */ /* ### pickup.c ### */ @@ -1958,6 +2028,7 @@ E void FDECL(make_blinded, (long, BOOLEAN_P)); E void NDECL(toggle_blindness); E boolean FDECL(make_hallucinated, (long, BOOLEAN_P, long)); E void FDECL(make_deaf, (long, BOOLEAN_P)); +E void FDECL(make_glib, (int)); E void NDECL(self_invis_message); E int NDECL(dodrink); E int FDECL(dopotion, (struct obj *)); @@ -1984,6 +2055,7 @@ E boolean FDECL(can_pray, (BOOLEAN_P)); E int NDECL(dopray); E const char *NDECL(u_gname); E int NDECL(doturn); +E int FDECL(altarmask_at, (int, int)); E const char *NDECL(a_gname); E const char *FDECL(a_gname_at, (XCHAR_P x, XCHAR_P y)); E const char *FDECL(align_gname, (ALIGNTYP_P)); @@ -2042,8 +2114,8 @@ E short FDECL(quest_info, (int)); E const char *NDECL(ldrname); E boolean FDECL(is_quest_artifact, (struct obj *)); E struct obj *FDECL(find_quest_artifact, (unsigned)); -E void FDECL(com_pager, (int)); -E void FDECL(qt_pager, (int)); +E void FDECL(com_pager, (const char *)); +E void FDECL(qt_pager, (const char *)); E struct permonst *NDECL(qt_montype); E void NDECL(deliver_splev_message); @@ -2364,7 +2436,7 @@ E void NDECL(sysopt_release); E void FDECL(sysopt_seduce_set, (int)); /* ### sp_lev.c ### */ - +#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) E boolean FDECL(check_room, (xchar *, xchar *, xchar *, xchar *, BOOLEAN_P)); E boolean FDECL(create_room, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P)); @@ -2373,11 +2445,28 @@ E boolean FDECL(dig_corridor, (coord *, coord *, BOOLEAN_P, SCHAR_P, SCHAR_P)); E void FDECL(fill_room, (struct mkroom *, BOOLEAN_P)); E boolean FDECL(load_special, (const char *)); -E xchar FDECL(selection_getpoint, (int, int, struct opvar *)); -E struct opvar *FDECL(selection_opvar, (char *)); -E void FDECL(opvar_free_x, (struct opvar *)); +E xchar FDECL(selection_getpoint, (int, int, struct selectionvar *)); +E struct selectionvar *NDECL(selection_new); +E void FDECL(selection_free, (struct selectionvar *)); +#if !defined(IN_SP_LEV_C) E void FDECL(set_selection_floodfillchk, (int FDECL((*), (int,int)))); -E void FDECL(selection_floodfill, (struct opvar *, int, int, BOOLEAN_P)); +#endif +E void FDECL(selection_floodfill, (struct selectionvar *, int, int, BOOLEAN_P)); +E void FDECL(get_location_coord, (schar *, schar *, int, struct mkroom *, long)); +E void FDECL(selection_setpoint, (int, int, struct selectionvar *, XCHAR_P)); +E struct selectionvar * FDECL(selection_not, (struct selectionvar *)); +E void FDECL(selection_filter_percent, (struct selectionvar *, int)); +E int FDECL(selection_rndcoord, (struct selectionvar *, schar *, schar *, BOOLEAN_P)); +E void FDECL(selection_do_grow, (struct selectionvar *, int)); +E void FDECL(selection_do_line, (SCHAR_P, SCHAR_P, SCHAR_P, SCHAR_P, struct selectionvar *)); +E void FDECL(selection_do_randline, (SCHAR_P, SCHAR_P, SCHAR_P, SCHAR_P, SCHAR_P, SCHAR_P, struct selectionvar *)); +E struct selectionvar *FDECL(selection_filter_mapchar, (struct selectionvar *, XCHAR_P, int)); +E void FDECL(set_floodfillchk_match_under, (XCHAR_P)); +E void FDECL(selection_do_ellipse, (struct selectionvar *, int, int, int, int, int)); +E void NDECL(update_croom); +E const char *FDECL(get_trapname_bytype, (int)); +E void FDECL(l_register_des, (lua_State *)); +#endif /* !CROSSCOMPILE || CROSSCOMPILE_TARGET */ /* ### spell.c ### */ @@ -2515,7 +2604,7 @@ E boolean FDECL(burnarmor, (struct monst *)); E int FDECL(erode_obj, (struct obj *, const char *, int, int)); E boolean FDECL(grease_protect, (struct obj *, const char *, struct monst *)); E struct trap *FDECL(maketrap, (int, int, int)); -E void FDECL(fall_through, (BOOLEAN_P)); +E void FDECL(fall_through, (BOOLEAN_P, unsigned)); E struct monst *FDECL(animate_statue, (struct obj *, XCHAR_P, XCHAR_P, int, int *)); E struct monst *FDECL(activate_statue_trap, @@ -2560,6 +2649,7 @@ E int FDECL(launch_obj, (SHORT_P, int, int, int, int, int)); E boolean NDECL(launch_in_progress); E void NDECL(force_launch_placement); E boolean FDECL(uteetering_at_seen_pit, (struct trap *)); +E boolean FDECL(uescaped_shaft, (struct trap *)); E boolean NDECL(lava_effects); E void NDECL(sink_into_lava); E void NDECL(sokoban_guilt); @@ -2578,6 +2668,8 @@ E int FDECL(find_roll_to_hit, (struct monst *, UCHAR_P, struct obj *, int *, int *)); E boolean FDECL(attack, (struct monst *)); E boolean FDECL(hmon, (struct monst *, struct obj *, int, int)); +E boolean FDECL(shade_miss, (struct monst *, struct monst *, struct obj *, + BOOLEAN_P, BOOLEAN_P)); E int FDECL(damageum, (struct monst *, struct attack *, int)); E void FDECL(missum, (struct monst *, struct attack *, BOOLEAN_P)); E int FDECL(passive, (struct monst *, struct obj *, BOOLEAN_P, int, @@ -2875,10 +2967,13 @@ E void NDECL(nhwindows_hangup); #endif E void NDECL(genl_status_init); E void NDECL(genl_status_finish); -E void FDECL(genl_status_enablefield, - (int, const char *, const char *, BOOLEAN_P)); -E void FDECL(genl_status_update, (int, genericptr_t, int, int, int, unsigned long *)); - +E void FDECL(genl_status_enablefield, (int, const char *, const char *, + BOOLEAN_P)); +E void FDECL(genl_status_update, (int, genericptr_t, int, int, int, + unsigned long *)); +#ifdef DUMPLOG +E char *FDECL(dump_fmtstr, (const char *, char *, BOOLEAN_P)); +#endif E void FDECL(dump_open_log, (time_t)); E void NDECL(dump_close_log); E void FDECL(dump_redirect, (BOOLEAN_P)); @@ -3009,7 +3104,7 @@ E int FDECL(destroy_mitem, (struct monst *, int, int)); E int FDECL(resist, (struct monst *, CHAR_P, int, int)); E void NDECL(makewish); -#endif /* !MAKEDEFS_C && !LEV_LEX_C */ +#endif /* !MAKEDEFS_C && !MDLIB_C && !LEV_LEX_C */ #undef E diff --git a/include/flag.h b/include/flag.h index 135cf0f54..d0237d628 100644 --- a/include/flag.h +++ b/include/flag.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 flag.h $NHDT-Date: 1569276988 2019/09/23 22:16:28 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.155 $ */ +/* NetHack 3.7 flag.h $NHDT-Date: 1574982014 2019/11/28 23:00:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.166 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -32,6 +32,7 @@ struct flag { #define discover flags.explore boolean female; boolean friday13; /* it's Friday the 13th */ + boolean goldX; /* for BUCX filtering, whether gold is X or U */ boolean help; /* look in data file for info about stuff */ boolean ignintr; /* ignore interrupts */ boolean ins_chkpt; /* checkpoint as appropriate; INSURANCE */ @@ -40,7 +41,6 @@ struct flag { boolean lit_corridor; /* show a dark corr as lit if it is in sight */ boolean nap; /* `timed_delay' option for display effects */ boolean null; /* OK to send nulls to the terminal */ - boolean p__obsolete; /* [3.6.2: perm_invent moved to iflags] */ boolean pickup; /* whether you pickup or move and look */ boolean pickup_thrown; /* auto-pickup items you threw */ boolean pushweapon; /* When wielding, push old weapon into second slot */ @@ -49,27 +49,6 @@ struct flag { boolean showexp; /* show experience points */ boolean showscore; /* show score */ boolean silent; /* whether the bell rings or not */ - /* The story so far: - * 'sortloot' originally took a True/False value but was changed - * to use a letter instead. 3.6.0 was released without changing its - * type from 'boolean' to 'char'. A compiler was smart enough to - * complain that assigning any of the relevant letters was not 0 or 1 - * so not appropriate for boolean (by a configuration which used - * SKIP_BOOLEAN to bypass nethack's 'boolean' and use a C++-compatible - * one). So the type was changed to 'xchar', which is guaranteed to - * match the size of 'boolean' (this guarantee only applies for the - * !SKIP_BOOLEAN config, unfortunately). Since xchar does not match - * actual use, the type was later changed to 'char'. But that would - * break 3.6.0 savefile compatibility for configurations which typedef - * 'schar' to 'short int' instead of to 'char'. (Needed by pre-ANSI - * systems that use unsigned characters without a way to force them - * to be signed.) So, the type has been changed back to 'xchar' for - * 3.6.x. - * - * TODO: change to 'char' (and move out of this block of booleans, - * and get rid of these comments...) once 3.6.0 savefile compatibility - * eventually ends. - */ boolean sortpack; /* sorted inventory */ boolean sparkle; /* show "resisting" special FX (Scott Bigham) */ boolean standout; /* use standout for --More-- */ @@ -91,9 +70,10 @@ struct flag { #define PARANOID_REMOVE 0x0040 #define PARANOID_BREAKWAND 0x0080 #define PARANOID_WERECHANGE 0x0100 +#define PARANOID_EATING 0x0200 int pickup_burden; /* maximum burden before prompt */ int pile_limit; /* controls feedback when walking over objects */ - char sortloot; /* 'n'=none, 'l'=loot (pickup), 'f'=full ('l'+invent) */ + char sortloot; /* 'n'=none, 'l'=loot (pickup), 'f'=full ('l'+invent) */ char inv_order[MAXOCLASSES]; char pickup_types[MAXOCLASSES]; #define NUM_DISCLOSURE_OPTIONS 6 /* i,a,v,g,c,o (decl.c) */ @@ -254,6 +234,8 @@ struct instance_flags { boolean mon_polycontrol; /* debug: control monster polymorphs */ boolean in_dumplog; /* doing the dumplog right now? */ boolean in_parse; /* is a command being parsed? */ + /* suppress terminate during options parsing, for --showpaths */ + boolean initoptions_noterminate; /* stuff that is related to options and/or user or platform preferences */ @@ -270,9 +252,6 @@ struct instance_flags { boolean deferred_X; /* deferred entry into explore mode */ boolean echo; /* 1 to echo characters */ boolean force_invmenu; /* always menu when handling inventory */ - /* FIXME: goldX belongs in flags, but putting it in iflags avoids - breaking 3.6.[01] save files */ - boolean goldX; /* for BUCX filtering, whether gold is X or U */ boolean hilite_pile; /* mark piles of objects with a hilite */ boolean implicit_uncursed; /* maybe omit "uncursed" status in inventory */ boolean mention_walls; /* give feedback when bumping walls */ @@ -293,25 +272,16 @@ struct instance_flags { boolean use_background_glyph; /* use background glyph when appropriate */ boolean use_menu_color; /* use color in menus; only if wc_color */ #ifdef STATUS_HILITES - long hilite_delta; /* number of moves to leave a temp hilite lit */ + long hilite_delta; /* number of moves to leave a temp hilite lit */ long unhilite_deadline; /* time when oldest temp hilite should be unlit */ #endif boolean zerocomp; /* write zero-compressed save files */ boolean rlecomp; /* alternative to zerocomp; run-length encoding * compression of levels when writing savefile */ uchar num_pad_mode; - boolean cursesgraphics; /* Use portable curses extended characters */ -#if 0 /* XXXgraphics superseded by symbol sets */ - boolean DECgraphics; /* use DEC VT-xxx extended character set */ - boolean IBMgraphics; /* use IBM extended character set */ -#ifdef MAC_GRAPHICS_ENV - boolean MACgraphics; /* use Macintosh extended character set, as - as defined in the special font HackFont */ -#endif -#endif - uchar bouldersym; /* symbol for boulder display */ - char prevmsg_window; /* type of old message window to use */ - boolean extmenu; /* extended commands use menu interface */ + uchar bouldersym; /* symbol for boulder display */ + char prevmsg_window; /* type of old message window to use */ + boolean extmenu; /* extended commands use menu interface */ #ifdef MFLOPPY boolean checkspace; /* check disk space before writing files */ /* (in iflags to allow restore after moving @@ -504,6 +474,9 @@ enum runmode_types { /* werechange: accepting randomly timed werecreature change to transform from human to creature or vice versa while having polymorph control */ #define ParanoidWerechange ((flags.paranoia_bits & PARANOID_WERECHANGE) != 0) +/* continue eating: prompt given _after_first_bite_ when eating something + while satiated */ +#define ParanoidEating ((flags.paranoia_bits & PARANOID_EATING) != 0) /* command parsing, mainly dealing with number_pad handling; not saved and restored */ diff --git a/include/global.h b/include/global.h index e6f0ec4a4..609d5ec33 100644 --- a/include/global.h +++ b/include/global.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 global.h $NHDT-Date: 1557510460 2019/05/10 17:47:40 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.72 $ */ +/* NetHack 3.7 global.h $NHDT-Date: 1574982019 2019/11/28 23:00:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.92 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -11,9 +11,10 @@ /* * Development status possibilities. */ -#define NH_STATUS_RELEASED 0 /* Released */ -#define NH_STATUS_WIP 1 /* Work in progress */ -#define NH_STATUS_BETA 2 /* BETA testing */ +#define NH_STATUS_RELEASED 0 /* Released */ +#define NH_STATUS_WIP 1 /* Work in progress */ +#define NH_STATUS_BETA 2 /* BETA testing */ +#define NH_STATUS_POSTRELEASE 3 /* patch commit point only */ /* * Development status of this NetHack version. @@ -46,7 +47,7 @@ #define ENGRAVEFILE "engrave" /* random engravings on the floor */ #define BOGUSMONFILE "bogusmon" /* hallucinatory monsters */ #define TRIBUTEFILE "tribute" /* 3.6 tribute to Terry Pratchett */ -#define LEV_EXT ".lev" /* extension for special level files */ +#define LEV_EXT ".lua" /* extension for special level files */ /* Assorted definitions that may depend on selections in config.h. */ @@ -70,9 +71,10 @@ * since otherwise comparisons with signed quantities are done incorrectly */ typedef schar xchar; -#if defined(__GNUC__) && defined(WIN32) && defined(__cplusplus) + +#ifdef __MINGW32__ /* Resolve conflict with Qt 5 and MinGW-w32 */ -typedef uchar boolean; /* 0 or 1 */ +typedef unsigned char boolean; /* 0 or 1 */ #else #ifndef SKIP_BOOLEAN typedef xchar boolean; /* 0 or 1 */ @@ -123,6 +125,41 @@ typedef uchar nhsym; #define LARGEST_INT 32767 #include "coord.h" + +#if defined(CROSSCOMPILE) +struct cross_target_s { + const char *build_date; + const char *copyright_banner_c; + const char *git_sha; + const char *git_branch; + const char *version_string; + const char *version_id; + unsigned long version_number; + unsigned long version_features; + unsigned long ignored_features; + unsigned long version_sanity1; + unsigned long version_sanity2; + unsigned long version_sanity3; + unsigned long build_time; +}; +extern struct cross_target_s cross_target; +#if defined(CROSSCOMPILE_TARGET) && !defined(MAKEDEFS_C) +#define BUILD_DATE cross_target.build_date /* "Wed Apr 1 00:00:01 2020" */ +#define COPYRIGHT_BANNER_C cross_target.copyright_banner_c +#define NETHACK_GIT_SHA cross_target.git_sha +#define NETHACK_GIT_BRANCH cross_target.git_branch +#define VERSION_ID cross_target.version_id +#define IGNORED_FEATURES cross_target.ignored_features +#define VERSION_FEATURES cross_target.version_features +#define VERSION_NUMBER cross_target.version_number +#define VERSION_SANITY1 cross_target.version_sanity1 +#define VERSION_SANITY2 cross_target.version_sanity2 +#define VERSION_SANITY3 cross_target.version_sanity3 +#define VERSION_STRING cross_target.version_string +#define BUILD_TIME cross_target.build_time /* (1574157640UL) */ +#endif /* CROSSCOMPILE_TARGET && !MAKEDEFS_C */ +#endif /* CROSSCOMPILE */ + /* * Automatic inclusions for the subsidiary files. * Please don't change the order. It does matter. @@ -351,6 +388,14 @@ struct savefile_info { #define MAXMONNO 120 /* extinct monst after this number created */ #define MHPMAX 500 /* maximum monster hp */ +/* + * Version 3.7.x has aspirations of portable file formats. We + * make a distinction between MAIL functionality and MAIL_STRUCTURES + * so that the underlying structures are consistent, whether MAIL is + * defined or not. + */ +#define MAIL_STRUCTURES + /* PANICTRACE: Always defined for NH_DEVEL_STATUS != NH_STATUS_RELEASED but only for supported platforms. */ #ifdef UNIX diff --git a/include/hack.h b/include/hack.h index 369519479..d22197b61 100644 --- a/include/hack.h +++ b/include/hack.h @@ -78,6 +78,10 @@ enum dismount_types { DISMOUNT_BYCHOICE = 6 }; +/* mgflags for mapglyph() */ +#define MG_FLAG_NORMAL 0x00 +#define MG_FLAG_NOOVERRIDE 0x01 + /* Special returns from mapglyph() */ #define MG_CORPSE 0x01 #define MG_INVIS 0x02 @@ -198,7 +202,6 @@ typedef struct { #include "context.h" #include "rm.h" #include "botl.h" -#include "qtext.h" /* Symbol offsets */ #define SYM_OFF_P (0) diff --git a/include/lev.h b/include/lev.h deleted file mode 100644 index 731944702..000000000 --- a/include/lev.h +++ /dev/null @@ -1,12 +0,0 @@ -/* NetHack 3.6 lev.h $NHDT-Date: 1432512781 2015/05/25 00:13:01 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ */ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/*-Copyright (c) Michael Allison, 2006. */ -/* NetHack may be freely redistributed. See license for details. */ - -/* Common include file for save and restore routines */ - -#ifndef LEV_H -#define LEV_H - - -#endif /* LEV_H */ diff --git a/include/mextra.h b/include/mextra.h index 386495cc1..9ceee2fb2 100644 --- a/include/mextra.h +++ b/include/mextra.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 mextra.h $NHDT-Date: 1547428759 2019/01/14 01:19:19 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.22 $ */ +/* NetHack 3.6 mextra.h $NHDT-Date: 1574722861 2019/11/25 23:01:01 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.24 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -179,7 +179,9 @@ struct mextra { struct eshk *eshk; struct emin *emin; struct edog *edog; - int mcorpsenm; /* obj->corpsenm for mimic posing as statue or corpse */ + int mcorpsenm; /* obj->corpsenm for mimic posing as statue or corpse, + * obj->spe (fruit index) for one posing as a slime mold, + * or an alignment mask for one posing as an altar */ }; #define MNAME(mon) ((mon)->mextra->mname) diff --git a/include/mondata.h b/include/mondata.h index e35601ae4..e84a09272 100644 --- a/include/mondata.h +++ b/include/mondata.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 mondata.h $NHDT-Date: 1550524558 2019/02/18 21:15:58 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.37 $ */ +/* NetHack 3.6 mondata.h $NHDT-Date: 1576626512 2019/12/17 23:48:32 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.39 $ */ /* Copyright (c) 1989 Mike Threepoint */ /* NetHack may be freely redistributed. See license for details. */ @@ -31,6 +31,7 @@ (is_minion((mon)->data) && mon_aligntyp(mon) == A_LAWFUL) #define is_flyer(ptr) (((ptr)->mflags1 & M1_FLY) != 0L) #define is_floater(ptr) ((ptr)->mlet == S_EYE || (ptr)->mlet == S_LIGHT) +/* clinger: piercers, mimics, wumpus -- generally don't fall down holes */ #define is_clinger(ptr) (((ptr)->mflags1 & M1_CLING) != 0L) #define is_swimmer(ptr) (((ptr)->mflags1 & M1_SWIM) != 0L) #define breathless(ptr) (((ptr)->mflags1 & M1_BREATHLESS) != 0L) @@ -41,14 +42,24 @@ #define noncorporeal(ptr) ((ptr)->mlet == S_GHOST) #define tunnels(ptr) (((ptr)->mflags1 & M1_TUNNEL) != 0L) #define needspick(ptr) (((ptr)->mflags1 & M1_NEEDPICK) != 0L) +/* hides_under() requires an object at the location in order to hide */ #define hides_under(ptr) (((ptr)->mflags1 & M1_CONCEAL) != 0L) +/* is_hider() is True for mimics but when hiding they appear as something + else rather than become mon->mundetected, so use is_hider() with care */ #define is_hider(ptr) (((ptr)->mflags1 & M1_HIDE) != 0L) +/* piercers cling to the ceiling; lurkers above are hiders but they fly + so aren't classified as clingers; unfortunately mimics are classified + as both hiders and clingers but have nothing to do with ceilings; + wumpuses (not wumpi :-) cling but aren't hiders */ +#define ceiling_hider(ptr) \ + (is_hider(ptr) && ((is_clinger(ptr) && (ptr)->mlet != S_MIMIC) \ + || is_flyer(ptr))) /* lurker above */ #define haseyes(ptr) (((ptr)->mflags1 & M1_NOEYES) == 0L) -#define eyecount(ptr) \ - (!haseyes(ptr) ? 0 : ((ptr) == &mons[PM_CYCLOPS] \ - || (ptr) == &mons[PM_FLOATING_EYE]) \ - ? 1 \ - : 2) +/* used to decide whether plural applies so no need for 'more than 2' */ +#define eyecount(ptr) \ + (!haseyes(ptr) ? 0 \ + : ((ptr) == &mons[PM_CYCLOPS] || (ptr) == &mons[PM_FLOATING_EYE]) ? 1 \ + : 2) #define nohands(ptr) (((ptr)->mflags1 & M1_NOHANDS) != 0L) #define nolimbs(ptr) (((ptr)->mflags1 & M1_NOLIMBS) == M1_NOLIMBS) #define notake(ptr) (((ptr)->mflags1 & M1_NOTAKE) != 0L) diff --git a/include/monst.h b/include/monst.h index bc8f939c5..3a26b7241 100644 --- a/include/monst.h +++ b/include/monst.h @@ -159,8 +159,9 @@ struct monst { long mtrapseen; /* bitmap of traps we've been trapped in */ long mlstmv; /* for catching up with lost time */ + long mstate; /* debugging info on monsters stored here */ + long migflags; /* migrating flags */ long mspare1; -#define mstate mspare1 /* only for debug exam right now, not code flow */ struct obj *minvent; /* mon's inventory */ struct obj *mw; /* mon's weapon */ long misc_worn_check; /* mon's wornmask */ diff --git a/include/ntconf.h b/include/ntconf.h index c2b0b3af0..461990dfc 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -32,7 +32,9 @@ /*#define CHANGE_COLOR*/ /* allow palette changes */ #define SELECTSAVED /* Provide menu of saved games to choose from at start */ - + +#define QWERTZ_SUPPORT /* when swap_yz is True, numpad 7 is 'z' not 'y' */ + /* * ----------------------------------------------------------------- * The remaining code shouldn't need modification. @@ -78,7 +80,12 @@ * objects being thrown when the hangup occurs. \ */ -#define MAIL +#define CONFIG_FILE ".nethackrc" +#define CONFIG_TEMPLATE ".nethackrc.template" +#define SYSCF_TEMPLATE "sysconf.template" +#define SYMBOLS_TEMPLATE "symbols.template" +#define GUIDEBOOK_FILE "Guidebook.txt" + /* Stuff to help the user with some common, yet significant errors */ #define INTERJECT_PANIC 0 #define INTERJECTION_TYPES (INTERJECT_PANIC + 1) @@ -99,7 +106,7 @@ extern void FDECL(interject, (int)); #ifdef strcasecmp #undef strcasecmp #endif -extern void NDECL(getlock); +/* extern int NDECL(getlock); */ #endif #ifdef _MSC_VER @@ -284,4 +291,9 @@ extern void FDECL(nhassert_failed, (const char * exp, const char * file, #define nethack_enter(argc, argv) nethack_enter_winnt() extern void FDECL(nethack_exit, (int)) NORETURN; extern boolean FDECL(file_exists, (const char *)); +extern boolean FDECL(file_newer, (const char *, const char *)); +#ifndef SYSTEM_H +#include "system.h" +#endif + #endif /* NTCONF_H */ diff --git a/include/patchlevel.h b/include/patchlevel.h index 3d7d95580..3d272ed14 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 patchlevel.h $NHDT-Date: 1557510467 2019/05/10 17:47:47 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.127 $ */ +/* NetHack 3.7 patchlevel.h $NHDT-Date: 1575775596 2019/12/08 03:26:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.136 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -14,7 +14,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 0 +#define EDITLEVEL 3 #define COPYRIGHT_BANNER_A "NetHack, Copyright 1985-2019" #define COPYRIGHT_BANNER_B \ @@ -33,16 +33,82 @@ */ #define VERSION_COMPATIBILITY 0x03070000L +/****************************************************************************/ +/* Version 3.7.x */ + +/* + * NetHack 3.7.0, + * + */ + /****************************************************************************/ /* Version 3.6.x */ -/* Patch 3, - * +/* Patch 4, December 18, 2019 + * + * fix potential buffer overflow when parsing run-time configuration file + * GDBPATH and GREPPATH from sysconf or -D... on compilation command line were + * being processed even if PANICTRACE was disabled but only being freed + * at end of game when that was enabled + * fix the article used in the message when your steed encounters a polymorph + * trap + * allow teleporting onto the vibrating square + * message "your knapsack can't accomodate any more items" when picking stuff + * up or removing such from container was inaccurate if there was some + * gold pending; vary the message rather than add more convoluted pickup + * code + * dozen-ish assorted spelling/typo fixes in messages and source comments + * wizard mode wishing for terrain would leave it unmapped if done while blind + * wizard mode terrain wish could leave hero in water (severe vision limits) + * or in lava (trapped, sinking) which wasn't there any more + * flying hero can go down (via '>') holes or trap doors instead of escaping + * trap + * polymorphed hero hiding on the ceiling can now use '>' to unhide instead of + * being told "you can't go down here" + * fix compilation on platforms that split the ncurses and tinfo libraries + * Windows: allow all game files to be on a portable device via the sysconf + * option 'portable_device_paths' + */ + +/* Patch 3, December 5, 2019 + * + * Fixed stale 'thrownobj' pointer for returning thrown aklys while engulfed + * Fixed uarmh null pointer dereference if a helm of opposite alignment came + * off due to being polymorphed + * Fixed 'object lost' panic when attempting to crawl of of the water during + * emergency disrobing/dropping + * Running now stops when moving over engravings so you can tell where they are + * Fixed detection of unseen/secret doors which failed to find monsters hiding + * under objects and failed to find monsters hiding at trap locations + * Ensured fatal status conditions made it to disclosure and/or dumplog + * Fixed "Bad fruit #N" warnings when saving bones with 'perm_invent' On + * Fixed it so yellow dragons don't have green breath + * Added several grammar corrections + * Improved recognition of deafness for several situations including the + * playing of musical instruments and bribing negotiations with demon lords + * Fixed ignoring of god's wrath when hero injured himself during altar kick + * Fixed several cases where persistent inventory window was not updated + * Fixed temple priests or shopkeepers moving over other monsters + * Fixed a crash-causing bug when putting on levitation boots over a sink + * Ensured that thrown or kicked objects will end up in bones + * Made water go all the way to the edges of level on the Plane of Water + * Made clouds disrupt line of sight along the edges of the Plane of Air + * Improved and expanded usage of status highlighting percentage rules + * Added more than 15 improvements and fixes to the curses window port + * Added and documented significant changes to default directory choices for + * the Windows platform + * Improved the layout and display of the player selection dialog used on the + * Windows graphical implementation + * Improved performance of some tty versions by reducing the number of + * function calls made from mapglyph + * Allowed the msdos implementation to build with curses and PDCurses + * Included over 100 other fixes and improvements as outlined in doc/fixes36.3 */ /* Patch 2, May 7, 2019 - * - * Over 320 bug fixes including a couple of crash bug fixes + * + * Over 320 bug fixes including a couple of crash bug fixes as outlined in + * doc/fixes36.2 * More than 15 enhancements or improvements * Ensuring that unix Makefiles do not rely on features unique to gnu make * Improvements to hilite_status parsing in an effort to ensure that expected @@ -54,13 +120,15 @@ */ /* Patch 1, April 27, 2018 - * Over four hundred and seventy bug fixes and improvements. + * + * Over four hundred and seventy bug fixes and improvements as outlined in + * doc/fixes36.1 */ /* * NetHack 3.6.0, December 7, 2015 * - * Hundreds of bug fixes. + * Hundreds of bug fixes as outlined in doc/fixes36.0. * Some code reorganization. * Some new features. * Variations of some community patches rolled in. diff --git a/include/pcconf.h b/include/pcconf.h index 875530efd..f1a1b7020 100644 --- a/include/pcconf.h +++ b/include/pcconf.h @@ -21,6 +21,9 @@ * Note: 3.6.x was not verified with Symantec C. */ +#define CONFIG_FILE "defaults.nh" +#define GUIDEBOOK_FILE "Guidebook.txt" + /* * The following options are somewhat configurable depending on * your compiler. diff --git a/include/prop.h b/include/prop.h index ba0dc0863..570f3f2fa 100644 --- a/include/prop.h +++ b/include/prop.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 prop.h $NHDT-Date: 1547514641 2019/01/15 01:10:41 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.20 $ */ +/* NetHack 3.6 prop.h $NHDT-Date: 1570566360 2019/10/08 20:26:00 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.21 $ */ /* Copyright (c) 1989 Mike Threepoint */ /* NetHack may be freely redistributed. See license for details. */ @@ -106,7 +106,7 @@ struct prop { #define W_WEP 0x00000100L /* Wielded weapon */ #define W_QUIVER 0x00000200L /* Quiver for (f)iring ammo */ #define W_SWAPWEP 0x00000400L /* Secondary weapon */ -#define W_WEAPON (W_WEP | W_SWAPWEP | W_QUIVER) +#define W_WEAPONS (W_WEP | W_SWAPWEP | W_QUIVER) #define W_ART 0x00001000L /* Carrying artifact (not really worn) */ #define W_ARTI 0x00002000L /* Invoked artifact (not really worn) */ /* Amulets, rings, tools, and other items */ diff --git a/include/qtext.h b/include/qtext.h deleted file mode 100644 index 752938423..000000000 --- a/include/qtext.h +++ /dev/null @@ -1,118 +0,0 @@ -/* NetHack 3.6 qtext.h $NHDT-Date: 1505170347 2017/09/11 22:52:27 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.18 $ */ -/* Copyright (c) Mike Stephenson 1991. */ -/* NetHack may be freely redistributed. See license for details. */ - -#ifndef QTEXT_H -#define QTEXT_H - -#define N_HDR 16 /* Maximum number of categories */ -/* (i.e., num roles + 1) */ -#define LEN_HDR 3 /* Maximum length of a category name */ - -struct qtmsg { - int msgnum; - char delivery; - long offset, size, summary_size; -}; - -#ifdef MAKEDEFS_C /***** MAKEDEFS *****/ - -#define N_MSG 100 /* arbitrary */ - -struct msghdr { - int n_msg; - struct qtmsg qt_msg[N_MSG]; -}; - -struct qthdr { - int n_hdr; - char id[N_HDR][LEN_HDR]; - long offset[N_HDR]; -}; - -/* Error message macros */ -#define CREC_IN_MSG "Control record encountered during message - line %d\n" -#define DUP_MSG "Duplicate message number at line %d\n" -#define END_NOT_IN_MSG "End record encountered before message - line %d\n" -#define TEXT_NOT_IN_MSG "Text encountered outside message - line %d\n" -#define UNREC_CREC "Unrecognized Control record at line %d\n" -#define MAL_SUM "Malformed summary in End record - line %d\n" -#define DUMB_SUM "Summary for single line message is useless - line %d\n" -#define CTRL_TRUNC "Control record truncated at line %d\n" -#define TEXT_TRUNC "Text record truncated at line %d\n" -#define OUT_OF_HEADERS \ - "Too many message types (line %d)\nAdjust N_HDR in qtext.h and " \ - "recompile.\n" -#define OUT_OF_MESSAGES \ - "Too many messages in class (line %d)\nAdjust N_MSG in qtext.h and " \ - "recompile.\n" - -#else /***** !MAKEDEFS *****/ - -struct qtlists { - struct qtmsg *common, -#if 0 /* UNUSED but available */ - *chrace, -#endif - *chrole; -}; - -/* - * Quest message defines. Used in quest.c to trigger off "realistic" - * dialogue to the player. - */ -#define QT_FIRSTTIME 1 -#define QT_NEXTTIME 2 -#define QT_OTHERTIME 3 - -#define QT_GUARDTALK 5 /* 5 random things guards say before quest */ -#define QT_GUARDTALK2 10 /* 5 random things guards say after quest */ - -#define QT_FIRSTLEADER 15 -#define QT_NEXTLEADER 16 -#define QT_OTHERLEADER 17 -#define QT_LASTLEADER 18 -#define QT_BADLEVEL 19 -#define QT_BADALIGN 20 -#define QT_ASSIGNQUEST 21 - -#define QT_ENCOURAGE 25 /* 1-10 random encouragement messages */ - -#define QT_FIRSTLOCATE 35 -#define QT_NEXTLOCATE 36 - -#define QT_FIRSTGOAL 40 -#define QT_NEXTGOAL 41 -#define QT_ALTGOAL 42 /* alternate to QT_NEXTGOAL if artifact is absent */ - -#define QT_FIRSTNEMESIS 50 -#define QT_NEXTNEMESIS 51 -#define QT_OTHERNEMESIS 52 -#define QT_NEMWANTSIT 53 /* you somehow got the artifact */ - -#define QT_DISCOURAGE 60 /* 1-10 random maledictive messages */ - -#define QT_GOTIT 70 - -#define QT_KILLEDNEM 80 -#define QT_OFFEREDIT 81 -#define QT_OFFEREDIT2 82 - -#define QT_POSTHANKS 90 -#define QT_HASAMULET 91 - -/* - * Message defines for common text used in maledictions. - */ -#define COMMON_ID "-" /* Common message id value */ - -#define QT_ANGELIC 10 -#define QTN_ANGELIC 10 - -#define QT_DEMONIC 30 -#define QTN_DEMONIC 20 - -#define QT_BANISHED 60 -#endif /***** !MAKEDEFS *****/ - -#endif /* QTEXT_H */ diff --git a/include/rm.h b/include/rm.h index e104fc20f..15d451bc3 100644 --- a/include/rm.h +++ b/include/rm.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 rm.h $NHDT-Date: 1559994624 2019/06/08 11:50:24 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.61 $ */ +/* NetHack 3.6 rm.h $NHDT-Date: 1573943499 2019/11/16 22:31:39 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.66 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2017. */ /* NetHack may be freely redistributed. See license for details. */ @@ -266,7 +266,9 @@ struct symparse { /* misc symbol definitions */ #define SYM_BOULDER 0 #define SYM_INVISIBLE 1 -#define MAXOTHER 2 +#define SYM_PET_OVERRIDE 2 +#define SYM_HERO_OVERRIDE 3 +#define MAXOTHER 4 /* linked list of symsets and their characteristics */ struct symsetentry { @@ -278,7 +280,8 @@ struct symsetentry { Bitfield(nocolor, 1); /* don't use color if set */ Bitfield(primary, 1); /* restricted for use as primary set */ Bitfield(rogue, 1); /* restricted for use as rogue lev set */ - /* 5 free bits */ + Bitfield(explicitly, 1); /* explicit symset set */ + /* 4 free bits */ }; /* @@ -298,6 +301,8 @@ struct symsetentry { #define H_IBM 1 #define H_DEC 2 #define H_CURS 3 +#define H_MAC 4 /* obsolete; needed so that the listing of available + * symsets by 'O' can skip it for !MAC_GRAPHICS_ENV */ extern const struct symdef defsyms[MAXPCHARS]; /* defaults */ #define WARNCOUNT 6 /* number of different warning levels */ diff --git a/include/sfprocs.h b/include/sfprocs.h deleted file mode 100644 index a3b3f5dd3..000000000 --- a/include/sfprocs.h +++ /dev/null @@ -1,192 +0,0 @@ -/* NetHack 3.6 sfprocs.h Tue Nov 6 19:38:48 2018 */ -/* Copyright (c) NetHack Development Team 2018. */ -/* NetHack may be freely redistributed. See license for details. */ - -#ifndef SFPROCS_H -#define SFPROCS_H - -#include "hack.h" -#include "integer.h" -#include "wintype.h" - -#define E extern - -/* output routines */ -E void FDECL(ascii_sfo_aligntyp, (NHFILE *, aligntyp *, const char *, const char *, int)); -E void FDECL(ascii_sfo_any, (NHFILE *, union any *d_any, const char *, const char *, int)); -E void FDECL(ascii_sfo_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int)); -E void FDECL(ascii_sfo_boolean, (NHFILE *, boolean *, const char *, const char *, int)); -E void FDECL(ascii_sfo_char, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(ascii_sfo_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int)); -E void FDECL(ascii_sfo_int, (NHFILE *, int *, const char *, const char *, int)); -E void FDECL(ascii_sfo_long, (NHFILE *, long *, const char *, const char *, int)); -E void FDECL(ascii_sfo_schar, (NHFILE *, schar *, const char *, const char *, int)); -E void FDECL(ascii_sfo_short, (NHFILE *, short *, const char *, const char *, int)); -E void FDECL(ascii_sfo_size_t, (NHFILE *, size_t *, const char *, const char *, int)); -E void FDECL(ascii_sfo_time_t, (NHFILE *, time_t *, const char *, const char *, int)); -E void FDECL(ascii_sfo_unsigned, (NHFILE *, unsigned *, const char *, const char *, int)); -E void FDECL(ascii_sfo_uchar, (NHFILE *, unsigned char *, const char *, const char *, int)); -E void FDECL(ascii_sfo_uint, (NHFILE *, unsigned int *, const char *, const char *, int)); -E void FDECL(ascii_sfo_ulong, (NHFILE *, unsigned long *, const char *, const char *, int)); -E void FDECL(ascii_sfo_ushort, (NHFILE *, unsigned short *, const char *, const char *, int)); -E void FDECL(ascii_sfo_xchar, (NHFILE *, xchar *, const char *, const char *, int)); -E void FDECL(ascii_sfo_str, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(ascii_sfo_addinfo, (NHFILE *, const char *, const char *, const char *, int)); - -/* input routines */ -E void FDECL(ascii_sfi_aligntyp, (NHFILE *, aligntyp *, const char *, const char *, int)); -E void FDECL(ascii_sfi_any, (NHFILE *, union any *d_any, const char *, const char *, int)); -E void FDECL(ascii_sfi_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int)); -E void FDECL(ascii_sfi_boolean, (NHFILE *, boolean *, const char *, const char *, int)); -E void FDECL(ascii_sfi_char, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(ascii_sfi_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int)); -E void FDECL(ascii_sfi_int, (NHFILE *, int *, const char *, const char *, int)); -E void FDECL(ascii_sfi_long, (NHFILE *, long *, const char *, const char *, int)); -E void FDECL(ascii_sfi_schar, (NHFILE *, schar *, const char *, const char *, int)); -E void FDECL(ascii_sfi_short, (NHFILE *, short *, const char *, const char *, int)); -E void FDECL(ascii_sfi_size_t, (NHFILE *, size_t *, const char *, const char *, int)); -E void FDECL(ascii_sfi_time_t, (NHFILE *, time_t *, const char *, const char *, int)); -E void FDECL(ascii_sfi_unsigned, (NHFILE *, unsigned *, const char *, const char *, int)); -E void FDECL(ascii_sfi_uchar, (NHFILE *, unsigned char *, const char *, const char *, int)); -E void FDECL(ascii_sfi_uint, (NHFILE *, unsigned int *, const char *, const char *, int)); -E void FDECL(ascii_sfi_ulong, (NHFILE *, unsigned long *, const char *, const char *, int)); -E void FDECL(ascii_sfi_ushort, (NHFILE *, unsigned short *, const char *, const char *, int)); -E void FDECL(ascii_sfi_xchar, (NHFILE *, xchar *, const char *, const char *, int)); -E void FDECL(ascii_sfi_str, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(ascii_sfi_addinfo, (NHFILE *, const char *, const char *, const char *, int)); - -/* output routines */ -E void FDECL(lendian_sfo_aligntyp, (NHFILE *, aligntyp *, const char *, const char *, int)); -E void FDECL(lendian_sfo_any, (NHFILE *, union any *d_any, const char *, const char *, int)); -E void FDECL(lendian_sfo_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int)); -E void FDECL(lendian_sfo_boolean, (NHFILE *, boolean *, const char *, const char *, int)); -E void FDECL(lendian_sfo_char, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(lendian_sfo_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int)); -E void FDECL(lendian_sfo_int, (NHFILE *, int *, const char *, const char *, int)); -E void FDECL(lendian_sfo_long, (NHFILE *, long *, const char *, const char *, int)); -E void FDECL(lendian_sfo_schar, (NHFILE *, schar *, const char *, const char *, int)); -E void FDECL(lendian_sfo_short, (NHFILE *, short *, const char *, const char *, int)); -E void FDECL(lendian_sfo_size_t, (NHFILE *, size_t *, const char *, const char *, int)); -E void FDECL(lendian_sfo_time_t, (NHFILE *, time_t *, const char *, const char *, int)); -E void FDECL(lendian_sfo_unsigned, (NHFILE *, unsigned *, const char *, const char *, int)); -E void FDECL(lendian_sfo_uchar, (NHFILE *, unsigned char *, const char *, const char *, int)); -E void FDECL(lendian_sfo_uint, (NHFILE *, unsigned int *, const char *, const char *, int)); -E void FDECL(lendian_sfo_ulong, (NHFILE *, unsigned long *, const char *, const char *, int)); -E void FDECL(lendian_sfo_ushort, (NHFILE *, unsigned short *, const char *, const char *, int)); -E void FDECL(lendian_sfo_xchar, (NHFILE *, xchar *, const char *, const char *, int)); -E void FDECL(lendian_sfo_str, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(lendian_sfo_addinfo, (NHFILE *, const char *, const char *, const char *, int)); - -/* input routines */ -E void FDECL(lendian_sfi_aligntyp, (NHFILE *, aligntyp *, const char *, const char *, int)); -E void FDECL(lendian_sfi_any, (NHFILE *, union any *d_any, const char *, const char *, int)); -E void FDECL(lendian_sfi_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int)); -E void FDECL(lendian_sfi_boolean, (NHFILE *, boolean *, const char *, const char *, int)); -E void FDECL(lendian_sfi_char, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(lendian_sfi_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int)); -E void FDECL(lendian_sfi_int, (NHFILE *, int *, const char *, const char *, int)); -E void FDECL(lendian_sfi_long, (NHFILE *, long *, const char *, const char *, int)); -E void FDECL(lendian_sfi_schar, (NHFILE *, schar *, const char *, const char *, int)); -E void FDECL(lendian_sfi_short, (NHFILE *, short *, const char *, const char *, int)); -E void FDECL(lendian_sfi_size_t, (NHFILE *, size_t *, const char *, const char *, int)); -E void FDECL(lendian_sfi_time_t, (NHFILE *, time_t *, const char *, const char *, int)); -E void FDECL(lendian_sfi_unsigned, (NHFILE *, unsigned *, const char *, const char *, int)); -E void FDECL(lendian_sfi_uchar, (NHFILE *, unsigned char *, const char *, const char *, int)); -E void FDECL(lendian_sfi_uint, (NHFILE *, unsigned int *, const char *, const char *, int)); -E void FDECL(lendian_sfi_ulong, (NHFILE *, unsigned long *, const char *, const char *, int)); -E void FDECL(lendian_sfi_ushort, (NHFILE *, unsigned short *, const char *, const char *, int)); -E void FDECL(lendian_sfi_xchar, (NHFILE *, xchar *, const char *, const char *, int)); -E void FDECL(lendian_sfi_str, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(lendian_sfi_addinfo, (NHFILE *, const char *, const char *, const char *, int)); - -#ifdef JSON_SUPPORT -/* output routines */ -E void FDECL(json_sfo_aligntyp, (NHFILE *, aligntype *, const char *, const char *, int)); -E void FDECL(json_sfo_any, (NHFILE *, union any *d_any, const char *, const char *, int)); -E void FDECL(json_sfo_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int)); -E void FDECL(json_sfo_boolean, (NHFILE *, boolean *, const char *, const char *, int)); -E void FDECL(json_sfo_char, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(json_sfo_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int)); -E void FDECL(json_sfo_int, (NHFILE *, int *, const char *, const char *, int)); -E void FDECL(json_sfo_long, (NHFILE *, long *, const char *, const char *, int)); -E void FDECL(json_sfo_schar, (NHFILE *, schar *, const char *, const char *, int)); -E void FDECL(json_sfo_short, (NHFILE *, short *, const char *, const char *, int)); -E void FDECL(json_sfo_size_t, (NHFILE *, size_t *, const char *, const char *, int)); -E void FDECL(json_sfo_time_t, (NHFILE *, time_t *, const char *, const char *, int)); -E void FDECL(json_sfo_unsigned, (NHFILE *, unsigned *, const char *, const char *, int)); -E void FDECL(json_sfo_uchar, (NHFILE *, unsigned char *, const char *, const char *, int)); -E void FDECL(json_sfo_uint, (NHFILE *, unsigned int *, const char *, const char *, int)); -E void FDECL(json_sfo_ulong, (NHFILE *, unsigned long *, const char *, const char *, int)); -E void FDECL(json_sfo_ushort, (NHFILE *, unsigned short *, const char *, const char *, int)); -E void FDECL(json_sfo_xchar, (NHFILE *, xchar *, const char *, const char *, int)); -E void FDECL(json_sfo_str, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(json_sfo_addinfo), (NHFILE *, const char *, const char *, const char *, int)); - -/* input routines */ -E void FDECL(json_sfi_aligntyp, (NHFILE *, aligntype *, const char *, const char *, int)); -E void FDECL(json_sfi_any, (NHFILE *, union any *d_any, const char *, const char *, int)); -E void FDECL(json_sfi_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int)); -E void FDECL(json_sfi_boolean, (NHFILE *, boolean *, const char *, const char *, int)); -E void FDECL(json_sfi_char, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(json_sfi_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int)); -E void FDECL(json_sfi_int, (NHFILE *, int *, const char *, const char *, int)); -E void FDECL(json_sfi_long, (NHFILE *, long *, const char *, const char *, int)); -E void FDECL(json_sfi_schar, (NHFILE *, schar *, const char *, const char *, int)); -E void FDECL(json_sfi_short, (NHFILE *, short *, const char *, const char *, int)); -E void FDECL(json_sfi_size_t, (NHFILE *, size_t *, const char *, const char *, int)); -E void FDECL(json_sfi_time_t, (NHFILE *, time_t *, const char *, const char *, int)); -E void FDECL(json_sfi_unsigned, (NHFILE *, unsigned *, const char *, const char *, int)); -E void FDECL(json_sfi_uchar, (NHFILE *, unsigned char *, const char *, const char *, int)); -E void FDECL(json_sfi_uint, (NHFILE *, unsigned int *, const char *, const char *, int)); -E void FDECL(json_sfi_ulong, (NHFILE *, unsigned long *, const char *, const char *, int)); -E void FDECL(json_sfi_ushort, (NHFILE *, unsigned short *, const char *, const char *, int)); -E void FDECL(json_sfi_xchar, (NHFILE *, xchar *, const char *, const char *, int)); -E void FDECL(json_sfi_str, (NHFILE *, char *, const char *, const char *, int)); -E void FDECL(json_sfi_addinfo), (NHFILE *, const char *, const char *, const char *, int)); -#endif /* JSON_SUPPORT */ - -struct fieldlevel_procs { - void FDECL((*sf_aligntyp), (NHFILE *, aligntyp *, const char *, const char *, int)); - void FDECL((*sf_any), (NHFILE *, union any *d_any, const char *, const char *, int)); - void FDECL((*sf_bitfield), (NHFILE *, uint8_t *, const char *, const char *, int)); - void FDECL((*sf_boolean), (NHFILE *, boolean *, const char *, const char *, int)); - void FDECL((*sf_char), (NHFILE *, char *, const char *, const char *, int)); - void FDECL((*sf_genericptr), (NHFILE *, genericptr_t *, const char *, const char *, int)); - void FDECL((*sf_int), (NHFILE *, int *, const char *, const char *, int)); - void FDECL((*sf_long), (NHFILE *, long *, const char *, const char *, int)); - void FDECL((*sf_schar), (NHFILE *, schar *, const char *, const char *, int)); - void FDECL((*sf_short), (NHFILE *, short *, const char *, const char *, int)); - void FDECL((*sf_size_t), (NHFILE *, size_t *, const char *, const char *, int)); - void FDECL((*sf_time_t), (NHFILE *, time_t *, const char *, const char *, int)); - void FDECL((*sf_unsigned), (NHFILE *, unsigned *, const char *, const char *, int)); - void FDECL((*sf_uchar), (NHFILE *, unsigned char *, const char *, const char *, int)); - void FDECL((*sf_uint), (NHFILE *, unsigned int *, const char *, const char *, int)); - void FDECL((*sf_ulong), (NHFILE *, unsigned long *, const char *, const char *, int)); - void FDECL((*sf_ushort), (NHFILE *, unsigned short *, const char *, const char *, int)); - void FDECL((*sf_xchar), (NHFILE *, xchar *, const char *, const char *, int)); - void FDECL((*sf_str), (NHFILE *, char *, const char *, const char *, int)); - void FDECL((*sf_addinfo), (NHFILE *, const char *, const char *, const char *, int)); -}; - -struct sf_procs { - const char *ext; - struct fieldlevel_procs fn; -}; - -E void NDECL(sf_init); -E struct sf_procs sfoprocs[4], sfiprocs[4]; - -E struct sf_procs ascii_sfo_procs; -E struct sf_procs ascii_sfi_procs; -E struct sf_procs lendian_sfo_procs; -E struct sf_procs lendian_sfi_procs; -E struct sf_procs stub_sfo_procs; -E struct sf_procs stub_sfi_procs; - -#ifdef JSON_SUPPORT -E struct sf_procs json_sfo_procs; -E struct sf_procs json_sfi_procs; -#endif - -#undef E -#endif /* SFPROCS_H */ diff --git a/include/sfproto.h b/include/sfproto.h deleted file mode 100644 index 7655f328a..000000000 --- a/include/sfproto.h +++ /dev/null @@ -1,201 +0,0 @@ -/* NetHack 3.7 sfproto.h Tue Jun 25 09:57:33 2019 */ -/* Copyright (c) NetHack Development Team 2018. */ -/* NetHack may be freely redistributed. See license for details. */ - -/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE! */ - -#ifndef SFPROTO_H -#define SFPROTO_H - -#include "hack.h" -#include "integer.h" -#include "wintype.h" - -#define E extern - -E int NDECL(critical_members_count); -/* sfbase.c output functions */ -E void FDECL(sfo_addinfo, (NHFILE *, const char *, const char *, const char *, int)); -E void FDECL(sfo_aligntyp, (NHFILE *, aligntyp *, const char *, const char *, int)); -E void FDECL(sfo_any, (NHFILE *, anything *, const char *, const char *, int)); -E void FDECL(sfo_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int)); -E void FDECL(sfo_boolean, (NHFILE *, boolean *, const char *, const char *, int)); -E void FDECL(sfo_char, (NHFILE *, const char *, const char *, const char *, int)); -E void FDECL(sfo_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int)); -E void FDECL(sfo_int, (NHFILE *, int *, const char *, const char *, int)); -E void FDECL(sfo_long, (NHFILE *, long *, const char *, const char *, int)); -E void FDECL(sfo_schar, (NHFILE *, schar *, const char *, const char *, int)); -E void FDECL(sfo_short, (NHFILE *, short *, const char *, const char *, int)); -E void FDECL(sfo_size_t, (NHFILE *, size_t *, const char *, const char *, int)); -E void FDECL(sfo_time_t, (NHFILE *, time_t *, const char *, const char *, int)); -E void FDECL(sfo_uchar, (NHFILE *, uchar *, const char *, const char *, int)); -E void FDECL(sfo_unsigned, (NHFILE *, unsigned *, const char *, const char *, int)); -E void FDECL(sfo_uchar, (NHFILE *, unsigned char *, const char *, const char *, int)); -E void FDECL(sfo_uint, (NHFILE *, unsigned int *, const char *, const char *, int)); -E void FDECL(sfo_ulong, (NHFILE *, unsigned long *, const char *, const char *, int)); -E void FDECL(sfo_ushort, (NHFILE *, unsigned short *, const char *, const char *, int)); -E void FDECL(sfo_xchar, (NHFILE *, xchar *, const char *, const char *, int)); -E void FDECL(sfo_str, (NHFILE *, const char *, const char *, const char *, int)); -/* sfbase.c input functions */ -E void FDECL(sfi_addinfo, (NHFILE *, const char *, const char *, const char *, int)); -E void FDECL(sfi_aligntyp, (NHFILE *, aligntyp *, const char *, const char *, int)); -E void FDECL(sfi_any, (NHFILE *, anything *, const char *, const char *, int)); -E void FDECL(sfi_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int)); -E void FDECL(sfi_boolean, (NHFILE *, boolean *, const char *, const char *, int)); -E void FDECL(sfi_char, (NHFILE *, const char *, const char *, const char *, int)); -E void FDECL(sfi_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int)); -E void FDECL(sfi_int, (NHFILE *, int *, const char *, const char *, int)); -E void FDECL(sfi_long, (NHFILE *, long *, const char *, const char *, int)); -E void FDECL(sfi_schar, (NHFILE *, schar *, const char *, const char *, int)); -E void FDECL(sfi_short, (NHFILE *, short *, const char *, const char *, int)); -E void FDECL(sfi_size_t, (NHFILE *, size_t *, const char *, const char *, int)); -E void FDECL(sfi_time_t, (NHFILE *, time_t *, const char *, const char *, int)); -E void FDECL(sfi_uchar, (NHFILE *, uchar *, const char *, const char *, int)); -E void FDECL(sfi_unsigned, (NHFILE *, unsigned *, const char *, const char *, int)); -E void FDECL(sfi_uchar, (NHFILE *, unsigned char *, const char *, const char *, int)); -E void FDECL(sfi_uint, (NHFILE *, unsigned int *, const char *, const char *, int)); -E void FDECL(sfi_ulong, (NHFILE *, unsigned long *, const char *, const char *, int)); -E void FDECL(sfi_ushort, (NHFILE *, unsigned short *, const char *, const char *, int)); -E void FDECL(sfi_xchar, (NHFILE *, xchar *, const char *, const char *, int)); -E void FDECL(sfi_str, (NHFILE *, const char *, const char *, const char *, int)); -/* generated output functions */ -E void FDECL(sfo_align, (NHFILE *, struct align *, const char *, const char *, int)); -E void FDECL(sfo_attribs, (NHFILE *, struct attribs *, const char *, const char *, int)); -E void FDECL(sfo_bill_x, (NHFILE *, struct bill_x *, const char *, const char *, int)); -E void FDECL(sfo_book_info, (NHFILE *, struct book_info *, const char *, const char *, int)); -E void FDECL(sfo_branch, (NHFILE *, struct branch *, const char *, const char *, int)); -E void FDECL(sfo_bubble, (NHFILE *, struct bubble *, const char *, const char *, int)); -E void FDECL(sfo_cemetery, (NHFILE *, struct cemetery *, const char *, const char *, int)); -E void FDECL(sfo_context_info, (NHFILE *, struct context_info *, const char *, const char *, int)); -E void FDECL(sfo_d_flags, (NHFILE *, struct d_flags *, const char *, const char *, int)); -E void FDECL(sfo_d_level, (NHFILE *, struct d_level *, const char *, const char *, int)); -E void FDECL(sfo_damage, (NHFILE *, struct damage *, const char *, const char *, int)); -E void FDECL(sfo_dest_area, (NHFILE *, struct dest_area *, const char *, const char *, int)); -E void FDECL(sfo_dgn_topology, (NHFILE *, struct dgn_topology *, const char *, const char *, int)); -E void FDECL(sfo_dig_info, (NHFILE *, struct dig_info *, const char *, const char *, int)); -E void FDECL(sfo_dungeon, (NHFILE *, struct dungeon *, const char *, const char *, int)); -E void FDECL(sfo_edog, (NHFILE *, struct edog *, const char *, const char *, int)); -E void FDECL(sfo_egd, (NHFILE *, struct egd *, const char *, const char *, int)); -E void FDECL(sfo_emin, (NHFILE *, struct emin *, const char *, const char *, int)); -E void FDECL(sfo_engr, (NHFILE *, struct engr *, const char *, const char *, int)); -E void FDECL(sfo_epri, (NHFILE *, struct epri *, const char *, const char *, int)); -E void FDECL(sfo_eshk, (NHFILE *, struct eshk *, const char *, const char *, int)); -E void FDECL(sfo_fakecorridor, (NHFILE *, struct fakecorridor *, const char *, const char *, int)); -E void FDECL(sfo_fe, (NHFILE *, struct fe *, const char *, const char *, int)); -E void FDECL(sfo_flag, (NHFILE *, struct flag *, const char *, const char *, int)); -E void FDECL(sfo_fruit, (NHFILE *, struct fruit *, const char *, const char *, int)); -E void FDECL(sfo_kinfo, (NHFILE *, struct kinfo *, const char *, const char *, int)); -E void FDECL(sfo_levelflags, (NHFILE *, struct levelflags *, const char *, const char *, int)); -E void FDECL(sfo_linfo, (NHFILE *, struct linfo *, const char *, const char *, int)); -E void FDECL(sfo_ls_t, (NHFILE *, struct ls_t *, const char *, const char *, int)); -E void FDECL(sfo_mapseen_feat, (NHFILE *, struct mapseen_feat *, const char *, const char *, int)); -E void FDECL(sfo_mapseen_flags, (NHFILE *, struct mapseen_flags *, const char *, const char *, int)); -E void FDECL(sfo_mapseen_rooms, (NHFILE *, struct mapseen_rooms *, const char *, const char *, int)); -E void FDECL(sfo_mapseen, (NHFILE *, struct mapseen *, const char *, const char *, int)); -E void FDECL(sfo_mextra, (NHFILE *, struct mextra *, const char *, const char *, int)); -E void FDECL(sfo_mkroom, (NHFILE *, struct mkroom *, const char *, const char *, int)); -E void FDECL(sfo_monst, (NHFILE *, struct monst *, const char *, const char *, int)); -E void FDECL(sfo_mvitals, (NHFILE *, struct mvitals *, const char *, const char *, int)); -E void FDECL(sfo_nhcoord, (NHFILE *, struct nhcoord *, const char *, const char *, int)); -E void FDECL(sfo_nhrect, (NHFILE *, struct nhrect *, const char *, const char *, int)); -E void FDECL(sfo_novel_tracking, (NHFILE *, struct novel_tracking *, const char *, const char *, int)); -E void FDECL(sfo_obj, (NHFILE *, struct obj *, const char *, const char *, int)); -E void FDECL(sfo_objclass, (NHFILE *, struct objclass *, const char *, const char *, int)); -E void FDECL(sfo_obj_split, (NHFILE *, struct obj_split *, const char *, const char *, int)); -E void FDECL(sfo_oextra, (NHFILE *, struct oextra *, const char *, const char *, int)); -E void FDECL(sfo_polearm_info, (NHFILE *, struct polearm_info *, const char *, const char *, int)); -E void FDECL(sfo_prop, (NHFILE *, struct prop *, const char *, const char *, int)); -E void FDECL(sfo_q_score, (NHFILE *, struct q_score *, const char *, const char *, int)); -E void FDECL(sfo_rm, (NHFILE *, struct rm *, const char *, const char *, int)); -E void FDECL(sfo_s_level, (NHFILE *, struct s_level *, const char *, const char *, int)); -E void FDECL(sfo_savefile_info, (NHFILE *, struct savefile_info *, const char *, const char *, int)); -E void FDECL(sfo_skills, (NHFILE *, struct skills *, const char *, const char *, int)); -E void FDECL(sfo_spell, (NHFILE *, struct spell *, const char *, const char *, int)); -E void FDECL(sfo_stairway, (NHFILE *, struct stairway *, const char *, const char *, int)); -E void FDECL(sfo_takeoff_info, (NHFILE *, struct takeoff_info *, const char *, const char *, int)); -E void FDECL(sfo_tin_info, (NHFILE *, struct tin_info *, const char *, const char *, int)); -E void FDECL(sfo_trap, (NHFILE *, struct trap *, const char *, const char *, int)); -E void FDECL(sfo_tribute_info, (NHFILE *, struct tribute_info *, const char *, const char *, int)); -E void FDECL(sfo_u_achieve, (NHFILE *, struct u_achieve *, const char *, const char *, int)); -E void FDECL(sfo_u_conduct, (NHFILE *, struct u_conduct *, const char *, const char *, int)); -E void FDECL(sfo_u_event, (NHFILE *, struct u_event *, const char *, const char *, int)); -E void FDECL(sfo_u_have, (NHFILE *, struct u_have *, const char *, const char *, int)); -E void FDECL(sfo_u_realtime, (NHFILE *, struct u_realtime *, const char *, const char *, int)); -E void FDECL(sfo_u_roleplay, (NHFILE *, struct u_roleplay *, const char *, const char *, int)); -E void FDECL(sfo_version_info, (NHFILE *, struct version_info *, const char *, const char *, int)); -E void FDECL(sfo_victual_info, (NHFILE *, struct victual_info *, const char *, const char *, int)); -E void FDECL(sfo_vlaunchinfo, (NHFILE *, union vlaunchinfo *, const char *, const char *, int)); -E void FDECL(sfo_vptrs, (NHFILE *, union vptrs *, const char *, const char *, int)); -E void FDECL(sfo_warntype_info, (NHFILE *, struct warntype_info *, const char *, const char *, int)); -E void FDECL(sfo_you, (NHFILE *, struct you *, const char *, const char *, int)); -/* generated input functions */ -E void FDECL(sfi_align, (NHFILE *, struct align *, const char *, const char *, int)); -E void FDECL(sfi_attribs, (NHFILE *, struct attribs *, const char *, const char *, int)); -E void FDECL(sfi_bill_x, (NHFILE *, struct bill_x *, const char *, const char *, int)); -E void FDECL(sfi_book_info, (NHFILE *, struct book_info *, const char *, const char *, int)); -E void FDECL(sfi_branch, (NHFILE *, struct branch *, const char *, const char *, int)); -E void FDECL(sfi_bubble, (NHFILE *, struct bubble *, const char *, const char *, int)); -E void FDECL(sfi_cemetery, (NHFILE *, struct cemetery *, const char *, const char *, int)); -E void FDECL(sfi_context_info, (NHFILE *, struct context_info *, const char *, const char *, int)); -E void FDECL(sfi_d_flags, (NHFILE *, struct d_flags *, const char *, const char *, int)); -E void FDECL(sfi_d_level, (NHFILE *, struct d_level *, const char *, const char *, int)); -E void FDECL(sfi_damage, (NHFILE *, struct damage *, const char *, const char *, int)); -E void FDECL(sfi_dest_area, (NHFILE *, struct dest_area *, const char *, const char *, int)); -E void FDECL(sfi_dgn_topology, (NHFILE *, struct dgn_topology *, const char *, const char *, int)); -E void FDECL(sfi_dig_info, (NHFILE *, struct dig_info *, const char *, const char *, int)); -E void FDECL(sfi_dungeon, (NHFILE *, struct dungeon *, const char *, const char *, int)); -E void FDECL(sfi_edog, (NHFILE *, struct edog *, const char *, const char *, int)); -E void FDECL(sfi_egd, (NHFILE *, struct egd *, const char *, const char *, int)); -E void FDECL(sfi_emin, (NHFILE *, struct emin *, const char *, const char *, int)); -E void FDECL(sfi_engr, (NHFILE *, struct engr *, const char *, const char *, int)); -E void FDECL(sfi_epri, (NHFILE *, struct epri *, const char *, const char *, int)); -E void FDECL(sfi_eshk, (NHFILE *, struct eshk *, const char *, const char *, int)); -E void FDECL(sfi_fakecorridor, (NHFILE *, struct fakecorridor *, const char *, const char *, int)); -E void FDECL(sfi_fe, (NHFILE *, struct fe *, const char *, const char *, int)); -E void FDECL(sfi_flag, (NHFILE *, struct flag *, const char *, const char *, int)); -E void FDECL(sfi_fruit, (NHFILE *, struct fruit *, const char *, const char *, int)); -E void FDECL(sfi_kinfo, (NHFILE *, struct kinfo *, const char *, const char *, int)); -E void FDECL(sfi_levelflags, (NHFILE *, struct levelflags *, const char *, const char *, int)); -E void FDECL(sfi_linfo, (NHFILE *, struct linfo *, const char *, const char *, int)); -E void FDECL(sfi_ls_t, (NHFILE *, struct ls_t *, const char *, const char *, int)); -E void FDECL(sfi_mapseen_feat, (NHFILE *, struct mapseen_feat *, const char *, const char *, int)); -E void FDECL(sfi_mapseen_flags, (NHFILE *, struct mapseen_flags *, const char *, const char *, int)); -E void FDECL(sfi_mapseen_rooms, (NHFILE *, struct mapseen_rooms *, const char *, const char *, int)); -E void FDECL(sfi_mapseen, (NHFILE *, struct mapseen *, const char *, const char *, int)); -E void FDECL(sfi_mextra, (NHFILE *, struct mextra *, const char *, const char *, int)); -E void FDECL(sfi_mkroom, (NHFILE *, struct mkroom *, const char *, const char *, int)); -E void FDECL(sfi_monst, (NHFILE *, struct monst *, const char *, const char *, int)); -E void FDECL(sfi_mvitals, (NHFILE *, struct mvitals *, const char *, const char *, int)); -E void FDECL(sfi_nhcoord, (NHFILE *, struct nhcoord *, const char *, const char *, int)); -E void FDECL(sfi_nhrect, (NHFILE *, struct nhrect *, const char *, const char *, int)); -E void FDECL(sfi_novel_tracking, (NHFILE *, struct novel_tracking *, const char *, const char *, int)); -E void FDECL(sfi_obj, (NHFILE *, struct obj *, const char *, const char *, int)); -E void FDECL(sfi_objclass, (NHFILE *, struct objclass *, const char *, const char *, int)); -E void FDECL(sfi_obj_split, (NHFILE *, struct obj_split *, const char *, const char *, int)); -E void FDECL(sfi_oextra, (NHFILE *, struct oextra *, const char *, const char *, int)); -E void FDECL(sfi_polearm_info, (NHFILE *, struct polearm_info *, const char *, const char *, int)); -E void FDECL(sfi_prop, (NHFILE *, struct prop *, const char *, const char *, int)); -E void FDECL(sfi_q_score, (NHFILE *, struct q_score *, const char *, const char *, int)); -E void FDECL(sfi_rm, (NHFILE *, struct rm *, const char *, const char *, int)); -E void FDECL(sfi_s_level, (NHFILE *, struct s_level *, const char *, const char *, int)); -E void FDECL(sfi_savefile_info, (NHFILE *, struct savefile_info *, const char *, const char *, int)); -E void FDECL(sfi_skills, (NHFILE *, struct skills *, const char *, const char *, int)); -E void FDECL(sfi_spell, (NHFILE *, struct spell *, const char *, const char *, int)); -E void FDECL(sfi_stairway, (NHFILE *, struct stairway *, const char *, const char *, int)); -E void FDECL(sfi_takeoff_info, (NHFILE *, struct takeoff_info *, const char *, const char *, int)); -E void FDECL(sfi_tin_info, (NHFILE *, struct tin_info *, const char *, const char *, int)); -E void FDECL(sfi_trap, (NHFILE *, struct trap *, const char *, const char *, int)); -E void FDECL(sfi_tribute_info, (NHFILE *, struct tribute_info *, const char *, const char *, int)); -E void FDECL(sfi_u_achieve, (NHFILE *, struct u_achieve *, const char *, const char *, int)); -E void FDECL(sfi_u_conduct, (NHFILE *, struct u_conduct *, const char *, const char *, int)); -E void FDECL(sfi_u_event, (NHFILE *, struct u_event *, const char *, const char *, int)); -E void FDECL(sfi_u_have, (NHFILE *, struct u_have *, const char *, const char *, int)); -E void FDECL(sfi_u_realtime, (NHFILE *, struct u_realtime *, const char *, const char *, int)); -E void FDECL(sfi_u_roleplay, (NHFILE *, struct u_roleplay *, const char *, const char *, int)); -E void FDECL(sfi_version_info, (NHFILE *, struct version_info *, const char *, const char *, int)); -E void FDECL(sfi_victual_info, (NHFILE *, struct victual_info *, const char *, const char *, int)); -E void FDECL(sfi_vlaunchinfo, (NHFILE *, union vlaunchinfo *, const char *, const char *, int)); -E void FDECL(sfi_vptrs, (NHFILE *, union vptrs *, const char *, const char *, int)); -E void FDECL(sfi_warntype_info, (NHFILE *, struct warntype_info *, const char *, const char *, int)); -E void FDECL(sfi_you, (NHFILE *, struct you *, const char *, const char *, int)); -#endif /* SFPROTO_H */ diff --git a/include/sp_lev.h b/include/sp_lev.h index f3ffe6a94..060be4400 100644 --- a/include/sp_lev.h +++ b/include/sp_lev.h @@ -42,148 +42,9 @@ enum lvlinit_types { LVLINIT_ROGUE }; -/* max. # of random registers */ -#define MAX_REGISTERS 10 - /* max. nested depth of subrooms */ #define MAX_NESTED_ROOMS 5 -/* max. # of opcodes per special level */ -#define SPCODER_MAX_RUNTIME 65536 - -/* Opcodes for creating the level - * If you change these, also change opcodestr[] in util/lev_main.c - */ -enum opcode_defs { - SPO_NULL = 0, - SPO_MESSAGE, - SPO_MONSTER, - SPO_OBJECT, - SPO_ENGRAVING, - SPO_ROOM, - SPO_SUBROOM, - SPO_DOOR, - SPO_STAIR, - SPO_LADDER, - SPO_ALTAR, - SPO_FOUNTAIN, - SPO_SINK, - SPO_POOL, - SPO_TRAP, - SPO_GOLD, - SPO_CORRIDOR, - SPO_LEVREGION, - SPO_DRAWBRIDGE, - SPO_MAZEWALK, - SPO_NON_DIGGABLE, - SPO_NON_PASSWALL, - SPO_WALLIFY, - SPO_MAP, - SPO_ROOM_DOOR, - SPO_REGION, - SPO_MINERALIZE, - SPO_CMP, - SPO_JMP, - SPO_JL, - SPO_JLE, - SPO_JG, - SPO_JGE, - SPO_JE, - SPO_JNE, - SPO_TERRAIN, - SPO_REPLACETERRAIN, - SPO_EXIT, - SPO_ENDROOM, - SPO_POP_CONTAINER, - SPO_PUSH, - SPO_POP, - SPO_RN2, - SPO_DEC, - SPO_INC, - SPO_MATH_ADD, - SPO_MATH_SUB, - SPO_MATH_MUL, - SPO_MATH_DIV, - SPO_MATH_MOD, - SPO_MATH_SIGN, - SPO_COPY, - SPO_END_MONINVENT, - SPO_GRAVE, - SPO_FRAME_PUSH, - SPO_FRAME_POP, - SPO_CALL, - SPO_RETURN, - SPO_INITLEVEL, - SPO_LEVEL_FLAGS, - SPO_VAR_INIT, /* variable_name data */ - SPO_SHUFFLE_ARRAY, - SPO_DICE, - - SPO_SEL_ADD, - SPO_SEL_POINT, - SPO_SEL_RECT, - SPO_SEL_FILLRECT, - SPO_SEL_LINE, - SPO_SEL_RNDLINE, - SPO_SEL_GROW, - SPO_SEL_FLOOD, - SPO_SEL_RNDCOORD, - SPO_SEL_ELLIPSE, - SPO_SEL_FILTER, - SPO_SEL_GRADIENT, - SPO_SEL_COMPLEMENT, - - MAX_SP_OPCODES -}; - -/* MONSTER and OBJECT can take a variable number of parameters, - * they also pop different # of values from the stack. So, - * first we pop a value that tells what the _next_ value will - * mean. - */ -/* MONSTER */ -enum sp_mon_var_flags { - SP_M_V_PEACEFUL = 0, - SP_M_V_ALIGN, - SP_M_V_ASLEEP, - SP_M_V_APPEAR, - SP_M_V_NAME, - SP_M_V_FEMALE, - SP_M_V_INVIS, - SP_M_V_CANCELLED, - SP_M_V_REVIVED, - SP_M_V_AVENGE, - SP_M_V_FLEEING, - SP_M_V_BLINDED, - SP_M_V_PARALYZED, - SP_M_V_STUNNED, - SP_M_V_CONFUSED, - SP_M_V_SEENTRAPS, - - SP_M_V_END -}; - -/* OBJECT */ -enum sp_obj_var_flags { - SP_O_V_SPE = 0, - SP_O_V_CURSE, - SP_O_V_CORPSENM, - SP_O_V_NAME, - SP_O_V_QUAN, - SP_O_V_BURIED, - SP_O_V_LIT, - SP_O_V_ERODED, - SP_O_V_LOCKED, - SP_O_V_TRAPPED, - SP_O_V_RECHARGED, - SP_O_V_INVIS, - SP_O_V_GREASED, - SP_O_V_BROKEN, - SP_O_V_COORD, - - SP_O_V_END -}; - /* When creating objects, we need to know whether * it's a container and/or contents. */ @@ -199,25 +60,6 @@ enum sp_obj_var_flags { #define SEL_GRADIENT_RADIAL 0 #define SEL_GRADIENT_SQUARE 1 -/* variable types */ -#define SPOVAR_NULL 0x00 -#define SPOVAR_INT 0x01 /* l */ -#define SPOVAR_STRING 0x02 /* str */ -#define SPOVAR_VARIABLE 0x03 /* str (contains the variable name) */ -#define SPOVAR_COORD \ - 0x04 /* coordinate, encoded in l; use SP_COORD_X() and SP_COORD_Y() */ -#define SPOVAR_REGION 0x05 /* region, encoded in l; use SP_REGION_X1() etc \ - */ -#define SPOVAR_MAPCHAR 0x06 /* map char, in l */ -#define SPOVAR_MONST \ - 0x07 /* monster class & specific monster, encoded in l; use SP_MONST_... \ - */ -#define SPOVAR_OBJ \ - 0x08 /* object class & specific object type, encoded in l; use \ - SP_OBJ_... */ -#define SPOVAR_SEL 0x09 /* selection. char[COLNO][ROWNO] in str */ -#define SPOVAR_ARRAY 0x40 /* used in splev_var & lc_vardefs, not in opvar */ - #define SP_COORD_IS_RANDOM 0x01000000L /* Humidity flags for get_location() and friends, used with * SP_COORD_PACK_RANDOM() */ @@ -234,76 +76,18 @@ enum sp_obj_var_flags { #define SP_COORD_PACK(x, y) (((x) & 0xff) + (((y) & 0xff) << 16)) #define SP_COORD_PACK_RANDOM(f) (SP_COORD_IS_RANDOM | (f)) -#define SP_REGION_X1(l) (l & 0xff) -#define SP_REGION_Y1(l) ((l >> 8) & 0xff) -#define SP_REGION_X2(l) ((l >> 16) & 0xff) -#define SP_REGION_Y2(l) ((l >> 24) & 0xff) -#define SP_REGION_PACK(x1, y1, x2, y2) \ - (((x1) & 0xff) + (((y1) & 0xff) << 8) + (((x2) & 0xff) << 16) \ - + (((y2) & 0xff) << 24)) - -/* permonst index, object index, and lit value might be negative; - * add 10 to accept -1 through -9 while forcing non-negative for bit shift - */ -#define SP_MONST_CLASS(l) ((l) & 0xff) -#define SP_MONST_PM(l) ((((l) >> 8) & 0xffff) - 10) -#define SP_MONST_PACK(pm, cls) (((10 + (pm)) << 8) | ((cls) & 0xff)) - -#define SP_OBJ_CLASS(l) ((l) & 0xff) -#define SP_OBJ_TYP(l) ((((l) >> 8) & 0xffff) - 10) -#define SP_OBJ_PACK(ob, cls) (((10 + (ob)) << 8) | ((cls) & 0xff)) - -#define SP_MAPCHAR_TYP(l) ((l) & 0xff) -#define SP_MAPCHAR_LIT(l) ((((l) >> 8) & 0xffff) - 10) -#define SP_MAPCHAR_PACK(typ, lit) (((10 + (lit)) << 8) | ((typ) & 0xff)) - -struct splev_var { - struct splev_var *next; - char *name; - xchar svtyp; /* SPOVAR_foo */ - union { - struct opvar *value; - struct opvar **arrayvalues; - } data; - long array_len; -}; - -struct splevstack { - long depth; - long depth_alloc; - struct opvar **stackdata; -}; - -struct sp_frame { - struct sp_frame *next; - struct splevstack *stack; - struct splev_var *variables; - long n_opcode; -}; - struct sp_coder { - struct splevstack *stack; - struct sp_frame *frame; int premapped; boolean solidify; struct mkroom *croom; + int room_stack; struct mkroom *tmproomlist[MAX_NESTED_ROOMS + 1]; boolean failed_room[MAX_NESTED_ROOMS + 1]; int n_subroom; - boolean exit_script; int lvl_is_joined; boolean check_inaccessibles; - - int opcode; /* current opcode */ - struct opvar *opdat; /* current push data (req. opcode == SPO_PUSH) */ }; -/* special level coder CPU flags */ -#define SP_CPUFLAG_LT 1 -#define SP_CPUFLAG_GT 2 -#define SP_CPUFLAG_EQ 4 -#define SP_CPUFLAG_ZERO 8 - /* * Structures manipulated by the special levels loader & compiler */ @@ -315,15 +99,6 @@ typedef struct { int x, y; } unpacked_coord; -typedef struct { - int cmp_what; - int cmp_val; -} opcmp; - -typedef struct { - long jmp_target; -} opjmp; - typedef struct { xchar init_style; /* one of LVLINIT_foo */ long flags; @@ -416,122 +191,4 @@ typedef struct { char **map; } mazepart; -typedef struct { - int opcode; - struct opvar *opdat; -} _opcode; - -typedef struct { - _opcode *opcodes; - long n_opcodes; -} sp_lev; - -typedef struct { - xchar x, y, direction, count, lit; - char typ; -} spill; - -/* only used by lev_comp */ -struct lc_funcdefs_parm { - char *name; - char parmtype; - struct lc_funcdefs_parm *next; -}; - -struct lc_funcdefs { - struct lc_funcdefs *next; - char *name; - long addr; - sp_lev code; - long n_called; - struct lc_funcdefs_parm *params; - long n_params; -}; - -struct lc_vardefs { - struct lc_vardefs *next; - char *name; - long var_type; /* SPOVAR_foo */ - long n_used; -}; - -struct lc_breakdef { - struct lc_breakdef *next; - struct opvar *breakpoint; - int break_depth; -}; - -/* - * Quick! Avert your eyes while you still have a chance! - */ -#ifdef SPEC_LEV -/* compiling lev_comp rather than nethack */ -/* clang format off */ -#ifdef USE_OLDARGS -#ifndef VA_TYPE -typedef const char *vA; -#define VA_TYPE -#endif -/* hack to avoid "warning: cast to 'vA' (aka 'const char *') from smaller - integer type 'int' [-Wint-to-pointer-cast]" */ -#define vA_(a) ((vA) (long) a) -#undef VA_ARGS /* redefine with the maximum number actually used */ -#undef VA_SHIFT /* ditto */ -#undef VA_PASS1 -#define VA_ARGS \ - arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, \ - arg12, arg13, arg14 -/* Unlike in the core, lev_comp's VA_SHIFT should be completely safe, - because callers always pass all these arguments. */ -#define VA_SHIFT() \ - (arg1 = arg2, arg2 = arg3, arg3 = arg4, arg4 = arg5, arg5 = arg6, \ - arg6 = arg7, arg7 = arg8, arg8 = arg9, arg9 = arg10, arg10 = arg11, \ - arg11 = arg12, arg12 = arg13, arg13 = arg14, arg14 = 0) -/* standard NULL may be either (void *)0 or plain 0, both of - which would need to be explicitly cast to (char *) here */ -#define VA_PASS1(a1) \ - vA_(a1), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), \ - vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0) -#define VA_PASS2(a1,a2) \ - vA_(a1), vA_(a2), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), \ - vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0) -#define VA_PASS3(a1,a2,a3) \ - vA_(a1), vA_(a2), vA_(a3), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), \ - vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0) -#define VA_PASS4(a1,a2,a3,a4) \ - vA_(a1), vA_(a2), vA_(a3), vA_(a4), vA_(0), vA_(0), vA_(0), vA_(0), \ - vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0) -#define VA_PASS5(a1,a2,a3,a4,a5) \ - vA_(a1), vA_(a2), vA_(a3), vA_(a4), vA_(a5), vA_(0), vA_(0), vA_(0), \ - vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0) -#define VA_PASS7(a1,a2,a3,a4,a5,a6,a7) \ - vA_(a1), vA_(a2), vA_(a3), vA_(a4), vA_(a5), vA_(a6), vA_(a7), vA_(0), \ - vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0) -#define VA_PASS8(a1,a2,a3,a4,a5,a6,a7,a8) \ - vA_(a1), vA_(a2), vA_(a3), vA_(a4), vA_(a5), vA_(a6), vA_(a7), vA_(a8), \ - vA_(0), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0) -#define VA_PASS9(a1,a2,a3,a4,a5,a6,a7,a8,a9) \ - vA_(a1), vA_(a2), vA_(a3), vA_(a4), vA_(a5), vA_(a6), vA_(a7), vA_(a8), \ - vA_(a9), vA_(0), vA_(0), vA_(0), vA_(0), vA_(0) -#define VA_PASS14(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) \ - vA_(a1), vA_(a2), vA_(a3), vA_(a4), vA_(a5), vA_(a6), vA_(a7), vA_(a8), \ - vA_(a9), vA_(a10), vA_(a11), vA_(a12), vA_(a13), vA_(a14) -#else /*!USE_OLDARGS*/ -/* USE_STDARG and USE_VARARGS don't need to pass dummy arguments - or cast real ones */ -#define VA_PASS1(a1) a1 -#define VA_PASS2(a1,a2) a1, a2 -#define VA_PASS3(a1,a2,a3) a1, a2, a3 -#define VA_PASS4(a1,a2,a3,a4) a1, a2, a3, a4 -#define VA_PASS5(a1,a2,a3,a4,a5) a1, a2, a3, a4, a5 -#define VA_PASS7(a1,a2,a3,a4,a5,a6,a7) a1, a2, a3, a4, a5, a6, a7 -#define VA_PASS8(a1,a2,a3,a4,a5,a6,a7,a8) a1, a2, a3, a4, a5, a6, a7, a8 -#define VA_PASS9(a1,a2,a3,a4,a5,a6,a7,a8,a9) a1, a2, a3, a4, a5, a6, a7, a8, a9 -#define VA_PASS14(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) \ - a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14 -#endif /*?USE_OLDARGS*/ -/* clang format on */ -/* You were warned to avert your eyes.... */ -#endif /*SPEC_LEV*/ - #endif /* SP_LEV_H */ diff --git a/include/sys.h b/include/sys.h index f7bd0b469..afb1fc865 100644 --- a/include/sys.h +++ b/include/sys.h @@ -45,6 +45,12 @@ struct sysopt { /* save and bones format */ int saveformat[2]; /* primary and onetime conversion */ int bonesformat[2]; /* primary and onetime conversion */ + + /* enable accessibility options */ + int accessibility; +#ifdef WIN32 + int portable_device_paths; /* nethack configuration for a portable device */ +#endif }; extern struct sysopt sysopt; diff --git a/include/system.h b/include/system.h index a2cb51f40..3906e68e4 100644 --- a/include/system.h +++ b/include/system.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 system.h $NHDT-Date: 1550268586 2019/02/15 22:09:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.17 $ */ +/* NetHack 3.6 system.h $NHDT-Date: 1574825213 2019/11/27 03:26:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.22 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2017. */ /* NetHack may be freely redistributed. See license for details. */ @@ -6,8 +6,8 @@ #ifndef SYSTEM_H #define SYSTEM_H +#if !defined(WIN32) #if !defined(__cplusplus) && !defined(__GO32__) - #define E extern /* some old may not define off_t and size_t; if your system is @@ -339,7 +339,7 @@ E int FDECL(memcmp, (const void *, const void *, size_t)); E void *FDECL(memcpy, (void *, const void *, size_t)); E void *FDECL(memset, (void *, int, size_t)); #else -#if defined(AZTEC_50) || defined(NHSTDC) || defined(WIN32) +#if defined(AZTEC_50) || defined(NHSTDC)) E int FDECL(memcmp, (const void *, const void *, size_t)); E void *FDECL(memcpy, (void *, const void *, size_t)); E void *FDECL(memset, (void *, int, size_t)); @@ -453,7 +453,7 @@ E char *FDECL(rindex, (const char *, int)); * If your system defines sprintf, et al, in stdio.h, add to the initial * #if. */ -#if defined(ULTRIX) || defined(__DECC) || defined(__SASC_60) || defined(WIN32) +#if defined(ULTRIX) || defined(__DECC) || defined(__SASC_60) #define SPRINTF_PROTO #endif #if (defined(SUNOS4) && defined(__STDC__)) || defined(_AIX32) @@ -527,7 +527,7 @@ E char *FDECL(tgetstr, (const char *, char **)); E char *FDECL(tgoto, (const char *, int, int)); #endif -#if defined(ALLOC_C) || defined(MAKEDEFS_C) +#if defined(ALLOC_C) || defined(MAKEDEFS_C) || defined(MDLIB_C) E genericptr_t FDECL(malloc, (size_t)); E genericptr_t FDECL(realloc, (genericptr_t, size_t)); #endif @@ -567,5 +567,10 @@ E int FDECL(atoi, (const char *)); #undef E #endif /* !__cplusplus && !__GO32__ */ +#endif /* WIN32 */ + +#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) +#include "nhlua.h" +#endif #endif /* SYSTEM_H */ diff --git a/include/vmsconf.h b/include/vmsconf.h index a815e704a..9f061563b 100644 --- a/include/vmsconf.h +++ b/include/vmsconf.h @@ -172,7 +172,13 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then * The remainder of the file should not need to be changed. */ -/* data librarian defs */ +/* This used to be force-defined for VMS in topten.c, but with + * the global variable consolidation into g in 3.7, it has to be + * defined here so that decl.h includes the field in g. + */ +#define UPDATE_RECORD_IN_PLACE + +/* data librarian defs */ #ifdef DLB #define DLBFILE "nh-data.dlb" /* diff --git a/include/winprocs.h b/include/winprocs.h index cc3b4046c..55b2b0611 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -14,6 +14,7 @@ struct window_procs { * '+' are reserved for processors. */ unsigned long wincap; /* window port capability options supported */ unsigned long wincap2; /* additional window port capability options */ + boolean has_color[CLR_MAX]; void FDECL((*win_init_nhwindows), (int *, char **)); void NDECL((*win_player_selection)); void NDECL((*win_askname)); @@ -450,6 +451,7 @@ extern void FDECL(safe_status_enablefield, extern void FDECL(safe_status_update, (int, genericptr_t, int, int, int, unsigned long *)); extern boolean NDECL(safe_can_suspend); extern void FDECL(stdio_raw_print, (const char *)); +extern void FDECL(stdio_nonl_raw_print, (const char *)); extern void FDECL(stdio_raw_print_bold, (const char *)); extern void NDECL(stdio_wait_synch); extern int NDECL(stdio_nhgetch); diff --git a/include/wintty.h b/include/wintty.h index 4863d6e10..a42ed22d4 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -114,16 +114,7 @@ E void FDECL(tty_startup, (int *, int *)); #ifndef NO_TERMS E void NDECL(tty_shutdown); #endif -#if defined(apollo) -/* Apollos don't widen old-style function definitions properly -- they try to - * be smart and use the prototype, or some such strangeness. So we have to - * define UNWIDENDED_PROTOTYPES (in tradstdc.h), which makes CHAR_P below a - * char. But the tputs termcap call was compiled as if xputc's argument - * actually would be expanded. So here, we have to make an exception. */ -E void FDECL(xputc, (int)); -#else -E void FDECL(xputc, (CHAR_P)); -#endif +E int FDECL(xputc, (int)); E void FDECL(xputs, (const char *)); #if defined(SCREEN_VGA) || defined(SCREEN_8514) E void FDECL(xputg, (int, int, unsigned)); diff --git a/include/you.h b/include/you.h index 657b9c3e7..611fcf3b1 100644 --- a/include/you.h +++ b/include/you.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 you.h $NHDT-Date: 1547514642 2019/01/15 01:10:42 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.35 $ */ +/* NetHack 3.6 you.h $NHDT-Date: 1574648937 2019/11/25 02:28:57 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.41 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -237,14 +237,21 @@ extern const struct Gender genders[]; /* table of available genders */ #define uhe() (genders[flags.female ? 1 : 0].he) #define uhim() (genders[flags.female ? 1 : 0].him) #define uhis() (genders[flags.female ? 1 : 0].his) +/* pronoun_gender() flag masks */ +#define PRONOUN_NORMAL 0 /* none of the below */ +#define PRONOUN_NO_IT 1 +#define PRONOUN_HALLU 2 /* corresponding pronouns for monsters; yields "it" when mtmp can't be seen */ -#define mhe(mtmp) (genders[pronoun_gender(mtmp, FALSE)].he) -#define mhim(mtmp) (genders[pronoun_gender(mtmp, FALSE)].him) -#define mhis(mtmp) (genders[pronoun_gender(mtmp, FALSE)].his) +#define mhe(mtmp) (genders[pronoun_gender(mtmp, PRONOUN_HALLU)].he) +#define mhim(mtmp) (genders[pronoun_gender(mtmp, PRONOUN_HALLU)].him) +#define mhis(mtmp) (genders[pronoun_gender(mtmp, PRONOUN_HALLU)].his) /* override "it" if reason is lack of visibility rather than neuter species */ -#define noit_mhe(mtmp) (genders[pronoun_gender(mtmp, TRUE)].he) -#define noit_mhim(mtmp) (genders[pronoun_gender(mtmp, TRUE)].him) -#define noit_mhis(mtmp) (genders[pronoun_gender(mtmp, TRUE)].his) +#define noit_mhe(mtmp) \ + (genders[pronoun_gender(mtmp, (PRONOUN_NO_IT | PRONOUN_HALLU))].he) +#define noit_mhim(mtmp) \ + (genders[pronoun_gender(mtmp, (PRONOUN_NO_IT | PRONOUN_HALLU))].him) +#define noit_mhis(mtmp) \ + (genders[pronoun_gender(mtmp, (PRONOUN_NO_IT | PRONOUN_HALLU))].his) /*** Unified structure specifying alignment information ***/ struct Align { diff --git a/src/allmain.c b/src/allmain.c index 9a8d31276..5808503e8 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -25,6 +25,9 @@ early_init() decl_globals_init(); objects_globals_init(); monst_globals_init(); +#if defined(OPTIONS_AT_RUNTIME) || defined(CROSSCOMPILE_TARGET) + runtime_info_init(); +#endif sys_early_init(); } @@ -619,7 +622,6 @@ newgame() if (iflags.news) display_file(NEWS, FALSE); #endif - load_qtlist(); /* load up the quest text info */ /* quest_init(); -- Now part of role_init() */ mklev(); @@ -636,7 +638,7 @@ newgame() if (flags.legacy) { flush_screen(1); - com_pager(1); + com_pager("legacy"); } urealtime.realtime = 0L; @@ -772,6 +774,7 @@ const char *msg; static const struct early_opt earlyopts[] = { {ARG_DEBUG, "debug", 5, TRUE}, {ARG_VERSION, "version", 4, TRUE}, + {ARG_SHOWPATHS, "showpaths", 9, FALSE}, #ifdef WIN32 {ARG_WINDOWS, "windows", 4, TRUE}, #endif @@ -850,6 +853,9 @@ enum earlyarg e_arg; early_version_info(insert_into_pastebuf); return 2; } + case ARG_SHOWPATHS: { + return 2; + } #ifdef WIN32 case ARG_WINDOWS: { if (extended_opt) { diff --git a/src/apply.c b/src/apply.c index d197be8e3..d554fc834 100644 --- a/src/apply.c +++ b/src/apply.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 apply.c $NHDT-Date: 1568922511 2019/09/19 19:48:31 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.277 $ */ +/* NetHack 3.6 apply.c $NHDT-Date: 1574648938 2019/11/25 02:28:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.301 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -99,8 +99,8 @@ struct obj *obj; switch (rn2(3)) { case 2: - old = Glib; - incr_itimeout(&Glib, rn1(10, 3)); + old = (Glib & TIMEOUT); + make_glib((int) old + rn1(10, 3)); /* + 3..12 */ Your("%s %s!", makeplural(body_part(HAND)), (old ? "are filthier than ever" : "get slimy")); if (is_wet_towel(obj)) @@ -139,8 +139,9 @@ struct obj *obj; } if (Glib) { - Glib = 0; - You("wipe off your %s.", makeplural(body_part(HAND))); + make_glib(0); + You("wipe off your %s.", + !uarmg ? makeplural(body_part(HAND)) : gloves_simple_name(uarmg)); if (is_wet_towel(obj)) dry_a_towel(obj, -1, drying_feedback); return 1; @@ -211,7 +212,7 @@ int rx, ry, *resp; if (mtmp) { mptr = mtmp->data = &mons[mtmp->mnum]; /* TRUE: override visibility check--it's not on the map */ - gndr = pronoun_gender(mtmp, TRUE); + gndr = pronoun_gender(mtmp, PRONOUN_NO_IT); } else { mptr = &mons[corpse->corpsenm]; if (is_female(mptr)) @@ -377,10 +378,27 @@ register struct obj *obj; newsym(mtmp->mx, mtmp->my); } else if (mtmp->mappearance) { const char *what = "thing"; + boolean use_plural = FALSE; + struct obj dummyobj, *odummy; switch (M_AP_TYPE(mtmp)) { case M_AP_OBJECT: - what = simple_typename(mtmp->mappearance); + /* FIXME? + * we should probably be using object_from_map() here + */ + odummy = init_dummyobj(&dummyobj, mtmp->mappearance, 1L); + /* simple_typename() yields "fruit" for any named fruit; + we want the same thing '//' or ';' shows: "slime mold" + or "grape" or "slice of pizza" */ + if (odummy->otyp == SLIME_MOLD + && has_mcorpsenm(mtmp) && MCORPSENM(mtmp) != NON_PM) { + odummy->spe = MCORPSENM(mtmp); + what = simpleonames(odummy); + } else { + what = simple_typename(odummy->otyp); + } + use_plural = (is_boots(odummy) || is_gloves(odummy) + || odummy->otyp == LENSES); break; case M_AP_MONSTER: /* ignore Hallucination here */ what = mons[mtmp->mappearance].mname; @@ -390,7 +408,9 @@ register struct obj *obj; break; } seemimic(mtmp); - pline("That %s is really %s.", what, mnm); + pline("%s %s %s really %s.", + use_plural ? "Those" : "That", what, + use_plural ? "are" : "is", mnm); } else if (flags.verbose && !canspotmon(mtmp)) { There("is %s there.", mnm); } @@ -423,7 +443,8 @@ register struct obj *obj; return res; } -static const char whistle_str[] = "produce a %s whistling sound."; +static const char whistle_str[] = "produce a %s whistling sound.", + alt_whistle_str[] = "produce a %s, sharp vibration."; static void use_whistle(obj) @@ -435,8 +456,7 @@ struct obj *obj; You("blow bubbles through %s.", yname(obj)); } else { if (Deaf) - You_feel("rushing air tickle your %s.", - body_part(NOSE)); + You_feel("rushing air tickle your %s.", body_part(NOSE)); else You(whistle_str, obj->cursed ? "shrill" : "high"); wake_nearby(); @@ -454,16 +474,17 @@ struct obj *obj; if (!can_blow(&g.youmonst)) { You("are incapable of using the whistle."); } else if (obj->cursed && !rn2(2)) { - You("produce a %shigh-pitched humming noise.", - Underwater ? "very " : ""); + You("produce a %shigh-%s.", Underwater ? "very " : "", + Deaf ? "frequency vibration" : "pitched humming noise"); wake_nearby(); } else { int pet_cnt = 0, omx, omy; /* it's magic! it works underwater too (at a higher pitch) */ - You(whistle_str, - Hallucination ? "normal" : Underwater ? "strange, high-pitched" - : "strange"); + You(Deaf ? alt_whistle_str : whistle_str, + Hallucination ? "normal" + : (Underwater && !Deaf) ? "strange, high-pitched" + : "strange"); for (mtmp = fmon; mtmp; mtmp = nextmon) { nextmon = mtmp->nmon; /* trap might kill mon */ if (DEADMONSTER(mtmp)) @@ -566,15 +587,13 @@ unleash_all() #define MAXLEASHED 2 -/* TODO: - * This ought to exclude various other things, such as lights and gas - * spore, is_whirly() critters, ethereal creatures, possibly others. - */ -static boolean +boolean leashable(mtmp) struct monst *mtmp; { - return (boolean) (mtmp->mnum != PM_LONG_WORM); + return (boolean) (mtmp->mnum != PM_LONG_WORM + && !unsolid(mtmp->data) + && (!nolimbs(mtmp->data) || has_head(mtmp->data))); } /* ARGSUSED */ @@ -646,6 +665,11 @@ struct obj *obj; if (mtmp->mleashed) { pline("This %s is already leashed.", spotmon ? l_monnam(mtmp) : "creature"); + } else if (unsolid(mtmp->data)) { + pline("The leash would just fall off."); + } else if (nolimbs(mtmp->data) && !has_head(mtmp->data)) { + pline("%s has no extremities the leash would fit.", + Monnam(mtmp)); } else if (!leashable(mtmp)) { pline("The leash won't fit onto %s%s.", spotmon ? "your " : "", l_monnam(mtmp)); @@ -910,8 +934,9 @@ struct obj *obj; /* infravision doesn't produce an image in the mirror */ } else if ((how_seen & SEENMON) == MONSEEN_INFRAVIS) { if (vis) /* (redundant) */ - pline("%s is too far away to see %sself in the dark.", - Monnam(mtmp), mhim(mtmp)); + pline("%s in the dark.", + monverbself(mtmp, Monnam(mtmp), "are", + "too far away to see")); /* some monsters do special things */ } else if (mlet == S_VAMPIRE || mlet == S_GHOST || is_vampshifter(mtmp)) { if (vis) @@ -941,7 +966,8 @@ struct obj *obj; if (vis) { char buf[BUFSZ]; /* "She" or "He" */ - pline("%s admires %sself in your %s.", Monnam(mtmp), mhim(mtmp), + pline("%s in your %s.", /* " admires self in your mirror " */ + monverbself(mtmp, Monnam(mtmp), "admire", (char *) 0), mirror); pline("%s takes it!", upstart(strcpy(buf, mhe(mtmp)))); } else @@ -2254,17 +2280,19 @@ struct obj *obj; if (Glib) { pline("%s from your %s.", Tobjnam(obj, "slip"), - makeplural(body_part(FINGER))); + fingers_or_gloves(FALSE)); dropx(obj); return; } if (obj->spe > 0) { + int oldglib; + if ((obj->cursed || Fumbling) && !rn2(2)) { consume_obj_charge(obj, TRUE); pline("%s from your %s.", Tobjnam(obj, "slip"), - makeplural(body_part(FINGER))); + fingers_or_gloves(FALSE)); dropx(obj); return; } @@ -2275,17 +2303,18 @@ struct obj *obj; return; consume_obj_charge(obj, TRUE); + oldglib = (int) (Glib & TIMEOUT); if (otmp != &cg.zeroobj) { You("cover %s with a thick layer of grease.", yname(otmp)); otmp->greased = 1; if (obj->cursed && !nohands(g.youmonst.data)) { - incr_itimeout(&Glib, rnd(15)); + make_glib(oldglib + rn1(6, 10)); /* + 10..15 */ pline("Some of the grease gets all over your %s.", - makeplural(body_part(HAND))); + fingers_or_gloves(TRUE)); } } else { - incr_itimeout(&Glib, rnd(15)); - You("coat your %s with grease.", makeplural(body_part(FINGER))); + make_glib(oldglib + rn1(11, 5)); /* + 5..15 */ + You("coat your %s with grease.", fingers_or_gloves(TRUE)); } } else { if (obj->known) diff --git a/src/artifact.c b/src/artifact.c index f6ab3065f..e25fedb24 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -6,8 +6,6 @@ #include "hack.h" #include "artifact.h" #include "artilist.h" -#include "sfproto.h" - /* * Note: both artilist[] and artiexist[] have a dummy element #0, @@ -85,15 +83,6 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) g.artiexist, sizeof g.artiexist); bwrite(nhfp->fd, (genericptr_t) g.artidisco, sizeof g.artidisco); } - if (nhfp->fieldlevel) { - int i; - - for (i = 0; i < (1 + NROFARTIFACTS + 1); ++i) - sfo_boolean(nhfp, &g.artiexist[i], "artifacts", "g.artiexist", 1); - - for (i = 0; i < NROFARTIFACTS; ++i) - sfo_xchar(nhfp, &g.artidisco[i], "artifacts", "g.artidisco", 1); - } } void @@ -104,15 +93,6 @@ NHFILE *nhfp; mread(nhfp->fd, (genericptr_t) g.artiexist, sizeof g.artiexist); mread(nhfp->fd, (genericptr_t) g.artidisco, sizeof g.artidisco); } - if (nhfp->fieldlevel) { - int i; - - for (i = 0; i < (1 + NROFARTIFACTS + 1); ++i) - sfi_boolean(nhfp, &g.artiexist[i], "artifacts", "g.artiexist", 1); - - for (i = 0; i < NROFARTIFACTS; ++i) - sfi_xchar(nhfp, &g.artidisco[i], "artifacts", "g.artidisco", 1); - } hack_artifacts(); /* redo non-saved special cases */ } diff --git a/src/attrib.c b/src/attrib.c index a50d93eb0..31c9fef67 100644 --- a/src/attrib.c +++ b/src/attrib.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 attrib.c $NHDT-Date: 1553363417 2019/03/23 17:50:17 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.65 $ */ +/* NetHack 3.6 attrib.c $NHDT-Date: 1575245050 2019/12/02 00:04:10 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.66 $ */ /* Copyright 1988, 1989, 1990, 1992, M. Stephenson */ /* NetHack may be freely redistributed. See license for details. */ @@ -147,7 +147,7 @@ int msgflg; /* positive => no message, zero => message, and */ * taken below the minimum, reduce max value (peak reached) * instead. That means that restore ability and repeated * applications of unicorn horn will not be able to recover - * all the lost value. Starting will 3.6.2, we only take away + * all the lost value. As of 3.6.2, we only take away * some (average half, possibly zero) of the excess from max * instead of all of it, but without intervening recovery, it * can still eventually drop to the minimum allowed. After diff --git a/src/ball.c b/src/ball.c index e7ab564d4..329fc9135 100644 --- a/src/ball.c +++ b/src/ball.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 ball.c $NHDT-Date: 1559601027 2019/06/03 22:30:27 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.40 $ */ +/* NetHack 3.6 ball.c $NHDT-Date: 1573940835 2019/11/16 21:47:15 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.44 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) David Cohrs, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -178,7 +178,7 @@ check_restriction(restriction) int restriction; { boolean ret = FALSE; - + if (!bcrestriction || (restriction == override_restriction)) ret = TRUE; else @@ -194,8 +194,7 @@ placebc() #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) char panicbuf[BUFSZ]; - Sprintf(panicbuf, - "placebc denied, restriction in effect"); + Sprintf(panicbuf, "placebc denied, restriction in effect"); paniclog("placebc", panicbuf); #endif return; @@ -239,10 +238,9 @@ int pin; #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) char panicbuf[BUFSZ]; - Sprintf(panicbuf, - "lift_covet_and_placebc denied, %s", - (pin != bcrestriction) ? - "pin mismatch" : "restriction in effect"); + Sprintf(panicbuf, "lift_covet_and_placebc denied, %s", + (pin != bcrestriction) ? "pin mismatch" + : "restriction in effect"); paniclog("placebc", panicbuf); #endif return; @@ -265,8 +263,7 @@ int linenum; #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) char panicbuf[BUFSZ]; - Sprintf(panicbuf, - "Placebc denied to %s:%d, restricted by %s:%d", + Sprintf(panicbuf, "Placebc denied to %s:%d, restricted by %s:%d", funcnm, linenum, bcpbreadcrumbs.funcnm, bcpbreadcrumbs.linenum); paniclog("Placebc", panicbuf); @@ -296,10 +293,9 @@ int linenum; if (bcrestriction) { char panicbuf[BUFSZ]; - Sprintf(panicbuf, - "Unplacebc from %s:%d, when restricted to %s:%d", - funcnm, linenum, - bcubreadcrumbs.funcnm, bcubreadcrumbs.linenum); + Sprintf(panicbuf, "Unplacebc from %s:%d, when restricted to %s:%d", + funcnm, linenum, + bcubreadcrumbs.funcnm, bcubreadcrumbs.linenum); paniclog("Unplacebc", panicbuf); } bcpbreadcrumbs.in_effect = FALSE; @@ -342,8 +338,8 @@ int linenum; #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) char panicbuf[BUFSZ]; - Sprintf(panicbuf, - "Lift_covet_and_placebc denied to %s:%d, restricted by %s:%d", + Sprintf(panicbuf, + "Lift_covet_and_placebc denied to %s:%d, restricted by %s:%d", funcnm, linenum, bcpbreadcrumbs.funcnm, bcpbreadcrumbs.linenum); paniclog("Lift_covet_and_placebc", panicbuf); @@ -1074,7 +1070,7 @@ bc_sanity_check() && uball->where != OBJ_FREE) || (freeball ^ freechain) || (uball->owornmask & W_BALL) == 0L - || (uball->owornmask & ~(W_BALL | W_WEAPON)) != 0L)) { + || (uball->owornmask & ~(W_BALL | W_WEAPONS)) != 0L)) { otyp = uball->otyp; onam = safe_typename(otyp); impossible("uball: type %d (%s), where %d, wornmask=0x%08lx", diff --git a/src/bones.c b/src/bones.c index 0359b386e..8ebe47cea 100644 --- a/src/bones.c +++ b/src/bones.c @@ -1,12 +1,9 @@ -/* NetHack 3.6 bones.c $NHDT-Date: 1557092711 2019/05/05 21:45:11 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.75 $ */ +/* NetHack 3.6 bones.c $NHDT-Date: 1571363147 2019/10/18 01:45:47 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.76 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" -#include "lev.h" -#include "sfproto.h" - #ifdef MFLOPPY extern long bytes_counted; @@ -85,6 +82,24 @@ boolean restore; } else if (has_oname(otmp)) { sanitize_name(ONAME(otmp)); } + /* 3.6.3: set no_charge for partly eaten food in shop; + all other items become goods for sale if in a shop */ + if (otmp->oclass == FOOD_CLASS && otmp->oeaten) { + struct obj *top; + char *p; + xchar ox, oy; + + for (top = otmp; top->where == OBJ_CONTAINED; + top = top->ocontainer) + continue; + otmp->no_charge = (top->where == OBJ_FLOOR + && get_obj_location(top, &ox, &oy, 0) + /* can't use costly_spot() since its + result depends upon hero's location */ + && inside_shop(ox, oy) + && *(p = in_rooms(ox, oy, SHOPBASE)) + && tended_shop(&g.rooms[*p - ROOMOFFSET])); + } } else { /* saving */ /* do not zero out o_ids for ghost levels anymore */ @@ -117,7 +132,7 @@ boolean restore; if (otmp->otyp == SLIME_MOLD) { goodfruit(otmp->spe); -#ifdef MAIL +#ifdef MAIL_STRUCTURES } else if (otmp->otyp == SCR_MAIL) { /* 0: delivered in-game via external event; 1: from bones or wishing; 2: written with marker */ @@ -537,10 +552,6 @@ struct obj *corpse; bwrite(nhfp->fd, (genericptr_t) &c, sizeof c); bwrite(nhfp->fd, (genericptr_t) bonesid, (unsigned) c); /* DD.nnn */ } - if (nhfp->fieldlevel) { - sfo_char(nhfp, &c, "bones", "bones_count", 1); - sfo_char(nhfp, bonesid, "bones", "bonesid", (int) c); - } savefruitchn(nhfp); if (nhfp->structlevel) bflush(nhfp->fd); @@ -564,11 +575,6 @@ struct obj *corpse; bwrite(nhfp->fd, (genericptr_t) bonesid, (unsigned) c); /* DD.nnn */ savefruitchn(nhfp); } - if (nhfp->fieldlevel) { - sfo_char(nhfp, &c, "bones", "bones_count", 1); - sfo_char(nhfp, bonesid, "bones", "bonesid", (int) c); /* DD.nnn */ - savefruitchn(nhfp); - } update_mlstmv(); /* update monsters for eventual restoration */ savelev(nhfp, ledger_no(&u.uz)); close_nhfile(nhfp); @@ -579,9 +585,9 @@ struct obj *corpse; int getbones() { - int ok, i; + int ok; NHFILE *nhfp = (NHFILE *) 0; - char c, *bonesid, oldbonesid[40]; /* was [10]; more should be safer */ + char c = 0, *bonesid, oldbonesid[40]; /* was [10]; more should be safer */ if (discover) /* save bones files for real games */ return 0; @@ -607,7 +613,7 @@ getbones() if (validate(nhfp, g.bones) != 0) { if (!wizard) - pline("Discarding unuseable bones; no need to panic..."); + pline("Discarding unusable bones; no need to panic..."); ok = FALSE; } else { ok = TRUE; @@ -622,11 +628,6 @@ getbones() mread(nhfp->fd, (genericptr_t) &c, sizeof c); /* length incl. '\0' */ mread(nhfp->fd, (genericptr_t) oldbonesid, (unsigned) c); /* DD.nnn */ } - if (nhfp->fieldlevel) { - sfi_char(nhfp, &c, "bones", "bones_count", 1); /* length incl. '\0' */ - for (i = 0; i < (int) c; ++i) - sfi_char(nhfp, &oldbonesid[i], "bones", "bonesid", 1); - } if (strcmp(bonesid, oldbonesid) != 0 /* from 3.3.0 through 3.6.0, bones in the quest branch stored a bogus bonesid in the file; 3.6.1 fixed that, but for diff --git a/src/botl.c b/src/botl.c index 5dd6747a4..d5454aa82 100644 --- a/src/botl.c +++ b/src/botl.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 botl.c $NHDT-Date: 1562114350 2019/07/03 00:39:10 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.146 $ */ +/* NetHack 3.6 botl.c $NHDT-Date: 1573178085 2019/11/08 01:54:45 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.148 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -141,9 +141,9 @@ do_statusline2() if (Upolyd) Sprintf(expr, "HD:%d", mons[u.umonnum].mlevel); else if (flags.showexp) - Sprintf(expr, "Xp:%u/%-1ld", u.ulevel, u.uexp); + Sprintf(expr, "Xp:%d/%-1ld", u.ulevel, u.uexp); else - Sprintf(expr, "Exp:%u", u.ulevel); + Sprintf(expr, "Exp:%d", u.ulevel); xln = strlen(expr); /* time/move counter */ @@ -809,6 +809,12 @@ boolean *valsetlist; if (anytype != ANY_MASK32) { #ifdef STATUS_HILITES if (chg || *curr->val) { + /* if Xp percentage changed, we set 'chg' to 1 above; + reset that if the Xp value hasn't actually changed + or possibly went down rather than up (level loss) */ + if (chg == 1 && fld == BL_XP) + chg = compare_blstats(prev, curr); + curr->hilite_rule = get_hilite(idx, fld, (genericptr_t) &curr->a, chg, pc, &color); diff --git a/src/cmd.c b/src/cmd.c index 9f1315162..df3646be4 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,10 +1,9 @@ -/* NetHack 3.6 cmd.c $NHDT-Date: 1565574994 2019/08/12 01:56:34 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.343 $ */ +/* NetHack 3.6 cmd.c $NHDT-Date: 1576201761 2019/12/13 01:49:21 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.383 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" -#include "lev.h" #include "func_tab.h" /* Macros for meta and ctrl modifiers: @@ -148,6 +147,7 @@ static int NDECL(wiz_where); static int NDECL(wiz_detect); static int NDECL(wiz_panic); static int NDECL(wiz_polyself); +static int NDECL(wiz_load_lua); static int NDECL(wiz_level_tele); static int NDECL(wiz_level_change); static int NDECL(wiz_show_seenv); @@ -785,16 +785,14 @@ wiz_identify(VOID_ARGS) return 0; } -/* #wizmakemap - discard current dungeon level and replace with a new one */ -static int -wiz_makemap(VOID_ARGS) +void +makemap_prepost(pre, wiztower) +boolean pre, wiztower; { NHFILE tmpnhfp; + struct monst *mtmp; - if (wizard) { - struct monst *mtmp; - boolean was_in_W_tower = In_W_tower(u.ux, u.uy, &u.uz); - + if (pre) { rm_mapseen(ledger_no(&u.uz)); for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { if (mtmp->isgd) { /* vault is going away; get rid of guard */ @@ -840,19 +838,16 @@ wiz_makemap(VOID_ARGS) zero_nhfile(&tmpnhfp); /* also sets fd to -1 as desired */ tmpnhfp.mode = FREEING; savelev(&tmpnhfp, ledger_no(&u.uz)); - /* create a new level; various things like bestowing a guardian - angel on Astral or setting off alarm on Ft.Ludios are handled - by goto_level(do.c) so won't occur for replacement levels */ - mklev(); - + } else { vision_reset(); g.vision_full_recalc = 1; cls(); /* was using safe_teleds() but that doesn't honor arrival region on levels which have such; we don't force stairs, just area */ u_on_rndspot((u.uhave.amulet ? 1 : 0) /* 'going up' flag */ - | (was_in_W_tower ? 2 : 0)); + | (wiztower ? 2 : 0)); losedogs(); + kill_genocided_monsters(); /* u_on_rndspot() might pick a spot that has a monster, or losedogs() might pick the hero's spot (only if there isn't already a monster there), so we might have to move hero or the co-located monster */ @@ -870,6 +865,21 @@ wiz_makemap(VOID_ARGS) #ifdef INSURANCE save_currentstate(); #endif + } +} + +/* #wizmakemap - discard current dungeon level and replace with a new one */ +static int +wiz_makemap(VOID_ARGS) +{ + if (wizard) { + boolean was_in_W_tower = In_W_tower(u.ux, u.uy, &u.uz); + makemap_prepost(TRUE, was_in_W_tower); + /* create a new level; various things like bestowing a guardian + angel on Astral or setting off alarm on Ft.Ludios are handled + by goto_level(do.c) so won't occur for replacement levels */ + mklev(); + makemap_prepost(FALSE, was_in_W_tower); } else { pline(unavailcmd, "#wizmakemap"); } @@ -930,6 +940,73 @@ wiz_detect(VOID_ARGS) return 0; } +static int +wiz_load_lua(VOID_ARGS) +{ + if (wizard) { + char buf[BUFSZ]; + + buf[0] = '\0'; + getlin("Load which lua file?", buf); + if (buf[0] == '\033' || buf[0] == '\0') + return 0; + if (!strchr(buf, '.')) + strcat(buf, ".lua"); + (void) load_lua(buf); + } else + pline("Unavailable command 'wiz_load_lua'."); + return 0; +} + +static int +wiz_load_splua(VOID_ARGS) +{ + if (wizard) { + boolean was_in_W_tower = In_W_tower(u.ux, u.uy, &u.uz); + char buf[BUFSZ]; + int ridx; + + buf[0] = '\0'; + getlin("Load which des lua file?", buf); + if (buf[0] == '\033' || buf[0] == '\0') + return 0; + if (!strchr(buf, '.')) + strcat(buf, ".lua"); + makemap_prepost(TRUE, was_in_W_tower); + + /* TODO: need to split some of this out of mklev(), makelevel(), makemaz() */ + g.in_mklev = TRUE; + oinit(); /* assign level dependent obj probabilities */ + clear_level_structures(); + + (void) load_special(buf); + + bound_digging(); + mineralize(-1, -1, -1, -1, FALSE); + g.in_mklev = FALSE; + if (g.level.flags.has_morgue) + g.level.flags.graveyard = 1; + if (!g.level.flags.is_maze_lev) { + struct mkroom *croom; + for (croom = &g.rooms[0]; croom != &g.rooms[g.nroom]; croom++) +#ifdef SPECIALIZATION + topologize(croom, FALSE); +#else + topologize(croom); +#endif + } + set_wall_state(); + /* for many room types, g.rooms[].rtype is zeroed once the room has been + entered; g.rooms[].orig_rtype always retains original rtype value */ + for (ridx = 0; ridx < SIZE(g.rooms); ridx++) + g.rooms[ridx].orig_rtype = g.rooms[ridx].rtype; + + makemap_prepost(FALSE, was_in_W_tower); + } else + pline("Unavailable command 'wiz_load_splua'."); + return 0; +} + /* ^V command - level teleport */ static int wiz_level_tele(VOID_ARGS) @@ -1273,7 +1350,7 @@ wiz_map_levltyp(VOID_ARGS) /* temporary? hack, since level type codes aren't the same as screen symbols and only the latter have easily accessible descriptions */ -static const char *levltyp[] = { +const char *levltyp[] = { "stone", "vertical wall", "horizontal wall", "top-left corner wall", "top-right corner wall", "bottom-left corner wall", "bottom-right corner wall", "cross wall", "tee-up wall", "tee-down wall", @@ -1289,6 +1366,15 @@ static const char *levltyp[] = { "" }; +const char * +levltyp_to_name(typ) +int typ; +{ + if (typ >= 0 && typ < MAX_TYPE) + return levltyp[typ]; + return NULL; +} + /* explanation of base-36 output from wiz_map_levltyp() */ static void wiz_levltyp_legend(VOID_ARGS) @@ -1476,15 +1562,21 @@ wiz_intrinsic(VOID_ARGS) = &mons[g.context.warntype.speciesidx]; } goto def_feedback; + case GLIB: + /* slippery fingers applies to gloves if worn at the time + so persistent inventory might need updating */ + make_glib((int) newtimeout); + goto def_feedback; case LEVITATION: case FLYING: float_vs_flight(); /*FALLTHRU*/ default: - def_feedback: + 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); + if (p != GLIB) + incr_itimeout(&u.uprops[p].intrinsic, amt); break; } g.context.botl = 1; /* probably not necessary... */ @@ -1933,7 +2025,7 @@ int final; enlght_out(buf); } - /* 3.6.2: dungeon level, so that ^X really has all status info as + /* As of 3.6.2: dungeon level, so that ^X really has all status info as claimed by the comment below; this reveals more information than the basic status display, but that's one of the purposes of ^X; similar information is revealed by #overview; the "You died in @@ -2466,7 +2558,9 @@ int final; } } if (Glib) { - Sprintf(buf, "slippery %s", makeplural(body_part(FINGER))); + Sprintf(buf, "slippery %s", fingers_or_gloves(TRUE)); + if (wizard) + Sprintf(eos(buf), " (%ld)", (Glib & TIMEOUT)); you_have(buf, ""); } if (Fumbling) { @@ -3520,6 +3614,10 @@ struct ext_func_tab extcmdlist[] = { wiz_intrinsic, IFBURIED | AUTOCOMPLETE | WIZMODECMD }, { C('v'), "wizlevelport", "teleport to another level", wiz_level_tele, IFBURIED | AUTOCOMPLETE | WIZMODECMD }, + { '\0', "wizloaddes", "load and execute a des-file lua script", + wiz_load_splua, IFBURIED | WIZMODECMD }, + { '\0', "wizloadlua", "load and execute a lua script", + wiz_load_lua, IFBURIED | WIZMODECMD }, { '\0', "wizmakemap", "recreate the current level", wiz_makemap, IFBURIED | WIZMODECMD }, { C('f'), "wizmap", "map the level", @@ -5043,7 +5141,7 @@ const char *s; char dirsym; int is_mov; -retry: + retry: if (g.in_doagain || *readchar_queue) dirsym = readchar(); else @@ -6038,19 +6136,27 @@ const char *prompt; to give the go-ahead for this query; default is "no" unless the ParanoidConfirm flag is set in which case there's no default */ if (be_paranoid) { - char qbuf[QBUFSZ], ans[BUFSZ] = DUMMY; - const char *promptprefix = "", *responsetype = ParanoidConfirm - ? "(yes|no)" - : "(yes) [no]"; - int trylimit = 6; /* 1 normal, 5 more with "Yes or No:" prefix */ + char pbuf[BUFSZ], qbuf[QBUFSZ], ans[BUFSZ]; + const char *promptprefix = "", + *responsetype = ParanoidConfirm ? "(yes|no)" : "(yes) [no]"; + int k, trylimit = 6; /* 1 normal, 5 more with "Yes or No:" prefix */ + copynchars(pbuf, prompt, BUFSZ - 1); /* in addition to being paranoid about this particular query, we might be even more paranoid about all paranoia responses (ie, ParanoidConfirm is set) in which case we require "no" to reject in addition to "yes" to confirm (except we won't loop if response is ESC; it means no) */ do { - Sprintf(qbuf, "%s%s %s", promptprefix, prompt, responsetype); + /* make sure we won't overflow a QBUFSZ sized buffer */ + k = (int) (strlen(promptprefix) + 1 + strlen(responsetype)); + if ((int) strlen(pbuf) + k > QBUFSZ - 1) { + /* chop off some at the end */ + Strcpy(pbuf + (QBUFSZ - 1) - k - 4, "...?"); /* -4: "...?" */ + } + + Sprintf(qbuf, "%s%s %s", promptprefix, pbuf, responsetype); + *ans = '\0'; getlin(qbuf, ans); (void) mungspaces(ans); confirmed_ok = !strcmpi(ans, "yes"); diff --git a/src/decl.c b/src/decl.c index 76c7a0bad..8ae9aa6c7 100644 --- a/src/decl.c +++ b/src/decl.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 decl.c $NHDT-Date: 1547025164 2019/01/09 09:12:44 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.141 $ */ +/* NetHack 3.6 decl.c $NHDT-Date: 1573869062 2019/11/16 01:51:02 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.149 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2009. */ /* NetHack may be freely redistributed. See license for details. */ @@ -40,6 +40,7 @@ NEARDATA struct obj *uwep, *uarm, *uswapwep, #ifdef TEXTCOLOR /* * This must be the same order as used for buzz() in zap.c. + * (They're only used in mapglyph.c so probably shouldn't be here.) */ const int zapcolors[NUM_ZAP] = { HI_ZAP, /* 0 - missile */ @@ -48,8 +49,10 @@ const int zapcolors[NUM_ZAP] = { HI_ZAP, /* 3 - sleep */ CLR_BLACK, /* 4 - death */ CLR_WHITE, /* 5 - lightning */ - CLR_YELLOW, /* 6 - poison gas */ - CLR_GREEN, /* 7 - acid */ + /* 3.6.3: poison gas zap used to be yellow and acid zap was green, + which conflicted with the corresponding dragon colors */ + CLR_GREEN, /* 6 - poison gas */ + CLR_YELLOW, /* 7 - acid */ }; #endif /* text color */ @@ -105,9 +108,17 @@ const char *materialnm[] = { "mysterious", "liquid", "wax", "organic", "platinum", "mithril", "plastic", "glass", "gemstone", "stone" }; +char emptystr[] = {0}; /* non-const */ + /* Global windowing data, defined here for multi-window-system support */ NEARDATA winid WIN_MESSAGE, WIN_STATUS, WIN_MAP, WIN_INVEN; - +#ifdef WIN32 +boolean fqn_prefix_locked[PREFIX_COUNT] = { FALSE, FALSE, FALSE, + FALSE, FALSE, FALSE, + FALSE, FALSE, FALSE, + FALSE }; +#endif + #ifdef PREFIXES_IN_USE const char *fqn_prefix_names[PREFIX_COUNT] = { "hackdir", "leveldir", "savedir", "bonesdir", "datadir", @@ -388,8 +399,10 @@ const struct instance_globals g_init = { DUMMY, /* symset */ 0, /* currentgraphics */ DUMMY, /* showsyms */ - DUMMY, /* l_syms */ - DUMMY, /* r_syms */ + DUMMY, /* primary_syms */ + DUMMY, /* rogue_syms */ + DUMMY, /* ov_primary_syms */ + DUMMY, /* ov_rogue_syms */ DUMMY, /* warnsyms */ /* dungeon.c */ @@ -563,8 +576,6 @@ const struct instance_globals g_init = { /* questpgr.c */ UNDEFINED_VALUES, /* cvt_buf */ - UNDEFINED_VALUES, /* qt_list */ - UNDEFINED_PTR, /* msg_file */ UNDEFINED_VALUES, /* nambuf */ /* read.c */ @@ -619,7 +630,8 @@ const struct instance_globals g_init = { NULL, /* lev_message */ NULL, /* lregions */ 0, /* num_lregions */ - UNDEFINED_VALUES, /* SplLev_Map */ + UNDEFINED_VALUES, /* SpLev_Map */ + NULL, /* coder */ UNDEFINED_VALUE, /* xstart */ UNDEFINED_VALUE, /* ystart */ UNDEFINED_VALUE, /* xsize */ @@ -631,7 +643,6 @@ const struct instance_globals g_init = { { UNDEFINED_PTR }, /* container_obj */ 0, /* container_idx */ NULL, /* invent_carrying_monster */ - { AM_CHAOTIC, AM_NEUTRAL, AM_LAWFUL }, /* ralign */ /* spells.c */ 0, /* spl_sortmode */ @@ -680,6 +691,13 @@ const struct instance_globals g_init = { UNDEFINED_VALUE, /* poly_zap */ UNDEFINED_VALUE, /* obj_zapped */ + /* new */ + DUMMY, /* lua_ver[LUA_VER_BUFSIZ] */ + DUMMY, /* lua_copyright[LUA_COPYRIGHT_BUFSIZ] */ + + /* per-level glyph mapping flags */ + 0L, /* glyphmap_perlevel_flags */ + IVMAGIC /* used to validate that structure layout has been preserved */ }; diff --git a/src/detect.c b/src/detect.c index f2e08aa0f..4e04d3f64 100644 --- a/src/detect.c +++ b/src/detect.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 detect.c $NHDT-Date: 1562630266 2019/07/08 23:57:46 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.96 $ */ +/* NetHack 3.6 detect.c $NHDT-Date: 1575245054 2019/12/02 00:04:14 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.100 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -598,13 +598,13 @@ int class; /* an object class, 0 for all */ } /* Special boulder symbol check - does the class symbol happen - * to match iflags.bouldersym which is a user-defined? + * to match showsyms[SYM_BOULDER + SYM_OFF_X] which is user-defined. * If so, that means we aren't sure what they really wanted to * detect. Rather than trump anything, show both possibilities. * We can exclude checking the buried obj chain for boulders below. */ sym = class ? def_oc_syms[class].sym : 0; - if (sym && iflags.bouldersym && sym == iflags.bouldersym) + if (sym && g.showsyms[SYM_BOULDER + SYM_OFF_X] && sym == g.showsyms[SYM_BOULDER + SYM_OFF_X]) boulder = ROCK_CLASS; if (Hallucination || (Confusion && class == SCROLL_CLASS)) @@ -1206,7 +1206,8 @@ struct obj **optr; ret = object_detect((struct obj *) 0, class); else if ((class = def_char_to_monclass(ch)) != MAXMCLASSES) ret = monster_detect((struct obj *) 0, class); - else if (iflags.bouldersym && (ch == iflags.bouldersym)) + else if (g.showsyms[SYM_BOULDER + SYM_OFF_X] + && (ch == g.showsyms[SYM_BOULDER + SYM_OFF_X])) ret = object_detect((struct obj *) 0, ROCK_CLASS); else switch (ch) { @@ -1333,7 +1334,7 @@ struct obj *sobj; /* scroll--actually fake spellbook--object */ * Unlike when casting the spell, it is much too intrustive when * in the midst of walking around or combatting monsters. * - * For 3.6.2, show terrain, then object, then monster like regular + * As of 3.6.2, show terrain, then object, then monster like regular * map updating, except in this case the map locations get marked * as seen from every direction rather than just from direction of * hero. Skilled spell marks revealed objects as 'seen up close' @@ -1413,8 +1414,13 @@ struct obj *sobj; /* scroll--actually fake spellbook--object */ continue; newglyph = glyph_at(zx, zy); if (glyph_is_monster(newglyph) - && glyph_to_mon(newglyph) != PM_LONG_WORM_TAIL) - map_invisible(zx, zy); + && glyph_to_mon(newglyph) != PM_LONG_WORM_TAIL) { + /* map_invisible() was unconditional here but that made + remembered objects be forgotten for the case where a + monster is immediately redrawn by see_monsters() */ + if ((mtmp = m_at(zx, zy)) == 0 || !canspotmon(mtmp)) + map_invisible(zx, zy); + } } see_monsters(); @@ -1929,7 +1935,7 @@ dump_map() glyph = reveal_terrain_getglyph(x, y, FALSE, u.uswallow, default_glyph, subset); - (void) mapglyph(glyph, &ch, &color, &special, x, y); + (void) mapglyph(glyph, &ch, &color, &special, x, y, 0); buf[x - 1] = ch; if (ch != ' ') { blankrow = FALSE; diff --git a/src/dig.c b/src/dig.c index 90c44caa6..802af8968 100644 --- a/src/dig.c +++ b/src/dig.c @@ -1167,7 +1167,7 @@ struct obj *obj; You("cannot stay under%s long enough.", is_pool(u.ux, u.uy) ? "water" : " the lava"); } else if ((trap = t_at(u.ux, u.uy)) != 0 - && uteetering_at_seen_pit(trap)) { + && (uteetering_at_seen_pit(trap) || uescaped_shaft(trap))) { dotrap(trap, FORCEBUNGLE); /* might escape trap and still be teetering at brink */ if (!u.utrap) diff --git a/src/display.c b/src/display.c index fc8977f01..35e1f41a0 100644 --- a/src/display.c +++ b/src/display.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 display.c $NHDT-Date: 1567213890 2019/08/31 01:11:30 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.106 $ */ +/* NetHack 3.6 display.c $NHDT-Date: 1574882660 2019/11/27 19:24:20 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.108 $ */ /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */ /* and Dave Cohrs, 1990. */ /* NetHack may be freely redistributed. See license for details. */ @@ -123,6 +123,7 @@ */ #include "hack.h" +static void FDECL(show_mon_or_warn, (int, int, int)); static void FDECL(display_monster, (XCHAR_P, XCHAR_P, struct monst *, int, XCHAR_P)); static int FDECL(swallow_to_glyph, (int, int)); @@ -361,6 +362,25 @@ int x, y, show; _map_location(x, y, show); } +/* display something on monster layer; may need to fixup object layer */ +static void +show_mon_or_warn(x, y, monglyph) +int x, y, monglyph; +{ + struct obj *o; + + /* "remembered, unseen monster" is tracked by object layer so if we're + putting something on monster layer at same spot, stop remembering + that; if an object is in view there, start remembering it instead */ + if (glyph_is_invisible(levl[x][y].glyph)) { + unmap_object(x, y); + if (cansee(x, y) && (o = vobj_at(x, y)) != 0) + map_object(o, FALSE); + } + + show_glyph(x, y, monglyph); +} + #define DETECTED 2 #define PHYSICALLY_SEEN 1 #define is_worm_tail(mon) ((mon) && ((x != (mon)->mx) || (y != (mon)->my))) @@ -477,7 +497,7 @@ xchar worm_tail; /* mon is actually a worm tail */ else num = mon_to_glyph(mon, rn2_on_display_rng); } - show_glyph(x, y, num); + show_mon_or_warn(x, y, num); } } @@ -507,14 +527,7 @@ register struct monst *mon; impossible("display_warning did not match warning type?"); return; } - /* warning glyph is drawn on the monster layer; unseen - monster glyph is drawn on the object/trap/floor layer; - if we see a 'warning' move onto 'remembered, unseen' we - need to explicitly remove that in order for it to not - reappear when the warned-of monster moves off that spot */ - if (glyph_is_invisible(levl[x][y].glyph)) - unmap_object(x, y); - show_glyph(x, y, glyph); + show_mon_or_warn(x, y, glyph); } int @@ -762,12 +775,19 @@ register int x, y; */ lev->waslit = (lev->lit != 0); /* remember lit condition */ - /* normal region shown only on accessible positions, but poison clouds - * also shown above lava, pools and moats. + mon = m_at(x, y); + worm_tail = is_worm_tail(mon); + + /* + * Normal region shown only on accessible positions, but + * poison clouds also shown above lava, pools and moats. + * However, sensed monsters take precedence over all regions. */ - if (reg && (ACCESSIBLE(lev->typ) - || (reg->glyph == cmap_to_glyph(S_poisoncloud) - && is_pool_or_lava(x, y)))) { + if (reg + && (ACCESSIBLE(lev->typ) + || (reg->glyph == cmap_to_glyph(S_poisoncloud) + && is_pool_or_lava(x, y))) + && (!mon || worm_tail || !sensemon(mon))) { show_region(reg, x, y); return; } @@ -782,8 +802,6 @@ register int x, y; if (see_self) display_self(); } else { - mon = m_at(x, y); - worm_tail = is_worm_tail(mon); see_it = mon && (mon_visible(mon) || (!worm_tail && (tp_sensemon(mon) || MATCH_WARN_OF_MON(mon)))); diff --git a/src/do.c b/src/do.c index f1a515c61..98a8ff3f2 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do.c $NHDT-Date: 1559670603 2019/06/04 17:50:03 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.192 $ */ +/* NetHack 3.6 do.c $NHDT-Date: 1576638499 2019/12/18 03:08:19 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.198 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -6,7 +6,6 @@ /* Contains code for 'd', 'D' (drop), '>', '<' (up, down) */ #include "hack.h" -#include "lev.h" static void FDECL(trycall, (struct obj *)); static void NDECL(polymorph_sink); @@ -165,7 +164,7 @@ const char *verb; since trapped target is a sitting duck */ int damage, dieroll = 1; - /* 3.6.2: this was calling hmon() unconditionally + /* As of 3.6.2: this was calling hmon() unconditionally so always credited/blamed the hero but the boulder might have been thrown by a giant or launched by a rolling boulder trap triggered by a monster or @@ -244,12 +243,13 @@ const char *verb; } return water_damage(obj, NULL, FALSE) == ER_DESTROYED; } else if (u.ux == x && u.uy == y && (t = t_at(x, y)) != 0 - && uteetering_at_seen_pit(t)) { + && (uteetering_at_seen_pit(t) || uescaped_shaft(t))) { if (Blind && !Deaf) You_hear("%s tumble downwards.", the(xname(obj))); else - pline("%s %s into %s pit.", The(xname(obj)), - otense(obj, "tumble"), the_your[t->madeby_u]); + pline("%s %s into %s %s.", The(xname(obj)), + otense(obj, "tumble"), the_your[t->madeby_u], + is_pit(t->ttyp) ? "pit" : "hole"); } else if (obj->globby) { /* Globby things like puddings might stick together */ while (obj && (otmp = obj_nexto_xy(obj, x, y, TRUE)) != 0) { @@ -307,6 +307,7 @@ polymorph_sink() { uchar sym = S_sink; boolean sinklooted; + int algn; if (levl[u.ux][u.uy].typ != SINK) return; @@ -333,7 +334,11 @@ polymorph_sink() case 2: sym = S_altar; levl[u.ux][u.uy].typ = ALTAR; - levl[u.ux][u.uy].altarmask = Align2amask(rn2((int) A_LAWFUL + 2) - 1); + /* 3.6.3: this used to pass 'rn2(A_LAWFUL + 2) - 1' to + Align2amask() but that evaluates its argument more than once */ + algn = rn2(3) - 1; /* -1 (A_Cha) or 0 (A_Neu) or +1 (A_Law) */ + levl[u.ux][u.uy].altarmask = ((Inhell && rn2(3)) ? AM_NONE + : Align2amask(algn)); break; case 3: sym = S_room; @@ -989,9 +994,27 @@ dodown() : surface(u.ux, u.uy)); return 0; /* didn't move */ } + + if (Upolyd && ceiling_hider(&mons[u.umonnum]) && u.uundetected) { + u.uundetected = 0; + if (Flying) { /* lurker above */ + You("fly out of hiding."); + } else { /* piercer */ + You("drop to the %s.", surface(u.ux, u.uy)); + if (is_pool_or_lava(u.ux, u.uy)) { + pooleffects(FALSE); + } else { + (void) pickup(1); + if ((trap = t_at(u.ux, u.uy)) != 0) + dotrap(trap, TOOKPLUNGE); + } + } + return 1; /* came out of hiding; might need '>' again to go down */ + } + if (!stairs_down && !ladder_down) { trap = t_at(u.ux, u.uy); - if (trap && uteetering_at_seen_pit(trap)) { + if (trap && (uteetering_at_seen_pit(trap) || uescaped_shaft(trap))) { dotrap(trap, TOOKPLUNGE); return 1; } else if (!trap || !is_hole(trap->ttyp) @@ -1273,15 +1296,22 @@ boolean at_stairs, falling, portal; * -1 11.46 12.50 12.5 * -2 5.21 4.17 0.0 * -3 2.08 0.0 0.0 + * + * 3.7.0: the chance for the "mysterious force" to kick in goes down + * as it kicks in, starting at 25% per climb attempt and dropping off + * gradually but substantially. The drop off is greater when hero is + * sent down farther so benefits lawfuls more than chaotics this time. */ if (Inhell && up && u.uhave.amulet && !newdungeon && !portal && (dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz) - 3)) { - if (!rn2(4)) { + if (!rn2(4 + g.context.mysteryforce)) { int odds = 3 + (int) u.ualign.type, /* 2..4 */ - diff = odds <= 1 ? 0 : rn2(odds); /* paranoia */ + diff = (odds <= 1) ? 0 : rn2(odds); /* paranoia */ if (diff != 0) { assign_rnd_level(newlevel, &u.uz, diff); + /* assign_rnd_level() may have used a value less than diff */ + diff = u.uz.dlevel - newlevel->dlevel; /* actual descent */ /* if inside the tower, stay inside */ if (was_in_W_tower && !On_W_tower_level(newlevel)) diff = 0; @@ -1289,15 +1319,20 @@ boolean at_stairs, falling, portal; if (diff == 0) assign_level(newlevel, &u.uz); - new_ledger = ledger_no(newlevel); - pline("A mysterious force momentarily surrounds you..."); + /* each time it kicks in, the chance of doing so again may drop; + that drops faster, on average, when being sent down farther so + while the impact is reduced for everybody compared to earlier + versions, it is reduced least for chaotics, most for lawfuls */ + g.context.mysteryforce += rn2(diff + 2); /* L:0-4, N:0-3, C:0-2 */ + if (on_level(newlevel, &u.uz)) { (void) safe_teleds(FALSE); (void) next_to_u(); return; - } else - at_stairs = g.at_ladder = FALSE; + } + new_ledger = ledger_no(newlevel); + at_stairs = g.at_ladder = FALSE; } } @@ -1572,6 +1607,7 @@ boolean at_stairs, falling, portal; /* Reset the screen. */ vision_reset(); /* reset the blockages */ + g.glyphmap_perlevel_flags = 0L; /* force per-level mapglyph() changes */ docrt(); /* does a full vision recalc */ flush_screen(-1); @@ -1663,9 +1699,9 @@ boolean at_stairs, falling, portal; || g.quest_status.leader_is_dead)) { if (!u.uevent.qcalled) { u.uevent.qcalled = 1; - com_pager(2); /* main "leader needs help" message */ + com_pager("quest_portal"); /* main "leader needs help" message */ } else { /* reminder message */ - com_pager(Role_if(PM_ROGUE) ? 4 : 3); + com_pager(Role_if(PM_ROGUE) ? "quest_portal_demand" : "quest_portal_again"); } } } diff --git a/src/do_name.c b/src/do_name.c index 9917dac23..cf812daa3 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do_name.c $NHDT-Date: 1560611967 2019/06/15 15:19:27 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.149 $ */ +/* NetHack 3.6 do_name.c $NHDT-Date: 1574648939 2019/11/25 02:28:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.167 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -306,7 +306,7 @@ gloc_filter_init() { if (iflags.getloc_filter == GFILTER_AREA) { if (!g.gloc_filter_map) { - g.gloc_filter_map = selection_opvar((char *) 0); + g.gloc_filter_map = selection_new(); } /* special case: if we're in a doorway, try to figure out which direction we're moving, and use that side of the doorway */ @@ -326,8 +326,8 @@ void gloc_filter_done() { if (g.gloc_filter_map) { - opvar_free_x(g.gloc_filter_map); - g.gloc_filter_map = (struct opvar *) 0; + selection_free(g.gloc_filter_map); + g.gloc_filter_map = (struct selectionvar *) 0; } } @@ -1468,6 +1468,7 @@ struct obj *obj; if (!obj->dknown) return; /* probably blind */ + flush_screen(1); /* buffered updates might matter to player's response */ if (obj->oclass == POTION_CLASS && obj->fromsink) /* kludge, meaning it's sink water */ @@ -1733,8 +1734,8 @@ boolean called; Strcat(buf, "saddled "); has_adjectives = (buf[0] != '\0'); - /* Put the actual monster name or type into the buffer now */ - /* Be sure to remember whether the buffer starts with a name */ + /* Put the actual monster name or type into the buffer now. + Remember whether the buffer starts with a personal name. */ if (do_hallu) { char rnamecode; char *rname = rndmonnam(&rnamecode); @@ -1958,7 +1959,7 @@ struct monst *mon, *other_mon; outbuf = mon_nam(mon); } else { outbuf = nextmbuf(); - switch (pronoun_gender(mon, FALSE)) { + switch (pronoun_gender(mon, PRONOUN_HALLU)) { case 0: Strcpy(outbuf, "himself"); break; @@ -1966,23 +1967,96 @@ struct monst *mon, *other_mon; Strcpy(outbuf, "herself"); break; default: + case 2: Strcpy(outbuf, "itself"); break; + case 3: /* could happen when hallucinating */ + Strcpy(outbuf, "themselves"); + break; } } return outbuf; } +/* construct " {him|her|it}self" which might + be distorted by Hallu; if that's plural, adjust monnamtext and verb */ +char * +monverbself(mon, monnamtext, verb, othertext) +struct monst *mon; +char *monnamtext; /* modifiable 'mbuf' with adequare room at end */ +const char *verb, *othertext; +{ + char *verbs, selfbuf[40]; /* sizeof "themselves" suffices */ + + /* "himself"/"herself"/"itself", maybe "themselves" if hallucinating */ + Strcpy(selfbuf, mon_nam_too(mon, mon)); + /* verb starts plural; this will yield singular except for "themselves" */ + verbs = vtense(selfbuf, verb); + if (!strcmp(verb, verbs)) { /* a match indicates that it stayed plural */ + monnamtext = makeplural(monnamtext); + /* for "it", makeplural() produces "them" but we want "they" */ + if (!strcmpi(monnamtext, genders[3].he)) { + boolean capitaliz = (monnamtext[0] == highc(monnamtext[0])); + + Strcpy(monnamtext, genders[3].him); + if (capitaliz) + monnamtext[0] = highc(monnamtext[0]); + } + } + Strcat(strcat(monnamtext, " "), verbs); + if (othertext && *othertext) + Strcat(strcat(monnamtext, " "), othertext); + Strcat(strcat(monnamtext, " "), selfbuf); + return monnamtext; +} + +/* for debugging messages, where data might be suspect and we aren't + taking what the hero does or doesn't know into consideration */ +char * +minimal_monnam(mon, ckloc) +struct monst *mon; +boolean ckloc; +{ + struct permonst *ptr; + char *outbuf = nextmbuf(); + + if (!mon) { + Strcpy(outbuf, "[Null monster]"); + } else if ((ptr = mon->data) == 0) { + Strcpy(outbuf, "[Null mon->data]"); + } else if (ptr < &mons[0]) { + Sprintf(outbuf, "[Invalid mon->data %s < %s]", + fmt_ptr((genericptr_t) mon->data), + fmt_ptr((genericptr_t) &mons[0])); + } else if (ptr >= &mons[NUMMONS]) { + Sprintf(outbuf, "[Invalid mon->data %s >= %s]", + fmt_ptr((genericptr_t) mon->data), + fmt_ptr((genericptr_t) &mons[NUMMONS])); + } else if (ckloc && ptr == &mons[PM_LONG_WORM] + && g.level.monsters[mon->mx][mon->my] != mon) { + Sprintf(outbuf, "%s <%d,%d>", + mons[PM_LONG_WORM_TAIL].mname, mon->mx, mon->my); + } else { + Sprintf(outbuf, "%s%s <%d,%d>", + mon->mtame ? "tame " : mon->mpeaceful ? "peaceful " : "", + mon->data->mname, mon->mx, mon->my); + if (mon->cham != NON_PM) + Sprintf(eos(outbuf), "{%s}", mons[mon->cham].mname); + } + return outbuf; +} + /* fake monsters used to be in a hard-coded array, now in a data file */ static char * bogusmon(buf, code) char *buf, *code; { + static const char bogon_codes[] = "-_+|="; /* see dat/bonusmon.txt */ char *mname = buf; get_rnd_text(BOGUSMONFILE, buf, rn2_on_display_rng); /* strip prefix if present */ - if (!letter(*mname)) { + if (index(bogon_codes, *mname)) { if (code) *code = *mname; ++mname; diff --git a/src/do_wear.c b/src/do_wear.c index ec9751c2c..584d9fb7c 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do_wear.c $NHDT-Date: 1559670603 2019/06/04 17:50:03 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.109 $ */ +/* NetHack 3.6 do_wear.c $NHDT-Date: 1575768410 2019/12/08 01:26:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.126 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -44,6 +44,16 @@ static int FDECL(accessory_or_armor_on, (struct obj *)); static void FDECL(already_wearing, (const char *)); static void FDECL(already_wearing2, (const char *, const char *)); +/* plural "fingers" or optionally "gloves" */ +const char * +fingers_or_gloves(check_gloves) +boolean check_gloves; +{ + return ((check_gloves && uarmg) + ? gloves_simple_name(uarmg) /* "gloves" or "gauntlets" */ + : makeplural(body_part(FINGER))); /* "fingers" */ +} + void off_msg(otmp) struct obj *otmp; @@ -182,18 +192,24 @@ Boots_on(VOID_ARGS) break; case LEVITATION_BOOTS: if (!oldprop && !HLevitation && !(BLevitation & FROMOUTSIDE)) { + uarmf->known = 1; /* might come off if putting on over a sink, + * so uarmf could be Null below; status line + * gets updated during brief interval they're + * worn so hero and player learn enchantment */ + g.context.botl = 1; /* status hilites might mark AC changed */ makeknown(uarmf->otyp); float_up(); if (Levitation) spoteffects(FALSE); /* for sink effect */ } else { - float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */ + float_vs_flight(); /* maybe toggle BFlying's I_SPECIAL */ } break; default: impossible(unknown_type, c_boots, uarmf->otyp); } - uarmf->known = 1; /* boots' +/- evident because of status line AC */ + if (uarmf) /* could be Null here (levitation boots put on over a sink) */ + uarmf->known = 1; /* boots' +/- evident because of status line AC */ return 0; } @@ -307,7 +323,8 @@ Cloak_on(VOID_ARGS) default: impossible(unknown_type, c_cloak, uarmc->otyp); } - uarmc->known = 1; /* cloak's +/- evident because of status line AC */ + if (uarmc) /* no known instance of !uarmc here but play it safe */ + uarmc->known = 1; /* cloak's +/- evident because of status line AC */ return 0; } @@ -379,24 +396,24 @@ Helmet_on(VOID_ARGS) adj_abon(uarmh, uarmh->spe); break; case CORNUTHAUM: - /* people think marked wizards know what they're talking - * about, but it takes trained arrogance to pull it off, - * and the actual enchantment of the hat is irrelevant. - */ + /* people think marked wizards know what they're talking about, + but it takes trained arrogance to pull it off, and the actual + enchantment of the hat is irrelevant */ ABON(A_CHA) += (Role_if(PM_WIZARD) ? 1 : -1); g.context.botl = 1; makeknown(uarmh->otyp); break; case HELM_OF_OPPOSITE_ALIGNMENT: uarmh->known = 1; /* do this here because uarmh could get cleared */ - /* changing alignment can toggle off active artifact - properties, including levitation; uarmh could get - dropped or destroyed here */ + /* changing alignment can toggle off active artifact properties, + including levitation; uarmh could get dropped or destroyed here + by hero falling onto a polymorph trap or into water (emergency + disrobe) or maybe lava (probably not, helm isn't 'organic') */ uchangealign((u.ualign.type != A_NEUTRAL) ? -u.ualign.type : (uarmh->o_id % 2) ? A_CHAOTIC : A_LAWFUL, 1); - /* makeknown(uarmh->otyp); -- moved below, after xname() */ + /* makeknown(HELM_OF_OPPOSITE_ALIGNMENT); -- below, after Tobjnam() */ /*FALLTHRU*/ case DUNCE_CAP: if (uarmh && !uarmh->cursed) { @@ -417,14 +434,14 @@ Helmet_on(VOID_ARGS) ? "like sitting in a corner" : "giddy"); } else { - /* [message moved to uchangealign()] */ + /* [message formerly given here moved to uchangealign()] */ makeknown(HELM_OF_OPPOSITE_ALIGNMENT); } break; default: impossible(unknown_type, c_helmet, uarmh->otyp); } - /* uarmh could be zero due to uchangealign() */ + /* uarmh could be Null due to uchangealign() */ if (uarmh) uarmh->known = 1; /* helmet's +/- evident because of status line AC */ return 0; @@ -499,7 +516,8 @@ Gloves_on(VOID_ARGS) default: impossible(unknown_type, c_gloves, uarmg->otyp); } - uarmg->known = 1; /* gloves' +/- evident because of status line AC */ + if (uarmg) /* no known instance of !uarmg here but play it safe */ + uarmg->known = 1; /* gloves' +/- evident because of status line AC */ return 0; } @@ -558,6 +576,14 @@ Gloves_off(VOID_ARGS) g.context.takeoff.cancelled_don = FALSE; (void) encumber_msg(); /* immediate feedback for GoP */ + /* usually can't remove gloves when they're slippery but it can + be done by having them fall off (polymorph), stolen, or + destroyed (scroll, overenchantment, monster spell); if that + happens, 'cure' slippery fingers so that it doesn't transfer + from gloves to bare hands */ + if (Glib) + make_glib(0); /* for update_inventory() */ + /* prevent wielding cockatrice when not wearing gloves */ if (uwep && uwep->otyp == CORPSE) wielding_corpse(uwep, on_purpose); @@ -590,7 +616,8 @@ Shield_on(VOID_ARGS) default: impossible(unknown_type, c_shield, uarms->otyp); } - uarms->known = 1; /* shield's +/- evident because of status line AC */ + if (uarms) /* no known instance of !uarmgs here but play it safe */ + uarms->known = 1; /* shield's +/- evident because of status line AC */ return 0; } @@ -630,7 +657,8 @@ Shirt_on(VOID_ARGS) default: impossible(unknown_type, c_shirt, uarmu->otyp); } - uarmu->known = 1; /* shirt's +/- evident because of status line AC */ + if (uarmu) /* no known instances of !uarmu here but play it safe */ + uarmu->known = 1; /* shirt's +/- evident because of status line AC */ return 0; } @@ -662,7 +690,8 @@ Armor_on(VOID_ARGS) * suits are set up as intrinsics (actually 'extrinsics') by setworn() * which is called by armor_or_accessory_on() before Armor_on(). */ - uarm->known = 1; /* suit's +/- evident because of status line AC */ + if (uarm) /* no known instances of !uarm here but play it safe */ + uarm->known = 1; /* suit's +/- evident because of status line AC */ return 0; } @@ -1097,7 +1126,7 @@ struct obj *otmp; boolean already_blind = Blind, changed = FALSE; /* blindfold might be wielded; release it for wearing */ - if (otmp->owornmask & W_WEAPON) + if (otmp->owornmask & W_WEAPONS) remove_worn_item(otmp, FALSE); setworn(otmp, W_TOOL); on_msg(otmp); @@ -1435,11 +1464,11 @@ struct obj *obj; return 0; } - reset_remarm(); /* clear g.context.takeoff.mask and g.context.takeoff.what */ + reset_remarm(); /* clear context.takeoff.mask and context.takeoff.what */ (void) select_off(obj); if (!g.context.takeoff.mask) return 0; - /* none of armoroff()/Ring_/Amulet/Blindf_off() use g.context.takeoff.mask */ + /* none of armoroff()/Ring_/Amulet/Blindf_off() use context.takeoff.mask */ reset_remarm(); if (obj->owornmask & W_ARMOR) { @@ -1525,7 +1554,15 @@ struct obj *otmp; boolean use_plural = (is_boots(otmp) || is_gloves(otmp) || otmp->otyp == LENSES || otmp->quan > 1L); - You("can't. %s cursed.", use_plural ? "They are" : "It is"); + /* might be trying again after applying grease to hands */ + if (Glib && otmp->bknown + /* for weapon, we'll only get here via 'A )' */ + && (uarmg ? (otmp == uwep) + : ((otmp->owornmask & (W_WEP | W_RING)) != 0))) + pline("Despite your slippery %s, you can't.", + fingers_or_gloves(TRUE)); + else + You("can't. %s cursed.", use_plural ? "They are" : "It is"); set_bknown(otmp, 1); return 1; } @@ -1536,53 +1573,87 @@ int armoroff(otmp) struct obj *otmp; { - register int delay = -objects[otmp->otyp].oc_delay; + static char offdelaybuf[60]; + int delay = -objects[otmp->otyp].oc_delay; + const char *what = 0; if (cursed(otmp)) return 0; + /* this used to make assumptions about which types of armor had + delays and which didn't; now both are handled for all types */ if (delay) { nomul(delay); g.multi_reason = "disrobing"; - if (is_helmet(otmp)) { - /* ick... */ - g.nomovemsg = !strcmp(helm_simple_name(otmp), "hat") - ? "You finish taking off your hat." - : "You finish taking off your helmet."; - g.afternmv = Helmet_off; - } else if (is_gloves(otmp)) { - g.nomovemsg = "You finish taking off your gloves."; - g.afternmv = Gloves_off; - } else if (is_boots(otmp)) { - g.nomovemsg = "You finish taking off your boots."; - g.afternmv = Boots_off; - } else { - g.nomovemsg = "You finish taking off your suit."; + switch (objects[otmp->otyp].oc_armcat) { + case ARM_SUIT: + what = suit_simple_name(otmp); g.afternmv = Armor_off; + break; + case ARM_SHIELD: + what = shield_simple_name(otmp); + g.afternmv = Shield_off; + break; + case ARM_HELM: + what = helm_simple_name(otmp); + g.afternmv = Helmet_off; + break; + case ARM_GLOVES: + what = gloves_simple_name(otmp); + g.afternmv = Gloves_off; + break; + case ARM_BOOTS: + what = boots_simple_name(otmp); + g.afternmv = Boots_off; + break; + case ARM_CLOAK: + what = cloak_simple_name(otmp); + g.afternmv = Cloak_off; + break; + case ARM_SHIRT: + what = shirt_simple_name(otmp); + g.afternmv = Shirt_off; + break; + default: + impossible("Taking off unknown armor (%d: %d), delay %d", + otmp->otyp, objects[otmp->otyp].oc_armcat, delay); + break; + } + if (what) { + /* sizeof offdelaybuf == 60; increase it if this becomes longer */ + Sprintf(offdelaybuf, "You finish taking off your %s.", what); + g.nomovemsg = offdelaybuf; } } else { - /* Be warned! We want off_msg after removing the item to - * avoid "You were wearing ____ (being worn)." However, an - * item which grants fire resistance might cause some trouble - * if removed in Hell and lifesaving puts it back on; in this - * case the message will be printed at the wrong time (after - * the messages saying you died and were lifesaved). Luckily, - * no cloak, shield, or fast-removable armor grants fire - * resistance, so we can safely do the off_msg afterwards. - * Rings do grant fire resistance, but for rings we want the - * off_msg before removal anyway so there's no problem. Take - * care in adding armors granting fire resistance; this code - * might need modification. - * 3.2 (actually 3.1 even): that comment is obsolete since - * fire resistance is not required for Gehennom so setworn() - * doesn't force the resistance granting item to be re-worn - * after being lifesaved anymore. - */ - if (is_cloak(otmp)) - (void) Cloak_off(); - else if (is_shield(otmp)) + /* no delay so no '(*afternmv)()' or 'nomovemsg' */ + switch (objects[otmp->otyp].oc_armcat) { + case ARM_SUIT: + (void) Armor_off(); + break; + case ARM_SHIELD: (void) Shield_off(); - else - setworn((struct obj *) 0, otmp->owornmask & W_ARMOR); + break; + case ARM_HELM: + (void) Helmet_off(); + break; + case ARM_GLOVES: + (void) Gloves_off(); + break; + case ARM_BOOTS: + (void) Boots_off(); + break; + case ARM_CLOAK: + (void) Cloak_off(); + break; + case ARM_SHIRT: + (void) Shirt_off(); + break; + default: + impossible("Taking off unknown armor (%d: %d), no delay", + otmp->otyp, objects[otmp->otyp].oc_armcat); + break; + } + /* We want off_msg() after removing the item to + avoid "You were wearing ____ (being worn)." */ off_msg(otmp); } g.context.takeoff.mask = g.context.takeoff.what = 0L; @@ -1732,6 +1803,13 @@ boolean noisy; You("cannot wear gloves over your %s.", is_sword(uwep) ? c_sword : c_weapon); err++; + } else if (Glib) { + /* prevent slippery bare fingers from transferring to + gloved fingers */ + if (noisy) + Your("%s are too slippery to pull on %s.", + fingers_or_gloves(FALSE), gloves_simple_name(otmp)); + err++; } else *mask = W_ARMG; } else if (is_shirt(otmp)) { @@ -1829,7 +1907,7 @@ struct obj *obj; if (uleft && uright) { There("are no more %s%s to fill.", humanoid(g.youmonst.data) ? "ring-" : "", - makeplural(body_part(FINGER))); + fingers_or_gloves(FALSE)); return 0; } if (uleft) { @@ -1856,10 +1934,16 @@ struct obj *obj; } } while (!mask); } + if (uarmg && Glib) { + Your( + "%s are too slippery to remove, so you cannot put on the ring.", + gloves_simple_name(uarmg)); + return 1; /* always uses move */ + } if (uarmg && uarmg->cursed) { res = !uarmg->bknown; set_bknown(uarmg, 1); - You("cannot remove your gloves to put on the ring."); + You("cannot remove your %s to put on the ring.", c_gloves); return res; /* uses move iff we learned gloves are cursed */ } if (uwep) { @@ -1915,7 +1999,7 @@ struct obj *obj; /* if the armor is wielded, release it for wearing (won't be welded even if cursed; that only happens for weapons/weptools) */ - if (obj->owornmask & W_WEAPON) + if (obj->owornmask & W_WEAPONS) remove_worn_item(obj, FALSE); /* * Setting obj->known=1 is done because setworn() causes hero's AC @@ -2014,7 +2098,7 @@ doputon() /* 'P' message doesn't mention armor */ Your("%s%s are full, and you're already wearing an amulet and %s.", humanoid(g.youmonst.data) ? "ring-" : "", - makeplural(body_part(FINGER)), + fingers_or_gloves(FALSE), (ublindf->otyp == LENSES) ? "some lenses" : "a blindfold"); return 0; } @@ -2084,7 +2168,7 @@ glibr() /* changed so cursed rings don't fall off, GAN 10/30/86 */ Your("%s off your %s.", (leftfall && rightfall) ? "rings slip" : "ring slips", - (leftfall && rightfall) ? makeplural(body_part(FINGER)) + (leftfall && rightfall) ? fingers_or_gloves(FALSE) : body_part(FINGER)); xfl++; if (leftfall) { @@ -2206,6 +2290,10 @@ int otyp; return uarmg; if (ring->cursed) return ring; + /* normally outermost layer is processed first, but slippery gloves + wears off quickly so uncurse ring itself before handling those */ + if (uarmg && Glib) + return uarmg; } /* either no ring or not right type or nothing prevents its removal */ return (struct obj *) 0; @@ -2234,17 +2322,21 @@ register struct obj *otmp; /* special ring checks */ if (otmp == uright || otmp == uleft) { + struct obj glibdummy; + if (nolimbs(g.youmonst.data)) { pline_The("ring is stuck."); return 0; } + glibdummy = cg.zeroobj; why = 0; /* the item which prevents ring removal */ if (welded(uwep) && (otmp == uright || bimanual(uwep))) { Sprintf(buf, "free a weapon %s", body_part(HAND)); why = uwep; - } else if (uarmg && uarmg->cursed) { - Sprintf(buf, "take off your %s", c_gloves); - why = uarmg; + } else if (uarmg && (uarmg->cursed || Glib)) { + Sprintf(buf, "take off your %s%s", + Glib ? "slippery " : "", gloves_simple_name(uarmg)); + why = !Glib ? uarmg : &glibdummy; } if (why) { You("cannot %s to remove the ring.", buf); @@ -2260,8 +2352,9 @@ register struct obj *otmp; set_bknown(uwep, 1); return 0; } else if (Glib) { - You_cant("take off the slippery %s with your slippery %s.", - c_gloves, makeplural(body_part(FINGER))); + pline("%s %s are too slippery to take off.", + uarmg->unpaid ? "The" : "Your", /* simplified Shk_Your() */ + gloves_simple_name(uarmg)); return 0; } } @@ -2541,7 +2634,7 @@ doddoremarm() possibly combined with weapons */ (void) strncpy(g.context.takeoff.disrobing, "disrobing", CONTEXTVERBSZ); /* specific activity when handling weapons only */ - if (!(g.context.takeoff.mask & ~W_WEAPON)) + if (!(g.context.takeoff.mask & ~W_WEAPONS)) (void) strncpy(g.context.takeoff.disrobing, "disarming", CONTEXTVERBSZ); (void) take_off(); diff --git a/src/dog.c b/src/dog.c index a5946eb76..5b9cfed69 100644 --- a/src/dog.c +++ b/src/dog.c @@ -417,7 +417,7 @@ boolean with_you; break; } - if ((mtmp->mspare1 & MIGR_LEFTOVERS) != 0L) { + if ((mtmp->migflags & MIGR_LEFTOVERS) != 0L) { /* Pick up the rest of the MIGR_TO_SPECIES objects */ if (g.migrating_objs) deliver_obj_to_mon(mtmp, 0, DF_ALL); diff --git a/src/dogmove.c b/src/dogmove.c index e74c0a418..a70c9c70a 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -432,7 +432,7 @@ int udist; } else { if ((obj = g.level.objects[omx][omy]) != 0 && !index(nofetch, obj->oclass) -#ifdef MAIL +#ifdef MAIL_STRUCTURES && obj->otyp != SCR_MAIL #endif ) { diff --git a/src/dokick.c b/src/dokick.c index 7e89ddb8b..1260f87b6 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dokick.c $NHDT-Date: 1562462061 2019/07/07 01:14:21 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.133 $ */ +/* NetHack 3.6 dokick.c $NHDT-Date: 1575245057 2019/12/02 00:04:17 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.136 $ */ /* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1042,7 +1042,7 @@ dokick() return 1; } else if (!rn2(4)) { if (dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz)) { - fall_through(FALSE); + fall_through(FALSE, 0); return 1; } else goto ouch; @@ -1192,9 +1192,16 @@ dokick() exercise(A_DEX, TRUE); return 1; } else if (!rn2(3)) { - pline("Flupp! %s.", - (Blind ? "You hear a sloshing sound" - : "Muddy waste pops up from the drain")); + if (Blind && Deaf) + Sprintf(buf, " %s", body_part(FACE)); + else + buf[0] = '\0'; + pline("%s%s%s.", !Deaf ? "Flupp! " : "", + !Blind + ? "Muddy waste pops up from the drain" + : !Deaf + ? "You hear a sloshing sound" /* Deaf-aware */ + : "Something splashes you in the", buf); if (!(g.maploc->looted & S_LRING)) { /* once per sink */ if (!Blind) You_see("a ring shining in its midst."); @@ -1751,7 +1758,7 @@ long num; Strcpy(obuf, optr); if (num) { /* means: other objects are impacted */ - /* 3.6.2: use a separate buffer for the suffix to avoid risk of + /* As of 3.6.2: use a separate buffer for the suffix to avoid risk of overrunning obuf[] (let pline() handle truncation if necessary) */ Sprintf(xbuf, " %s %s object%s", otense(otmp, "hit"), (num == 1L) ? "another" : "other", (num > 1L) ? "s" : ""); diff --git a/src/dothrow.c b/src/dothrow.c index dacce7a87..6f401e0d1 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dothrow.c $NHDT-Date: 1569276989 2019/09/23 22:16:29 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.161 $ */ +/* NetHack 3.6 dothrow.c $NHDT-Date: 1573688688 2019/11/13 23:44:48 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.164 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1148,6 +1148,10 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */ will be left with a stale pointer. */ if (u.uswallow) { + if (obj == uball) { + uball->ox = uchain->ox = u.ux; + uball->oy = uchain->oy = u.uy; + } mon = u.ustuck; g.bhitpos.x = mon->mx; g.bhitpos.y = mon->my; @@ -1282,7 +1286,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */ (void) snuff_candle(obj); g.notonhead = (g.bhitpos.x != mon->mx || g.bhitpos.y != mon->my); obj_gone = thitmonst(mon, obj); - /* Monster may have been tamed; this frees old mon */ + /* Monster may have been tamed; this frees old mon [obsolete] */ mon = m_at(g.bhitpos.x, g.bhitpos.y); /* [perhaps this should be moved into thitmonst or hmon] */ @@ -1303,10 +1307,12 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */ swallowit: if (obj != uball) (void) mpickobj(u.ustuck, obj); /* clears 'g.thrownobj' */ + else + clear_thrownobj = TRUE; goto throwit_return; } else { - /* Mjollnir must we wielded to be thrown--caller verifies this; - aklys must we wielded as primary to return when thrown */ + /* Mjollnir must be wielded to be thrown--caller verifies this; + aklys must be wielded as primary to return when thrown */ if (iflags.returning_missile) { /* Mjollnir or aklys */ if (rn2(100)) { if (tethered_weapon) diff --git a/src/drawing.c b/src/drawing.c index dc59af9bd..8a97c4496 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 drawing.c $NHDT-Date: 1546656404 2019/01/05 02:46:44 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.59 $ */ +/* NetHack 3.6 drawing.c $NHDT-Date: 1573943500 2019/11/16 22:31:40 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.64 $ */ /* Copyright (c) NetHack Development Team 1992. */ /* NetHack may be freely redistributed. See license for details. */ @@ -19,7 +19,7 @@ const char invisexplain[] = "remembered, unseen, creature", altinvisexplain[] = "unseen creature"; /* for clairvoyance */ - + /* Default object class symbols. See objclass.h. * {symbol, name, explain} * name: used in object_detect(). @@ -246,9 +246,9 @@ static const uchar def_r_oc_syms[MAXOCLASSES] = { #undef C -#ifdef TERMLIB +#if defined(TERMLIB) || defined(CURSES_GRAPHICS) void NDECL((*decgraphics_mode_callback)) = 0; /* set in tty_start_screen() */ -#endif /* TERMLIB */ +#endif /* TERMLIB || CURSES */ #ifdef PC9800 void NDECL((*ibmgraphics_mode_callback)) = 0; /* set in tty_start_screen() */ @@ -291,13 +291,14 @@ char ch; return i; } +#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) /* * Explanations of the functions found below: * * init_symbols() * Sets the current display symbols, the * loadable symbols to the default NetHack - * symbols, including the r_syms rogue level + * symbols, including the rogue_syms rogue level * symbols. This would typically be done * immediately after execution begins. Any * previously loaded external symbol sets are @@ -313,8 +314,8 @@ char ch; * * If (arg != 0), which is the normal expected * usage, then showsyms are taken from the - * adjustable display symbols found in l_syms. - * l_syms may have been loaded from an external + * adjustable display symbols found in g.primary_syms. + * g.primary_syms may have been loaded from an external * symbol file by config file options or interactively * in the Options menu. * @@ -324,37 +325,33 @@ char ch; * out of other {rogue} level display modes. * * If arg is ROGUESET, this places the rogue level - * symbols from r_syms into showsyms. + * symbols from g.rogue_syms into g.showsyms. * * If arg is PRIMARY, this places the symbols - * from l_monsyms into showsyms. + * from g.primary_syms into g.showsyms. * - * update_l_symset() - * Update a member of the loadable (l_*) symbol set. + * update_primary_symset() + * Update a member of the primary(primary_*) symbol set. * - * update_r_symset() - * Update a member of the rogue (r_*) symbol set. + * update_rogue_symset() + * Update a member of the rogue (rogue_*) symbol set. + * + * update_ov_primary_symset() + * Update a member of the overrides for primary symbol set. + * + * update_ov_rogue_symset() + * Update a member of the overrides for rogue symbol set. * */ void init_symbols() { - init_l_symbols(); + init_ov_primary_symbols(); + init_ov_rogue_symbols(); + init_primary_symbols(); init_showsyms(); - init_r_symbols(); -} - -void -update_bouldersym() -{ - nhsym boulder = (nhsym) iflags.bouldersym; - - if (!boulder) - boulder = def_oc_syms[ROCK_CLASS].sym; /* (nhsym) ROCK_SYM */ - g.showsyms[SYM_BOULDER + SYM_OFF_X] = boulder; - g.l_syms[SYM_BOULDER + SYM_OFF_X] = boulder; - g.r_syms[SYM_BOULDER + SYM_OFF_X] = boulder; + init_rogue_symbols(); } void @@ -370,44 +367,78 @@ init_showsyms() g.showsyms[i + SYM_OFF_M] = def_monsyms[i].sym; for (i = 0; i < WARNCOUNT; i++) g.showsyms[i + SYM_OFF_W] = def_warnsyms[i].sym; - for (i = 0; i < MAXOTHER; i++) { - if (i == SYM_BOULDER) - g.showsyms[i + SYM_OFF_X] = iflags.bouldersym - ? iflags.bouldersym - : def_oc_syms[ROCK_CLASS].sym; - else if (i == SYM_INVISIBLE) - g.showsyms[i + SYM_OFF_X] = DEF_INVISIBLE; - } + for (i = 0; i < MAXOTHER; i++) + g.showsyms[i + SYM_OFF_X] = get_othersym(i, PRIMARY); } -/* initialize defaults for the loadable symset */ +/* initialize defaults for the overrides to the rogue symset */ void -init_l_symbols() +init_ov_rogue_symbols() +{ + register int i; + + for (i = 0; i < SYM_MAX; i++) + g.ov_rogue_syms[i] = (nhsym) 0; +} +/* initialize defaults for the overrides to the primary symset */ +void +init_ov_primary_symbols() +{ + register int i; + + for (i = 0; i < SYM_MAX; i++) + g.ov_primary_syms[i] = (nhsym) 0; +} + +nhsym +get_othersym(idx, which_set) +int idx, which_set; +{ + nhsym sym = (nhsym) 0; + int oidx = idx + SYM_OFF_X; + + if (which_set == ROGUESET) + sym = g.ov_rogue_syms[oidx] ? g.ov_rogue_syms[oidx] + : g.rogue_syms[oidx]; + else + sym = g.ov_primary_syms[oidx] ? g.ov_primary_syms[oidx] + : g.primary_syms[oidx]; + if (!sym) { + switch(idx) { + case SYM_BOULDER: + sym = def_oc_syms[ROCK_CLASS].sym; + break; + case SYM_INVISIBLE: + sym = DEF_INVISIBLE; + break; + } + } + return sym; +} + +/* initialize defaults for the primary symset */ +void +init_primary_symbols() { register int i; for (i = 0; i < MAXPCHARS; i++) - g.l_syms[i + SYM_OFF_P] = defsyms[i].sym; + g.primary_syms[i + SYM_OFF_P] = defsyms[i].sym; for (i = 0; i < MAXOCLASSES; i++) - g.l_syms[i + SYM_OFF_O] = def_oc_syms[i].sym; + g.primary_syms[i + SYM_OFF_O] = def_oc_syms[i].sym; for (i = 0; i < MAXMCLASSES; i++) - g.l_syms[i + SYM_OFF_M] = def_monsyms[i].sym; + g.primary_syms[i + SYM_OFF_M] = def_monsyms[i].sym; for (i = 0; i < WARNCOUNT; i++) - g.l_syms[i + SYM_OFF_W] = def_warnsyms[i].sym; - for (i = 0; i < MAXOTHER; i++) { - if (i == SYM_BOULDER) - g.l_syms[i + SYM_OFF_X] = iflags.bouldersym - ? iflags.bouldersym - : def_oc_syms[ROCK_CLASS].sym; - else if (i == SYM_INVISIBLE) - g.l_syms[i + SYM_OFF_X] = DEF_INVISIBLE; - } + g.primary_syms[i + SYM_OFF_W] = def_warnsyms[i].sym; + for (i = 0; i < MAXOTHER; i++) + g.primary_syms[i + SYM_OFF_X] = get_othersym(i, PRIMARY); clear_symsetentry(PRIMARY, FALSE); } +/* initialize defaults for the rogue symset */ void -init_r_symbols() +init_rogue_symbols() { register int i; @@ -415,24 +446,18 @@ init_r_symbols() later by the roguesymbols option */ for (i = 0; i < MAXPCHARS; i++) - g.r_syms[i + SYM_OFF_P] = defsyms[i].sym; - g.r_syms[S_vodoor] = g.r_syms[S_hodoor] = g.r_syms[S_ndoor] = '+'; - g.r_syms[S_upstair] = g.r_syms[S_dnstair] = '%'; + g.rogue_syms[i + SYM_OFF_P] = defsyms[i].sym; + g.rogue_syms[S_vodoor] = g.rogue_syms[S_hodoor] = g.rogue_syms[S_ndoor] = '+'; + g.rogue_syms[S_upstair] = g.rogue_syms[S_dnstair] = '%'; for (i = 0; i < MAXOCLASSES; i++) - g.r_syms[i + SYM_OFF_O] = def_r_oc_syms[i]; + g.rogue_syms[i + SYM_OFF_O] = def_r_oc_syms[i]; for (i = 0; i < MAXMCLASSES; i++) - g.r_syms[i + SYM_OFF_M] = def_monsyms[i].sym; + g.rogue_syms[i + SYM_OFF_M] = def_monsyms[i].sym; for (i = 0; i < WARNCOUNT; i++) - g.r_syms[i + SYM_OFF_W] = def_warnsyms[i].sym; - for (i = 0; i < MAXOTHER; i++) { - if (i == SYM_BOULDER) - g.r_syms[i + SYM_OFF_X] = iflags.bouldersym - ? iflags.bouldersym - : def_oc_syms[ROCK_CLASS].sym; - else if (i == SYM_INVISIBLE) - g.r_syms[i + SYM_OFF_X] = DEF_INVISIBLE; - } + g.rogue_syms[i + SYM_OFF_W] = def_warnsyms[i].sym; + for (i = 0; i < MAXOTHER; i++) + g.rogue_syms[i + SYM_OFF_X] = get_othersym(i, ROGUESET); clear_symsetentry(ROGUESET, FALSE); /* default on Rogue level is no color @@ -452,7 +477,8 @@ int whichset; /* Adjust graphics display characters on Rogue levels */ for (i = 0; i < SYM_MAX; i++) - g.showsyms[i] = g.r_syms[i]; + g.showsyms[i] = g.ov_rogue_syms[i] ? g.ov_rogue_syms[i] + : g.rogue_syms[i]; #if defined(MSDOS) && defined(USE_TILES) if (iflags.grmode) @@ -464,7 +490,8 @@ int whichset; case PRIMARY: default: for (i = 0; i < SYM_MAX; i++) - g.showsyms[i] = g.l_syms[i]; + g.showsyms[i] = g.ov_primary_syms[i] ? g.ov_primary_syms[i] + : g.primary_syms[i]; #if defined(MSDOS) && defined(USE_TILES) if (iflags.grmode) @@ -483,41 +510,63 @@ int nondefault; if (nondefault) { for (i = 0; i < SYM_MAX; i++) - g.showsyms[i] = g.l_syms[i]; + g.showsyms[i] = g.ov_primary_syms[i] ? g.ov_primary_syms[i] + : g.primary_syms[i]; #ifdef PC9800 if (SYMHANDLING(H_IBM) && ibmgraphics_mode_callback) (*ibmgraphics_mode_callback)(); - else if (!g.symset[g.currentgraphics].name && ascgraphics_mode_callback) + else if (SYMHANDLING(H_UNK) && ascgraphics_mode_callback) (*ascgraphics_mode_callback)(); #endif -#ifdef TERMLIB +#if defined(TERMLIB) || defined(CURSES_GRAPHICS) + /* curses doesn't assign any routine to dec..._callback but + probably does the expected initialization under the hood + for terminals capable of rendering DECgraphics */ if (SYMHANDLING(H_DEC) && decgraphics_mode_callback) (*decgraphics_mode_callback)(); -#endif # ifdef CURSES_GRAPHICS + /* there aren't any symbol sets with CURS handling, and the + curses interface never assigns a routine to curses..._callback */ if (SYMHANDLING(H_CURS) && cursesgraphics_mode_callback) (*cursesgraphics_mode_callback)(); # endif +#endif } else { - init_l_symbols(); + init_primary_symbols(); init_showsyms(); } } void -update_l_symset(symp, val) +update_ov_primary_symset(symp, val) struct symparse *symp; int val; { - g.l_syms[symp->idx] = val; + g.ov_primary_syms[symp->idx] = val; } void -update_r_symset(symp, val) +update_ov_rogue_symset(symp, val) struct symparse *symp; int val; { - g.r_syms[symp->idx] = val; + g.ov_rogue_syms[symp->idx] = val; +} + +void +update_primary_symset(symp, val) +struct symparse *symp; +int val; +{ + g.primary_syms[symp->idx] = val; +} + +void +update_rogue_symset(symp, val) +struct symparse *symp; +int val; +{ + g.rogue_syms[symp->idx] = val; } void @@ -553,6 +602,7 @@ const char *known_handling[] = { "IBM", /* H_IBM */ "DEC", /* H_DEC */ "CURS", /* H_CURS */ + "MAC", /* H_MAC -- pre-OSX MACgraphics */ (const char *) 0, }; @@ -757,7 +807,10 @@ const struct symparse loadsyms[] = { { SYM_MON, S_MIMIC_DEF + SYM_OFF_M, "S_mimic_def" }, { SYM_OTH, SYM_BOULDER + SYM_OFF_X, "S_boulder" }, { SYM_OTH, SYM_INVISIBLE + SYM_OFF_X, "S_invisible" }, + { SYM_OTH, SYM_PET_OVERRIDE + SYM_OFF_X, "S_pet_override" }, + { SYM_OTH, SYM_HERO_OVERRIDE + SYM_OFF_X, "S_hero_override" }, { 0, 0, (const char *) 0 } /* fence post */ }; +#endif /* !CROSSCOMPILE || CROSSCOMPILE_TARGET */ /*drawing.c*/ diff --git a/src/dungeon.c b/src/dungeon.c index 474a85a21..54a13c9ae 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -6,11 +6,8 @@ #include "hack.h" #include "dgn_file.h" #include "dlb.h" -#include "lev.h" -#include "sfproto.h" - -#define DUNGEON_FILE "dungeon" +#define DUNGEON_FILE "dungeon.lua" #define X_START "x-strt" #define X_LOCATE "x-loca" @@ -35,7 +32,9 @@ struct lchoice { char menuletter; }; +#if 0 static void FDECL(Fread, (genericptr_t, int, int, dlb *)); +#endif static xchar FDECL(dname_to_dnum, (const char *)); static int FDECL(find_branch, (const char *, struct proto_dungeon *)); static xchar FDECL(parent_dnum, (const char *, struct proto_dungeon *)); @@ -135,7 +134,7 @@ save_dungeon(nhfp, perform_write, free_data) NHFILE *nhfp; boolean perform_write, free_data; { - int i, count; + int count; branch *curr, *next; mapseen *curr_ms, *next_ms; @@ -147,26 +146,14 @@ boolean perform_write, free_data; bwrite(nhfp->fd, (genericptr_t) &g.dungeon_topology, sizeof g.dungeon_topology); bwrite(nhfp->fd, (genericptr_t) g.tune, sizeof tune); } - if (nhfp->fieldlevel) { - sfo_int(nhfp, &g.n_dgns, "dungeon", "dungeon_count", 1); - for (i = 0; i < g.n_dgns; ++i) - sfo_dungeon(nhfp, &g.dungeons[i], "dungeon", "dungeon", 1); - sfo_dgn_topology(nhfp, &g.dungeon_topology, "dungeon", "g.dungeon_topology", 1); - for (i = 0; i < (int) sizeof tune; ++i) - sfo_char(nhfp, &g.tune[i], "dungeon", "tune", 1); - } for (count = 0, curr = g.branches; curr; curr = curr->next) count++; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &count, sizeof(count)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &count, "dungeon", "branch_count", 1); for (curr = g.branches; curr; curr = curr->next) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) curr, sizeof(branch)); - if (nhfp->fieldlevel) - sfo_branch(nhfp, curr, "dungeon", "branch", 1); } count = maxledgerno(); if (nhfp->structlevel) { @@ -175,20 +162,12 @@ boolean perform_write, free_data; (unsigned) count * sizeof(struct linfo)); bwrite(nhfp->fd, (genericptr_t) &g.inv_pos, sizeof g.inv_pos); } - if (nhfp->fieldlevel) { - sfo_int(nhfp, &count, "dungeon", "level_info_count", 1); - for (i = 0; i < count; ++i) - sfo_linfo(nhfp, &g.level_info[i], "dungeon", "g.level_info", 1); - sfo_nhcoord(nhfp, &g.inv_pos, "dungeon", "g.inv_pos", 1); - } for (count = 0, curr_ms = g.mapseenchn; curr_ms; curr_ms = curr_ms->next) count++; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &count, sizeof(count)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &count, "dungeon", "mapseen_count", 1); for (curr_ms = g.mapseenchn; curr_ms; curr_ms = curr_ms->next) { save_mapseen(nhfp, curr_ms); @@ -219,7 +198,7 @@ restore_dungeon(nhfp) NHFILE *nhfp; { branch *curr, *last; - int count, i; + int count = 0, i; mapseen *curr_ms, *last_ms; if (nhfp->structlevel) { @@ -228,27 +207,15 @@ NHFILE *nhfp; mread(nhfp->fd, (genericptr_t) &g.dungeon_topology, sizeof g.dungeon_topology); mread(nhfp->fd, (genericptr_t) g.tune, sizeof tune); } - if (nhfp->fieldlevel) { - sfi_int(nhfp, &g.n_dgns, "dungeon", "dungeon_count", 1); - for (i = 0; i < g.n_dgns; ++i) - sfi_dungeon(nhfp, &g.dungeons[i], "dungeon", "dungeon", 1); - sfi_dgn_topology(nhfp, &g.dungeon_topology, "dungeon", "g.dungeon_topology", 1); - for (i = 0; i < (int) sizeof tune; ++i) - sfi_char(nhfp, &g.tune[i], "dungeon", "tune", 1); - } last = g.branches = (branch *) 0; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &count, sizeof(count)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &count, "dungeon", "branch_count", 1); for (i = 0; i < count; i++) { curr = (branch *) alloc(sizeof(branch)); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) curr, sizeof(branch)); - if (nhfp->fieldlevel) - sfi_branch(nhfp, curr, "dungeon", "branch", 1); curr->next = (branch *) 0; if (last) last->next = curr; @@ -259,8 +226,6 @@ NHFILE *nhfp; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &count, sizeof(count)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &count, "dungeon", "level_info_count", 1); if (count >= MAXLINFO) panic("level information count larger (%d) than allocated size", @@ -268,18 +233,11 @@ NHFILE *nhfp; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) g.level_info, (unsigned) count * sizeof(struct linfo)); - if (nhfp->fieldlevel) - for (i = 0; i < count; ++i) - sfi_linfo(nhfp, &g.level_info[i], "dungeon", "g.level_info", 1); if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) &g.inv_pos, sizeof g.inv_pos); mread(nhfp->fd, (genericptr_t) &count, sizeof(count)); } - if (nhfp->fieldlevel) { - sfi_nhcoord(nhfp, &g.inv_pos, "dungeon", "inv_pos", 1); - sfi_int(nhfp, &count, "dungeon", "mapseen_count", 1); - } last_ms = (mapseen *) 0; for (i = 0; i < count; i++) { @@ -293,6 +251,7 @@ NHFILE *nhfp; } } +#if 0 static void Fread(ptr, size, nitems, stream) genericptr_t ptr; @@ -308,6 +267,7 @@ dlb *stream; nh_terminate(EXIT_FAILURE); } } +#endif static xchar dname_to_dnum(s) @@ -764,21 +724,57 @@ struct level_map { { X_GOAL, &nemesis_level }, { "", (d_level *) 0 } }; +int +get_dgn_flags(L) +lua_State *L; +{ + int dgn_flags = 0; + const char *const flagstrs[] = { "town", "hellish", "mazelike", "roguelike", NULL}; + const int flagstrs2i[] = { TOWN, HELLISH, MAZELIKE, ROGUELIKE, 0 }; + + lua_getfield(L, -1, "flags"); + if (lua_type(L, -1) == LUA_TTABLE) { + int f, nflags; + + lua_len(L, -1); + nflags = (int) lua_tointeger(L, -1); + lua_pop(L, 1); + for (f = 0; f < nflags; f++) { + lua_pushinteger(L, f+1); + lua_gettable(L, -2); + if (lua_type(L, -1) == LUA_TSTRING) { + dgn_flags |= flagstrs2i[luaL_checkoption(L, -1, NULL, flagstrs)]; + lua_pop(L, 1); + } else + impossible("flags[%i] is not a string", f); + } + } else if (lua_type(L, -1) == LUA_TSTRING) { + dgn_flags |= flagstrs2i[luaL_checkoption(L, -1, NULL, flagstrs)]; + } else if (lua_type(L, -1) != LUA_TNIL) + impossible("flags is not an array or string"); + lua_pop(L, 1); + + return dgn_flags; +} + /* initialize the "dungeon" structs */ void init_dungeons() { - dlb *dgn_file; - register int i, cl = 0, cb = 0; + const char *const dgnaligns[] = { "unaligned", "noalign", "lawful", "neutral", "chaotic", NULL}; + const int dgnaligns2i[] = { D_ALIGN_NONE, D_ALIGN_NONE, D_ALIGN_LAWFUL, D_ALIGN_NEUTRAL, D_ALIGN_CHAOTIC, D_ALIGN_NONE }; + lua_State *L; + register int i, cl = 0; register s_level *x; struct proto_dungeon pd; struct level_map *lev_map; - struct version_info vers_info; + int tidx; + (void) memset(&pd, 0, sizeof(struct proto_dungeon)); pd.n_levs = pd.n_brs = 0; - dgn_file = dlb_fopen(DUNGEON_FILE, RDBMODE); - if (!dgn_file) { + L = nhl_init(); + if (!nhl_loadlua(L, DUNGEON_FILE)) { char tbuf[BUFSZ]; Sprintf(tbuf, "Cannot open dungeon description - \"%s", DUNGEON_FILE); #ifdef DLBRSRC /* using a resource from the executable */ @@ -804,55 +800,200 @@ init_dungeons() panic1(tbuf); } - /* validate the data's version against the program's version */ - Fread((genericptr_t) &vers_info, sizeof vers_info, 1, dgn_file); - /* we'd better clear the screen now, since when error messages come from - * check_version() they will be printed using pline(), which doesn't - * mix with the raw messages that might be already on the screen - */ if (iflags.window_inited) clear_nhwindow(WIN_MAP); - if (!check_version(&vers_info, DUNGEON_FILE, TRUE, UTD_CHECKSIZES)) - panic("Dungeon description not valid."); + + g.sp_levchn = (s_level *) 0; + + lua_settop(L, 0); + + lua_getglobal(L, "dungeon"); + if (!lua_istable(L, -1)) + panic("dungeon is not a lua table"); + + lua_len(L, -1); + g.n_dgns = (int) lua_tointeger(L, -1); + lua_pop(L, 1); + + pd.start = 0; + pd.n_levs = 0; + pd.n_brs = 0; /* * Read in each dungeon and transfer the results to the internal * dungeon arrays. */ - g.sp_levchn = (s_level *) 0; - Fread((genericptr_t) &g.n_dgns, sizeof(int), 1, dgn_file); + if (g.n_dgns >= MAXDUNGEON) panic("init_dungeons: too many dungeons"); - for (i = 0; i < g.n_dgns; i++) { - Fread((genericptr_t) &pd.tmpdungeon[i], sizeof(struct tmpdungeon), 1, - dgn_file); - if (!wizard && pd.tmpdungeon[i].chance - && (pd.tmpdungeon[i].chance <= rn2(100))) { - int j; + tidx = lua_gettop(L); - /* skip over any levels or branches */ - for (j = 0; j < pd.tmpdungeon[i].levels; j++) - Fread((genericptr_t) &pd.tmplevel[cl], - sizeof(struct tmplevel), 1, dgn_file); + lua_pushnil(L); /* first key */ + i = 0; + while (lua_next(L, tidx) != 0) { + char *dgn_name, *dgn_bonetag, *dgn_protoname; + int dgn_base, dgn_range, dgn_align, dgn_entry, dgn_chance, dgn_flags; - for (j = 0; j < pd.tmpdungeon[i].branches; j++) - Fread((genericptr_t) &pd.tmpbranch[cb], - sizeof(struct tmpbranch), 1, dgn_file); + if (!lua_istable(L, -1)) + panic("dungeon[%i] is not a lua table", i); + + dgn_name = get_table_str(L, "name"); + dgn_bonetag = get_table_str_opt(L, "bonetag", emptystr); /* TODO: single char or "none" */ + dgn_protoname = get_table_str_opt(L, "protofile", emptystr); + dgn_base = get_table_int(L, "base"); + dgn_range = get_table_int_opt(L, "range", 0); + dgn_align = dgnaligns2i[get_table_option(L, "alignment", "unaligned", dgnaligns)]; + dgn_entry = get_table_int_opt(L, "entry", 0); + dgn_chance = get_table_int_opt(L, "chance", 100); + dgn_flags = get_dgn_flags(L); + + debugpline4("DUNGEON[%i]: %s, base=(%i,%i)", i, dgn_name, dgn_base, dgn_range); + + if (!wizard && dgn_chance && (dgn_chance <= rn2(100))) { + debugpline1("IGNORING %s", dgn_name); g.n_dgns--; - i--; + lua_pop(L, 1); /* pop the dungeon table */ continue; } - Strcpy(g.dungeons[i].dname, pd.tmpdungeon[i].name); - Strcpy(g.dungeons[i].proto, pd.tmpdungeon[i].protoname); - g.dungeons[i].boneid = pd.tmpdungeon[i].boneschar; + /* levels begin */ + lua_getfield(L, -1, "levels"); + if (lua_type(L, -1) == LUA_TTABLE) { + int f, nlevels; - if (pd.tmpdungeon[i].lev.rand) - g.dungeons[i].num_dunlevs = (xchar) rn1(pd.tmpdungeon[i].lev.rand, - pd.tmpdungeon[i].lev.base); + lua_len(L, -1); + nlevels = (int) lua_tointeger(L, -1); + pd.tmpdungeon[i].levels = nlevels; + lua_pop(L, 1); + for (f = 0; f < nlevels; f++) { + lua_pushinteger(L, f+1); + lua_gettable(L, -2); + if (lua_type(L, -1) == LUA_TTABLE) { + int bi; + char *lvl_name = get_table_str(L, "name"); + char *lvl_bonetag = get_table_str_opt(L, "bonetag", emptystr); + int lvl_base = get_table_int(L, "base"); + int lvl_range = get_table_int_opt(L, "range", 0); + int lvl_nlevels = get_table_int_opt(L, "nlevels", 0); + int lvl_chance = get_table_int_opt(L, "chance", 100); + char *lvl_chain = get_table_str_opt(L, "chainlevel", NULL); + int lvl_align = dgnaligns2i[get_table_option(L, "alignment", "unaligned", dgnaligns)]; + int lvl_flags = get_dgn_flags(L); + struct tmplevel *tmpl = &pd.tmplevel[pd.n_levs + f]; + + debugpline4("LEVEL[%i]:%s,(%i,%i)", f, lvl_name, lvl_base, lvl_range); + tmpl->name = lvl_name; + tmpl->chainlvl = lvl_chain; + tmpl->lev.base = lvl_base; + tmpl->lev.rand = lvl_range; + tmpl->chance = lvl_chance; + tmpl->rndlevs = lvl_nlevels; + tmpl->flags = lvl_flags | lvl_align; + tmpl->boneschar = *lvl_bonetag ? *lvl_bonetag : 0; + free(lvl_bonetag); + tmpl->chain = -1; + if (lvl_chain) { + debugpline1("CHAINLEVEL: %s", lvl_chain); + for (bi = 0; bi < pd.n_levs + f; bi++) { + debugpline2("checking(%i):%s", bi, pd.tmplevel[bi].name); + if (!strcmp(pd.tmplevel[bi].name, lvl_chain)) { + tmpl->chain = bi; + break; + } + } + if (tmpl->chain == -1) + panic("Could not chain level %s to %s", lvl_name, lvl_chain); + free(lvl_chain); + } + } else + panic("dungeon[%i].levels[%i] is not a hash", i, f); + lua_pop(L, 1); + } + pd.n_levs += nlevels; + if (pd.n_levs > LEV_LIMIT) + panic("init_dungeon: too many special levels"); + } else if (lua_type(L, -1) != LUA_TNIL) + panic("dungeon[%i].levels is not an array of hashes", i); + lua_pop(L, 1); + /* levels end */ + + /* branches begin */ + lua_getfield(L, -1, "branches"); + if (lua_type(L, -1) == LUA_TTABLE) { + int f, nbranches; + + lua_len(L, -1); + nbranches = (int) lua_tointeger(L, -1); + pd.tmpdungeon[i].branches = nbranches; + lua_pop(L, 1); + for (f = 0; f < nbranches; f++) { + lua_pushinteger(L, f+1); + lua_gettable(L, -2); + if (lua_type(L, -1) == LUA_TTABLE) { + int bi; + const char *const brdirstr[] = { "up", "down", NULL }; + const int brdirstr2i[] = { TRUE, FALSE, FALSE }; + const char *const brtypes[] = { "stair", "portal", "no_down", "no_up", NULL }; + const int brtypes2i[] = { TBR_STAIR, TBR_PORTAL, TBR_NO_DOWN, TBR_NO_UP, TBR_STAIR }; + char *br_name = get_table_str(L, "name"); + int br_base = get_table_int(L, "base"); + int br_range = get_table_int_opt(L, "range", 0); + int br_type = brtypes2i[get_table_option(L, "branchtype", "stair", brtypes)]; + int br_up = brdirstr2i[get_table_option(L, "direction", "down", brdirstr)]; + char *br_chain = get_table_str_opt(L, "chainlevel", NULL); + struct tmpbranch *tmpb = &pd.tmpbranch[pd.n_brs + f]; + + debugpline4("BRANCH[%i]:%s,(%i,%i)", f, br_name, br_base, br_range); + tmpb->name = br_name; + tmpb->lev.base = br_base; + tmpb->lev.rand = br_range; + tmpb->type = br_type; + tmpb->up = br_up; + tmpb->chain = -1; + if (br_chain) { + debugpline1("CHAINBRANCH:%s", br_chain); + for (bi = 0; bi < pd.n_levs + f - 1; bi++) + if (!strcmp(pd.tmplevel[bi].name, br_chain)) { + tmpb->chain = bi; + break; + } + if (tmpb->chain == -1) + panic("Could not chain branch %s to level %s", br_name, br_chain); + free(br_chain); + } + } else + panic("dungeon[%i].branches[%i] is not a hash", i, f); + lua_pop(L, 1); + } + pd.n_brs += nbranches; + if (pd.n_brs > BRANCH_LIMIT) + panic("init_dungeon: too many branches"); + } else if (lua_type(L, -1) != LUA_TNIL) + panic("dungeon[%i].branches is not an array of hashes", i); + lua_pop(L, 1); + /* branches end */ + + pd.tmpdungeon[i].name = dgn_name; + pd.tmpdungeon[i].protoname = dgn_protoname; + pd.tmpdungeon[i].boneschar = *dgn_bonetag ? *dgn_bonetag : 0; + pd.tmpdungeon[i].lev.base = dgn_base; + pd.tmpdungeon[i].lev.rand = dgn_range; + pd.tmpdungeon[i].flags = dgn_flags; + pd.tmpdungeon[i].align = dgn_align; + pd.tmpdungeon[i].chance = dgn_chance; + pd.tmpdungeon[i].entry_lev = dgn_entry; + + Strcpy(g.dungeons[i].dname, dgn_name); /* FIXME: dname length */ + Strcpy(g.dungeons[i].proto, dgn_protoname); /* FIXME: proto length */ + g.dungeons[i].boneid = *dgn_bonetag ? *dgn_bonetag : 0; + free(dgn_protoname); + free(dgn_bonetag); + + if (dgn_range) + g.dungeons[i].num_dunlevs = (xchar) rn1(dgn_range, dgn_base); else - g.dungeons[i].num_dunlevs = (xchar) pd.tmpdungeon[i].lev.base; + g.dungeons[i].num_dunlevs = (xchar) dgn_base; if (!i) { g.dungeons[i].ledger_start = 0; @@ -864,14 +1005,13 @@ init_dungeons() g.dungeons[i].dunlev_ureached = 0; } - g.dungeons[i].flags.hellish = !!(pd.tmpdungeon[i].flags & HELLISH); - g.dungeons[i].flags.maze_like = !!(pd.tmpdungeon[i].flags & MAZELIKE); - g.dungeons[i].flags.rogue_like = !!(pd.tmpdungeon[i].flags & ROGUELIKE); - g.dungeons[i].flags.align = - ((pd.tmpdungeon[i].flags & D_ALIGN_MASK) >> 4); + g.dungeons[i].flags.hellish = !!(dgn_flags & HELLISH); + g.dungeons[i].flags.maze_like = !!(dgn_flags & MAZELIKE); + g.dungeons[i].flags.rogue_like = !!(dgn_flags & ROGUELIKE); + g.dungeons[i].flags.align = dgn_align; + /* - * Set the entry level for this dungeon. The pd.tmpdungeon entry - * value means: + * Set the entry level for this dungeon. The entry value means: * < 0 from bottom (-1 == bottom level) * 0 default (top) * > 0 actual level (1 = top) @@ -879,13 +1019,13 @@ init_dungeons() * Note that the entry_lev field in the dungeon structure is * redundant. It is used only here and in print_dungeon(). */ - if (pd.tmpdungeon[i].entry_lev < 0) { + if (dgn_entry < 0) { g.dungeons[i].entry_lev = - g.dungeons[i].num_dunlevs + pd.tmpdungeon[i].entry_lev + 1; + g.dungeons[i].num_dunlevs + dgn_entry + 1; if (g.dungeons[i].entry_lev <= 0) g.dungeons[i].entry_lev = 1; - } else if (pd.tmpdungeon[i].entry_lev > 0) { - g.dungeons[i].entry_lev = pd.tmpdungeon[i].entry_lev; + } else if (dgn_entry > 0) { + g.dungeons[i].entry_lev = dgn_entry; if (g.dungeons[i].entry_lev > g.dungeons[i].num_dunlevs) g.dungeons[i].entry_lev = g.dungeons[i].num_dunlevs; } else { /* default */ @@ -927,23 +1067,14 @@ init_dungeons() - (g.dungeons[i].entry_lev - 1); } - /* this is redundant - it should have been flagged by dgn_comp */ if (g.dungeons[i].num_dunlevs > MAXLEVEL) g.dungeons[i].num_dunlevs = MAXLEVEL; - pd.start = pd.n_levs; /* save starting point */ - pd.n_levs += pd.tmpdungeon[i].levels; - if (pd.n_levs > LEV_LIMIT) - panic("init_dungeon: too many special levels"); - /* - * Read in the prototype special levels. Don't add generated - * special levels until they are all placed. - */ - for (; cl < pd.n_levs; cl++) { - Fread((genericptr_t) &pd.tmplevel[cl], sizeof(struct tmplevel), 1, - dgn_file); + + for (; cl < pd.n_levs; cl++) { init_level(i, cl, &pd); } + /* * Recursively place the generated levels for this dungeon. This * routine will attempt all possible combinations before giving @@ -956,18 +1087,18 @@ init_dungeons() fflush(stderr); getchar(); #endif + for (; pd.start < pd.n_levs; pd.start++) if (pd.final_lev[pd.start]) add_level(pd.final_lev[pd.start]); + /* levels handling end */ - pd.n_brs += pd.tmpdungeon[i].branches; - if (pd.n_brs > BRANCH_LIMIT) - panic("init_dungeon: too many branches"); - for (; cb < pd.n_brs; cb++) - Fread((genericptr_t) &pd.tmpbranch[cb], sizeof(struct tmpbranch), - 1, dgn_file); + lua_pop(L, 1); /* pop the dungeon table */ + i++; } - (void) dlb_fclose(dgn_file); + + lua_pop(L, 1); /* get rid of the dungeon global */ + debugpline2("init_dungeon lua DONE (n_levs=%i, n_brs=%i)", pd.n_levs, pd.n_brs); for (i = 0; i < 5; i++) g.tune[i] = 'A' + rn2(7); @@ -1027,6 +1158,18 @@ init_dungeons() so that it's hidden from '#wizwhere' feedback. */ } + lua_close(L); + + for (i = 0; i < pd.n_brs; i++) { + free(pd.tmpbranch[i].name); + } + for (i = 0; i < pd.n_levs; i++) { + free(pd.tmplevel[i].name); + } + for (i = 0; i < g.n_dgns; i++) { + free(pd.tmpdungeon[i].name); + } + #ifdef DEBUG dumpit(); #endif @@ -2252,15 +2395,13 @@ NHFILE *nhfp; mapseen *mptr; { branch *curr; - int i, brindx; + int brindx; for (brindx = 0, curr = g.branches; curr; curr = curr->next, ++brindx) if (curr == mptr->br) break; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &brindx, sizeof brindx); - if (nhfp->fieldlevel) - sfo_int(nhfp, &brindx, "mapseen", "branch_index", 1); if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) &mptr->lev, sizeof mptr->lev); @@ -2268,29 +2409,15 @@ mapseen *mptr; bwrite(nhfp->fd, (genericptr_t) &mptr->flags, sizeof mptr->flags); bwrite(nhfp->fd, (genericptr_t) &mptr->custom_lth, sizeof mptr->custom_lth); } - if (nhfp->fieldlevel) { - sfo_d_level(nhfp, &mptr->lev, "mapseen", "d_level", 1); - sfo_mapseen_feat(nhfp, &mptr->feat, "mapseen", "feat", 1); - sfo_mapseen_flags(nhfp, &mptr->flags, "mapseen", "flags", 1); - sfo_unsigned(nhfp, &mptr->custom_lth, "mapseen", "custom_lth", 1); - } if (mptr->custom_lth) { if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) mptr->custom, mptr->custom_lth); } - if (nhfp->fieldlevel) { - for (i = 0; i < (int) mptr->custom_lth; ++i) - sfo_char(nhfp, &mptr->custom[i], "mapseen", "custom", 1); - } } if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) &mptr->msrooms, sizeof mptr->msrooms); } - if (nhfp->fieldlevel) { - for (i = 0; i < ((MAXNROFROOMS + 1) * 2); ++i) - sfo_mapseen_rooms(nhfp, &mptr->msrooms[i], "mapseen", "msrooms", 1); - } savecemetery(nhfp, &mptr->final_resting_place); } @@ -2298,7 +2425,7 @@ static mapseen * load_mapseen(nhfp) NHFILE *nhfp; { - int i, branchnum, brindx; + int branchnum = 0, brindx; mapseen *load; branch *curr; @@ -2306,8 +2433,6 @@ NHFILE *nhfp; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &branchnum, sizeof branchnum); - if (nhfp->fieldlevel) - sfi_int(nhfp, &branchnum, "mapseen", "branch_index", 1); for (brindx = 0, curr = g.branches; curr; curr = curr->next, ++brindx) if (brindx == branchnum) break; @@ -2319,12 +2444,6 @@ NHFILE *nhfp; mread(nhfp->fd, (genericptr_t) &load->flags, sizeof load->flags); mread(nhfp->fd, (genericptr_t) &load->custom_lth, sizeof load->custom_lth); } - if (nhfp->fieldlevel) { - sfi_d_level(nhfp, &load->lev, "mapseen", "d_level", 1); - sfi_mapseen_feat(nhfp, &load->feat, "mapseen", "feat", 1); - sfi_mapseen_flags(nhfp, &load->flags, "mapseen", "flags", 1); - sfi_unsigned(nhfp, &load->custom_lth, "mapseen", "custom_lth", 1); - } if (load->custom_lth) { /* length doesn't include terminator (which isn't saved & restored) */ @@ -2332,20 +2451,12 @@ NHFILE *nhfp; if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) load->custom, load->custom_lth); } - if (nhfp->fieldlevel) { - for (i = 0; i < (int) load->custom_lth; ++i) - sfi_char(nhfp, &load->custom[i], "mapseen", "custom", 1); - } load->custom[load->custom_lth] = '\0'; } else load->custom = 0; if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) &load->msrooms, sizeof load->msrooms); } - if (nhfp->fieldlevel) { - for (i = 0; i < ((MAXNROFROOMS + 1) * 2); ++i) - sfi_mapseen_rooms(nhfp, &load->msrooms[i], "mapseen", "msrooms", 1); - } restcemetery(nhfp, &load->final_resting_place); return load; } diff --git a/src/eat.c b/src/eat.c index 23ee9f721..7144eecf2 100644 --- a/src/eat.c +++ b/src/eat.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 eat.c $NHDT-Date: 1561233801 2019/06/22 20:03:21 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.203 $ */ +/* NetHack 3.6 eat.c $NHDT-Date: 1574900825 2019/11/28 00:27:05 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.206 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1372,9 +1372,9 @@ const char *mesg; if (tintxts[r].greasy) { /* Assume !Glib, because you can't open tins when Glib. */ - incr_itimeout(&Glib, rnd(15)); + make_glib(rn1(11, 5)); /* 5..15 */ pline("Eating %s food made your %s very slippery.", - tintxts[r].txt, makeplural(body_part(FINGER))); + tintxts[r].txt, fingers_or_gloves(TRUE)); } } else { /* spinach... */ @@ -1499,8 +1499,7 @@ struct obj *otmp; no_opener: pline("It is not so easy to open this tin."); if (Glib) { - pline_The("tin slips from your %s.", - makeplural(body_part(FINGER))); + pline_The("tin slips from your %s.", fingers_or_gloves(FALSE)); if (otmp->quan > 1L) { otmp = splitobj(otmp, 1L); } @@ -2102,7 +2101,7 @@ eatspecial() return; } if (objects[otmp->otyp].oc_material == PAPER) { -#ifdef MAIL +#ifdef MAIL_STRUCTURES if (otmp->otyp == SCR_MAIL) /* no nutrition */ pline("This junk mail is less than satisfying."); @@ -2548,7 +2547,7 @@ doeat() /* oc_nutrition is usually weight anyway */ else basenutrit = objects[otmp->otyp].oc_nutrition; -#ifdef MAIL +#ifdef MAIL_STRUCTURES if (otmp->otyp == SCR_MAIL) { basenutrit = 0; nodelicious = TRUE; @@ -2870,23 +2869,20 @@ int num; /* Have lesshungry() report when you're nearly full so all eating * warns when you're about to choke. */ - if (u.uhunger >= 1500) { - if (!g.context.victual.eating - || (g.context.victual.eating && !g.context.victual.fullwarn)) { - pline("You're having a hard time getting all of it down."); - g.nomovemsg = "You're finally finished."; - if (!g.context.victual.eating) { - g.multi = -2; - } else { - g.context.victual.fullwarn = TRUE; - if (g.context.victual.canchoke - && g.context.victual.reqtime > 1) { - /* a one-gulp food will not survive a stop */ - if (yn_function("Continue eating?", ynchars, 'n') - != 'y') { - reset_eat(); - g.nomovemsg = (char *) 0; - } + if (u.uhunger >= 1500 + && (!g.context.victual.eating + || (g.context.victual.eating && !g.context.victual.fullwarn))) { + pline("You're having a hard time getting all of it down."); + g.nomovemsg = "You're finally finished."; + if (!g.context.victual.eating) { + g.multi = -2; + } else { + g.context.victual.fullwarn = TRUE; + if (g.context.victual.canchoke && g.context.victual.reqtime > 1) { + /* a one-gulp food will not survive a stop */ + if (!paranoid_query(ParanoidEating, "Continue eating?")) { + reset_eat(); + g.nomovemsg = (char *) 0; } } } diff --git a/src/end.c b/src/end.c index fa758fe43..c35677ed2 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 end.c $NHDT-Date: 1562532734 2019/07/07 20:52:14 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.179 $ */ +/* NetHack 3.6 end.c $NHDT-Date: 1575245059 2019/12/02 00:04:19 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.181 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -6,7 +6,6 @@ #define NEED_VARARGS /* comment line for pre-compiled headers */ #include "hack.h" -#include "lev.h" #ifndef NO_SIGNAL #include #endif @@ -15,7 +14,6 @@ #include #endif #include "dlb.h" -#include "sfproto.h" /* add b to long a, convert wraparound to max value */ @@ -238,8 +236,8 @@ NH_panictrace_gdb() #ifdef PANICTRACE_GDB /* A (more) generic method to get a stack trace - invoke * gdb on ourself. */ - char *gdbpath = GDBVAR; - char *greppath = GREPVAR; + const char *gdbpath = GDBVAR; + const char *greppath = GREPVAR; char buf[BUFSZ]; FILE *gdb; @@ -248,8 +246,8 @@ NH_panictrace_gdb() if (greppath == NULL || greppath[0] == 0) return FALSE; - sprintf(buf, "%s -n -q %s %d 2>&1 | %s '^#'", gdbpath, ARGV0, getpid(), - greppath); + sprintf(buf, "%s -n -q %s %d 2>&1 | %s '^#'", + gdbpath, ARGV0, getpid(), greppath); gdb = popen(buf, "w"); if (gdb) { raw_print("Generating more information you may report:\n"); @@ -948,7 +946,7 @@ int size; /* max value is less than 20 */ #if 0 /* * odds_and_ends() was used for 3.6.0 and 3.6.1. - * Schroedinger's Cat is handled differently starting with 3.6.2. + * Schroedinger's Cat is handled differently as of 3.6.2. */ static boolean FDECL(odds_and_ends, (struct obj *, int)); @@ -2153,8 +2151,6 @@ NHFILE *nhfp; for (kptr = &g.killer; kptr != (struct kinfo *) 0; kptr = kptr->next) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t)kptr, sizeof(struct kinfo)); - if (nhfp->fieldlevel) - sfo_kinfo(nhfp, kptr, "killers", "kinfo", 1); } } if (release_data(nhfp)) { @@ -2175,8 +2171,6 @@ NHFILE *nhfp; for (kptr = &g.killer; kptr != (struct kinfo *) 0; kptr = kptr->next) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t)kptr, sizeof(struct kinfo)); - if (nhfp->fieldlevel) - sfi_kinfo(nhfp, kptr, "killers", "kinfo", 1); if (kptr->next) { kptr->next = (struct kinfo *) alloc(sizeof (struct kinfo)); } diff --git a/src/engrave.c b/src/engrave.c index 4e5413526..8d37b0027 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -1,12 +1,9 @@ -/* NetHack 3.6 engrave.c $NHDT-Date: 1456304550 2016/02/24 09:02:30 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.61 $ */ +/* NetHack 3.6 engrave.c $NHDT-Date: 1570318925 2019/10/05 23:42:05 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.75 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" -#include "lev.h" -#include "sfproto.h" - static NEARDATA struct engr *head_engr; static const char *NDECL(blengr); @@ -156,7 +153,8 @@ boolean check_pit; if (u.usteed && P_SKILL(P_RIDING) < P_BASIC) return FALSE; if (check_pit && !Flying - && (t = t_at(u.ux, u.uy)) != 0 && uteetering_at_seen_pit(t)) + && (t = t_at(u.ux, u.uy)) != 0 + && (uteetering_at_seen_pit(t) || uescaped_shaft(t))) return FALSE; return (boolean) ((!Levitation || Is_airlevel(&u.uz) @@ -289,7 +287,8 @@ int cnt; void wipe_engr_at(x, y, cnt, magical) -xchar x, y, cnt, magical; +xchar x, y, cnt; +boolean magical; { register struct engr *ep = engr_at(x, y); @@ -316,7 +315,6 @@ int x, y; { register struct engr *ep = engr_at(x, y); int sensed = 0; - char buf[BUFSZ]; /* Sensing an engraving does not require sight, * nor does it necessarily imply comprehension (literacy). @@ -365,17 +363,22 @@ int x, y; impossible("%s is written in a very strange way.", Something); sensed = 1; } + if (sensed) { - char *et; - unsigned maxelen = BUFSZ - sizeof("You feel the words: \"\". "); - if (strlen(ep->engr_txt) > maxelen) { - (void) strncpy(buf, ep->engr_txt, (int) maxelen); + char *et, buf[BUFSZ]; + int maxelen = (int) (sizeof buf + /* sizeof "literal" counts terminating \0 */ + - sizeof "You feel the words: \"\"."); + + if ((int) strlen(ep->engr_txt) > maxelen) { + (void) strncpy(buf, ep->engr_txt, maxelen); buf[maxelen] = '\0'; et = buf; - } else + } else { et = ep->engr_txt; + } You("%s: \"%s\".", (Blind) ? "feel the words" : "read", et); - if (g.context.run > 1) + if (g.context.run > 0) nomul(0); } } @@ -752,7 +755,7 @@ doengrave() } Strcpy(post_engr_text, (Blind && !Deaf) - ? "You hear drilling!" + ? "You hear drilling!" /* Deaf-aware */ : Blind ? "You feel tremors." : IS_GRAVE(levl[u.ux][u.uy].typ) @@ -789,7 +792,7 @@ doengrave() doblind = TRUE; } else Strcpy(post_engr_text, !Deaf - ? "You hear crackling!" + ? "You hear crackling!" /* Deaf-aware */ : "Your hair stands up!"); break; @@ -1188,11 +1191,6 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t)&(ep->engr_lth), sizeof(ep->engr_lth)); bwrite(nhfp->fd, (genericptr_t)ep, sizeof(struct engr) + ep->engr_lth); } - if (nhfp->fieldlevel) { - sfo_unsigned(nhfp, &(ep->engr_lth), "engravings", "engr_lth", 1); - sfo_engr(nhfp, ep, "engravings", "engr", 1); - sfo_str(nhfp, ep->engr_txt, "engravings", "engr_txt", ep->engr_lth); - } } if (release_data(nhfp)) dealloc_engr(ep); @@ -1200,8 +1198,6 @@ NHFILE *nhfp; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t)&no_more_engr, sizeof no_more_engr); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &no_more_engr, "engravings", "engr_lth", 1); } if (release_data(nhfp)) head_engr = 0; @@ -1212,14 +1208,12 @@ rest_engravings(nhfp) NHFILE *nhfp; { struct engr *ep; - unsigned lth; + unsigned lth = 0; head_engr = 0; while (1) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) <h, sizeof(unsigned)); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, <h, "engravings", "engr_lth", 1); if (lth == 0) return; @@ -1227,11 +1221,6 @@ NHFILE *nhfp; if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) ep, sizeof(struct engr) + lth); } - if (nhfp->fieldlevel) { - sfi_engr(nhfp, ep, "engravings", "engr", 1); - ep->engr_txt = (char *) (ep + 1); - sfi_str(nhfp, ep->engr_txt, "engravings", "engr_txt", lth); - } ep->nxt_engr = head_engr; head_engr = ep; ep->engr_txt = (char *) (ep + 1); /* Andreas Bormann */ diff --git a/src/exper.c b/src/exper.c index ab5a84348..73bfe9f4b 100644 --- a/src/exper.c +++ b/src/exper.c @@ -128,7 +128,7 @@ register int nk; if (mtmp->m_lev > 8) tmp += 50; -#ifdef MAIL +#ifdef MAIL_STRUCTURES /* Mail daemons put up no fight. */ if (mtmp->data == &mons[PM_MAIL_DAEMON]) tmp = 1; diff --git a/src/explode.c b/src/explode.c index 20b7a04b4..38e6cdf8d 100644 --- a/src/explode.c +++ b/src/explode.c @@ -621,6 +621,13 @@ struct obj *obj; /* only scatter this obj */ obj->ox, obj->oy, sx, sy); while ((otmp = (individual_object ? obj : g.level.objects[sx][sy])) != 0) { + if (otmp == uball || otmp == uchain) { + boolean waschain = (otmp == uchain); + pline_The("chain shatters!"); + unpunish(); + if (waschain) + continue; + } if (otmp->quan > 1L) { qtmp = otmp->quan - 1L; if (qtmp > LARGEST_INT) @@ -764,6 +771,9 @@ struct obj *obj; /* only scatter this obj */ newsym(x, y); } newsym(sx, sy); + if (sx == u.ux && sy == u.uy && u.uundetected + && hides_under(g.youmonst.data)) + (void) hideunder(&g.youmonst); return total; } diff --git a/src/files.c b/src/files.c index 0aed6a08a..82d6330df 100644 --- a/src/files.c +++ b/src/files.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 files.c $NHDT-Date: 1562719337 2019/07/10 00:42:17 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.252 $ */ +/* NetHack 3.7 files.c $NHDT-Date: 1576626110 2019/12/17 23:41:50 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.276 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -8,9 +8,6 @@ #include "hack.h" #include "dlb.h" #include -#include "sfproto.h" -#include "sfprocs.h" -#include "lev.h" #ifdef TTY_GRAPHICS #include "wintty.h" /* more() */ @@ -56,7 +53,7 @@ const #endif #if defined(MSDOS) || defined(OS2) || defined(TOS) || defined(WIN32) -#ifndef GNUDOS +#ifndef __DJGPP__ #include #else #include @@ -106,6 +103,10 @@ extern void FDECL(amii_set_text_font, (char *, int)); #ifndef WIN_CE #define DeleteFile unlink #endif +#ifdef WIN32 +/*from windmain.c */ +extern char *FDECL(translate_path_variables, (const char *, char *)); +#endif #endif #ifdef MAC @@ -299,6 +300,13 @@ const char *basenam; int whichprefix UNUSED_if_not_PREFIXES_IN_USE; int buffnum UNUSED_if_not_PREFIXES_IN_USE; { +#ifdef PREFIXES_IN_USE + char *bufptr; +#endif +#ifdef WIN32 + char tmpbuf[BUFSZ]; +#endif + #ifndef PREFIXES_IN_USE return basenam; #else @@ -310,15 +318,19 @@ int buffnum UNUSED_if_not_PREFIXES_IN_USE; impossible("Invalid fqn_filename_buffer specified: %d", buffnum); buffnum = 0; } - if (strlen(g.fqn_prefix[whichprefix]) + strlen(basenam) - >= FQN_MAX_FILENAME) { - impossible("fqname too long: %s + %s", g.fqn_prefix[whichprefix], - basenam); + bufptr = g.fqn_prefix[whichprefix]; +#ifdef WIN32 + if (strchr(g.fqn_prefix[whichprefix], '%') + || strchr(g.fqn_prefix[whichprefix], '~')) + bufptr = translate_path_variables(g.fqn_prefix[whichprefix], tmpbuf); +#endif + if (strlen(bufptr) + strlen(basenam) >= FQN_MAX_FILENAME) { + impossible("fqname too long: %s + %s", bufptr, basenam); return basenam; /* XXX */ } - Strcpy(fqn_filename_buffer[buffnum], g.fqn_prefix[whichprefix]); + Strcpy(fqn_filename_buffer[buffnum], bufptr); return strcat(fqn_filename_buffer[buffnum], basenam); -#endif +#endif /* !PREFIXES_IN_USE */ } int @@ -436,18 +448,6 @@ NHFILE *nhfp; if (nhfp) { if (nhfp->structlevel && nhfp->fd != -1) (void) nhclose(nhfp->fd), nhfp->fd = -1; - if (nhfp->fieldlevel) { - if (nhfp->fpdef) { - (void) fclose(nhfp->fpdef); - nhfp->fpdef = (FILE *) 0; - } - } - if (nhfp->fplog) - (void) fprintf(nhfp->fplog, "# closing\n"); - if (nhfp->fplog) - (void) fclose(nhfp->fplog); - if (nhfp->fpdebug) - (void) fclose(nhfp->fpdebug); zero_nhfile(nhfp); free_nhfile(nhfp); } @@ -464,13 +464,6 @@ NHFILE *nhfp; (void) lseek(nhfp->fd, (off_t) 0, 0); #endif } - if (nhfp->fieldlevel) { - if (nhfp->fpdef) { - rewind(nhfp->fpdef); - nhfp->count = 0L; - nhfp->eof = FALSE; - } - } } static @@ -482,25 +475,10 @@ NHFILE *nhfp; the pointer to the nethack file descriptor */ if (nhfp) { /* check for no open file at all, - * not a structlevel legacy file, - * nor a fieldlevel file. + * not a structlevel legacy file */ - if (((nhfp->fd == -1) && !nhfp->fpdef) - || (nhfp->structlevel && nhfp->fd < 0) - || (nhfp->fieldlevel && !nhfp->fpdef)) { + if (nhfp->structlevel && nhfp->fd < 0) { /* not viable, start the cleanup */ - if (nhfp->fieldlevel) { - if (nhfp->fpdef) { - (void) fclose(nhfp->fpdef); - nhfp->fpdef = (FILE *) 0; - } - if (nhfp->fplog) { - (void) fprintf(nhfp->fplog, "# closing, not viable\n"); - (void) fclose(nhfp->fplog); - } - if (nhfp->fpdebug) - (void) fclose(nhfp->fpdebug); - } zero_nhfile(nhfp); free_nhfile(nhfp); nhfp = (NHFILE *) 0; @@ -742,12 +720,12 @@ d_level *lev; char *dptr; /* - * "bonD0.nn" = bones for level nn in the main dungeon; - * "bonM0.T" = bones for Minetown; - * "bonQBar.n" = bones for level n in the Barbarian quest; - * "bon3D0.nn" = \ - * "bon3M0.T" = > same as above, but for bones pool #3. - * "bon3QBar.n" = / + * "bonD0.nn.le" = bones for level nn in the main dungeon; + * "bonM0.T.le" = bones for Minetown; + * "bonQBar.n.le" = bones for level n in the Barbarian quest; + * "bon3D0.nn.le" = \ + * "bon3M0.T.le" = > same as above, but for bones pool #3. + * "bon3QBar.n.le" = / * * Return value for content validation skips "bon" and the * pool number (if present), making it feasible for the admin @@ -780,8 +758,6 @@ d_level *lev; Sprintf(eos(dptr), ".%d", lev->dlevel); #ifdef SYSCF idx = sysopt.bonesformat[0]; - if (idx > historical && idx <= ascii) - Strcat(dptr, sfoprocs[idx].ext); #endif #ifdef VMS Strcat(dptr, ";1"); @@ -832,26 +808,6 @@ char errbuf[]; nhfp->fieldlevel = FALSE; nhfp->ftype = NHF_BONESFILE; nhfp->mode = WRITING; -#ifdef SYSCF - if (sysopt.bonesformat[0] > historical && - sysopt.bonesformat[0] <= ascii) { - nhfp->structlevel = FALSE; - nhfp->fieldlevel = TRUE; - nhfp->addinfo = TRUE; - nhfp->style.deflt = TRUE; - nhfp->style.binary = (sysopt.bonesformat[0] != ascii); - nhfp->fnidx = sysopt.bonesformat[0]; - nhfp->fd = -1; - nhfp->fpdef = fopen(file, nhfp->style.binary ? WRBMODE : WRTMODE); - if (nhfp->fpdef) { -#ifdef SAVEFILE_DEBUGGING - nhfp->fpdebug = fopen("create_bonesfile-debug.log", "a"); -#endif - } else { - failed = errno; - } - } -#endif /* SYSCF */ if (nhfp->structlevel) { #if defined(MICRO) || defined(WIN32) /* Use O_TRUNC to force the file to be shortened if it already @@ -947,26 +903,6 @@ char **bonesid; nhfp->fieldlevel = FALSE; nhfp->ftype = NHF_BONESFILE; nhfp->mode = READING; -#ifdef SYSCF - if (sysopt.bonesformat[0] > historical && - sysopt.bonesformat[0] <= ascii) { - nhfp->structlevel = FALSE; - nhfp->fieldlevel = TRUE; - nhfp->addinfo = TRUE; - nhfp->style.deflt = TRUE; - nhfp->style.binary = (sysopt.bonesformat[0] != ascii); - nhfp->fnidx = sysopt.bonesformat[0]; - nhfp->fd = -1; - nhfp->fpdef = fopen(fq_bones, nhfp->style.binary ? RDBMODE : RDTMODE); - if (nhfp->fpdef) { -#ifdef SAVEFILE_DEBUGGING - nhfp->fpdebug = fopen("open_bonesfile-debug.log", "a"); -#endif - } else { - failed = errno; - } - } -#endif /* SYSCF */ if (nhfp->structlevel) { #ifdef MAC nhfp->fd = macopen(fq_bones, O_RDONLY | O_BINARY, BONE_TYPE); @@ -1007,21 +943,26 @@ void set_savefile_name(regularize_it) boolean regularize_it; { - int idx = 0, regoffset = 0, overflow = 0, + int idx = historical, regoffset = 0, overflow = 0, indicator_spot = 0; /* 0=no indicator, 1=before ext, 2=after ext */ const char *postappend = (const char *) 0, *sfindicator = (const char *) 0; -#ifdef SYSCF - idx = sysopt.saveformat[0]; - if (idx > historical && idx <= ascii) - sfindicator = sfoprocs[idx].ext; -#endif + if (g.program_state.in_self_recover) { + /* self_recover needs to be done as historical + structlevel content until that process is + re-written to use something other than + copy_bytes() to retrieve data content from + level files (which are structlevel) and + place it into the save file. + */ + idx = historical; + } #ifdef VMS Sprintf(g.SAVEF, "[.save]%d%s", getuid(), g.plname); regoffset = 7; indicator_spot = 1; - postappend = ";1"); + postappend = ";1"; #endif #if defined(WIN32) if (regularize_it) { @@ -1086,15 +1027,7 @@ boolean regularize_it; if (strlen(g.SAVEF) + strlen(SAVE_EXTENSION) < (SAVESIZE - 1)) { Strcat(g.SAVEF, SAVE_EXTENSION); #ifdef MSDOS -#ifdef SYSCF - if (idx >= historical && idx <= ascii) { - /* we did leave room for the extra char in SAVE_EXTENSION */ - g.SAVEF[strlen(g.SAVEF)-1] = - (idx == lendian) ? 'l' : - (idx == ascii) ? 'a' : '\0'; - } - sfindicator = sfoprocs[idx].ext; -#endif + sfindicator = ""; #endif } else overflow = 3; @@ -1114,8 +1047,8 @@ boolean regularize_it; } #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) if (overflow) - impossible("set_savefile_name() couldn't complete without overlow %d", - overflow); + impossible("set_savefile_name() couldn't complete without overflow %d", + overflow); #endif } @@ -1126,8 +1059,6 @@ NHFILE *nhfp; { if (nhfp->structlevel) (void) write(nhfp->fd, (genericptr_t) g.SAVEF, sizeof(g.SAVEF)); - if (nhfp->fieldlevel) - sfo_str(nhfp, g.SAVEF, "savefile_name", "g.savef", sizeof(g.SAVEF)); } #endif @@ -1161,6 +1092,7 @@ create_savefile() int failed = 0; const char *fq_save; NHFILE *nhfp = (NHFILE *) 0; + boolean do_historical = TRUE; fq_save = fqname(g.SAVEF, SAVEPREFIX, 0); nhfp = new_nhfile(); @@ -1171,24 +1103,20 @@ create_savefile() nhfp->mode = WRITING; #ifdef SYSCF if (sysopt.saveformat[0] > historical && - sysopt.saveformat[0] <= ascii) { - nhfp->structlevel = FALSE; - nhfp->fieldlevel = TRUE; - nhfp->addinfo = TRUE; - nhfp->style.deflt = TRUE; - nhfp->style.binary = (sysopt.saveformat[0] != ascii); - nhfp->fnidx = sysopt.saveformat[0]; - nhfp->fd = -1; - nhfp->fpdef = fopen(fq_save, nhfp->style.binary ? WRBMODE : WRTMODE); - if (nhfp->fpdef) { -#ifdef SAVEFILE_DEBUGGING - nhfp->fpdebug = fopen("create_savefile-debug.log", "a"); -#endif - } else { - failed = errno; - } - } + sysopt.saveformat[0] <= ascii) + do_historical = FALSE; #endif /* SYSCF */ + if (g.program_state.in_self_recover) { + do_historical = TRUE; /* force it */ + nhfp->structlevel = TRUE; + nhfp->fieldlevel = FALSE; + nhfp->addinfo = FALSE; + nhfp->style.deflt = FALSE; + nhfp->style.binary = TRUE; + nhfp->fnidx = historical; + nhfp->fd = -1; + nhfp->fpdef = (FILE *) 0; + } if (nhfp->structlevel) { #if defined(MICRO) || defined(WIN32) nhfp->fd = open(fq_save, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, FCMASK); @@ -1225,6 +1153,7 @@ open_savefile() int failed = 0; const char *fq_save; NHFILE *nhfp = (NHFILE *) 0; + boolean do_historical = TRUE; fq_save = fqname(g.SAVEF, SAVEPREFIX, 0); nhfp = new_nhfile(); @@ -1233,26 +1162,17 @@ open_savefile() nhfp->fieldlevel = FALSE; nhfp->ftype = NHF_SAVEFILE; nhfp->mode = READING; -#ifdef SYSCF - if (sysopt.saveformat[0] > historical && - sysopt.saveformat[0] <= ascii) { - nhfp->structlevel = FALSE; - nhfp->fieldlevel = TRUE; - nhfp->addinfo = TRUE; - nhfp->style.deflt = TRUE; - nhfp->style.binary = (sysopt.saveformat[0] < ascii); - nhfp->fnidx = sysopt.saveformat[0]; + if (g.program_state.in_self_recover) { + do_historical = TRUE; /* force it */ + nhfp->structlevel = TRUE; + nhfp->fieldlevel = FALSE; + nhfp->addinfo = FALSE; + nhfp->style.deflt = FALSE; + nhfp->style.binary = TRUE; + nhfp->fnidx = historical; nhfp->fd = -1; - nhfp->fpdef = fopen(fq_save, nhfp->style.binary ? RDBMODE : RDTMODE); - if (nhfp->fpdef) { -#ifdef SAVEFILE_DEBUGGING - nhfp->fpdebug = fopen("open_savefile-debug.log", "a"); -#endif - } else { - failed = errno; - } + nhfp->fpdef = (FILE *) 0; } -#endif /* SYSCF */ if (nhfp->structlevel) { #ifdef MAC nhfp->fd = macopen(fq_save, O_RDONLY | O_BINARY, SAVE_TYPE); @@ -1291,10 +1211,6 @@ restore_saved_game() nh_uncompress(fq_save); if ((nhfp = open_savefile()) != 0) { - if (nhfp && nhfp->fieldlevel && nhfp->fplog) - (void) fprintf(nhfp->fplog, "# just opened\n"); - if (nhfp->fieldlevel && nhfp->addinfo) - sfi_addinfo(nhfp, "NetHack", "start", "savefile", 0); if (validate(nhfp, fq_save) != 0) { close_nhfile(nhfp); nhfp = (NHFILE *)0; @@ -1371,6 +1287,10 @@ get_saved_games() { char *foundfile; const char *fq_save; + const char *fq_new_save; + const char *fq_old_save; + char **files = 0; + int i; Strcpy(g.plname, "*"); set_savefile_name(FALSE); @@ -1386,20 +1306,44 @@ get_saved_games() ++n; } while (findnext()); } + if (n > 0) { - result = (char **) alloc((n + 1) * sizeof(char *)); /* at most */ - (void) memset((genericptr_t) result, 0, (n + 1) * sizeof(char *)); + files = (char **) alloc((n + 1) * sizeof(char *)); /* at most */ + (void) memset((genericptr_t) files, 0, (n + 1) * sizeof(char *)); if (findfirst((char *) fq_save)) { - j = n = 0; + i = 0; do { - char *r; - r = plname_from_file(foundfile); - if (r) - result[j++] = r; - ++n; + files[i++] = strdup(foundfile); } while (findnext()); } } + + if (n > 0) { + result = (char **) alloc((n + 1) * sizeof(char *)); /* at most */ + (void) memset((genericptr_t) result, 0, (n + 1) * sizeof(char *)); + for(i = 0; i < n; i++) { + char *r; + r = plname_from_file(files[i]); + + if (r) { + + /* rename file if it is not named as expected */ + Strcpy(g.plname, r); + set_savefile_name(FALSE); + fq_new_save = fqname(g.SAVEF, SAVEPREFIX, 0); + fq_old_save = fqname(files[i], SAVEPREFIX, 1); + + if(strcmp(fq_old_save, fq_new_save) != 0 && + !file_exists(fq_new_save)) + rename(fq_old_save, fq_new_save); + + result[j++] = r; + } + } + } + + free_saved_games(files); + } #endif #if defined(UNIX) && defined(QT_GRAPHICS) @@ -1847,7 +1791,7 @@ boolean uncomp; /* ---------- BEGIN FILE LOCKING HANDLING ----------- */ #if defined(NO_FILE_LINKS) || defined(USE_FCNTL) /* implies UNIX */ -static int lockfd; /* for lock_file() to pass to unlock_file() */ +static int lockfd = -1; /* for lock_file() to pass to unlock_file() */ #endif #ifdef USE_FCNTL struct flock sflock; /* for unlocking, same as above */ @@ -1959,7 +1903,7 @@ int retryct; return FALSE; } #else - register int errnosv = errno; + int errnosv = errno; switch (errnosv) { /* George Barbanis */ case EEXIST: @@ -2070,9 +2014,10 @@ const char *filename; if (g.nesting == 1) { #ifdef USE_FCNTL sflock.l_type = F_UNLCK; - if (fcntl(lockfd, F_SETLK, &sflock) == -1) { - HUP raw_printf("Can't remove fcntl lock on %s.", filename); - (void) close(lockfd); + if (lockfd >= 0) { + if (fcntl(lockfd, F_SETLK, &sflock) == -1) + HUP raw_printf("Can't remove fcntl lock on %s.", filename); + (void) close(lockfd), lockfd = -1; } #else lockname = make_lockname(filename, locknambuf); @@ -2084,7 +2029,7 @@ const char *filename; if (unlink(lockname) < 0) HUP raw_printf("Can't unlink %s.", lockname); #ifdef NO_FILE_LINKS - (void) nhclose(lockfd); + (void) nhclose(lockfd), lockfd = -1; #endif #endif /* UNIX || VMS */ @@ -2113,7 +2058,7 @@ const char *default_configfile = "NetHack Defaults"; #else #if defined(MSDOS) || defined(WIN32) - "defaults.nh"; + CONFIG_FILE; #else "NetHack.cnf"; #endif @@ -2223,7 +2168,7 @@ int src; /* constructed full path names don't need fqname() */ #ifdef VMS /* no punctuation, so might be a logical name */ - set_configfile_name(fqname("nethackini", CONFIGPREFIX, 0)); + set_configfile_name("nethackini"); if ((fp = fopenp(configfile, "r")) != (FILE *) 0) return fp; set_configfile_name("sys$login:nethack.ini"); @@ -2259,7 +2204,7 @@ int src; set_configfile_name(tmp_config); if ((fp = fopenp(configfile, "r")) != (FILE *) 0) return fp; - /* may be easier for user to edit if filename as '.txt' suffix */ + /* may be easier for user to edit if filename has '.txt' suffix */ Sprintf(tmp_config, "%s/%s", envp, "Library/Preferences/NetHack Defaults.txt"); set_configfile_name(tmp_config); @@ -2342,7 +2287,7 @@ const char *name; /* name of option for error message */ break; default: - gi_error: + gi_error: raw_printf("Syntax error in %s", name); wait_synch(); return count; @@ -2361,6 +2306,10 @@ int prefixid; if (!bufp) return; +#ifdef WIN32 + if (fqn_prefix_locked[prefixid]) + return; +#endif /* Backward compatibility, ignore trailing ;n */ if ((ptr = index(bufp, ';')) != 0) *ptr = '\0'; @@ -2485,18 +2434,21 @@ char *origbuf; static boolean ramdisk_specified = FALSE; #endif #ifdef SYSCF - int n; + int n, src = iflags.parse_config_file_src; #endif char *bufp, buf[4 * BUFSZ]; uchar translate[MAXPCHARS]; int len; boolean retval = TRUE; - int src = iflags.parse_config_file_src; + while (*origbuf == ' ' || *origbuf == '\t') /* skip leading whitespace */ + ++origbuf; /* (caller probably already did this) */ + (void) strncpy(buf, origbuf, sizeof buf - 1); + buf[sizeof buf - 1] = '\0'; /* strncpy not guaranteed to NUL terminate */ /* convert any tab to space, condense consecutive spaces into one, remove leading and trailing spaces (exception: if there is nothing but spaces, one of them will be kept even though it leads/trails) */ - mungspaces(strcpy(buf, origbuf)); + mungspaces(buf); /* find the '=' or ':' */ bufp = find_optparam(buf); @@ -2775,11 +2727,29 @@ char *origbuf; } else if (src == SET_IN_SYS && match_varname(buf, "BONESFORMAT", 11)) { parseformat(sysopt.bonesformat, bufp); + } else if (src == SET_IN_SYS + && match_varname(buf, "ACCESSIBILITY", 13)) { + n = atoi(bufp); + if (n < 0 || n > 1) { + config_error_add("Illegal value in ACCESSIBILITY (not 0,1)."); + return FALSE; + } + sysopt.accessibility = n; +#ifdef WIN32 + } else if (src == SET_IN_SYS + && match_varname(buf, "portable_device_paths", 8)) { + n = atoi(bufp); + if (n < 0 || n > 1) { + config_error_add("Illegal value in portable_device_paths (not 0,1)."); + return FALSE; + } + sysopt.portable_device_paths = n; +#endif #endif /* SYSCF */ } else if (match_varname(buf, "BOULDER", 3)) { - (void) get_uchars(bufp, &iflags.bouldersym, TRUE, 1, - "BOULDER"); + (void) get_uchars(bufp, &g.ov_primary_syms[SYM_BOULDER + SYM_OFF_X], + TRUE, 1, "BOULDER"); } else if (match_varname(buf, "MENUCOLOR", 9)) { if (!add_menu_coloring(bufp)) retval = FALSE; @@ -2792,8 +2762,14 @@ char *origbuf; (void) get_uchars(bufp, translate, FALSE, WARNCOUNT, "WARNINGS"); assign_warnings(translate); + } else if (match_varname(buf, "ROGUESYMBOLS", 4)) { + if (!parsesymbols(bufp, ROGUESET)) { + config_error_add("Error in ROGUESYMBOLS definition '%s'", bufp); + retval = FALSE; + } + switch_symbols(TRUE); } else if (match_varname(buf, "SYMBOLS", 4)) { - if (!parsesymbols(bufp)) { + if (!parsesymbols(bufp, PRIMARY)) { config_error_add("Error in SYMBOLS definition '%s'", bufp); retval = FALSE; } @@ -3202,7 +3178,11 @@ boolean proc_wizkit_line(buf) char *buf; { - struct obj *otmp = readobjnam(buf, (struct obj *) 0); + struct obj *otmp; + + if (strlen(buf) >= BUFSZ) + buf[BUFSZ - 1] = '\0'; + otmp = readobjnam(buf, (struct obj *) 0); if (otmp) { if (otmp != &cg.zeroobj) @@ -3298,9 +3278,10 @@ boolean FDECL((*proc), (char *)); } ep = inbuf; - while (*ep == ' ' || *ep == '\t') ep++; + while (*ep == ' ' || *ep == '\t') + ++ep; - /* lines beginning with '#' are comments. ignore empty lines. */ + /* ignore empty lines and full-line comment lines */ if (!*ep || *ep == '#') ignoreline = TRUE; @@ -3309,22 +3290,24 @@ boolean FDECL((*proc), (char *)); /* merge now read line with previous ones, if necessary */ if (!ignoreline) { - len = strlen(inbuf) + 1; + len = (int) strlen(ep) + 1; /* +1: final '\0' */ if (buf) - len += strlen(buf); + len += (int) strlen(buf) + 1; /* +1: space */ tmpbuf = (char *) alloc(len); + *tmpbuf = '\0'; if (buf) { - Sprintf(tmpbuf, "%s %s", buf, inbuf); + Strcat(strcpy(tmpbuf, buf), " "); free(buf); - } else - Strcpy(tmpbuf, inbuf); - buf = tmpbuf; + } + buf = strcat(tmpbuf, ep); + if (strlen(buf) >= sizeof inbuf) + buf[sizeof inbuf - 1] = '\0'; } if (morelines || (ignoreline && !oldline)) continue; - if (handle_config_section(ep)) { + if (handle_config_section(buf)) { free(buf); buf = (char *) 0; continue; @@ -3335,6 +3318,7 @@ boolean FDECL((*proc), (char *)); if (match_varname(buf, "CHOOSE", 6)) { char *section; char *bufp = find_optparam(buf); + if (!bufp) { config_error_add( "Format is CHOOSE=section1,section2,..."); @@ -3345,11 +3329,11 @@ boolean FDECL((*proc), (char *)); } bufp++; if (g.config_section_chosen) - free(g.config_section_chosen); + free(g.config_section_chosen), g.config_section_chosen = 0; section = choose_random_part(bufp, ','); - if (section) + if (section) { g.config_section_chosen = dupstr(section); - else { + } else { config_error_add("No config section to choose"); rv = FALSE; } @@ -3383,7 +3367,14 @@ fopen_sym_file() { FILE *fp; - fp = fopen_datafile(SYMBOLS, "r", HACKPREFIX); + fp = fopen_datafile(SYMBOLS, "r", +#ifdef WIN32 + SYSCONFPREFIX +#else + HACKPREFIX +#endif + ); + return fp; } @@ -3397,10 +3388,11 @@ int which_set; { FILE *fp; + g.symset[which_set].explicitly = FALSE; if (!(fp = fopen_sym_file())) return 0; - g.symset_count = 0; + g.symset[which_set].explicitly = TRUE; g.chosen_symset_start = g.chosen_symset_end = FALSE; g.symset_which_set = which_set; @@ -3419,7 +3411,14 @@ int which_set; || !strcmpi(g.symset[which_set].name, "default"))) clear_symsetentry(which_set, TRUE); config_error_done(); - return (g.symset[which_set].name == 0) ? 1 : 0; + + /* If name was defined, it was invalid... Then we're loading fallback */ + if (g.symset[which_set].name) { + g.symset[which_set].explicitly = FALSE; + return 0; + } + + return 1; } if (!g.chosen_symset_end) config_error_add("Missing finish for symset \"%s\"", @@ -3446,6 +3445,8 @@ int which_set; struct symparse *symp; char *bufp, *commentp, *altp; + if (strlen(buf) >= BUFSZ) + buf[BUFSZ - 1] = '\0'; /* convert each instance of whitespace (tabs, consecutive spaces) into a single space; leading and trailing spaces are stripped */ mungspaces(buf); @@ -3490,14 +3491,19 @@ int which_set; building a pick-list of possible symset values from the file, so only do that */ if (symp->range == SYM_CONTROL) { - struct symsetentry *tmpsp; + struct symsetentry *tmpsp, *lastsp; + for (lastsp = g.symset_list; lastsp; lastsp = lastsp->next) + if (!lastsp->next) + break; switch (symp->idx) { case 0: tmpsp = (struct symsetentry *) alloc(sizeof *tmpsp); - tmpsp->next = g.symset_list; - g.symset_list = tmpsp; - tmpsp->idx = g.symset_count++; + tmpsp->next = (struct symsetentry *) 0; + if (!lastsp) + g.symset_list = tmpsp; + else + lastsp->next = tmpsp; tmpsp->name = dupstr(bufp); tmpsp->desc = (char *) 0; tmpsp->handling = H_UNK; @@ -3508,21 +3514,22 @@ int which_set; break; case 2: /* handler type identified */ - tmpsp = g.symset_list; /* most recent symset */ + tmpsp = lastsp; /* most recent symset */ for (i = 0; known_handling[i]; ++i) if (!strcmpi(known_handling[i], bufp)) { tmpsp->handling = i; break; /* for loop */ } break; - case 3: /* description:something */ - tmpsp = g.symset_list; /* most recent symset */ + case 3: + /* description:something */ + tmpsp = lastsp; /* most recent symset */ if (tmpsp && !tmpsp->desc) tmpsp->desc = dupstr(bufp); break; case 5: /* restrictions: xxxx*/ - tmpsp = g.symset_list; /* most recent symset */ + tmpsp = lastsp; /* most recent symset */ for (i = 0; known_restrictions[i]; ++i) { if (!strcmpi(known_restrictions[i], bufp)) { switch (i) { @@ -3551,9 +3558,9 @@ int which_set; g.chosen_symset_start = TRUE; /* these init_*() functions clear symset fields too */ if (which_set == ROGUESET) - init_r_symbols(); + init_rogue_symbols(); else if (which_set == PRIMARY) - init_l_symbols(); + init_primary_symbols(); } break; case 1: @@ -3606,9 +3613,9 @@ int which_set; val = sym_val(bufp); if (g.chosen_symset_start) { if (which_set == PRIMARY) { - update_l_symset(symp, val); + update_primary_symset(symp, val); } else if (which_set == ROGUESET) { - update_r_symset(symp, val); + update_rogue_symset(symp, val); } } } @@ -3859,14 +3866,15 @@ boolean recover_savefile() { NHFILE *gnhfp, *lnhfp, *snhfp; - int lev, savelev, hpid, pltmpsiz; + int lev, savelev, hpid, pltmpsiz, filecmc; xchar levc; struct version_info version_data; int processed[256]; - char savename[SAVESIZE], errbuf[BUFSZ]; + char savename[SAVESIZE], errbuf[BUFSZ], indicator; struct savefile_info sfi; char tmpplbuf[PL_NSIZ]; - + const char *savewrite_failure = (const char *) 0; + for (lev = 0; lev < 256; lev++) processed[lev] = 0; @@ -3901,6 +3909,10 @@ recover_savefile() } if ((read(gnhfp->fd, (genericptr_t) savename, sizeof savename) != sizeof savename) + || (read(gnhfp->fd, (genericptr_t) &indicator, sizeof indicator) + != sizeof indicator) + || (read(gnhfp->fd, (genericptr_t) &filecmc, sizeof filecmc) + != sizeof filecmc) || (read(gnhfp->fd, (genericptr_t) &version_data, sizeof version_data) != sizeof version_data) || (read(gnhfp->fd, (genericptr_t) &sfi, sizeof sfi) != sizeof sfi) @@ -3913,6 +3925,7 @@ recover_savefile() } /* save file should contain: + * format indicator and cmc * version info * savefile info * player name @@ -3920,6 +3933,13 @@ recover_savefile() * (non-level-based) game state * other levels */ + + /* + * Set a flag for the savefile routines to know the + * circumstances and act accordingly: + * g.program_state.in_self_recover + */ + g.program_state.in_self_recover = TRUE; set_savefile_name(TRUE); snhfp = create_savefile(); if (!snhfp) { @@ -3937,46 +3957,34 @@ recover_savefile() return FALSE; } - if (write(snhfp->fd, (genericptr_t) &version_data, sizeof version_data) - != sizeof version_data) { - raw_printf("\nError writing %s; recovery failed.", g.SAVEF); - close_nhfile(gnhfp); - close_nhfile(snhfp); - close_nhfile(lnhfp); - delete_savefile(); - return FALSE; - } + /* + * Our savefile output format might _not_ be structlevel. + * We have to check and use the correct output routine here. + */ + /*store_formatindicator(snhfp); */ + store_version(snhfp); - if (write(snhfp->fd, (genericptr_t) &sfi, sizeof sfi) != sizeof sfi) { - raw_printf("\nError writing %s; recovery failed (savefile_info).\n", - g.SAVEF); - close_nhfile(gnhfp); - close_nhfile(snhfp); - close_nhfile(lnhfp); - delete_savefile(); - return FALSE; + if (snhfp->structlevel) { + if (write(snhfp->fd, (genericptr_t) &sfi, sizeof sfi) != sizeof sfi) + savewrite_failure = "savefileinfo"; } + if (savewrite_failure) + goto cleanup; - if (write(snhfp->fd, (genericptr_t) &pltmpsiz, sizeof pltmpsiz) - != sizeof pltmpsiz) { - raw_printf("Error writing %s; recovery failed (player name size).\n", - g.SAVEF); - close_nhfile(gnhfp); - close_nhfile(snhfp); - close_nhfile(lnhfp); - delete_savefile(); - return FALSE; + if (snhfp->structlevel) { + if (write(snhfp->fd, (genericptr_t) &pltmpsiz, sizeof pltmpsiz) + != sizeof pltmpsiz) + savewrite_failure = "player name size"; } + if (savewrite_failure) + goto cleanup; - if (write(snhfp->fd, (genericptr_t) &tmpplbuf, pltmpsiz) != pltmpsiz) { - raw_printf("Error writing %s; recovery failed (player name).\n", - g.SAVEF); - close_nhfile(gnhfp); - close_nhfile(snhfp); - close_nhfile(lnhfp); - delete_savefile(); - return FALSE; + if (snhfp->structlevel) { + if (write(snhfp->fd, (genericptr_t) &tmpplbuf, pltmpsiz) != pltmpsiz) + savewrite_failure = "player name"; } + if (savewrite_failure) + goto cleanup; if (!copy_bytes(lnhfp->fd, snhfp->fd)) { close_nhfile(gnhfp); @@ -4032,6 +4040,20 @@ recover_savefile() (void) unlink(fq_lock); } } + cleanup: + if (savewrite_failure) { + raw_printf("\nError writing %s; recovery failed (%s).\n", + g.SAVEF, savewrite_failure); + close_nhfile(gnhfp); + close_nhfile(snhfp); + close_nhfile(lnhfp); + g.program_state.in_self_recover = FALSE; + delete_savefile(); + return FALSE; + } + /* we don't clear g.program_state.in_self_recover here, we + leave it as a flag to reload the structlevel savefile + in the caller. The caller should then clear it. */ return TRUE; } @@ -4063,6 +4085,10 @@ assure_syscf_file() { int fd; +#ifdef WIN32 + /* We are checking that the sysconf exists ... lock the path */ + fqn_prefix_locked[SYSCONFPREFIX] = TRUE; +#endif /* * All we really care about is the end result - can we read the file? * So just check that directly. @@ -4167,6 +4193,219 @@ boolean wildcards; #endif /*DEBUG*/ +#ifdef UNIX +#ifndef PATH_MAX +#include +#endif +#endif + +void +reveal_paths(VOID_ARGS) +{ + const char *fqn, *nodumpreason; + char buf[BUFSZ]; +#if defined(SYSCF) || !defined(UNIX) || defined(DLB) + const char *filep; +#ifdef SYSCF + const char *gamename = (g.hname && *g.hname) ? g.hname : "NetHack"; +#endif +#endif +#if defined(PREFIXES_IN_USE) + const char *cstrp; +#endif +#ifdef UNIX + char *endp, *envp, cwdbuf[PATH_MAX]; +#endif +#ifdef PREFIXES_IN_USE + int i, maxlen = 0; + + raw_print("Variable playground locations:"); + for (i = 0; i < PREFIX_COUNT; i++) + raw_printf(" [%-10s]=\"%s\"", fqn_prefix_names[i], + g.fqn_prefix[i] ? g.fqn_prefix[i] : "not set"); +#endif + + /* sysconf file */ + +#ifdef SYSCF +#ifdef PREFIXES_IN_USE + cstrp = fqn_prefix_names[SYSCONFPREFIX]; + maxlen = BUFSZ - sizeof " (in )"; + if (cstrp && (int) strlen(cstrp) < maxlen) + Sprintf(buf, " (in %s)", cstrp); +#else + buf[0] = '\0'; +#endif + raw_printf("%s system configuration file%s:", s_suffix(gamename), buf); +#ifdef SYSCF_FILE + filep = SYSCF_FILE; +#else + filep = "sysconf"; +#endif + fqn = fqname(filep, SYSCONFPREFIX, 0); + if (fqn) { + set_configfile_name(fqn); + filep = configfile; + } + raw_printf(" \"%s\"", filep); +#else /* !SYSCF */ + raw_printf("No system configuration file."); +#endif /* ?SYSCF */ + + /* symbols file */ + + buf[0] = '\0'; +#ifndef UNIX +#ifdef PREFIXES_IN_USE +#ifdef WIN32 + cstrp = fqn_prefix_names[SYSCONFPREFIX]; +#else + cstrp = fqn_prefix_names[HACKPREFIX]; +#endif /* WIN32 */ + maxlen = BUFSZ - sizeof " (in )"; + if (cstrp && (int) strlen(cstrp) < maxlen) + Sprintf(buf, " (in %s)", cstrp); +#endif /* PREFIXES_IN_USE */ + raw_printf("The loadable symbols file%s:", buf); +#endif /* UNIX */ + +#ifdef UNIX + envp = getcwd(cwdbuf, PATH_MAX); + if (envp) { + raw_print("The loadable symbols file:"); + raw_printf(" \"%s/%s\"", envp, SYMBOLS); + } +#else /* UNIX */ + filep = SYMBOLS; +#ifdef PREFIXES_IN_USE +#ifdef WIN32 + fqn = fqname(filep, SYSCONFPREFIX, 1); +#else + fqn = fqname(filep, HACKPREFIX, 1); +#endif /* WIN32 */ + if (fqn) + filep = fqn; +#endif /* PREFIXES_IN_USE */ + raw_printf(" \"%s\"", filep); +#endif /* UNIX */ + + /* dlb vs non-dlb */ + + buf[0] = '\0'; +#ifdef PREFIXES_IN_USE + cstrp = fqn_prefix_names[DATAPREFIX]; + maxlen = BUFSZ - sizeof " (in )"; + if (cstrp && (int) strlen(cstrp) < maxlen) + Sprintf(buf, " (in %s)", cstrp); +#endif +#ifdef DLB + raw_printf("Basic data files%s are collected inside:", buf); + filep = DLBFILE; +#ifdef VERSION_IN_DLB_FILENAME + Strcpy(buf, build_dlb_filename((const char *) 0)); +#ifdef PREFIXES_IN_USE + fqn = fqname(buf, DATAPREFIX, 1); + if (fqn) + filep = fqn; +#endif /* PREFIXES_IN_USE */ +#endif + raw_printf(" \"%s\"", filep); +#ifdef DLBFILE2 + filep = DLBFILE2; + raw_printf(" \"%s\"", filep); +#endif +#else /* !DLB */ + raw_printf("Basic data files%s are in many separate files.", buf); +#endif /* ?DLB */ + + /* dumplog */ + +#ifndef DUMPLOG + nodumpreason = "not supported"; +#else + nodumpreason = "disabled"; +#ifdef SYSCF + fqn = sysopt.dumplogfile; +#else /* !SYSCF */ +#ifdef DUMPLOG_FILE + fqn = DUMPLOG_FILE; +#else + fqn = (char *) 0; +#endif +#endif /* ?SYSCF */ + if (fqn && *fqn) { + raw_print("Your end-of-game disclosure file:"); + (void) dump_fmtstr(fqn, buf, FALSE); + buf[sizeof buf - sizeof " \"\""] = '\0'; + raw_printf(" \"%s\"", buf); + } else +#endif /* ?DUMPLOG */ + raw_printf("No end-of-game disclosure file (%s).", nodumpreason); + +#ifdef WIN32 + if (sysopt.portable_device_paths) { + const char *pd = get_portable_device(); + + raw_printf("portable_device_paths (set in sysconf):"); + raw_printf(" \"%s\"", pd); + } +#endif + + /* personal configuration file */ + + buf[0] = '\0'; +#ifdef PREFIXES_IN_USE + cstrp = fqn_prefix_names[CONFIGPREFIX]; + maxlen = BUFSZ - sizeof " (in )"; + if (cstrp && (int) strlen(cstrp) < maxlen) + Sprintf(buf, " (in %s)", cstrp); +#endif /* PREFIXES_IN_USE */ + raw_printf("Your personal configuration file%s:", buf); + +#ifdef UNIX + buf[0] = '\0'; + if ((envp = nh_getenv("HOME")) != 0) { + copynchars(buf, envp, (int) sizeof buf - 1 - 1); + Strcat(buf, "/"); + } + endp = eos(buf); + copynchars(endp, default_configfile, + (int) (sizeof buf - 1 - strlen(buf))); +#if defined(__APPLE__) /* UNIX+__APPLE__ => MacOSX aka OSX aka macOS */ + if (envp) { + if (access(buf, 4) == -1) { /* 4: R_OK, -1: failure */ + /* read access to default failed; might be protected excessively + but more likely it doesn't exist; try first alternate: + "$HOME/Library/Pref..."; 'endp' points past '/' */ + copynchars(endp, "Library/Preferences/NetHack Defaults", + (int) (sizeof buf - 1 - strlen(buf))); + if (access(buf, 4) == -1) { + /* first alternate failed, try second: + ".../NetHack Defaults.txt"; no 'endp', just append */ + copynchars(eos(buf), ".txt", + (int) (sizeof buf - 1 - strlen(buf))); + if (access(buf, 4) == -1) { + /* second alternate failed too, so revert to the + original default ("$HOME/.nethackrc") for message */ + copynchars(endp, default_configfile, + (int) (sizeof buf - 1 - strlen(buf))); + } + } + } + } +#endif /* __APPLE__ */ + raw_printf(" \"%s\"", buf); +#else /* !UNIX */ + fqn = (const char *) 0; +#ifdef PREFIXES_IN_USE + fqn = fqname(default_configfile, CONFIGPREFIX, 2); +#endif + raw_printf(" \"%s\"", fqn ? fqn : default_configfile); +#endif /* ?UNIX */ + + raw_print(""); +} + /* ---------- BEGIN TRIBUTE ----------- */ /* 3.6 tribute code @@ -4366,7 +4605,7 @@ unsigned oid; /* book identifier */ } } -cleanup: + cleanup: (void) dlb_fclose(fp); if (nowin_buf) { /* one-line buffer */ diff --git a/src/hack.c b/src/hack.c index ee260b396..d15ca467c 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 hack.c $NHDT-Date: 1568509227 2019/09/15 01:00:27 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.216 $ */ +/* NetHack 3.6 hack.c $NHDT-Date: 1576638500 2019/12/18 03:08:20 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.220 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -151,17 +151,35 @@ moverock() if (mtmp && !noncorporeal(mtmp->data) && (!mtmp->mtrapped || !(ttmp && is_pit(ttmp->ttyp)))) { + boolean deliver_part1 = FALSE; + if (Blind) feel_location(sx, sy); if (canspotmon(mtmp)) { pline("There's %s on the other side.", a_monnam(mtmp)); + deliver_part1 = TRUE; } else { You_hear("a monster behind %s.", the(xname(otmp))); + if (!Deaf) + deliver_part1 = TRUE; map_invisible(rx, ry); } - if (flags.verbose) - pline("Perhaps that's why %s cannot move it.", - u.usteed ? y_monnam(u.usteed) : "you"); + if (flags.verbose) { + char you_or_steed[BUFSZ]; + + Strcpy(you_or_steed, + u.usteed ? y_monnam(u.usteed) : "you"); + pline("%s%s cannot move %s.", + deliver_part1 + ? "Perhaps that's why " + : "", + deliver_part1 + ? you_or_steed + : upstart(you_or_steed), + deliver_part1 + ? "it" + : the(xname(otmp))); + } goto cannot_push; } @@ -2103,6 +2121,10 @@ boolean newspot; /* true if called by spoteffects */ } /* not mounted */ + /* if hiding on ceiling then don't automatically enter pool */ + if (Upolyd && ceiling_hider(&mons[u.umonnum]) && u.uundetected) + return FALSE; + /* drown(),lava_effects() return true if hero changes location while surviving the problem */ if (is_lava(u.ux, u.uy)) { @@ -2614,8 +2636,10 @@ pickup_checks() } if (!can_reach_floor(TRUE)) { struct trap *traphere = t_at(u.ux, u.uy); - if (traphere && uteetering_at_seen_pit(traphere)) - You("cannot reach the bottom of the pit."); + if (traphere + && (uteetering_at_seen_pit(traphere) || uescaped_shaft(traphere))) + You("cannot reach the bottom of the %s.", + is_pit(traphere->ttyp) ? "pit" : "abyss"); else if (u.usteed && P_SKILL(P_RIDING) < P_BASIC) rider_cant_reach(); else if (Blind && !can_reach_floor(TRUE)) @@ -2816,7 +2840,7 @@ int x, y; if (!IS_DOOR(lev_p->typ)) return FALSE; /* all rogue level doors are doorless but disallow diagonal access, so - we treat them as if their non-existant doors were actually present */ + we treat them as if their non-existent doors were actually present */ if (Is_rogue_level(&u.uz)) return FALSE; return !(lev_p->doormask & ~(D_NODOOR | D_BROKEN)); diff --git a/src/hacklib.c b/src/hacklib.c index e33d17e8a..d823351f9 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 hacklib.c $NHDT-Date: 1552639487 2019/03/15 08:44:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.67 $ */ +/* NetHack 3.6 hacklib.c $NHDT-Date: 1574636502 2019/11/24 23:01:42 $ $NHDT-Branch: paxed-quest-lua $:$NHDT-Revision: 1.79 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2007. */ /* Copyright (c) Robert Patrick Rankin, 1991 */ @@ -22,8 +22,10 @@ char * trimspaces (char *) char * strip_newline (char *) char * stripchars (char *, const char *, const char *) + char * stripdigits (char *) char * eos (char *) boolean str_end_is (const char *, const char *) + int str_lines_maxlen (const char *) char * strkitten (char *,char) void copynchars (char *,const char *,int) char chrcasecpy (int,int) @@ -69,6 +71,7 @@ void strbuf_reserve (strbuf *, int) void strbuf_empty (strbuf *) void strbuf_nl_to_crlf (strbuf_t *) + char * nonconst (const char *, char *) =*/ #ifdef LINT #define Static /* pacify lint */ @@ -224,6 +227,31 @@ const char *str, *chkstr; return FALSE; } +/* return the max line length from buffer comprising of newline-separated strings */ +int +str_lines_maxlen(str) +const char *str; +{ + const char *s1, *s2; + int len, max_len = 0; + + s1 = str; + while (s1 && *s1) { + s2 = index(s1, '\n'); + if (s2) { + len = (int) (s2 - s1); + s1 = s2 + 1; + } else { + len = (int) strlen(s1); + s1 = (char *) 0; + } + if (len > max_len) + max_len = len; + } + + return max_len; +} + /* append a character to a string (in place): strcat(s, {c,'\0'}); */ char * strkitten(s, c) @@ -468,6 +496,21 @@ const char *stuff_to_strip, *orig; return bp; } +/* remove digits from string */ +char * +stripdigits(s) +char *s; +{ + char *s1, *s2; + + for (s1 = s2 = s; *s1; s1++) + if (*s1 < '0' || *s1 > '9') + *s2++ = *s1; + *s2 = '\0'; + + return s; +} + /* substitute a word or phrase in a string (in place) */ /* caller is responsible for ensuring that bp points to big enough buffer */ char * @@ -1219,4 +1262,19 @@ strbuf_t *strbuf; } } +char * +nonconst(str, buf) +const char *str; +char *buf; +{ + char *retval = emptystr; + + if (str && buf) + if ((int) strlen(str) < BUFSZ - 1) { + Strcpy(buf, str); + retval = buf; + } + return retval; +} + /*hacklib.c*/ diff --git a/src/invent.c b/src/invent.c index 6f1a4e1a5..0089cd7ac 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 invent.c $NHDT-Date: 1567213892 2019/08/31 01:11:32 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.262 $ */ +/* NetHack 3.7 invent.c $NHDT-Date: 1575245062 2019/12/02 00:04:22 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.267 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -139,8 +139,10 @@ struct obj *obj; case DRUM_OF_EARTHQUAKE: case HORN_OF_PLENTY: /* not a musical instrument */ k = 3; /* instrument or unknown horn of plenty */ + break; default: k = 4; /* 'other' tool */ + break; } break; case FOOD_CLASS: @@ -464,8 +466,8 @@ const genericptr vptr2; * (fragile) or by avoiding sortloot() during inventory display * (more robust). * - * 3.6.2 reverts to the temporary array of ordered obj pointers - * but has sortloot() do the counting and allocation. Callers + * As of 3.6.2: revert to the temporary array of ordered obj pointers + * but have sortloot() do the counting and allocation. Callers * need to use array traversal instead of linked list traversal * and need to free the temporary array when done. And the * array contains 'struct sortloot_item' (aka 'Loot') entries @@ -1712,7 +1714,7 @@ register const char *let, *word; if (iflags.force_invmenu) Sprintf(menuquery, "What do you want to %s?", word); if (!strcmp(word, "grease")) - Sprintf(qbuf, "your %s", makeplural(body_part(FINGER))); + Sprintf(qbuf, "your %s", fingers_or_gloves(FALSE)); else if (!strcmp(word, "write with")) Sprintf(qbuf, "your %s", body_part(FINGERTIP)); else if (!strcmp(word, "wield")) @@ -1882,7 +1884,7 @@ boolean is_worn(otmp) struct obj *otmp; { - return (otmp->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE | W_WEAPON)) + return (otmp->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE | W_WEAPONS)) ? TRUE : FALSE; } @@ -2893,7 +2895,7 @@ boolean FDECL((*filterfunc), (OBJ_P)); /* coins are either uncursed or unknown based upon option setting */ if (list->oclass == COIN_CLASS) { - if (type == (iflags.goldX ? BUC_UNKNOWN : BUC_UNCURSED)) + if (type == (flags.goldX ? BUC_UNKNOWN : BUC_UNCURSED)) ++count; continue; } @@ -2929,7 +2931,7 @@ int *bcp, *ucp, *ccp, *xcp, *ocp; list->bknown = (list->oclass != COIN_CLASS); /* coins are either uncursed or unknown based upon option setting */ if (list->oclass == COIN_CLASS) { - if (iflags.goldX) + if (flags.goldX) ++(*xcp); else ++(*ucp); @@ -2949,30 +2951,32 @@ int *bcp, *ucp, *ccp, *xcp, *ocp; /* count everything inside a container, or just shop-owned items inside */ long -count_contents(container, nested, quantity, everything) +count_contents(container, nested, quantity, everything, newdrop) struct obj *container; boolean nested, /* include contents of any nested containers */ quantity, /* count all vs count separate stacks */ - everything; /* all objects vs only unpaid objects */ + everything, /* all objects vs only unpaid objects */ + newdrop; /* on floor, but hero-owned items haven't been marked + * no_charge yet and shop-owned items are still marked + * unpaid -- used when asking the player whether to sell */ { struct obj *otmp, *topc; boolean shoppy = FALSE; long count = 0L; - if (!everything) { + if (!everything && !newdrop) { + xchar x, y; + for (topc = container; topc->where == OBJ_CONTAINED; topc = topc->ocontainer) continue; - if (topc->where == OBJ_FLOOR) { - xchar x, y; - - (void) get_obj_location(topc, &x, &y, CONTAINED_TOO); + if (topc->where == OBJ_FLOOR && get_obj_location(topc, &x, &y, 0)) shoppy = costly_spot(x, y); - } } for (otmp = container->cobj; otmp; otmp = otmp->nobj) { if (nested && Has_contents(otmp)) - count += count_contents(otmp, nested, quantity, everything); + count += count_contents(otmp, nested, quantity, everything, + newdrop); if (everything || otmp->unpaid || (shoppy && !otmp->no_charge)) count += quantity ? otmp->quan : 1L; } @@ -3091,7 +3095,7 @@ struct obj *obj; /* if filtering by bless/curse state, gold is classified as either unknown or uncursed based on user option setting */ if (g.this_type && index("BUCX", g.this_type)) - res = (g.this_type == (iflags.goldX ? 'X' : 'U')); + res = (g.this_type == (flags.goldX ? 'X' : 'U')); } else { switch (g.this_type) { case 'B': diff --git a/src/light.c b/src/light.c index 2fd09425a..243282bfe 100644 --- a/src/light.c +++ b/src/light.c @@ -3,9 +3,6 @@ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" -#include "lev.h" /* for checking save modes */ -#include "sfproto.h" - /* * Mobile light sources. @@ -326,9 +323,6 @@ int range; if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) &count, sizeof count); } - if (nhfp->fieldlevel) { - sfo_int(nhfp, &count, "lightsources", "lightsource_count", 1); - } actual = maybe_write_ls(nhfp, range, TRUE); if (actual != count) panic("counted %d light sources, wrote %d! [range=%d]", count, @@ -373,21 +367,17 @@ void restore_light_sources(nhfp) NHFILE *nhfp; { - int count; + int count = 0; light_source *ls; /* restore elements */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &count, sizeof count); - if (nhfp->fieldlevel) - sfi_int(nhfp, &count, "lightsources", "lightsource_count", 1); while (count-- > 0) { ls = (light_source *) alloc(sizeof(light_source)); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) ls, sizeof(light_source)); - if (nhfp->fieldlevel) - sfi_ls_t(nhfp, ls, "lightsources", "lightsource", 1); ls->next = g.light_base; g.light_base = ls; } @@ -529,8 +519,6 @@ light_source *ls; if (ls->flags & LSF_NEEDS_FIXUP) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) ls, sizeof(light_source)); - if (nhfp->fieldlevel) - sfo_ls_t(nhfp, ls, "lightsources", "lightsource", 1); } else { /* replace object pointer with id for write, then put back */ arg_save = ls->id; @@ -552,8 +540,6 @@ light_source *ls; ls->flags |= LSF_NEEDS_FIXUP; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) ls, sizeof(light_source)); - if (nhfp->fieldlevel) - sfo_ls_t(nhfp, ls, "lightsources", "lightsource", 1); ls->id = arg_save; ls->flags &= ~LSF_NEEDS_FIXUP; } diff --git a/src/mail.c b/src/mail.c index 839e030a4..a6ec5ddc6 100644 --- a/src/mail.c +++ b/src/mail.c @@ -10,8 +10,12 @@ # include # include #endif /* SIMPLE_MAIL */ +#endif /* MAIL */ +#ifdef MAIL_STRUCTURES #include "mail.h" +#endif +#ifdef MAIL /* * Notify user when new mail has arrived. Idea by Merlyn Leroy. * diff --git a/src/makemon.c b/src/makemon.c index f38864433..d9c6bdb4e 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 makemon.c $NHDT-Date: 1561236435 2019/06/22 20:47:15 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.138 $ */ +/* NetHack 3.6 makemon.c $NHDT-Date: 1574722863 2019/11/25 23:01:03 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.142 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -166,7 +166,7 @@ register struct monst *mtmp; register struct permonst *ptr = mtmp->data; register int mm = monsndx(ptr); struct obj *otmp; - int bias, spe2, w1, w2; + int bias, w1, w2; if (Is_rogue_level(&u.uz)) return; @@ -259,12 +259,10 @@ register struct monst *mtmp; } else if (ptr->msound == MS_PRIEST || quest_mon_represents_role(ptr, PM_PRIEST)) { otmp = mksobj(MACE, FALSE, FALSE); - if (otmp) { - otmp->spe = rnd(3); - if (!rn2(2)) - curse(otmp); - (void) mpickobj(mtmp, otmp); - } + otmp->spe = rnd(3); + if (!rn2(2)) + curse(otmp); + (void) mpickobj(mtmp, otmp); } else if (mm == PM_NINJA) { /* extra quest villains */ (void) mongets(mtmp, rn2(4) ? SHURIKEN : DART); (void) mongets(mtmp, rn2(4) ? SHORT_SWORD : AXE); @@ -336,14 +334,13 @@ register struct monst *mtmp; artiname(rn2(2) ? ART_DEMONBANE : ART_SUNSWORD)); bless(otmp); otmp->oerodeproof = TRUE; - spe2 = rn2(4); - otmp->spe = max(otmp->spe, spe2); + otmp->spe = rn2(4); (void) mpickobj(mtmp, otmp); otmp = mksobj(!rn2(4) || is_lord(ptr) ? SHIELD_OF_REFLECTION : LARGE_SHIELD, FALSE, FALSE); - otmp->cursed = FALSE; + /* uncurse(otmp); -- mksobj(,FALSE,) item is always uncursed */ otmp->oerodeproof = TRUE; otmp->spe = 0; (void) mpickobj(mtmp, otmp); @@ -1626,7 +1623,7 @@ int mndx, mvflagsmask, genomask; return FALSE; if (is_placeholder(ptr)) return FALSE; -#ifdef MAIL +#ifdef MAIL_STRUCTURES /* special levels might ask for random demon type; reject this one */ if (ptr == &mons[PM_MAIL_DAEMON]) return FALSE; @@ -2194,10 +2191,12 @@ register struct monst *mtmp; } else if (rt == TEMPLE) { ap_type = M_AP_FURNITURE; appear = S_altar; - /* - * We won't bother with beehives, morgues, barracks, throne rooms - * since they shouldn't contain too many mimics anyway... - */ + + /* + * We won't bother with beehives, morgues, barracks, throne rooms + * since they shouldn't contain too many mimics anyway... + */ + } else if (rt >= SHOPBASE) { s_sym = get_shop_item(rt - SHOPBASE); if (s_sym < 0) { @@ -2245,6 +2244,23 @@ register struct monst *mtmp; newmcorpsenm(mtmp); MCORPSENM(mtmp) = mndx; + } else if (ap_type == M_AP_OBJECT && appear == SLIME_MOLD) { + newmcorpsenm(mtmp); + MCORPSENM(mtmp) = g.context.current_fruit; + /* if no objects of this fruit type have been created yet, + context.current_fruit is available for re-use when the player + assigns a new fruit name; override that--having a mimic as the + current_fruit is equivalent to creating an instance of that + fruit (no-op if a fruit of this type has actually been made) */ + flags.made_fruit = TRUE; + } else if (ap_type == M_AP_FURNITURE && appear == S_altar) { + int algn = rn2(3) - 1; /* -1 (A_Cha) or 0 (A_Neu) or +1 (A_Law) */ + + newmcorpsenm(mtmp); + MCORPSENM(mtmp) = (Inhell && rn2(3)) ? AM_NONE : Align2amask(algn); + } else if (has_mcorpsenm(mtmp)) { + /* don't retain stale value from a previously mimicked shape */ + MCORPSENM(mtmp) = NON_PM; } if (does_block(mx, my, &levl[mx][my])) diff --git a/src/mapglyph.c b/src/mapglyph.c index 59512dbbb..74492cc74 100644 --- a/src/mapglyph.c +++ b/src/mapglyph.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mapglyph.c $NHDT-Date: 1552945095 2019/03/18 21:38:15 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.48 $ */ +/* NetHack 3.6 mapglyph.c $NHDT-Date: 1575830186 2019/12/08 18:36:26 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.60 $ */ /* Copyright (c) David Cohrs, 1991 */ /* NetHack may be freely redistributed. See license for details. */ @@ -9,9 +9,11 @@ #include "color.h" #define HI_DOMESTIC CLR_WHITE /* monst.c */ +#if 0 #if !defined(TTY_GRAPHICS) #define has_color(n) TRUE #endif +#endif #ifdef TEXTCOLOR static const int explcolors[] = { @@ -57,22 +59,43 @@ static const int explcolors[] = { #define is_objpile(x,y) (!Hallucination && g.level.objects[(x)][(y)] \ && g.level.objects[(x)][(y)]->nexthere) +#define GMAP_SET 0x00000001 +#define GMAP_ROGUELEVEL 0x00000002 +#define GMAP_ALTARCOLOR 0x00000004 + /*ARGSUSED*/ int -mapglyph(glyph, ochar, ocolor, ospecial, x, y) +mapglyph(glyph, ochar, ocolor, ospecial, x, y, mgflags) int glyph, *ocolor, x, y; int *ochar; unsigned *ospecial; +unsigned mgflags; { register int offset, idx; int color = NO_COLOR; nhsym ch; unsigned special = 0; /* condense multiple tests in macro version down to single */ - boolean has_rogue_ibm_graphics = HAS_ROGUE_IBM_GRAPHICS; - boolean has_rogue_color = (has_rogue_ibm_graphics + boolean has_rogue_ibm_graphics = HAS_ROGUE_IBM_GRAPHICS, + is_you = (x == u.ux && y == u.uy), + has_rogue_color = (has_rogue_ibm_graphics && g.symset[g.currentgraphics].nocolor == 0); + if (!g.glyphmap_perlevel_flags) { + /* + * GMAP_SET 0x00000001 + * GMAP_ROGUELEVEL 0x00000002 + * GMAP_ALTARCOLOR 0x00000004 + */ + g.glyphmap_perlevel_flags |= GMAP_SET; + + if (Is_rogue_level(&u.uz)) { + g.glyphmap_perlevel_flags |= GMAP_ROGUELEVEL; + } else if ((Is_astralevel(&u.uz) || Is_sanctum(&u.uz))) { + g.glyphmap_perlevel_flags |= GMAP_ALTARCOLOR; + } + } + /* * Map the glyph back to a character and color. * @@ -136,8 +159,54 @@ unsigned *ospecial; if they use the same symbol and color is disabled */ } else if (!iflags.use_color && offset == S_lava && (g.showsyms[idx] == g.showsyms[S_pool + SYM_OFF_P] - || g.showsyms[idx] == g.showsyms[S_water + SYM_OFF_P])) { + || g.showsyms[idx] + == g.showsyms[S_water + SYM_OFF_P])) { special |= MG_BW_LAVA; + } else if (offset == S_altar && iflags.use_color) { + int amsk = altarmask_at(x, y); /* might be a mimic */ + + if ((g.glyphmap_perlevel_flags & GMAP_ALTARCOLOR) + && (amsk & AM_SHRINE) != 0) { + /* high altar */ + color = CLR_BRIGHT_MAGENTA; + } else { + switch (amsk & AM_MASK) { +#if 0 /* + * On OSX with TERM=xterm-color256 these render as + * white -> tty: gray, curses: ok + * gray -> both tty and curses: black + * black -> both tty and curses: blue + * red -> both tty and curses: ok. + * Since the colors have specific associations (with the + * unicorns matched with each alignment), we shouldn't use + * scrambled colors and we don't have sufficient information + * to handle platform-specific color variations. + */ + case AM_LAWFUL: /* 4 */ + color = CLR_WHITE; + break; + case AM_NEUTRAL: /* 2 */ + color = CLR_GRAY; + break; + case AM_CHAOTIC: /* 1 */ + color = CLR_BLACK; + break; +#else /* !0: TEMP? */ + case AM_LAWFUL: /* 4 */ + case AM_NEUTRAL: /* 2 */ + case AM_CHAOTIC: /* 1 */ + cmap_color(S_altar); /* gray */ + break; +#endif /* 0 */ + case AM_NONE: /* 0 */ + color = CLR_RED; + break; + default: /* 3, 5..7 -- shouldn't happen but 3 was possible + * prior to 3.6.3 (due to faulty sink polymorph) */ + color = NO_COLOR; + break; + } + } } else { cmap_color(offset); } @@ -206,7 +275,7 @@ unsigned *ospecial; } else { /* a monster */ idx = mons[glyph].mlet + SYM_OFF_M; if (has_rogue_color && iflags.use_color) { - if (x == u.ux && y == u.uy) + if (is_you) /* actually player should be yellow-on-gray if in corridor */ color = CLR_YELLOW; else @@ -215,27 +284,42 @@ unsigned *ospecial; mon_color(glyph); #ifdef TEXTCOLOR /* special case the hero for `showrace' option */ - if (iflags.use_color && x == u.ux && y == u.uy - && flags.showrace && !Upolyd) + if (iflags.use_color && is_you && flags.showrace && !Upolyd) color = HI_DOMESTIC; #endif } } + /* These were requested by a blind player to enhance screen reader use */ + if (sysopt.accessibility == 1 && !(mgflags & MG_FLAG_NOOVERRIDE)) { + int ovidx; + + if ((special & MG_PET) != 0) { + ovidx = SYM_PET_OVERRIDE + SYM_OFF_X; + if ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) + ? g.ov_rogue_syms[ovidx] + : g.ov_primary_syms[ovidx]) + idx = ovidx; + } + if (is_you) { + ovidx = SYM_HERO_OVERRIDE + SYM_OFF_X; + if ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) + ? g.ov_rogue_syms[ovidx] + : g.ov_primary_syms[ovidx]) + idx = ovidx; + } + } + ch = g.showsyms[idx]; #ifdef TEXTCOLOR /* Turn off color if no color defined, or rogue level w/o PC graphics. */ - if (!has_color(color) || (Is_rogue_level(&u.uz) && !has_rogue_color)) - color = NO_COLOR; + if (!has_color(color) || + ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) && !has_rogue_color)) #endif - + color = NO_COLOR; *ochar = (int) ch; *ospecial = special; -#ifdef TEXTCOLOR *ocolor = color; -#else - nhUse(ocolor); -#endif return idx; } @@ -282,7 +366,7 @@ const char *str; gv = (gv * 16) + ((int) (dp - hex) / 2); else break; - so = mapglyph(gv, &ch, &oc, &os, 0, 0); + so = mapglyph(gv, &ch, &oc, &os, 0, 0, 0); *put++ = g.showsyms[so]; /* 'str' is ready for the next loop iteration and '*str' should not be copied at the end of this iteration */ diff --git a/src/mcastu.c b/src/mcastu.c index ab1039ea2..ad00be361 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -72,7 +72,7 @@ boolean undirected; pline("%s points %s.", Monnam(mtmp), point_msg); } else if ((!(g.moves % 4) || !rn2(4))) { if (!Deaf) - Norep("You hear a mumbled curse."); + Norep("You hear a mumbled curse."); /* Deaf-aware */ } } diff --git a/src/mdlib.c b/src/mdlib.c new file mode 100644 index 000000000..b749b18e0 --- /dev/null +++ b/src/mdlib.c @@ -0,0 +1,807 @@ +/* NetHack 3.7 mdlib.c $NHDT-Date: 1575161954 2019/12/01 00:59:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.6 $ */ +/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ +/*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */ +/* Copyright (c) M. Stephenson, 1990, 1991. */ +/* Copyright (c) Dean Luick, 1990. */ +/* NetHack may be freely redistributed. See license for details. */ + +/* + * This can be linked into a binary to provide the functionality + * via the contained functions, or it can be #included directly + * into util/makedefs.c to provide it there. + */ + +#ifndef MAKEDEFS_C +#define MDLIB_C +#include "config.h" +#ifdef MONITOR_HEAP +#undef free /* makedefs, mdlib don't use the alloc and free in src/alloc.c */ +#endif +#include "permonst.h" +#include "objclass.h" +#include "monsym.h" +#include "artilist.h" +#include "dungeon.h" +#include "obj.h" +#include "monst.h" +#include "you.h" +#include "context.h" +#include "flag.h" +#include "dlb.h" +#include +/* version information */ +#ifdef SHORT_FILENAMES +#include "patchlev.h" +#else +#include "patchlevel.h" +#endif +#define Fprintf (void) fprintf +#define Fclose (void) fclose +#define Unlink (void) unlink +#if !defined(AMIGA) || defined(AZTEC_C) +#define rewind(fp) fseek((fp), 0L, SEEK_SET) /* guarantee a return value */ +#endif /* AMIGA || AZTEC_C */ +#else +#ifndef GLOBAL_H +#include "global.h" +#endif +#endif /* !MAKEDEFS_C */ + +#if defined(MAKEDEFS_C) || defined(CROSSCOMPILE_TARGET) +/* REPRODUCIBLE_BUILD will change this to TRUE */ +static boolean date_via_env = FALSE; + +static char *FDECL(version_string, (char *, const char *)); +static char *FDECL(version_id_string, (char *, const char *)); +static char *FDECL(bannerc_string, (char *, const char *)); + +static int FDECL(case_insensitive_comp, (const char *, const char *)); +static void NDECL(make_version); +static char *FDECL(eos, (char *)); +#endif /* MAKEDEFS_C || CROSSCOMPILE_TARGET */ + +void NDECL(build_options); +static void FDECL(opt_out_words, (char *, int *)); +static void NDECL(build_savebones_compat_string); +static int idxopttext, done_runtime_opt_init_once = 0; +#define MAXOPT 40 +static char rttimebuf[MAXOPT]; +static char *opttext[120] = { 0 }; +char optbuf[BUFSZ]; +static struct version_info version; +static const char opt_indent[] = " "; + +struct win_info { + const char *id, /* DEFAULT_WINDOW_SYS string */ + *name; /* description, often same as id */ +}; + +static struct win_info window_opts[] = { +#ifdef TTY_GRAPHICS + { "tty", + /* testing 'USE_TILES' here would bring confusion because it could + apply to another interface such as X11, so check MSDOS explicitly + instead; even checking TTY_TILES_ESCCODES would probably be + confusing to most users (and it will already be listed separately + in the compiled options section so users aware of it can find it) */ +#ifdef MSDOS + "traditional text with optional 'tiles' graphics" +#else + /* assume that one or more of IBMgraphics, DECgraphics, or MACgraphics + can be enabled; we can't tell from here whether that is accurate */ + "traditional text with optional line-drawing" +#endif + }, +#endif /*TTY_GRAPHICS */ +#ifdef CURSES_GRAPHICS + { "curses", "terminal-based graphics" }, +#endif +#ifdef X11_GRAPHICS + { "X11", "X11" }, +#endif +#ifdef QT_GRAPHICS /* too vague; there are multiple incompatible versions */ + { "Qt", "Qt" }, +#endif +#ifdef GNOME_GRAPHICS /* unmaintained/defunct */ + { "Gnome", "Gnome" }, +#endif +#ifdef MAC /* defunct OS 9 interface */ + { "mac", "Mac" }, +#endif +#ifdef AMIGA_INTUITION /* unmaintained/defunct */ + { "amii", "Amiga Intuition" }, +#endif +#ifdef GEM_GRAPHICS /* defunct Atari interface */ + { "Gem", "Gem" }, +#endif +#ifdef MSWIN_GRAPHICS /* win32 */ + { "mswin", "mswin" }, +#endif +#ifdef BEOS_GRAPHICS /* unmaintained/defunct */ + { "BeOS", "BeOS InterfaceKit" }, +#endif + { 0, 0 } +}; + +/* + * Use this to explicitly mask out features during version checks. + * + * ZEROCOMP, RLECOMP, and ZLIB_COMP describe compression features + * that the port/plaform which wrote the savefile was capable of + * dealing with. Don't reject a savefile just because the port + * reading the savefile doesn't match on all/some of them. + * The actual compression features used to produce the savefile are + * recorded in the savefile_info structure immediately following the + * version_info, and that is what needs to be checked against the + * feature set of the port that is reading the savefile back in. + * That check is done in src/restore.c now. + * + */ +#ifndef MD_IGNORED_FEATURES +#define MD_IGNORED_FEATURES \ + (0L | (1L << 19) /* SCORE_ON_BOTL */ \ + | (1L << 27) /* ZEROCOMP */ \ + | (1L << 28) /* RLECOMP */ \ + ) +#endif /* MD_IGNORED_FEATUES */ + +static void +make_version() +{ + register int i; + + /* + * integer version number + */ + version.incarnation = ((unsigned long) VERSION_MAJOR << 24) + | ((unsigned long) VERSION_MINOR << 16) + | ((unsigned long) PATCHLEVEL << 8) + | ((unsigned long) EDITLEVEL); + /* + * encoded feature list + * Note: if any of these magic numbers are changed or reassigned, + * EDITLEVEL in patchlevel.h should be incremented at the same time. + * The actual values have no special meaning, and the category + * groupings are just for convenience. + */ + version.feature_set = (unsigned long) (0L +/* levels and/or topology (0..4) */ +/* monsters (5..9) */ +#ifdef MAIL_STRUCTURES + | (1L << 6) +#endif +/* objects (10..14) */ +/* flag bits and/or other global variables (15..26) */ +#ifdef TEXTCOLOR + | (1L << 17) +#endif +#ifdef INSURANCE + | (1L << 18) +#endif +#ifdef SCORE_ON_BOTL + | (1L << 19) +#endif +/* data format (27..31) + * External compression methods such as COMPRESS and ZLIB_COMP + * do not affect the contents and are thus excluded from here */ +#ifdef ZEROCOMP + | (1L << 27) +#endif +#ifdef RLECOMP + | (1L << 28) +#endif + ); + /* + * Value used for object & monster sanity check. + * (NROFARTIFACTS<<24) | (NUM_OBJECTS<<12) | (NUMMONS<<0) + */ + for (i = 1; artifact_names[i]; i++) + continue; + version.entity_count = (unsigned long) (i - 1); + for (i = 1; objects[i].oc_class != ILLOBJ_CLASS; i++) + continue; + version.entity_count = (version.entity_count << 12) | (unsigned long) i; + for (i = 0; mons[i].mlet; i++) + continue; + version.entity_count = (version.entity_count << 12) | (unsigned long) i; + /* + * Value used for compiler (word size/field alignment/padding) check. + */ + version.struct_sizes1 = + (((unsigned long) sizeof(struct context_info) << 24) + | ((unsigned long) sizeof(struct obj) << 17) + | ((unsigned long) sizeof(struct monst) << 10) + | ((unsigned long) sizeof(struct you))); + version.struct_sizes2 = (((unsigned long) sizeof(struct flag) << 10) | +/* free bits in here */ +#ifdef SYSFLAGS + ((unsigned long) sizeof(struct sysflag))); +#else + ((unsigned long) 0L)); +#endif + return; +} + +#if defined(MAKEDEFS_C) || defined(CROSSCOMPILE_TARGET) + +static char * +version_string(outbuf, delim) +char *outbuf; +const char *delim; +{ + Sprintf(outbuf, "%d%s%d%s%d", VERSION_MAJOR, delim, VERSION_MINOR, delim, + PATCHLEVEL); +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) + Sprintf(eos(outbuf), "-%d", EDITLEVEL); +#endif + return outbuf; +} + +static char * +version_id_string(outbuf, build_date) +char *outbuf; +const char *build_date; +{ + char subbuf[64], versbuf[64]; + char statusbuf[64]; + +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) +#if (NH_DEVEL_STATUS == NH_STATUS_BETA) + Strcpy(statusbuf, " Beta"); +#else +#if (NH_DEVEL_STATUS == NH_STATUS_WIP) + Strcpy(statusbuf, " Work-in-progress"); +#else + Strcpy(statusbuf, " post-release"); +#endif +#endif +#else + statusbuf[0] = '\0'; +#endif + subbuf[0] = '\0'; +#ifdef PORT_SUB_ID + subbuf[0] = ' '; + Strcpy(&subbuf[1], PORT_SUB_ID); +#endif + + Sprintf(outbuf, "%s NetHack%s Version %s%s - last %s %s.", PORT_ID, + subbuf, version_string(versbuf, "."), statusbuf, + date_via_env ? "revision" : "build", build_date); + return outbuf; +} + +/* still within #if MAKDEFS_C || CROSSCOMPILE_TARGET */ + +static char * +bannerc_string(outbuf, build_date) +char *outbuf; +const char *build_date; +{ + char subbuf[64], versbuf[64]; + + subbuf[0] = '\0'; +#ifdef PORT_SUB_ID + subbuf[0] = ' '; + Strcpy(&subbuf[1], PORT_SUB_ID); +#endif +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) +#if (NH_DEVEL_STATUS == NH_STATUS_BETA) + Strcat(subbuf, " Beta"); +#else + Strcat(subbuf, " Work-in-progress"); +#endif +#endif + + Sprintf(outbuf, " Version %s %s%s, %s %s.", + version_string(versbuf, "."), PORT_ID, subbuf, + date_via_env ? "revised" : "built", &build_date[4]); +#if 0 + Sprintf(outbuf, "%s NetHack%s %s Copyright 1985-%s (built %s)", + PORT_ID, subbuf, version_string(versbuf,"."), RELEASE_YEAR, + &build_date[4]); +#endif + return outbuf; +} + +#endif /* MAKEDEFS_C || CROSSCOMPILE_TARGET */ + +static int +case_insensitive_comp(s1, s2) +const char *s1; +const char *s2; +{ + uchar u1, u2; + + for (;; s1++, s2++) { + u1 = (uchar) *s1; + if (isupper(u1)) + u1 = tolower(u1); + u2 = (uchar) *s2; + if (isupper(u2)) + u2 = tolower(u2); + if (u1 == '\0' || u1 != u2) + break; + } + return u1 - u2; +} + +static char * +eos(str) +char *str; +{ + while (*str) + str++; + return str; +} + +static char save_bones_compat_buf[BUFSZ]; + +static void +build_savebones_compat_string() +{ +#ifdef VERSION_COMPATIBILITY + unsigned long uver = VERSION_COMPATIBILITY, + cver = (((unsigned long) VERSION_MAJOR << 24) + | ((unsigned long) VERSION_MINOR << 16) + | ((unsigned long) PATCHLEVEL << 8)); +#endif + + Strcpy(save_bones_compat_buf, + "save and bones files accepted from version"); +#ifdef VERSION_COMPATIBILITY + if (uver != cver) + Sprintf(eos(save_bones_compat_buf), "s %lu.%lu.%lu through %d.%d.%d", + ((uver >> 24) & 0x0ffUL), + ((uver >> 16) & 0x0ffUL), + ((uver >> 8) & 0x0ffUL), + VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL); + else +#endif + Sprintf(eos(save_bones_compat_buf), " %d.%d.%d only", + VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL); +} + +static const char *build_opts[] = { +#ifdef AMIGA_WBENCH + "Amiga WorkBench support", +#endif +#ifdef ANSI_DEFAULT + "ANSI default terminal", +#endif +#ifdef TEXTCOLOR + "color", +#endif +#ifdef TTY_GRAPHICS +#ifdef TTY_TILES_ESCCODES + "console escape codes for tile hinting", +#endif +#endif +#ifdef COM_COMPL + "command line completion", +#endif +#ifdef LIFE + "Conway's Game of Life", +#endif +#ifdef COMPRESS + "data file compression", +#endif +#ifdef ZLIB_COMP + "ZLIB data file compression", +#endif +#ifdef DLB +#ifndef VERSION_IN_DLB_FILENAME + "data librarian", +#else + "data librarian with a version-dependent name", +#endif +#endif +#ifdef DUMPLOG + "end-of-game dumplogs", +#endif +#ifdef HOLD_LOCKFILE_OPEN + "exclusive lock on level 0 file", +#endif +#if defined(MSGHANDLER) && (defined(POSIX_TYPES) || defined(__GNUC__)) + "external program as a message handler", +#endif +#ifdef MFLOPPY + "floppy drive support", +#endif +#ifdef INSURANCE + "insurance files for recovering from crashes", +#endif +#ifdef LOGFILE + "log file", +#endif +#ifdef XLOGFILE + "extended log file", +#endif +#ifdef PANICLOG + "errors and warnings log file", +#endif +#ifdef MAIL_STRUCTURES + "mail daemon", +#endif +#if defined(GNUDOS) || defined(__DJGPP__) + "MSDOS protected mode", +#endif +#ifdef NEWS + "news file", +#endif +#ifdef OVERLAY +#ifdef MOVERLAY + "MOVE overlays", +#else +#ifdef VROOMM + "VROOMM overlays", +#else + "overlays", +#endif +#endif +#endif + /* pattern matching method will be substituted by nethack at run time */ + "pattern matching via :PATMATCH:", +#ifdef USE_ISAAC64 + "pseudo random numbers generated by ISAAC64", +#ifdef DEV_RANDOM +#ifdef NHSTDC + /* include which specific one */ + "strong PRNG seed available from " DEV_RANDOM, +#else + "strong PRNG seed available from DEV_RANDOM", +#endif +#else +#ifdef WIN32 + "strong PRNG seed available from CNG BCryptGenRandom()", +#endif +#endif /* DEV_RANDOM */ +#else /* ISAAC64 */ +#ifdef RANDOM + "pseudo random numbers generated by random()", +#else + "pseudo random numbers generated by C rand()", +#endif +#endif /* ISAAC64 */ +#ifdef SELECTSAVED + "restore saved games via menu", +#endif +#ifdef SCORE_ON_BOTL + "score on status line", +#endif +#ifdef CLIPPING + "screen clipping", +#endif +#ifdef NO_TERMS +#ifdef MAC + "screen control via mactty", +#endif +#ifdef SCREEN_BIOS + "screen control via BIOS", +#endif +#ifdef SCREEN_DJGPPFAST + "screen control via DJGPP fast", +#endif +#ifdef SCREEN_VGA + "screen control via VGA graphics", +#endif +#ifdef WIN32CON + "screen control via WIN32 console I/O", +#endif +#endif /* NO_TERMS */ +#ifdef SHELL + "shell command", +#endif + "traditional status display", +#ifdef STATUS_HILITES + "status via windowport with highlighting", +#else + "status via windowport without highlighting", +#endif +#ifdef SUSPEND + "suspend command", +#endif +#ifdef TTY_GRAPHICS +#ifdef TERMINFO + "terminal info library", +#else +#if defined(TERMLIB) || (!defined(MICRO) && !defined(WIN32)) + "terminal capability library", +#endif +#endif +#endif /*TTY_GRAPHICS*/ +#ifdef USE_XPM + "tiles file in XPM format", +#endif +#ifdef GRAPHIC_TOMBSTONE + "graphical RIP screen", +#endif +#ifdef TIMED_DELAY + "timed wait for display effects", +#endif +#ifdef USER_SOUNDS + "user sounds", +#endif +#ifdef PREFIXES_IN_USE + "variable playground", +#endif +#ifdef VISION_TABLES + "vision tables", +#endif +#ifdef ZEROCOMP + "zero-compressed save files", +#endif +#ifdef RLECOMP + "run-length compression of map in save files", +#endif +#ifdef SYSCF + "system configuration at run-time", +#endif + save_bones_compat_buf, + "and basic NetHack features" +}; + +static void +opt_out_words(str, length_p) +char *str; /* input, but modified during processing */ +int *length_p; /* in/out */ +{ + char *word; + + while (*str) { + word = index(str, ' '); +#if 0 + /* treat " (" as unbreakable space */ + if (word && *(word + 1) == '(') + word = index(word + 1, ' '); +#endif + if (word) + *word = '\0'; + if (*length_p + (int) strlen(str) > COLNO - 5) { + opttext[idxopttext] = strdup(optbuf); + if (idxopttext < (MAXOPT - 1)) + idxopttext++; + Sprintf(optbuf, "%s", opt_indent), + *length_p = (int) strlen(opt_indent); + } else { + Sprintf(eos(optbuf), " "), (*length_p)++; + } + Sprintf(eos(optbuf), + "%s", str), *length_p += (int) strlen(str); + str += strlen(str) + (word ? 1 : 0); + } +} + +void +build_options() +{ + char buf[BUFSZ]; + int i, length, winsyscnt; + + build_savebones_compat_string(); + opttext[idxopttext] = strdup(optbuf); + if (idxopttext < (MAXOPT - 1)) + idxopttext++; +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) +#if (NH_DEVEL_STATUS == NH_STATUS_BETA) +#define STATUS_ARG " [beta]" +#else +#define STATUS_ARG " [work-in-progress]" +#endif +#else +#define STATUS_ARG "" +#endif /* NH_DEVEL_STATUS == NH_STATUS_RELEASED */ + Sprintf(optbuf, "%sNetHack version %d.%d.%d%s\n", + opt_indent, VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL, STATUS_ARG); + opttext[idxopttext] = strdup(optbuf); + if (idxopttext < (MAXOPT - 1)) + idxopttext++; + Sprintf(optbuf, "Options compiled into this edition:"); + opttext[idxopttext] = strdup(optbuf); + if (idxopttext < (MAXOPT - 1)) + idxopttext++; + optbuf[0] = '\0'; + length = COLNO + 1; /* force 1st item onto new line */ + for (i = 0; i < SIZE(build_opts); i++) { + opt_out_words(strcat(strcpy(buf, build_opts[i]), + (i < SIZE(build_opts) - 1) ? "," : "."), + &length); + } + opttext[idxopttext] = strdup(optbuf); + if (idxopttext < (MAXOPT - 1)) + idxopttext++; + optbuf[0] = '\0'; + winsyscnt = SIZE(window_opts) - 1; + opttext[idxopttext] = strdup(optbuf); + if (idxopttext < (MAXOPT - 1)) + idxopttext++; + Sprintf(optbuf, "Supported windowing system%s:", + (winsyscnt > 1) ? "s" : ""); + opttext[idxopttext] = strdup(optbuf); + if (idxopttext < (MAXOPT - 1)) + idxopttext++; + optbuf[0] = '\0'; + length = COLNO + 1; /* force 1st item onto new line */ + for (i = 0; i < winsyscnt; i++) { + Sprintf(buf, "\"%s\"", window_opts[i].id); + if (strcmp(window_opts[i].name, window_opts[i].id)) + Sprintf(eos(buf), " (%s)", window_opts[i].name); + /* + * 1 : foo. + * 2 : foo and bar (note no period; comes from 'with default' below) + * 3+: for, bar, and quux + */ + opt_out_words(strcat(buf, (winsyscnt == 1) ? "." /* no 'default' */ + : (winsyscnt == 2 && i == 0) ? " and" + : (i == winsyscnt - 2) ? ", and" + : ","), + &length); + } + if (winsyscnt > 1) { + Sprintf(buf, "with a default of \"%s\".", DEFAULT_WINDOW_SYS); + opt_out_words(buf, &length); + } + opttext[idxopttext] = strdup(optbuf); + if (idxopttext < (MAXOPT - 1)) + idxopttext++; + optbuf[0] = '\0'; + +#if defined(MAKEDEFS_C) || (defined(CROSSCOMPILE) && defined(CROSSCOMPILE_TARGET)) + { + static const char *lua_info[] = { + "", "NetHack 3.7.* uses the 'Lua' interpreter to process some data:", "", + " :LUACOPYRIGHT:", "", + /* 1 2 3 4 5 6 7 + 1234567890123456789012345678901234567890123456789012345678901234567890123456 + */ + " \"Permission is hereby granted, free of charge, to any person obtaining", + " a copy of this software and associated documentation files (the ", + " \"Software\"), to deal in the Software without restriction including", + " without limitation the rights to use, copy, modify, merge, publish,", + " distribute, sublicense, and/or sell copies of the Software, and to ", + " permit persons to whom the Software is furnished to do so, subject to", + " the following conditions:", + " The above copyright notice and this permission notice shall be", + " included in all copies or substantial portions of the Software.\"", + (const char *) 0 + }; + + /* add lua copyright notice; + ":TAG:" substitutions are deferred to caller */ + for (i = 0; lua_info[i]; ++i) { + opttext[idxopttext] = strdup(lua_info[i]); + if (idxopttext < (MAXOPT - 1)) + idxopttext++; + } + } +#endif /* MAKEDEFS_C || (CROSSCOMPILE && CROSSCOMPILE_TARGET) */ + + /* end with a blank line */ + opttext[idxopttext] = strdup(""); + if (idxopttext < (MAXOPT - 1)) + idxopttext++; + return; +} + +#if defined(__DATE__) && defined(__TIME__) +#define extract_field(t,s,n,z) \ + do { \ + for (i = 0; i < n; ++i) \ + t[i] = s[i + z]; \ + t[i] = '\0'; \ + } while (0) +#endif + +void +runtime_info_init() +{ + int i; + char tmpbuf[BUFSZ], *strp; + const char *mth[] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + struct tm t = {0}; + time_t timeresult; + + if (!done_runtime_opt_init_once) { + done_runtime_opt_init_once = 1; + build_savebones_compat_string(); + /* construct the current version number */ + make_version(); + /* + * In a cross-compiled environment, you can't execute + * the target binaries during the build, so we can't + * use makedefs to write the values of the build + * date and time to a file for retrieval. Not for + * information meaningful to the target execution + * environment. + * + * How can we capture the build date/time of the target + * binaries in such a situation? We need to rely on the + * cross-compiler itself to do it for us during the + * cross-compile. + * + * To that end, we are going to make use of the + * following pre-defined preprocessor macros for this: + * gcc, msvc, clang __DATE__ "Feb 12 1996" + * gcc, msvc, clang __TIME__ "23:59:01" + * + */ + +#if defined(__DATE__) && defined(__TIME__) + if (sizeof __DATE__ + sizeof __TIME__ + sizeof "123" < + sizeof rttimebuf) + Sprintf(rttimebuf, "%s %s", __DATE__, __TIME__); + /* "Feb 12 1996 23:59:01" + 01234567890123456789 */ + if ((int) strlen(rttimebuf) == 20) { + extract_field(tmpbuf, rttimebuf, 4, 7); /* year */ + t.tm_year = atoi(tmpbuf) - 1900; + extract_field(tmpbuf, rttimebuf, 3, 0); /* mon */ + for (i = 0; i < SIZE(mth); ++i) + if (!case_insensitive_comp(tmpbuf, mth[i])) { + t.tm_mon = i; + break; + } + extract_field(tmpbuf, rttimebuf, 2, 4); /* mday */ + strp = tmpbuf; + if (*strp == ' ') + strp++; + t.tm_mday = atoi(strp); + extract_field(tmpbuf, rttimebuf, 2, 12); /* hour */ + t.tm_hour = atoi(tmpbuf); + extract_field(tmpbuf, rttimebuf, 2, 15); /* min */ + t.tm_min = atoi(tmpbuf); + extract_field(tmpbuf, rttimebuf, 2, 18); /* sec */ + t.tm_sec = atoi(tmpbuf); + timeresult = mktime(&t); +#if defined(CROSSCOMPILE_TARGET) && !defined(MAKEDEFS_C) + BUILD_TIME = (unsigned long) timeresult; + BUILD_DATE = rttimebuf; +#endif +#else /* __DATE__ && __TIME__ */ + nhUse(strp); +#endif /* __DATE__ && __TIME__ */ + +#if defined(CROSSCOMPILE_TARGET) && !defined(MAKEDEFS_C) + VERSION_NUMBER = version.incarnation; + VERSION_FEATURES = version.feature_set; +#ifdef MD_IGNORED_FEATURES + IGNORED_FEATURES = MD_IGNORED_FEATURES; +#endif + VERSION_SANITY1 = version.entity_count; + VERSION_SANITY2 = version.struct_sizes1; + VERSION_SANITY3 = version.struct_sizes2; + + VERSION_STRING = strdup(version_string(tmpbuf, ".")); + VERSION_ID = strdup(version_id_string(tmpbuf, BUILD_DATE)); + COPYRIGHT_BANNER_C = strdup(bannerc_string(tmpbuf, BUILD_DATE)); +#ifdef NETHACK_HOST_GIT_SHA + NETHACK_GIT_SHA = strdup(NETHACK_HOST_GIT_SHA); +#endif +#ifdef NETHACK_HOST_GIT_BRANCH + NETHACK_GIT_BRANCH = strdup(NETHACK_HOST_GIT_BRANCH); +#endif +#endif /* CROSSCOMPILE_TARGET && !MAKEDEFS_C */ + } + idxopttext = 0; + build_options(); + } +} + +const char * +do_runtime_info(rtcontext) +int *rtcontext; +{ + const char *retval = (const char *) 0; + + if (!done_runtime_opt_init_once) + runtime_info_init(); + if (idxopttext && rtcontext) + if (*rtcontext >= 0 && *rtcontext < (MAXOPT - 1)) { + retval = opttext[*rtcontext]; + *rtcontext += 1; + } + return retval; +} + +/*mdlib.c*/ diff --git a/src/mhitm.c b/src/mhitm.c index 7420cc1ab..ba19dc957 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mhitm.c $NHDT-Date: 1560161806 2019/06/10 10:16:46 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.116 $ */ +/* NetHack 3.6 mhitm.c $NHDT-Date: 1573773926 2019/11/14 23:25:26 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.118 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -52,16 +52,35 @@ struct attack *mattk; { const char *fmt; char buf[BUFSZ]; + boolean showit = FALSE; + + /* unhiding or unmimicking happens even if hero can't see it + because the formerly concealed monster is now in action */ + if (M_AP_TYPE(mdef)) { + seemimic(mdef); + showit |= g.vis; + } else if (mdef->mundetected) { + mdef->mundetected = 0; + showit |= g.vis; + } + if (M_AP_TYPE(magr)) { + seemimic(magr); + showit |= g.vis; + } else if (magr->mundetected) { + magr->mundetected = 0; + showit |= g.vis; + } if (g.vis) { if (!canspotmon(magr)) map_invisible(magr->mx, magr->my); + else if (showit) + newsym(magr->mx, magr->my); if (!canspotmon(mdef)) map_invisible(mdef->mx, mdef->my); - if (M_AP_TYPE(mdef)) - seemimic(mdef); - if (M_AP_TYPE(magr)) - seemimic(magr); + else if (showit) + newsym(mdef->mx, mdef->my); + fmt = (could_seduce(magr, mdef, mattk) && !magr->mcan) ? "%s pretends to be friendly to" : "%s misses"; @@ -381,9 +400,9 @@ register struct monst *magr, *mdef; || mdef->data == &mons[PM_BROWN_PUDDING]) && (g.otmp && (objects[g.otmp->otyp].oc_material == IRON || objects[g.otmp->otyp].oc_material == METAL)) - && mdef->mhp > 1 - && !mdef->mcan) { + && mdef->mhp > 1 && !mdef->mcan) { struct monst *mclone; + if ((mclone = clone_mon(mdef, 0, 0)) != 0) { if (g.vis && canspotmon(mdef)) { char buf[BUFSZ]; @@ -425,6 +444,13 @@ register struct monst *magr, *mdef; break; case AT_ENGL: + if (mdef->data == &mons[PM_SHADE]) { /* no silver teeth... */ + if (g.vis) + pline("%s attempt to engulf %s is futile.", + s_suffix(Monnam(magr)), mon_nam(mdef)); + strike = 0; + break; + } if (u.usteed && mdef == u.usteed) { strike = 0; break; @@ -501,23 +527,49 @@ hitmm(magr, mdef, mattk) register struct monst *magr, *mdef; struct attack *mattk; { + boolean weaponhit = ((mattk->aatyp == AT_WEAP + || (mattk->aatyp == AT_CLAW && g.otmp))), + silverhit = (weaponhit && g.otmp + && objects[g.otmp->otyp].oc_material == SILVER), + showit = FALSE; + + /* unhiding or unmimicking happens even if hero can't see it + because the formerly concealed monster is now in action */ + if (M_AP_TYPE(mdef)) { + seemimic(mdef); + showit |= g.vis; + } else if (mdef->mundetected) { + mdef->mundetected = 0; + showit |= g.vis; + } + if (M_AP_TYPE(magr)) { + seemimic(magr); + showit |= g.vis; + } else if (magr->mundetected) { + magr->mundetected = 0; + showit |= g.vis; + } + if (g.vis) { int compat; char buf[BUFSZ]; if (!canspotmon(magr)) map_invisible(magr->mx, magr->my); + else if (showit) + newsym(magr->mx, magr->my); if (!canspotmon(mdef)) map_invisible(mdef->mx, mdef->my); - if (M_AP_TYPE(mdef)) - seemimic(mdef); - if (M_AP_TYPE(magr)) - seemimic(magr); + else if (showit) + newsym(mdef->mx, mdef->my); + if ((compat = could_seduce(magr, mdef, mattk)) && !magr->mcan) { Sprintf(buf, "%s %s", Monnam(magr), mdef->mcansee ? "smiles at" : "talks to"); pline("%s %s %s.", buf, mon_nam(mdef), compat == 2 ? "engagingly" : "seductively"); + } else if (shade_miss(magr, mdef, g.otmp, FALSE, TRUE)) { + return MM_MISS; /* bypass mdamagem() */ } else { char magr_name[BUFSZ]; @@ -548,6 +600,28 @@ struct attack *mattk; Sprintf(buf, "%s hits", magr_name); } pline("%s %s.", buf, mon_nam_too(mdef, magr)); + + if (mon_hates_silver(mdef) && silverhit) { + char *mdef_name = mon_nam_too(mdef, magr); + + /* note: mon_nam_too returns a modifiable buffer; so + does s_suffix, but it returns a single static buffer + and we might be calling it twice for this message */ + Strcpy(magr_name, s_suffix(magr_name)); + if (!noncorporeal(mdef->data) && !amorphous(mdef->data)) { + if (mdef != magr) { + mdef_name = s_suffix(mdef_name); + } else { + (void) strsubst(mdef_name, "himself", "his own"); + (void) strsubst(mdef_name, "herself", "her own"); + (void) strsubst(mdef_name, "itself", "its own"); + } + Strcat(mdef_name, " flesh"); + } + + pline("%s %s sears %s!", magr_name, /*s_suffix(magr_name), */ + simpleonames(g.otmp), mdef_name); + } } } else noises(magr, mattk); @@ -775,11 +849,12 @@ mdamagem(magr, mdef, mattk) register struct monst *magr, *mdef; register struct attack *mattk; { - struct obj *obj; + struct obj *obj, dmgwep; char buf[BUFSZ]; struct permonst *pa = magr->data, *pd = mdef->data; - int armpro, num, tmp = d((int) mattk->damn, (int) mattk->damd), - res = MM_MISS; + int armpro, num, + tmp = d((int) mattk->damn, (int) mattk->damd), + res = MM_MISS; boolean cancelled; if ((touch_petrifies(pd) /* or flesh_petrifies() */ @@ -882,15 +957,26 @@ register struct attack *mattk; case AD_HEAL: case AD_PHYS: physical: - if (mattk->aatyp == AT_KICK && thick_skinned(pd)) { + /* this shade check is necessary in case any attacks which + dish out physical damage bypass hitmm() to get here */ + if ((mattk->aatyp == AT_WEAP || mattk->aatyp == AT_CLAW) && g.otmp) + dmgwep = *g.otmp; + else + dmgwep = cg.zeroobj; + + if (shade_miss(magr, mdef, &dmgwep, FALSE, TRUE)) { tmp = 0; - } else if (mattk->aatyp == AT_WEAP) { + } else if (mattk->aatyp == AT_KICK && thick_skinned(pd)) { + tmp = 0; + } else if (mattk->aatyp == AT_WEAP + || (mattk->aatyp == AT_CLAW && g.otmp)) { if (g.otmp) { struct obj *marmg; if (g.otmp->otyp == CORPSE && touch_petrifies(&mons[g.otmp->corpsenm])) goto do_stone; + tmp += dmgval(g.otmp, mdef); if ((marmg = which_armor(magr, W_ARMG)) != 0 && marmg->otyp == GAUNTLETS_OF_POWER) diff --git a/src/mhitu.c b/src/mhitu.c index b063ba367..e3057bb6c 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mhitu.c $NHDT-Date: 1562800504 2019/07/10 23:15:04 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.166 $ */ +/* NetHack 3.6 mhitu.c $NHDT-Date: 1575245065 2019/12/02 00:04:25 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.168 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1398,7 +1398,7 @@ register struct attack *mattk; (Teleport_control && !Stunned && !unconscious()) ? "" : "very "); tele(); - /* 3.6.2: make sure damage isn't fatal; previously, it + /* As of 3.6.2: make sure damage isn't fatal; previously, it was possible to be teleported and then drop dead at the destination when QM's 1d4 damage gets applied below; even though that wasn't "wrong", it seemed strange, @@ -1789,8 +1789,7 @@ struct attack *mattk; if (!engulf_target(mtmp, &g.youmonst)) return 0; - if ((t && is_pit(t->ttyp)) - && sobj_at(BOULDER, u.ux, u.uy)) + if ((t && is_pit(t->ttyp)) && sobj_at(BOULDER, u.ux, u.uy)) return 0; if (Punished) @@ -1873,6 +1872,14 @@ struct attack *mattk; if (mtmp != u.ustuck) return 0; + if (Punished) { + /* ball&chain are in limbo while swallowed; update their internal + location to be at swallower's spot */ + if (uchain->where == OBJ_FREE) + uchain->ox = mtmp->mx, uchain->oy = mtmp->my; + if (uball->where == OBJ_FREE) + uball->ox = mtmp->mx, uball->oy = mtmp->my; + } if (u.uswldtim > 0) u.uswldtim -= 1; @@ -2008,7 +2015,7 @@ struct attack *mattk; is_animal(mtmp->data) ? "regurgitates" : "expels"); expels(mtmp, mtmp->data, FALSE); } else if (!u.uswldtim || g.youmonst.data->msize >= MZ_HUGE) { - /* 3.6.2: u.uswldtim used to be set to 0 by life-saving but it + /* As of 3.6.2: u.uswldtim used to be set to 0 by life-saving but it expels now so the !u.uswldtim case is no longer possible; however, polymorphing into a huge form while already swallowed is still possible */ diff --git a/src/minion.c b/src/minion.c index de6018a8d..6a8a06ee7 100644 --- a/src/minion.c +++ b/src/minion.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 minion.c $NHDT-Date: 1544998886 2018/12/16 22:21:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.40 $ */ +/* NetHack 3.6 minion.c $NHDT-Date: 1575245071 2019/12/02 00:04:31 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.44 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2008. */ /* NetHack may be freely redistributed. See license for details. */ @@ -390,7 +390,7 @@ aligntyp atyp; /* A_NONE is used for 'any alignment' */ struct permonst *ptr; /* - * 3.6.2: [fix #H2204, 22-Dec-2010, eight years later...] + * 3.6.2: [fixed #H2204, 22-Dec-2010, eight years later...] * pick a correctly aligned demon in one try. This used to * use mkclass() to choose a random demon type and keep trying * (up to 20 times) until it got one with the desired alignment. @@ -460,15 +460,18 @@ gain_guardian_angel() && (mtmp = mk_roamer(&mons[PM_ANGEL], u.ualign.type, mm.x, mm.y, TRUE)) != 0) { mtmp->mstrategy &= ~STRAT_APPEARMSG; + /* guardian angel -- the one case mtame doesn't imply an + * edog structure, so we don't want to call tamedog(). + * [Note: this predates mon->mextra which allows a monster + * to have both emin and edog at the same time.] + */ + mtmp->mtame = 10; + /* for 'hilite_pet'; after making tame, before next message */ + newsym(mtmp->mx, mtmp->my); if (!Blind) pline("An angel appears near you."); else You_feel("the presence of a friendly angel near you."); - /* guardian angel -- the one case mtame doesn't - * imply an edog structure, so we don't want to - * call tamedog(). - */ - mtmp->mtame = 10; /* make him strong enough vs. endgame foes */ mtmp->m_lev = rn1(8, 15); mtmp->mhp = mtmp->mhpmax = diff --git a/src/mklev.c b/src/mklev.c index 57ee19a63..64faea76b 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -14,7 +14,7 @@ static void FDECL(mksink, (struct mkroom *)); static void FDECL(mkaltar, (struct mkroom *)); static void FDECL(mkgrave, (struct mkroom *)); static void NDECL(makevtele); -static void NDECL(clear_level_structures); +void NDECL(clear_level_structures); static void NDECL(makelevel); static boolean FDECL(bydoor, (XCHAR_P, XCHAR_P)); static struct mkroom *FDECL(find_branch_room, (coord *)); @@ -354,6 +354,14 @@ register struct mkroom *aroom; register int tmp; int i; + if (aroom->doorct) { + for (i = 0; i < aroom->doorct; i++) { + tmp = aroom->fdoor + i; + if (g.doors[tmp].x == x && g.doors[tmp].y == y) + return; + } + } + if (aroom->doorct == 0) aroom->fdoor = g.doorindex; @@ -573,7 +581,7 @@ makevtele() * special) but it's easier to put it all in one place than make sure * each type initializes what it needs to separately. */ -static void +void clear_level_structures() { static struct rm zerorm = { cmap_to_glyph(S_stone), @@ -642,6 +650,14 @@ clear_level_structures() g.dnstairs_room = g.upstairs_room = g.sstairs_room = (struct mkroom *) 0; g.made_branch = FALSE; clear_regions(); + g.xstart = 1; + g.ystart = 0; + g.xsize = COLNO - 1; + g.ysize = ROWNO; + if (g.lev_message) { + free(g.lev_message); + g.lev_message = (char *) 0; + } } static void diff --git a/src/mkmap.c b/src/mkmap.c index 868e93f36..91593d216 100644 --- a/src/mkmap.c +++ b/src/mkmap.c @@ -28,8 +28,10 @@ schar bg_typ; register int i, j; for (i = 1; i < COLNO; i++) - for (j = 0; j < ROWNO; j++) + for (j = 0; j < ROWNO; j++) { levl[i][j].typ = bg_typ; + levl[i][j].lit = FALSE; + } } static void diff --git a/src/mkmaze.c b/src/mkmaze.c index f6c8333d6..27c5ee490 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -5,9 +5,6 @@ #include "hack.h" #include "sp_lev.h" -#include "lev.h" /* save & restore info */ -#include "sfproto.h" - static int FDECL(iswall, (int, int)); static int FDECL(iswall_or_stone, (int, int)); @@ -646,14 +643,14 @@ unsigned long mflags; /* once in a blue moon, he won't be at the very bottom */ if (!rn2(40)) nlev--; - mtmp->mspare1 |= MIGR_LEFTOVERS; + mtmp->migflags |= MIGR_LEFTOVERS; } else { nlev = rn2((max_depth - cur_depth) + 1) + cur_depth; if (nlev == cur_depth) nlev++; if (nlev > max_depth) nlev = max_depth; - mtmp->mspare1 = (mtmp->mspare1 & ~MIGR_LEFTOVERS); + mtmp->migflags = (mtmp->migflags & ~MIGR_LEFTOVERS); } get_level(&dest, nlev); migrate_to_level(mtmp, ledger_no(&dest), MIGR_RANDOM, (coord *) 0); @@ -671,7 +668,7 @@ struct monst *mtmp; goldprob = is_captain ? 600 : 300; gemprob = goldprob / 4; if (rn2(1000) < goldprob) { - if ((otmp = mksobj(GOLD_PIECE, FALSE, FALSE)) != 0) { + if ((otmp = mksobj(GOLD_PIECE, TRUE, FALSE)) != 0) { otmp->quan = 1L + rnd(goldprob); otmp->owt = weight(otmp); add_to_minv(mtmp, otmp); @@ -687,7 +684,7 @@ struct monst *mtmp; } if (is_captain || !rn2(8)) { otyp = shiny_obj(RING_CLASS); - if (otyp != STRANGE_OBJECT && (otmp = mksobj(otyp, FALSE, FALSE)) != 0) + if (otyp != STRANGE_OBJECT && (otmp = mksobj(otyp, TRUE, FALSE)) != 0) add_to_minv(mtmp, otmp); } } @@ -1361,7 +1358,7 @@ fumaroles() } } if (snd && !Deaf) - Norep("You hear a %swhoosh!", loud ? "loud " : ""); + Norep("You hear a %swhoosh!", loud ? "loud " : ""); /* Deaf-aware */ } /* @@ -1579,18 +1576,9 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) &g.xmax, sizeof(int)); bwrite(nhfp->fd, (genericptr_t) &g.ymax, sizeof(int)); } - if (nhfp->fieldlevel) { - sfo_int(nhfp, &n, "waterlevel", "bubble_count", 1); - sfo_int(nhfp, &g.xmin, "waterlevel", "g.xmin", 1); - sfo_int(nhfp, &g.ymin, "waterlevel", "g.ymin", 1); - sfo_int(nhfp, &g.xmax, "waterlevel", "g.xmax", 1); - sfo_int(nhfp, &g.ymax, "waterlevel", "g.ymax", 1); - } for (b = g.bbubbles; b; b = b->next) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) b, sizeof(struct bubble)); - if (nhfp->fieldlevel) - sfo_bubble(nhfp, b, "waterlevel", "bubble", 1); } } if (release_data(nhfp)) @@ -1602,7 +1590,7 @@ restore_waterlevel(nhfp) NHFILE *nhfp; { struct bubble *b = (struct bubble *) 0, *btmp; - int i, n; + int i, n = 0; if (!Is_waterlevel(&u.uz) && !Is_airlevel(&u.uz)) return; @@ -1623,20 +1611,11 @@ NHFILE *nhfp; mread(nhfp->fd,(genericptr_t)&g.xmax,sizeof(int)); mread(nhfp->fd,(genericptr_t)&g.ymax,sizeof(int)); } - if (nhfp->fieldlevel) { - sfi_int(nhfp, &n, "waterlevel", "bubble_count", 1); - sfi_int(nhfp, &g.xmin, "waterlevel", "g.xmin", 1); - sfi_int(nhfp, &g.ymin, "waterlevel", "g.ymin", 1); - sfi_int(nhfp, &g.xmax, "waterlevel", "g.xmax", 1); - sfi_int(nhfp, &g.ymax, "waterlevel", "g.ymax", 1); - } for (i = 0; i < n; i++) { btmp = b; b = (struct bubble *) alloc(sizeof(struct bubble)); if (nhfp->structlevel) mread(nhfp->fd,(genericptr_t) b, sizeof(struct bubble)); - if (nhfp->fieldlevel) - sfi_bubble(nhfp, b, "waterlevel", "bubble", 1); if (g.bbubbles) { btmp->next = b; b->prev = btmp; diff --git a/src/mkobj.c b/src/mkobj.c index f8ef49c75..54416100e 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mkobj.c $NHDT-Date: 1561588627 2019/06/26 22:37:07 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.151 $ */ +/* NetHack 3.6 mkobj.c $NHDT-Date: 1571531889 2019/10/20 00:38:09 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.157 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -235,15 +235,14 @@ boolean init, artif; struct obj *otmp; otmp = mksobj(otyp, init, artif); - if (otmp) { - add_to_migration(otmp); - otmp->owornmask = (long) MIGR_TO_SPECIES; - otmp->corpsenm = mflags2; - } + add_to_migration(otmp); + otmp->owornmask = (long) MIGR_TO_SPECIES; + otmp->corpsenm = mflags2; return otmp; } -/* mkobj(): select a type of item from a class, use mksobj() to create it */ +/* mkobj(): select a type of item from a class, use mksobj() to create it; + result is always non-Null */ struct obj * mkobj(oclass, artif) char oclass; @@ -309,8 +308,7 @@ struct obj *box; for (n = rn2(n + 1); n > 0; n--) { if (box->otyp == ICE_BOX) { - if (!(otmp = mksobj(CORPSE, TRUE, TRUE))) - continue; + otmp = mksobj(CORPSE, TRUE, TRUE); /* Note: setting age to 0 is correct. Age has a different * from usual meaning for objects stored in ice boxes. -KAA */ @@ -768,7 +766,7 @@ static const char dknowns[] = { WAND_CLASS, RING_CLASS, POTION_CLASS, SCROLL_CLASS, GEM_CLASS, SPBOOK_CLASS, WEAPON_CLASS, TOOL_CLASS, 0 }; -/* mksobj(): create a specific type of object */ +/* mksobj(): create a specific type of object; result it always non-Null */ struct obj * mksobj(otyp, init, artif) int otyp; @@ -982,7 +980,7 @@ boolean artif; break; case POTION_CLASS: /* note: potions get some additional init below */ case SCROLL_CLASS: -#ifdef MAIL +#ifdef MAIL_STRUCTURES if (otmp->otyp != SCR_MAIL) #endif blessorcurse(otmp, 4); @@ -1062,9 +1060,12 @@ boolean artif; case COIN_CLASS: break; /* do nothing */ default: - impossible("impossible mkobj %d, sym '%c'.", otmp->otyp, - objects[otmp->otyp].oc_class); - return (struct obj *) 0; + /* 3.6.3: this used to be impossible() followed by return 0 + but most callers aren't prepared to deal with Null result + and cluttering them up to do so is pointless */ + panic("mksobj tried to make type %d, class %d.", + (int) otmp->otyp, (int) objects[otmp->otyp].oc_class); + /*NOTREACHED*/ } } @@ -1472,6 +1473,7 @@ register struct obj *obj; static const int treefruits[] = { APPLE, ORANGE, PEAR, BANANA, EUCALYPTUS_LEAF }; +/* called when a tree is kicked; never returns Null */ struct obj * rnd_treefruit_at(x, y) int x, y; @@ -1479,15 +1481,17 @@ int x, y; return mksobj_at(treefruits[rn2(SIZE(treefruits))], x, y, TRUE, FALSE); } +/* create a stack of N gold pieces; never returns Null */ struct obj * mkgold(amount, x, y) long amount; int x, y; { - register struct obj *gold = g_at(x, y); + struct obj *gold = g_at(x, y); if (amount <= 0L) { long mul = rnd(30 / max(12-depth(&u.uz), 2)); + amount = (long) (1 + rnd(level_difficulty() + 2) * mul); } if (gold) { @@ -1500,12 +1504,14 @@ int x, y; return gold; } -/* return TRUE if the corpse has special timing */ -#define special_corpse(num) \ - (((num) == PM_LIZARD) || ((num) == PM_LICHEN) || (is_rider(&mons[num])) \ - || (mons[num].mlet == S_TROLL)) +/* return TRUE if the corpse has special timing; + lizards and lichen don't rot, trolls and Riders auto-revive */ +#define special_corpse(num) \ + (((num) == PM_LIZARD || (num) == PM_LICHEN) \ + || (mons[num].mlet == S_TROLL || is_rider(&mons[num]))) -/* +/* mkcorpstat: make a corpse or statue; never returns Null. + * * OEXTRA note: Passing mtmp causes mtraits to be saved * even if ptr passed as well, but ptr is always used for * the corpse type (corpsenm). That allows the corpse type @@ -1522,40 +1528,39 @@ struct permonst *ptr; int x, y; unsigned corpstatflags; { - register struct obj *otmp; + struct obj *otmp; boolean init = ((corpstatflags & CORPSTAT_INIT) != 0); if (objtype != CORPSE && objtype != STATUE) impossible("making corpstat type %d", objtype); if (x == 0 && y == 0) { /* special case - random placement */ otmp = mksobj(objtype, init, FALSE); - if (otmp) - (void) rloco(otmp); - } else + (void) rloco(otmp); + } else { otmp = mksobj_at(objtype, x, y, init, FALSE); - if (otmp) { - if (mtmp) { - struct obj *otmp2; + } - if (!ptr) - ptr = mtmp->data; - /* save_mtraits frees original data pointed to by otmp */ - otmp2 = save_mtraits(otmp, mtmp); - if (otmp2) - otmp = otmp2; - } - /* use the corpse or statue produced by mksobj() as-is - unless `ptr' is non-null */ - if (ptr) { - int old_corpsenm = otmp->corpsenm; + /* when 'mtmp' is non-null save the monster's details with the + corpse or statue; it will also force the 'ptr' override below */ + if (mtmp) { + /* save_mtraits updates otmp->oextra->omonst in place */ + (void) save_mtraits(otmp, mtmp); - otmp->corpsenm = monsndx(ptr); - otmp->owt = weight(otmp); - if (otmp->otyp == CORPSE && (special_corpse(old_corpsenm) - || special_corpse(otmp->corpsenm))) { - obj_stop_timers(otmp); - start_corpse_timeout(otmp); - } + if (!ptr) + ptr = mtmp->data; + } + + /* when 'ptr' is non-null it comes from our caller or from 'mtmp'; + override mkobjs()'s initialization of a random monster type */ + if (ptr) { + int old_corpsenm = otmp->corpsenm; + + otmp->corpsenm = monsndx(ptr); + otmp->owt = weight(otmp); + if (otmp->otyp == CORPSE && (special_corpse(old_corpsenm) + || special_corpse(otmp->corpsenm))) { + obj_stop_timers(otmp); + start_corpse_timeout(otmp); } } return otmp; @@ -1573,15 +1578,14 @@ int corpse_revive_type(obj) struct obj *obj; { - int revivetype; + int revivetype = obj->corpsenm; struct monst *mtmp; - if (has_omonst(obj) - && ((mtmp = get_mtraits(obj, FALSE)) != (struct monst *) 0)) { + + if (has_omonst(obj) && ((mtmp = get_mtraits(obj, FALSE)) != 0)) { /* mtmp is a temporary pointer to a monster's stored attributes, not a real monster */ revivetype = mtmp->mnum; - } else - revivetype = obj->corpsenm; + } return revivetype; } @@ -1657,26 +1661,29 @@ boolean copyof; return mnew; } -/* make an object named after someone listed in the scoreboard file */ +/* make an object named after someone listed in the scoreboard file; + never returns Null */ struct obj * mk_tt_object(objtype, x, y) int objtype; /* CORPSE or STATUE */ -register int x, y; +int x, y; { - register struct obj *otmp, *otmp2; + struct obj *otmp; boolean initialize_it; /* player statues never contain books */ initialize_it = (objtype != STATUE); - if ((otmp = mksobj_at(objtype, x, y, initialize_it, FALSE)) != 0) { - /* tt_oname will return null if the scoreboard is empty */ - if ((otmp2 = tt_oname(otmp)) != 0) - otmp = otmp2; - } + otmp = mksobj_at(objtype, x, y, initialize_it, FALSE); + /* tt_oname() will return null if the scoreboard is empty; + assigning an object name used to allocate a new obj but + doesn't any more so we can safely ignore the return value */ + (void) tt_oname(otmp); + return otmp; } -/* make a new corpse or statue, uninitialized if a statue (i.e. no books) */ +/* make a new corpse or statue, uninitialized if a statue (i.e. no books); + never returns Null */ struct obj * mk_named_object(objtype, ptr, x, y, nm) int objtype; /* CORPSE or STATUE */ @@ -1685,8 +1692,8 @@ int x, y; const char *nm; { struct obj *otmp; - unsigned corpstatflags = - (objtype != STATUE) ? CORPSTAT_INIT : CORPSTAT_NONE; + unsigned corpstatflags = (objtype != STATUE) ? CORPSTAT_INIT + : CORPSTAT_NONE; otmp = mkcorpstat(objtype, (struct monst *) 0, ptr, x, y, corpstatflags); if (nm) @@ -2463,6 +2470,36 @@ struct monst *mon; } } +/* + * Initialize a dummy obj with just enough info + * to allow some of the tests in obj.h that + * take an obj pointer to work. + */ +struct obj * +init_dummyobj(obj, otyp, oquan) +struct obj *obj; +short otyp; +long oquan; +{ + if (obj) { + *obj = cg.zeroobj; + obj->otyp = otyp; + obj->oclass = objects[otyp].oc_class; + /* obj->dknown = 0; */ + /* suppress known except for amulets (needed for fakes & real AoY) */ + obj->known = (obj->oclass == AMULET_CLASS) + ? obj->known + /* default is "on" for types which don't use it */ + : !objects[otyp].oc_uses_known; + obj->quan = oquan ? oquan : 1L; + obj->corpsenm = NON_PM; /* suppress statue and figurine details */ + /* but suppressing fruit details leads to "bad fruit #0" */ + if (obj->otyp == SLIME_MOLD) + obj->spe = g.context.current_fruit; + } + return obj; +} + /* obj sanity check: check objects inside container */ static void check_contained(container, mesg) @@ -2572,7 +2609,7 @@ struct obj *obj; } if (n == 2 && carried(obj) && obj == uball && (owornmask & W_BALL) != 0L - && (owornmask & W_WEAPON) != 0L) { + && (owornmask & W_WEAPONS) != 0L) { /* chained ball can be wielded/alt-wielded/quivered; if so, pretend it's not chained in order to check the weapon pointer (we've already verified the ball pointer by successfully passing @@ -2681,7 +2718,7 @@ struct obj *obj; becoming embedded in poly'd hero's skin */ if (embedded && !Is_dragon_scales(obj)) what = "skin"; - } else if (owornmask & W_WEAPON) { + } else if (owornmask & W_WEAPONS) { /* monsters don't maintain alternate weapon or quiver */ if (mcarried(obj) && (owornmask & (W_SWAPWEP | W_QUIVER)) != 0L) what = (owornmask & W_SWAPWEP) != 0L ? "monst alt weapon?" diff --git a/src/mkroom.c b/src/mkroom.c index de87a14e2..0a3319289 100644 --- a/src/mkroom.c +++ b/src/mkroom.c @@ -16,8 +16,6 @@ */ #include "hack.h" -#include "sfproto.h" - static boolean FDECL(isbig, (struct mkroom *)); static struct mkroom *FDECL(pick_room, (BOOLEAN_P)); @@ -811,8 +809,6 @@ struct mkroom *r; */ if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) r, sizeof (struct mkroom)); - if (nhfp->fieldlevel) - sfo_mkroom(nhfp, r, "room", "mkroom", 1); for (i = 0; i < r->nsubrooms; i++) { save_room(nhfp, r->sbrooms[i]); } @@ -830,8 +826,6 @@ NHFILE *nhfp; /* First, write the number of rooms */ if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.nroom, sizeof(g.nroom)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &g.nroom, "room", "g.nroom", 1); for (i = 0; i < g.nroom; i++) save_room(nhfp, &g.rooms[i]); } @@ -845,8 +839,6 @@ struct mkroom *r; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) r, sizeof(struct mkroom)); - if (nhfp->fieldlevel) - sfi_mkroom(nhfp, r, "room", "mkroom", 1); for (i = 0; i < r->nsubrooms; i++) { r->sbrooms[i] = &g.subrooms[g.nsubroom]; @@ -867,8 +859,6 @@ NHFILE *nhfp; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.nroom, sizeof(g.nroom)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &g.nroom, "room", "g.nroom", 1); g.nsubroom = 0; for (i = 0; i < g.nroom; i++) { diff --git a/src/mon.c b/src/mon.c index 22c999bda..3edeac039 100644 --- a/src/mon.c +++ b/src/mon.c @@ -2038,7 +2038,7 @@ register struct monst *mtmp; /* if it's a (possibly polymorphed) quest leader, mark him as dead */ if (mtmp->m_id == g.quest_status.leader_m_id) g.quest_status.leader_is_dead = TRUE; -#ifdef MAIL +#ifdef MAIL_STRUCTURES /* if the mail daemon dies, no more mail delivery. -3. */ if (tmp == PM_MAIL_DAEMON) g.mvitals[tmp].mvflags |= G_GENOD; @@ -2412,7 +2412,7 @@ int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */ if (nocorpse || LEVEL_SPECIFIC_NOCORPSE(mdat)) goto cleanup; -#ifdef MAIL +#ifdef MAIL_STRUCTURES if (mdat == &mons[PM_MAIL_DAEMON]) { stackobj(mksobj_at(SCR_MAIL, x, y, FALSE, FALSE)); } @@ -3771,6 +3771,9 @@ boolean msg; /* "The oldmon turns into a newmon!" */ /* take on the new form... */ set_mon_data(mtmp, mdat); + if (mtmp->mleashed && !leashable(mtmp)) + m_unleash(mtmp, TRUE); + if (emits_light(olddata) != emits_light(mtmp->data)) { /* used to give light, now doesn't, or vice versa, or light's range has changed */ diff --git a/src/mondata.c b/src/mondata.c index f510afcfd..ba5b27d0a 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mondata.c $NHDT-Date: 1550525093 2019/02/18 21:24:53 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.72 $ */ +/* NetHack 3.6 mondata.c $NHDT-Date: 1574648940 2019/11/25 02:29:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.76 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -910,13 +910,20 @@ register struct monst *mtmp; return mtmp->female; } -/* Like gender(), but lower animals and such are still "it". - This is the one we want to use when printing messages. */ +/* Like gender(), but unseen humanoids are "it" rather than "he" or "she" + and lower animals and such are "it" even when seen; hallucination might + yield "they". This is the one we want to use when printing messages. */ int -pronoun_gender(mtmp, override_vis) +pronoun_gender(mtmp, pg_flags) register struct monst *mtmp; -boolean override_vis; /* if True then 'no it' unless neuter */ +unsigned pg_flags; /* flags&1: 'no it' unless neuter, + * flags&2: random if hallucinating */ { + boolean override_vis = (pg_flags & PRONOUN_NO_IT) ? TRUE : FALSE, + hallu_rand = (pg_flags & PRONOUN_HALLU) ? TRUE : FALSE; + + if (hallu_rand && Hallucination) + return rn2(4); /* 0..3 */ if (!override_vis && !canspotmon(mtmp)) return 2; if (is_neuter(mtmp->data)) diff --git a/src/monmove.c b/src/monmove.c index 0e805492c..b72353629 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 monmove.c $NHDT-Date: 1557094802 2019/05/05 22:20:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.113 $ */ +/* NetHack 3.6 monmove.c $NHDT-Date: 1575245074 2019/12/02 00:04:34 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.116 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -925,7 +925,7 @@ register int after; mmoved = 0; } -#ifdef MAIL +#ifdef MAIL_STRUCTURES if (ptr == &mons[PM_MAIL_DAEMON]) { if (!Deaf && canseemon(mtmp)) verbalize("I'm late!"); @@ -1444,7 +1444,7 @@ register int after; add_damage(mtmp->mx, mtmp->my, 0L); } } else if (levl[mtmp->mx][mtmp->my].typ == IRONBARS) { - /* 3.6.2: was using may_dig() but it doesn't handle bars */ + /* As of 3.6.2: was using may_dig() but it doesn't handle bars */ if (!(levl[mtmp->mx][mtmp->my].wall_info & W_NONDIGGABLE) && (dmgtype(ptr, AD_RUST) || dmgtype(ptr, AD_CORR))) { if (canseemon(mtmp)) @@ -1653,8 +1653,8 @@ register struct monst *mtmp; */ boolean undesirable_disp(mtmp, x, y) -struct monst *mtmp; -xchar x, y; +struct monst *mtmp; /* barging creature */ +xchar x, y; /* spot 'mtmp' is considering moving to */ { boolean is_pet = (mtmp && mtmp->mtame && !mtmp->isminion); struct trap *trap = t_at(x, y); @@ -1673,6 +1673,18 @@ xchar x, y; return TRUE; } + /* oversimplification: creatures that bargethrough can't swap places + when target monster is in rock or closed door or water (in particular, + avoid moving to spots where mondied() won't leave a corpse; doesn't + matter whether barger is capable of moving to such a target spot if + it were unoccupied) */ + if (!accessible(x, y) + /* mondied() allows is_pool() as an exception to !accessible(), + but we'll only do that if 'mtmp' is already at a water location + so that we don't swap a water critter onto land */ + && !(is_pool(x, y) && is_pool(mtmp->mx, mtmp->my))) + return TRUE; + return FALSE; } diff --git a/src/monst.c b/src/monst.c index 4c798aec3..23af5d298 100644 --- a/src/monst.c +++ b/src/monst.c @@ -2589,7 +2589,7 @@ struct permonst _mons2[] = { M3_INFRAVISIBLE | M3_INFRAVISION | M3_DISPLACES, 34, HI_LORD), /* other demons */ -#ifdef MAIL +#ifdef MAIL_STRUCTURES MON("mail daemon", S_DEMON, LVL(56, 24, 10, 127, 0), (G_NOGEN | G_NOCORPSE), A(NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), diff --git a/src/mthrowu.c b/src/mthrowu.c index 504cb533a..a1b36476a 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mthrowu.c $NHDT-Date: 1564767726 2019/08/02 17:42:06 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.85 $ */ +/* NetHack 3.6 mthrowu.c $NHDT-Date: 1573688695 2019/11/13 23:44:55 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.86 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -346,6 +346,10 @@ boolean verbose; /* give message(s) even when you can't see what happened */ damage = dmgval(otmp, mtmp); if (otmp->otyp == ACID_VENOM && resists_acid(mtmp)) damage = 0; +#if 0 /* can't use this because we don't have the attacker */ + if (is_orc(mtmp->data) && is_elf(?magr?)) + damage++; +#endif if (ismimic) seemimic(mtmp); mtmp->msleeping = 0; @@ -376,10 +380,19 @@ boolean verbose; /* give message(s) even when you can't see what happened */ } if (objects[otmp->otyp].oc_material == SILVER && mon_hates_silver(mtmp)) { - if (vis) - pline_The("silver sears %s flesh!", s_suffix(mon_nam(mtmp))); - else if (verbose && !g.mtarget) - pline("Its flesh is seared!"); + boolean flesh = (!noncorporeal(mtmp->data) + && !amorphous(mtmp->data)); + + /* note: extra silver damage is handled by dmgval() */ + if (vis) { + char *m_name = mon_nam(mtmp); + + if (flesh) /* s_suffix returns a modifiable buffer */ + m_name = strcat(s_suffix(m_name), " flesh"); + pline_The("silver sears %s!", m_name); + } else if (verbose && !g.mtarget) { + pline("%s is seared!", flesh ? "Its flesh" : "It"); + } } if (otmp->otyp == ACID_VENOM && cansee(mtmp->mx, mtmp->my)) { if (resists_acid(mtmp)) { @@ -531,7 +544,12 @@ struct obj *obj; /* missile (or stack providing it) */ while (range-- > 0) { /* Actually the loop is always exited by break */ g.bhitpos.x += dx; g.bhitpos.y += dy; - if ((mtmp = m_at(g.bhitpos.x, g.bhitpos.y)) != 0) { + mtmp = m_at(g.bhitpos.x, g.bhitpos.y); + if (mtmp && shade_miss(mon, mtmp, singleobj, TRUE, TRUE)) { + /* if mtmp is a shade and missile passes harmlessly through it, + give message and skip it in order to keep going */ + mtmp = (struct monst *) 0; + } else if (mtmp) { if (ohitmon(mtmp, singleobj, range, TRUE)) break; } else if (g.bhitpos.x == u.ux && g.bhitpos.y == u.uy) { @@ -746,7 +764,7 @@ struct attack *mattk; break; default: impossible("bad attack type in spitmu"); - /* fall through */ + /*FALLTHRU*/ case AD_ACID: otmp = mksobj(ACID_VENOM, TRUE, FALSE); break; diff --git a/src/muse.c b/src/muse.c index 5173952a3..25e29ed91 100644 --- a/src/muse.c +++ b/src/muse.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 muse.c $NHDT-Date: 1560161807 2019/06/10 10:16:47 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.96 $ */ +/* NetHack 3.6 muse.c $NHDT-Date: 1574648940 2019/11/25 02:29:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.115 $ */ /* Copyright (C) 1990 by Ken Arromdee */ /* NetHack may be freely redistributed. See license for details. */ @@ -161,7 +161,8 @@ boolean self; ? "nearby" : "distant"); otmp->known = 0; } else if (self) { - pline("%s zaps %sself with %s!", Monnam(mtmp), mhim(mtmp), + pline("%s with %s!", + monverbself(mtmp, Monnam(mtmp), "zap", (char *) 0), doname(otmp)); } else { pline("%s zaps %s!", Monnam(mtmp), an(xname(otmp))); @@ -186,9 +187,15 @@ boolean self; ? "nearby" : "in the distance"); otmp->known = 0; /* hero doesn't know how many charges are left */ } else { + char *objnamp, objbuf[BUFSZ]; + otmp->dknown = 1; - pline("%s plays a %s directed at %s!", Monnam(mtmp), xname(otmp), - self ? mon_nam_too(mtmp, mtmp) : (char *) "you"); + objnamp = xname(otmp); + if (strlen(objnamp) >= QBUFSZ) + objnamp = simpleonames(otmp); + Sprintf(objbuf, "a %s directed at", objnamp); + /* " plays a directed at himself!" */ + pline("%s!", monverbself(mtmp, Monnam(mtmp), "play", objbuf)); makeknown(otmp->otyp); /* (wands handle this slightly differently) */ if (!self) stop_occupation(); @@ -2461,7 +2468,7 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */ } else if (otyp == STRANGE_OBJECT) { /* monster is using fire breath on self */ if (vis) - pline("%s breathes fire on %sself.", Monnam(mon), mhim(mon)); + pline("%s.", monverbself(mon, Monnam(mon), "breath", "fire on")); if (!rn2(3)) mon->mspec_used = rn1(10, 5); /* -21 => monster's fire breath; 1 => # of damage dice */ @@ -2478,8 +2485,8 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */ vis = FALSE; /* skip makeknown() below */ res = FALSE; /* failed to cure sliming */ } else { - m_useup(mon, obj); /* before explode() */ dmg = (2 * (rn1(3, 3) + 2 * bcsign(obj)) + 1) / 3; + m_useup(mon, obj); /* before explode() */ /* -11 => monster's fireball */ explode(mon->mx, mon->my, -11, dmg, SCROLL_CLASS, /* by_you: override -11 for mon but not others */ diff --git a/src/music.c b/src/music.c index f1bf9c724..055c407d6 100644 --- a/src/music.c +++ b/src/music.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 music.c $NHDT-Date: 1544442713 2018/12/10 11:51:53 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.57 $ */ +/* NetHack 3.6 music.c $NHDT-Date: 1573063606 2019/11/06 18:06:46 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.60 $ */ /* Copyright (c) 1989 by Jean-Christophe Collet */ /* NetHack may be freely redistributed. See license for details. */ @@ -170,8 +170,9 @@ struct monst *bugler; /* monster that played instrument */ mtmp->mstrategy &= ~STRAT_WAITMASK; if (canseemon(mtmp)) pline("%s is now ready for battle!", Monnam(mtmp)); - else - Norep("You hear the rattle of battle gear being readied."); + else if (!Deaf) + Norep("%s the rattle of battle gear being readied.", + "You hear"); /* Deaf-aware */ } else if ((distm = ((bugler == &g.youmonst) ? distu(mtmp->mx, mtmp->my) : dist2(bugler->mx, bugler->my, mtmp->mx, @@ -284,7 +285,7 @@ int force; /*FALLTHRU*/ case ROOM: case CORR: /* Try to make a pit */ - do_pit: + do_pit: chasm = maketrap(x, y, PIT); if (!chasm) break; /* no pit if portal at that location */ @@ -467,6 +468,7 @@ struct obj *instr; mundane = TRUE; } + #define PLAY_NORMAL 0x00 #define PLAY_STUNNED 0x01 #define PLAY_CONFUSED 0x02 @@ -479,18 +481,41 @@ struct obj *instr; if (Hallucination) mode |= PLAY_HALLU; + if (!rn2(2)) { + /* + * TEMPORARY? for multiple impairments, don't always + * give the generic "it's far from music" message. + */ + /* remove if STUNNED+CONFUSED ever gets its own message below */ + if (mode == (PLAY_STUNNED | PLAY_CONFUSED)) + mode = !rn2(2) ? PLAY_STUNNED : PLAY_CONFUSED; + /* likewise for stunned and/or confused combined with hallucination */ + if (mode & PLAY_HALLU) + mode = PLAY_HALLU; + } + + /* 3.6.3: most of these gave "You produce " and then many of + the instrument-specific messages below which immediately follow + also gave "You produce ." That looked strange so we + now use a different verb here */ switch (mode) { case PLAY_NORMAL: You("start playing %s.", yname(instr)); break; case PLAY_STUNNED: - You("produce an obnoxious droning sound."); + if (!Deaf) + You("radiate an obnoxious droning sound."); + else + You_feel("a monotonous vibration."); break; case PLAY_CONFUSED: - You("produce a raucous noise."); + if (!Deaf) + You("generate a raucous noise."); + else + You_feel("a jarring vibration."); break; case PLAY_HALLU: - You("produce a kaleidoscopic display of floating butterfiles."); + You("disseminate a kaleidoscopic display of floating butterflies."); break; /* TODO? give some or all of these combinations their own feedback; hallucination ones should reference senses other than hearing... */ @@ -499,7 +524,7 @@ struct obj *instr; case PLAY_CONFUSED | PLAY_HALLU: case PLAY_STUNNED | PLAY_CONFUSED | PLAY_HALLU: default: - pline("What you produce is quite far from music..."); + pline("What you perform is quite far from music..."); break; } #undef PLAY_NORMAL @@ -511,13 +536,17 @@ struct obj *instr; case MAGIC_FLUTE: /* Make monster fall asleep */ consume_obj_charge(instr, TRUE); - You("produce %s music.", Hallucination ? "piped" : "soft"); + You("%sproduce %s music.", !Deaf ? "" : "seem to ", + Hallucination ? "piped" : "soft"); put_monsters_to_sleep(u.ulevel * 5); exercise(A_DEX, TRUE); break; case WOODEN_FLUTE: /* May charm snakes */ do_spec &= (rn2(ACURR(A_DEX)) + u.ulevel > 25); - pline("%s.", Tobjnam(instr, do_spec ? "trill" : "toot")); + if (!Deaf) + pline("%s.", Tobjnam(instr, do_spec ? "trill" : "toot")); + else + You_feel("%s %s.", yname(instr), do_spec ? "trill" : "toot"); if (do_spec) charm_snakes(u.ulevel * 3); exercise(A_DEX, TRUE); @@ -543,26 +572,38 @@ struct obj *instr; makeknown(instr->otyp); break; case TOOLED_HORN: /* Awaken or scare monsters */ - You("produce a frightful, grave sound."); + if (!Deaf) + You("produce a frightful, grave sound."); + else + You("blow into the horn."); awaken_monsters(u.ulevel * 30); exercise(A_WIS, FALSE); break; case BUGLE: /* Awaken & attract soldiers */ - You("extract a loud noise from %s.", yname(instr)); + if (!Deaf) + You("extract a loud noise from %s.", yname(instr)); + else + You("blow into the bugle."); awaken_soldiers(&g.youmonst); exercise(A_WIS, FALSE); break; case MAGIC_HARP: /* Charm monsters */ consume_obj_charge(instr, TRUE); - pline("%s very attractive music.", Tobjnam(instr, "produce")); + if (!Deaf) + pline("%s very attractive music.", Tobjnam(instr, "produce")); + else + You_feel("very soothing vibrations."); charm_monsters((u.ulevel - 1) / 3 + 1); exercise(A_DEX, TRUE); break; case WOODEN_HARP: /* May calm Nymph */ do_spec &= (rn2(ACURR(A_DEX)) + u.ulevel > 25); - pline("%s %s.", Yname2(instr), - do_spec ? "produces a lilting melody" : "twangs"); + if (!Deaf) + pline("%s %s.", Yname2(instr), + do_spec ? "produces a lilting melody" : "twangs"); + else + You_feel("soothing vibrations."); if (do_spec) calm_nymphs(u.ulevel * 3); exercise(A_DEX, TRUE); @@ -583,8 +624,12 @@ struct obj *instr; break; case LEATHER_DRUM: /* Awaken monsters */ if (!mundane) { - You("beat a deafening row!"); - incr_itimeout(&HDeaf, rn1(20, 30)); + if (!Deaf) { + You("beat a deafening row!"); + incr_itimeout(&HDeaf, rn1(20, 30)); + } else { + You("pound on the drum."); + } exercise(A_WIS, FALSE); } else You("%s %s.", @@ -649,7 +694,10 @@ struct obj *instr; *s = 'B'; } } - You("extract a strange sound from %s!", the(xname(instr))); + + You(!Deaf ? "extract a strange sound from %s!" + : "can feel %s emitting vibrations.", the(xname(instr))); + /* Check if there was the Stronghold drawbridge near * and if the tune conforms to what we're waiting for. @@ -662,8 +710,8 @@ struct obj *instr; for (x = u.ux - 1; x <= u.ux + 1; x++) if (isok(x, y)) if (find_drawbridge(&x, &y)) { - u.uevent.uheard_tune = - 2; /* tune now fully known */ + /* tune now fully known */ + u.uevent.uheard_tune = 2; if (levl[x][y].typ == DRAWBRIDGE_DOWN) close_drawbridge(x, y); else @@ -696,7 +744,7 @@ struct obj *instr; if (buf[x] == g.tune[x]) { gears++; matched[x] = TRUE; - } else + } else { for (y = 0; y < 5; y++) if (!matched[y] && buf[x] == g.tune[y] && buf[y] != g.tune[y]) { @@ -704,8 +752,9 @@ struct obj *instr; matched[y] = TRUE; break; } + } } - if (tumblers) + if (tumblers) { if (gears) You_hear("%d tumbler%s click and %d gear%s turn.", tumblers, plur(tumblers), gears, @@ -713,7 +762,7 @@ struct obj *instr; else You_hear("%d tumbler%s click.", tumblers, plur(tumblers)); - else if (gears) { + } else if (gears) { You_hear("%d gear%s turn.", gears, plur(gears)); /* could only get `gears == 5' by playing five correct notes followed by excess; otherwise, @@ -728,7 +777,7 @@ struct obj *instr; } else return do_improvisation(instr); -nevermind: + nevermind: pline1(Never_mind); return 0; } diff --git a/src/nhlobj.c b/src/nhlobj.c new file mode 100644 index 000000000..1ce9cd710 --- /dev/null +++ b/src/nhlobj.c @@ -0,0 +1,462 @@ +/* NetHack 3.7 nhlobj.c $NHDT-Date: 1576097301 2019/12/11 20:48:21 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.0 $ */ +/* Copyright (c) 2019 by Pasi Kallinen */ +/* NetHack may be freely redistributed. See license for details. */ + +#include "hack.h" +#include "sp_lev.h" + +static int FDECL(l_obj_add_to_container, (lua_State *)); +static int FDECL(l_obj_addcontent, (lua_State *)); +static int FDECL(l_obj_at, (lua_State *)); +static int FDECL(l_obj_class, (lua_State *)); +static int FDECL(l_obj_container, (lua_State *)); +static int FDECL(l_obj_contents, (lua_State *)); +static int FDECL(l_obj_gc, (lua_State *)); +static int FDECL(l_obj_getcontents, (lua_State *)); +static int FDECL(l_obj_isnull, (lua_State *)); +static int FDECL(l_obj_new_readobjnam, (lua_State *)); +static int FDECL(l_obj_next, (lua_State *)); +static int FDECL(l_obj_nextobj, (lua_State *)); +static int FDECL(l_obj_obj_add_to_container, (lua_State *)); +static int FDECL(l_obj_obj_getcontents, (lua_State *)); +static int FDECL(l_obj_obj_objects_to_table, (lua_State *)); +static int FDECL(l_obj_objects_to_table, (lua_State *)); +static int FDECL(l_obj_placeobj, (lua_State *)); +static int FDECL(l_obj_to_table, (lua_State *)); +static int FDECL(l_obj_totable, (lua_State *)); + +struct _lua_obj { + int state; /* UNUSED */ + struct obj *obj; +}; + +struct _lua_obj * +l_obj_check(L, index) +lua_State *L; +int index; +{ + struct _lua_obj *lo; + + luaL_checktype(L, index, LUA_TUSERDATA); + lo = (struct _lua_obj *)luaL_checkudata(L, index, "obj"); + if (!lo) + nhl_error(L, "Obj error"); + return lo; +} + +static int +l_obj_gc(L) +lua_State *L; +{ + struct _lua_obj *lo = l_obj_check(L, 1); + + if (lo && lo->obj) { + /* free-floating objects are deallocated */ + if (lo->obj->where == OBJ_FREE) { + if (Has_contents(lo->obj)) { + struct obj *otmp; + while ((otmp = lo->obj->cobj) != 0) { + obj_extract_self(otmp); + dealloc_obj(otmp); + } + } + dealloc_obj(lo->obj); + } + lo->obj = NULL; + } + + return 0; +} + +static struct _lua_obj * +l_obj_push(L, otmp) +lua_State *L; +struct obj *otmp; +{ + struct _lua_obj *lo = (struct _lua_obj *)lua_newuserdata(L, sizeof(struct _lua_obj)); + luaL_getmetatable(L, "obj"); + lua_setmetatable(L, -2); + + lo->state = 0; + lo->obj = otmp; + + return lo; +} + +/* local o = obj.new("large chest"); + local cobj = o:contents(); */ +static int +l_obj_getcontents(L) +lua_State *L; +{ + struct _lua_obj *lo = l_obj_check(L, 1); + struct obj *obj = lo->obj; + + if (!obj) + nhl_error(L, "l_obj_getcontents: no obj"); + if (!obj->cobj) + nhl_error(L, "l_obj_getcontents: no cobj"); + + (void) l_obj_push(L, obj->cobj); + return 1; +} + +/* local box = obj.new("large chest"); + box.addcontent(obj.new("rock")); +*/ +static int +l_obj_add_to_container(L) +lua_State *L; +{ + struct _lua_obj *lobox = l_obj_check(L, 1); + struct _lua_obj *lo = l_obj_check(L, 2); + struct obj *otmp; + + if (!lo->obj || !lobox->obj) + nhl_error(L, "l_obj_add_to_container: no obj"); + + if (!Is_container(lobox->obj)) + nhl_error(L, "l_obj_add_to_container: not a container"); + + otmp = add_to_container(lobox->obj, lo->obj); + + /* was lo->obj merged? FIXME: causes problems if both lo->obj and + the one it merged with are handled by lua. Use lo->state? */ + if (otmp != lo->obj) + lo->obj = otmp; + + return 0; +} + +/* Get a table of object class data. */ +/* local odata = obj.class(otbl.otyp); */ +/* local odata = obj.class(obj.new("rock")); */ +static int +l_obj_objects_to_table(L) +lua_State *L; +{ + int argc = lua_gettop(L); + int otyp = -1; + struct objclass *o; + + if (argc != 1) { + nhl_error(L, "l_obj_objects_to_table: Wrong args"); + return 0; + } + + if (lua_type(L, 1) == LUA_TNUMBER) { + otyp = (int) luaL_checkinteger(L, 1); + } else if (lua_type(L, 1) == LUA_TUSERDATA) { + struct _lua_obj *lo = l_obj_check(L, 1); + if (lo && lo->obj) + otyp = lo->obj->otyp; + } + lua_pop(L, 1); + + if (otyp == -1) { + nhl_error(L, "l_obj_objects_to_table: Wrong args"); + return 0; + } + + o = &objects[otyp]; + + lua_newtable(L); + + if (OBJ_NAME(objects[otyp])) + nhl_add_table_entry_str(L, "name", OBJ_NAME(objects[otyp])); + if (OBJ_DESCR(objects[otyp])) + nhl_add_table_entry_str(L, "descr", + OBJ_DESCR(objects[otyp])); + if (o->oc_uname) + nhl_add_table_entry_str(L, "uname", o->oc_uname); + + nhl_add_table_entry_int(L, "name_known", o->oc_name_known); + nhl_add_table_entry_int(L, "merge", o->oc_merge); + nhl_add_table_entry_int(L, "uses_known", o->oc_uses_known); + nhl_add_table_entry_int(L, "pre_discovered", o->oc_pre_discovered); + nhl_add_table_entry_int(L, "magic", o->oc_magic); + nhl_add_table_entry_int(L, "charged", o->oc_charged); + nhl_add_table_entry_int(L, "unique", o->oc_unique); + nhl_add_table_entry_int(L, "nowish", o->oc_nowish); + nhl_add_table_entry_int(L, "big", o->oc_big); + /* TODO: oc_bimanual, oc_bulky */ + nhl_add_table_entry_int(L, "tough", o->oc_tough); + nhl_add_table_entry_int(L, "dir", o->oc_dir); /* TODO: convert to text */ + nhl_add_table_entry_int(L, "material", o->oc_material); /* TODO: convert to text */ + /* TODO: oc_subtyp, oc_skill, oc_armcat */ + nhl_add_table_entry_int(L, "oprop", o->oc_oprop); + nhl_add_table_entry_char(L, "class", + def_oc_syms[(uchar) o->oc_class].sym); + nhl_add_table_entry_int(L, "delay", o->oc_delay); + nhl_add_table_entry_int(L, "color", o->oc_color); /* TODO: text? */ + nhl_add_table_entry_int(L, "prob", o->oc_prob); + nhl_add_table_entry_int(L, "weight", o->oc_weight); + nhl_add_table_entry_int(L, "cost", o->oc_cost); + nhl_add_table_entry_int(L, "damage_small", o->oc_wsdam); + nhl_add_table_entry_int(L, "damage_large", o->oc_wldam); + /* TODO: oc_oc1, oc_oc2, oc_hitbon, a_ac, a_can, oc_level */ + nhl_add_table_entry_int(L, "nutrition", o->oc_nutrition); + + return 1; +} + +/* Create a lua table representation of the object, unpacking all the + object fields. + local o = obj.new("rock"); + local otbl = o:totable(); */ +static int +l_obj_to_table(L) +lua_State *L; +{ + struct _lua_obj *lo = l_obj_check(L, 1); + struct obj *obj = lo->obj; + + lua_newtable(L); + + if (!obj) { + nhl_add_table_entry_int(L, "NO_OBJ", 1); + return 1; + } + + nhl_add_table_entry_int(L, "has_contents", Has_contents(obj)); + nhl_add_table_entry_int(L, "is_container", Is_container(obj)); + nhl_add_table_entry_int(L, "o_id", obj->o_id); + nhl_add_table_entry_int(L, "ox", obj->ox); + nhl_add_table_entry_int(L, "oy", obj->oy); + nhl_add_table_entry_int(L, "otyp", obj->otyp); + if (OBJ_NAME(objects[obj->otyp])) + nhl_add_table_entry_str(L, "otyp_name", OBJ_NAME(objects[obj->otyp])); + if (OBJ_DESCR(objects[obj->otyp])) + nhl_add_table_entry_str(L, "otyp_descr", + OBJ_DESCR(objects[obj->otyp])); + nhl_add_table_entry_int(L, "owt", obj->owt); + nhl_add_table_entry_int(L, "quan", obj->quan); + nhl_add_table_entry_int(L, "spe", obj->spe); + + if (obj->otyp == STATUE) { + nhl_add_table_entry_int(L, "historic", (obj->spe & STATUE_HISTORIC)); + nhl_add_table_entry_int(L, "statue_male", (obj->spe & STATUE_MALE)); + nhl_add_table_entry_int(L, "statue_female", (obj->spe & STATUE_FEMALE)); + } + + nhl_add_table_entry_char(L, "oclass", + def_oc_syms[(uchar) obj->oclass].sym); + nhl_add_table_entry_char(L, "invlet", obj->invlet); + /* TODO: nhl_add_table_entry_char(L, "oartifact", obj->oartifact);*/ + nhl_add_table_entry_int(L, "where", obj->where); + /* TODO: nhl_add_table_entry_int(L, "timed", obj->timed); */ + nhl_add_table_entry_int(L, "cursed", obj->cursed); + nhl_add_table_entry_int(L, "blessed", obj->blessed); + nhl_add_table_entry_int(L, "unpaid", obj->unpaid); + nhl_add_table_entry_int(L, "no_charge", obj->no_charge); + nhl_add_table_entry_int(L, "known", obj->known); + nhl_add_table_entry_int(L, "dknown", obj->dknown); + nhl_add_table_entry_int(L, "bknown", obj->bknown); + nhl_add_table_entry_int(L, "rknown", obj->rknown); + if (obj->oclass == POTION_CLASS) + nhl_add_table_entry_int(L, "odiluted", obj->odiluted); + else + nhl_add_table_entry_int(L, "oeroded", obj->oeroded); + nhl_add_table_entry_int(L, "oeroded2", obj->oeroded2); + /* TODO: orotten, norevive */ + nhl_add_table_entry_int(L, "oerodeproof", obj->oerodeproof); + nhl_add_table_entry_int(L, "olocked", obj->olocked); + nhl_add_table_entry_int(L, "obroken", obj->obroken); + if (is_poisonable(obj)) + nhl_add_table_entry_int(L, "opoisoned", obj->opoisoned); + else + nhl_add_table_entry_int(L, "otrapped", obj->otrapped); + /* TODO: degraded_horn */ + nhl_add_table_entry_int(L, "recharged", obj->recharged); + /* TODO: on_ice */ + nhl_add_table_entry_int(L, "lamplit", obj->lamplit); + nhl_add_table_entry_int(L, "globby", obj->globby); + nhl_add_table_entry_int(L, "greased", obj->greased); + nhl_add_table_entry_int(L, "nomerge", obj->nomerge); + nhl_add_table_entry_int(L, "was_thrown", obj->was_thrown); + nhl_add_table_entry_int(L, "in_use", obj->in_use); + nhl_add_table_entry_int(L, "bypass", obj->bypass); + nhl_add_table_entry_int(L, "cknown", obj->cknown); + nhl_add_table_entry_int(L, "lknown", obj->lknown); + nhl_add_table_entry_int(L, "corpsenm", obj->corpsenm); + if (obj->corpsenm != NON_PM + && (obj->otyp == TIN || obj->otyp == CORPSE || obj->otyp == EGG + || obj->otyp == FIGURINE || obj->otyp == STATUE)) + nhl_add_table_entry_str(L, "corpsenm_name", mons[obj->corpsenm].mname); + /* TODO: leashmon, fromsink, novelidx, record_achieve_special */ + nhl_add_table_entry_int(L, "usecount", obj->usecount); + /* TODO: spestudied */ + nhl_add_table_entry_int(L, "oeaten", obj->oeaten); + nhl_add_table_entry_int(L, "age", obj->age); + nhl_add_table_entry_int(L, "owornmask", obj->owornmask); + /* TODO: more of oextra */ + nhl_add_table_entry_int(L, "has_oname", has_oname(obj)); + if (has_oname(obj)) + nhl_add_table_entry_str(L, "oname", ONAME(obj)); + + return 1; +} + +/* create a new object via wishing routine */ +/* local o = obj.new("rock"); */ +static int +l_obj_new_readobjnam(L) +lua_State *L; +{ + int argc = lua_gettop(L); + + if (argc == 1) { + char buf[BUFSZ]; + struct obj *otmp; + Sprintf(buf, "%s", luaL_checkstring(L, 1)); + lua_pop(L, 1); + otmp = readobjnam(buf, NULL); + (void) l_obj_push(L, otmp); + return 1; + } else + nhl_error(L, "l_obj_new_readobjname: Wrong args"); + return 0; +} + +/* Get the topmost object on the map at x,y */ +/* local o = obj.at(x, y); */ +static int +l_obj_at(L) +lua_State *L; +{ + int argc = lua_gettop(L); + + if (argc == 2) { + int x, y; + + x = (int) luaL_checkinteger(L, 1); + y = (int) luaL_checkinteger(L, 2); + lua_pop(L, 2); + (void) l_obj_push(L, g.level.objects[x][y]); + return 1; + } else + nhl_error(L, "l_obj_at: Wrong args"); + return 0; +} + +/* Place an object on the map at (x,y). + local o = obj.new("rock"); + o:placeobj(u.ux, u.uy); */ +static int +l_obj_placeobj(L) +lua_State *L; +{ + int argc = lua_gettop(L); + struct _lua_obj *lo = l_obj_check(L, 1); + + if (argc != 3) + nhl_error(L, "l_obj_placeobj: Wrong args"); + + if (lo && lo->obj) { + int x, y; + + x = (int) luaL_checkinteger(L, 2); + y = (int) luaL_checkinteger(L, 3); + lua_pop(L, 3); + + place_object(lo->obj, x, y); + } else + nhl_error(L, "l_obj_placeobj: Wrong args"); + + return 0; +} + +/* Get the next object in the object chain */ +/* local o = obj.at(x, y); + local o2 = o:next(); +*/ +static int +l_obj_nextobj(L) +lua_State *L; +{ + struct _lua_obj *lo = l_obj_check(L, 1); + + if (lo && lo->obj) + (void) l_obj_push(L, lo->obj->where == OBJ_FLOOR ? lo->obj->nexthere : lo->obj->nobj); + return 1; +} + +/* Get the container object is in */ +/* local box = o:container(); */ +static int +l_obj_container(L) +lua_State *L; +{ + struct _lua_obj *lo = l_obj_check(L, 1); + + if (lo && lo->obj && lo->obj->where == OBJ_CONTAINED) { + (void) l_obj_push(L, lo->obj->ocontainer); + return 1; + } + (void) l_obj_push(L, NULL); + return 1; +} + +/* Is the object a null? */ +/* local badobj = o:isnull(); */ +static int +l_obj_isnull(L) +lua_State *L; +{ + struct _lua_obj *lo = l_obj_check(L, 1); + + lua_pushboolean(L, lo && lo->obj); + return 1; +} + + +static const struct luaL_Reg l_obj_methods[] = { + { "new", l_obj_new_readobjnam }, + { "isnull", l_obj_isnull }, + { "at", l_obj_at }, + { "next", l_obj_nextobj }, + { "totable", l_obj_to_table }, + { "class", l_obj_objects_to_table }, + { "placeobj", l_obj_placeobj }, + { "container", l_obj_container }, + { "contents", l_obj_getcontents }, + { "addcontent", l_obj_add_to_container }, + { NULL, NULL } +}; + +static const luaL_Reg l_obj_meta[] = { + { "__gc", l_obj_gc }, + { NULL, NULL } +}; + +int +l_obj_register(L) +lua_State *L; +{ + int lib_id, meta_id; + + /* newclass = {} */ + lua_createtable(L, 0, 0); + lib_id = lua_gettop(L); + + /* metatable = {} */ + luaL_newmetatable(L, "obj"); + meta_id = lua_gettop(L); + luaL_setfuncs(L, l_obj_meta, 0); + + /* metatable.__index = _methods */ + luaL_newlib(L, l_obj_methods); + lua_setfield(L, meta_id, "__index"); + + /* metatable.__metatable = _meta */ + luaL_newlib(L, l_obj_meta); + lua_setfield(L, meta_id, "__metatable"); + + /* class.__metatable = metatable */ + lua_setmetatable(L, lib_id); + + /* _G["obj"] = newclass */ + lua_setglobal(L, "obj"); + + return 0; +} diff --git a/src/nhlsel.c b/src/nhlsel.c new file mode 100644 index 000000000..6fa291d17 --- /dev/null +++ b/src/nhlsel.c @@ -0,0 +1,741 @@ +/* NetHack 3.7 nhlua.c $NHDT-Date: 1574646948 2019/11/25 01:55:48 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.4 $ */ +/* Copyright (c) 2018 by Pasi Kallinen */ +/* NetHack may be freely redistributed. See license for details. */ + +#include "hack.h" +#include "sp_lev.h" + +/* lua_CFunction prototypes */ +static int FDECL(l_selection_new, (lua_State *)); +static int FDECL(l_selection_clone, (lua_State *)); +static int FDECL(l_selection_getpoint, (lua_State *)); +static int FDECL(l_selection_setpoint, (lua_State *)); +static int FDECL(l_selection_not, (lua_State *)); +static int FDECL(l_selection_filter_percent, (lua_State *)); +static int FDECL(l_selection_rndcoord, (lua_State *)); +static int FDECL(l_selection_line, (lua_State *)); +static int FDECL(l_selection_randline, (lua_State *)); +static int FDECL(l_selection_rect, (lua_State *)); +static int FDECL(l_selection_fillrect, (lua_State *)); +static int FDECL(l_selection_fillrect, (lua_State *)); +static int FDECL(l_selection_grow, (lua_State *)); +static int FDECL(l_selection_filter_mapchar, (lua_State *)); +static int FDECL(l_selection_flood, (lua_State *)); +static int FDECL(l_selection_circle, (lua_State *)); +static int FDECL(l_selection_ellipse, (lua_State *)); +static int FDECL(l_selection_gc, (lua_State *)); +static int FDECL(l_selection_not, (lua_State *)); +static int FDECL(l_selection_and, (lua_State *)); +static int FDECL(l_selection_or, (lua_State *)); +static int FDECL(l_selection_xor, (lua_State *)); +static int FDECL(l_selection_not, (lua_State *)); +#if 0 +/* the following do not appear to currently be + used and because they are static, the OSX + compiler is complaining about them. I've + if ifdef'd out the prototype here and the + function body below. + */ +static int FDECL(l_selection_gradient, (lua_State *)); +static int FDECL(l_selection_iterate, (lua_State *)); +static int FDECL(l_selection_add, (lua_State *)); +static int FDECL(l_selection_sub, (lua_State *)); +static int FDECL(l_selection_ipairs, (lua_State *)); +static struct selectionvar *FDECL(l_selection_to, (lua_State *, int)); +#endif + +struct selectionvar * +l_selection_check(L, index) +lua_State *L; +int index; +{ + struct selectionvar *sel; + + luaL_checktype(L, index, LUA_TUSERDATA); + sel = (struct selectionvar *)luaL_checkudata(L, index, "selection"); + if (!sel) + nhl_error(L, "Selection error"); + return sel; +} + +static int +l_selection_gc(L) +lua_State *L; +{ + struct selectionvar *sel = l_selection_check(L, 1); + if (sel) + selection_free(sel); + return 0; +} + +#if 0 +static struct selectionvar * +l_selection_to(L, index) +lua_State *L; +int index; +{ + struct selectionvar *sel = (struct selectionvar *)lua_touserdata(L, index); + + if (!sel) + nhl_error(L, "Selection error"); + return sel; +} +#endif + +static struct selectionvar * +l_selection_push(L) +lua_State *L; +{ + struct selectionvar *tmp = selection_new(); + struct selectionvar *sel = (struct selectionvar *)lua_newuserdata(L, sizeof(struct selectionvar)); + luaL_getmetatable(L, "selection"); + lua_setmetatable(L, -2); + + sel->wid = tmp->wid; + sel->hei = tmp->hei; + sel->map = dupstr(tmp->map); + selection_free(tmp); + free(tmp); + + return sel; +} + +/* local sel = selection.new(); */ +static int +l_selection_new(L) +lua_State *L; +{ + (void) l_selection_push(L); + return 1; +} + +/* local sel = selection.clone(sel); */ +static int +l_selection_clone(L) +lua_State *L; +{ + struct selectionvar *sel = l_selection_check(L, 1); + struct selectionvar *tmp; + /* int x,y; */ /* REVIEW: unreferenced */ + lua_pop(L, 1); + (void) l_selection_new(L); + tmp = l_selection_check(L, 1); + if (tmp->map) + free(tmp->map); + tmp->map = dupstr(sel->map); + tmp->wid = sel->wid; + tmp->hei = sel->hei; + return 1; +} + +/* selection.set(sel, x, y); */ +/* selection.set(sel, x, y, value); */ +/* local sel = selection.set(); */ +/* local sel = sel:set(); */ +/* local sel = selection.set(sel); */ +/* TODO: allow setting multiple coordinates at once: set({x,y}, {x,y}, ...); */ +static int +l_selection_setpoint(L) +lua_State *L; +{ + struct selectionvar *sel = (struct selectionvar *) 0; + schar x = -1, y = -1; + int val = 1; + int argc = lua_gettop(L); + long coord = 0L; + + if (argc == 0) { + (void) l_selection_new(L); + } else if (argc == 1) { + sel = l_selection_check(L, 1); + } else if (argc == 2) { + x = (schar) luaL_checkinteger(L, 1); + y = (schar) luaL_checkinteger(L, 2); + lua_pop(L, 2); + (void) l_selection_new(L); + sel = l_selection_check(L, 1); + } else { + sel = l_selection_check(L, 1); + x = (schar) luaL_checkinteger(L, 2); + y = (schar) luaL_checkinteger(L, 3); + val = (int) luaL_optinteger(L, 4, 1); + } + + if (!sel || !sel->map) { + nhl_error(L, "Selection setpoint error"); + /*NOTREACHED*/ + return 0; + } + + if (x == -1 && y == -1) + coord = SP_COORD_PACK_RANDOM(0); + else + coord = SP_COORD_PACK(x,y); + get_location_coord(&x, &y, ANY_LOC, + g.coder ? g.coder->croom : NULL, coord); + selection_setpoint(x, y, sel, val); + lua_settop(L, 1); + return 1; +} + +/* local value = selection.get(sel, x, y); */ +static int +l_selection_getpoint(L) +lua_State *L; +{ + struct selectionvar *sel = l_selection_check(L, 1); + schar x = (schar) luaL_checkinteger(L, 2); + schar y = (schar) luaL_checkinteger(L, 3); + int val; + long coord; + + if (x == -1 && y == -1) + coord = SP_COORD_PACK_RANDOM(0); + else + coord = SP_COORD_PACK(x,y); + get_location_coord(&x, &y, ANY_LOC, g.coder ? g.coder->croom : NULL, coord); + + val = selection_getpoint(x, y, sel); + lua_settop(L, 0); + lua_pushnumber(L, val); + return 1; +} + +/* local s = selection.negate(sel); */ +/* local s = selection.negate(); */ +static int +l_selection_not(L) +lua_State *L; +{ + int argc = lua_gettop(L); + struct selectionvar *sel; + + if (argc == 0) + (void) l_selection_new(L); + sel = l_selection_check(L, 1); + selection_not(sel); + lua_settop(L, 1); + return 1; +} + +/* local sel = selection.area(4,5, 40,10) & selection.rect(7,8, 60,14); */ +static int +l_selection_and(L) +lua_State *L; +{ + int x,y; + struct selectionvar *sela = l_selection_check(L, 1); + struct selectionvar *selb = l_selection_check(L, 2); + + for (x = 0; x < sela->wid; x++) + for (y = 0; y < sela->hei; y++) { + int val = selection_getpoint(x, y, sela) & selection_getpoint(x, y, selb); + selection_setpoint(x, y, sela, val); + } + + lua_settop(L, 1); + return 1; +} + +/* local sel = selection.area(4,5, 40,10) | selection.rect(7,8, 60,14); */ +static int +l_selection_or(L) +lua_State *L; +{ + int x,y; + struct selectionvar *sela = l_selection_check(L, 1); + struct selectionvar *selb = l_selection_check(L, 2); + + for (x = 0; x < sela->wid; x++) + for (y = 0; y < sela->hei; y++) { + int val = selection_getpoint(x, y, sela) | selection_getpoint(x, y, selb); + selection_setpoint(x, y, sela, val); + } + + lua_settop(L, 1); + return 1; +} + +/* local sel = selection.area(4,5, 40,10) ~ selection.rect(7,8, 60,14); */ +static int +l_selection_xor(L) +lua_State *L; +{ + int x,y; + struct selectionvar *sela = l_selection_check(L, 1); + struct selectionvar *selb = l_selection_check(L, 2); + + for (x = 0; x < sela->wid; x++) + for (y = 0; y < sela->hei; y++) { + int val = selection_getpoint(x, y, sela) ^ selection_getpoint(x, y, selb); + selection_setpoint(x, y, sela, val); + } + + lua_settop(L, 1); + return 1; +} + + +/* local s = selection.percentage(sel, 50); */ +static int +l_selection_filter_percent(L) +lua_State *L; +{ + struct selectionvar *sel = l_selection_check(L, 1); + int p = (int) luaL_checkinteger(L, 2); + selection_filter_percent(sel, p); + lua_settop(L, 1); + return 1; +} + +/* local x,y = selection.rndcoord(sel); */ +/* local x,y = selection.rndcoord(sel, 1); */ +static int +l_selection_rndcoord(L) +lua_State *L; +{ + struct selectionvar *sel = l_selection_check(L, 1); + int removeit = (int) luaL_optinteger(L, 2, 0); + schar x, y; + selection_rndcoord(sel, &x, &y, removeit); + update_croom(); + if (g.coder && g.coder->croom) { + x -= g.coder->croom->lx; + y -= g.coder->croom->ly; + } else { + x -= g.xstart; + y -= g.ystart; + } + lua_settop(L, 0); + lua_pushnumber(L, x); + lua_pushnumber(L, y); + return 2; +} + +/* local s = selection.line(sel, x1,y1, x2,y2); */ +/* local s = selection.line(x1,y1, x2,y2); */ +/* s:line(x1,y1, x2,y2); */ +static int +l_selection_line(L) +lua_State *L; +{ + int argc = lua_gettop(L); + struct selectionvar *sel; + schar x1; + schar y1; + schar x2; + schar y2; + + if (argc == 4) { + (void) l_selection_new(L); + x1 = (schar) luaL_checkinteger(L, 1); + y1 = (schar) luaL_checkinteger(L, 2); + x2 = (schar) luaL_checkinteger(L, 3); + y2 = (schar) luaL_checkinteger(L, 4); + sel = l_selection_check(L, 5); + lua_remove(L, 1); + lua_remove(L, 1); + lua_remove(L, 1); + lua_remove(L, 1); + } else { + sel = l_selection_check(L, 1); + x1 = (schar) luaL_checkinteger(L, 2); + y1 = (schar) luaL_checkinteger(L, 3); + x2 = (schar) luaL_checkinteger(L, 4); + y2 = (schar) luaL_checkinteger(L, 5); + } + + get_location_coord(&x1, &y1, ANY_LOC, g.coder ? g.coder->croom : NULL, SP_COORD_PACK(x1,y1)); + get_location_coord(&x2, &y2, ANY_LOC, g.coder ? g.coder->croom : NULL, SP_COORD_PACK(x2,y2)); + + selection_do_line(x1,y1,x2,y2, sel); + lua_settop(L, 1); + return 1; +} + +/* local s = selection.rect(sel, x1,y1, x2,y2); */ +static int +l_selection_rect(L) +lua_State *L; +{ + int argc = lua_gettop(L); + struct selectionvar *sel; + schar x1; + schar y1; + schar x2; + schar y2; + + if (argc == 4) { + (void) l_selection_new(L); + x1 = (schar) luaL_checkinteger(L, 1); + y1 = (schar) luaL_checkinteger(L, 2); + x2 = (schar) luaL_checkinteger(L, 3); + y2 = (schar) luaL_checkinteger(L, 4); + sel = l_selection_check(L, 5); + lua_remove(L, 1); + lua_remove(L, 1); + lua_remove(L, 1); + lua_remove(L, 1); + } else { + sel = l_selection_check(L, 1); + x1 = (schar) luaL_checkinteger(L, 2); + y1 = (schar) luaL_checkinteger(L, 3); + x2 = (schar) luaL_checkinteger(L, 4); + y2 = (schar) luaL_checkinteger(L, 5); + } + + get_location_coord(&x1, &y1, ANY_LOC, g.coder ? g.coder->croom : NULL, SP_COORD_PACK(x1,y1)); + get_location_coord(&x2, &y2, ANY_LOC, g.coder ? g.coder->croom : NULL, SP_COORD_PACK(x2,y2)); + + selection_do_line(x1,y1,x2,y1, sel); + selection_do_line(x1,y1,x1,y2, sel); + selection_do_line(x2,y1,x2,y2, sel); + selection_do_line(x1,y2,x2,y2, sel); + lua_settop(L, 1); + return 1; +} + +/* local s = selection.fillrect(sel, x1,y1, x2,y2); */ +/* local s = selection.fillrect(x1,y1, x2,y2); */ +/* s:fillrect(x1,y1, x2,y2); */ +/* selection.area(x1,y1, x2,y2); */ +static int +l_selection_fillrect(L) +lua_State *L; +{ + int argc = lua_gettop(L); + struct selectionvar *sel; + int y; + schar x1; + schar y1; + schar x2; + schar y2; + + if (argc == 4) { + (void) l_selection_new(L); + x1 = (schar) luaL_checkinteger(L, 1); + y1 = (schar) luaL_checkinteger(L, 2); + x2 = (schar) luaL_checkinteger(L, 3); + y2 = (schar) luaL_checkinteger(L, 4); + sel = l_selection_check(L, 5); + lua_remove(L, 1); + lua_remove(L, 1); + lua_remove(L, 1); + lua_remove(L, 1); + } else { + sel = l_selection_check(L, 1); + x1 = (schar) luaL_checkinteger(L, 2); + y1 = (schar) luaL_checkinteger(L, 3); + x2 = (schar) luaL_checkinteger(L, 4); + y2 = (schar) luaL_checkinteger(L, 5); + } + + get_location_coord(&x1, &y1, ANY_LOC, g.coder ? g.coder->croom : NULL, SP_COORD_PACK(x1,y1)); + get_location_coord(&x2, &y2, ANY_LOC, g.coder ? g.coder->croom : NULL, SP_COORD_PACK(x2,y2)); + + if (x1 == x2) { + for (y = y1; y <= y2; y++) + selection_setpoint(x1, y, sel, 1); + } else { + for (y = y1; y <= y2; y++) + selection_do_line(x1,y,x2,y, sel); + } + lua_settop(L, 1); + return 1; +} + +/* local s = selection.randline(sel, x1,y1, x2,y2, roughness); */ +/* local s = selection.randline(x1,y1, x2,y2, roughness); */ +/* TODO: selection.randline(x1,y1, x2,y2, roughness); */ +/* TODO: selection.randline({x1,y1}, {x2,y2}, roughness); */ +static int +l_selection_randline(L) +lua_State *L; +{ + int argc = lua_gettop(L); + struct selectionvar *sel = (struct selectionvar *) 0; + schar x1, y1, x2, y2; + int roughness = 7; + + if (argc == 6) { + sel = l_selection_check(L, 1); + x1 = (schar) luaL_checkinteger(L, 2); + y1 = (schar) luaL_checkinteger(L, 3); + x2 = (schar) luaL_checkinteger(L, 4); + y2 = (schar) luaL_checkinteger(L, 5); + roughness = (int) luaL_checkinteger(L, 6); + } else if (argc == 5 && lua_type(L, 1) == LUA_TNUMBER) { + x1 = (schar) luaL_checkinteger(L, 1); + y1 = (schar) luaL_checkinteger(L, 2); + x2 = (schar) luaL_checkinteger(L, 3); + y2 = (schar) luaL_checkinteger(L, 4); + roughness = (int) luaL_checkinteger(L, 5); + lua_pop(L, 5); + (void) l_selection_new(L); + sel = l_selection_check(L, 1); + } + + get_location_coord(&x1, &y1, ANY_LOC, + g.coder ? g.coder->croom : NULL, SP_COORD_PACK(x1, y1)); + get_location_coord(&x2, &y2, ANY_LOC, + g.coder ? g.coder->croom : NULL, SP_COORD_PACK(x2, y2)); + + selection_do_randline(x1, y1, x2, y2, roughness, 12, sel); + lua_settop(L, 1); + return 1; +} + +/* local s = selection.grow(sel); */ +/* local s = selection.grow(sel, "north"); */ +static int +l_selection_grow(L) +lua_State *L; +{ + const char *const growdirs[] = { "all", "random", "north", "west", "east", "south", NULL }; + const int growdirs2i[] = { W_ANY, -1, W_NORTH, W_WEST, W_EAST, W_SOUTH, 0 }; + + struct selectionvar *sel = l_selection_check(L, 1); + int dir = growdirs2i[luaL_checkoption(L, 2, "all", growdirs)]; + selection_do_grow(sel, dir); + lua_settop(L, 1); + return 1; +} + + +/* local s = selection.filter_mapchar(sel, mapchar, lit); */ +static int +l_selection_filter_mapchar(L) +lua_State *L; +{ + struct selectionvar *sel = l_selection_check(L, 1); + char *mapchr = dupstr(luaL_checkstring(L, 2)); + xchar typ = check_mapchr(mapchr); + int lit = (int) luaL_optinteger(L, 3, -2); /* TODO: special lit values */ + struct selectionvar *tmp = selection_filter_mapchar(sel, typ, lit); + + if (typ == INVALID_TYPE) + nhl_error(L, "Erroneous map char"); + + if (sel->map) + free(sel->map); + sel->map = tmp->map; + if (tmp) + free(tmp); + if (mapchr) + free(mapchr); + + lua_settop(L, 1); + return 1; +} + + +/* local s = selection.floodfill(sel, x, y); */ +/* local s = selection.floodfill(x,y); */ +static int +l_selection_flood(L) +lua_State *L; +{ + int argc = lua_gettop(L); + struct selectionvar *sel = (struct selectionvar *) 0; + schar x, y; + + if (argc == 3) { + sel = l_selection_check(L, 1); + x = (schar) luaL_checkinteger(L, 2); + y = (schar) luaL_checkinteger(L, 3); + } else if (argc == 2) { + x = (schar) luaL_checkinteger(L, 1); + y = (schar) luaL_checkinteger(L, 2); + lua_pop(L, 2); + (void) l_selection_new(L); + sel = l_selection_check(L, 1); + } else { + nhl_error(L, "wrong parameters"); + /*NOTREACHED*/ + } + + get_location_coord(&x, &y, ANY_LOC, + g.coder ? g.coder->croom : NULL, SP_COORD_PACK(x, y)); + + if (isok(x, y)) { + set_floodfillchk_match_under(levl[x][y].typ); + selection_floodfill(sel, x, y, FALSE); + } + lua_settop(L, 1); + return 1; +} + + +/* local s = selection.circle(x,y, radius); */ +/* local s = selection.circle(x, y, radius, filled); */ +/* local s = selection.circle(sel, x, y, radius); */ +/* local s = selection.circle(sel, x, y, radius, filled); */ +static int +l_selection_circle(L) +lua_State *L; +{ + int argc = lua_gettop(L); + struct selectionvar *sel = (struct selectionvar *) 0; + schar x = 0, y = 0; + int r = 0, filled = 0; + + if (argc == 3) { + x = (schar) luaL_checkinteger(L, 1); + y = (schar) luaL_checkinteger(L, 2); + r = (int) luaL_checkinteger(L, 3); + lua_pop(L, 3); + (void) l_selection_new(L); + sel = l_selection_check(L, 1); + filled = 0; + } else if (argc == 4 && lua_type(L, 1) == LUA_TNUMBER) { + x = (schar) luaL_checkinteger(L, 1); + y = (schar) luaL_checkinteger(L, 2); + r = (int) luaL_checkinteger(L, 3); + filled = (int) luaL_checkinteger(L, 4); /* TODO: boolean*/ + lua_pop(L, 4); + (void) l_selection_new(L); + sel = l_selection_check(L, 1); + } else if (argc == 4 || argc == 5) { + sel = l_selection_check(L, 1); + x = (schar) luaL_checkinteger(L, 2); + y = (schar) luaL_checkinteger(L, 3); + r = (int) luaL_checkinteger(L, 4); + filled = (int) luaL_optinteger(L, 5, 0); /* TODO: boolean */ + } else { + nhl_error(L, "wrong parameters"); + /*NOTREACHED*/ + } + + get_location_coord(&x, &y, ANY_LOC, + g.coder ? g.coder->croom : NULL, SP_COORD_PACK(x, y)); + + selection_do_ellipse(sel, x, y, r, r, !filled); + + lua_settop(L, 1); + return 1; +} + +/* local s = selection.ellipse(x, y, radius1, radius2); */ +/* local s = selection.ellipse(x, y, radius1, radius2, filled); */ +/* local s = selection.ellipse(sel, x, y, radius1, radius2); */ +/* local s = selection.ellipse(sel, x, y, radius1, radius2, filled); */ +static int +l_selection_ellipse(L) +lua_State *L; +{ + int argc = lua_gettop(L); + struct selectionvar *sel = (struct selectionvar *) 0; + schar x = 0, y = 0; + int r1 = 0, r2 = 0, filled = 0; + + if (argc == 4) { + x = (schar) luaL_checkinteger(L, 1); + y = (schar) luaL_checkinteger(L, 2); + r1 = (int) luaL_checkinteger(L, 3); + r2 = (int) luaL_checkinteger(L, 4); + lua_pop(L, 4); + (void) l_selection_new(L); + sel = l_selection_check(L, 1); + filled = 0; + } else if (argc == 5 && lua_type(L, 1) == LUA_TNUMBER) { + x = (schar) luaL_checkinteger(L, 1); + y = (schar) luaL_checkinteger(L, 2); + r1 = (int) luaL_checkinteger(L, 3); + r2 = (int) luaL_checkinteger(L, 4); + filled = (int) luaL_optinteger(L, 5, 0); /* TODO: boolean */ + lua_pop(L, 5); + (void) l_selection_new(L); + sel = l_selection_check(L, 1); + } else if (argc == 5 || argc == 6) { + sel = l_selection_check(L, 1); + x = (schar) luaL_checkinteger(L, 2); + y = (schar) luaL_checkinteger(L, 3); + r1 = (int) luaL_checkinteger(L, 4); + r2 = (int) luaL_checkinteger(L, 5); + filled = (int) luaL_optinteger(L, 6, 0); /* TODO: boolean */ + } else { + nhl_error(L, "wrong parameters"); + /*NOTREACHED*/ + } + + get_location_coord(&x, &y, ANY_LOC, + g.coder ? g.coder->croom : NULL, SP_COORD_PACK(x, y)); + + selection_do_ellipse(sel, x, y, r1, r2, !filled); + + lua_settop(L, 1); + return 1; +} + + +static const struct luaL_Reg l_selection_methods[] = { + { "new", l_selection_new }, + { "clone", l_selection_clone }, + { "get", l_selection_getpoint }, + { "set", l_selection_setpoint }, + { "negate", l_selection_not }, + { "percentage", l_selection_filter_percent }, + { "rndcoord", l_selection_rndcoord }, + { "line", l_selection_line }, + { "randline", l_selection_randline }, + { "rect", l_selection_rect }, + { "fillrect", l_selection_fillrect }, + { "area", l_selection_fillrect }, + { "grow", l_selection_grow }, + { "filter_mapchar", l_selection_filter_mapchar }, + { "floodfill", l_selection_flood }, + { "circle", l_selection_circle }, + { "ellipse", l_selection_ellipse }, + /* TODO: + { "gradient", l_selection_gradient }, + { "iterate", l_selection_iterate }, + */ + { NULL, NULL } +}; + +static const luaL_Reg l_selection_meta[] = { + { "__gc", l_selection_gc }, + { "__unm", l_selection_not }, + { "__band", l_selection_and }, + { "__bor", l_selection_or }, + { "__bxor", l_selection_xor }, + { "__bnot", l_selection_not }, + /* TODO: http://lua-users.org/wiki/MetatableEvents + { "__add", l_selection_add }, + { "__sub", l_selection_sub }, + { "__ipairs", l_selection_ipairs }, + */ + { NULL, NULL } +}; + +int +l_selection_register(L) +lua_State *L; +{ + int lib_id, meta_id; + + /* newclass = {} */ + lua_createtable(L, 0, 0); + lib_id = lua_gettop(L); + + /* metatable = {} */ + luaL_newmetatable(L, "selection"); + meta_id = lua_gettop(L); + luaL_setfuncs(L, l_selection_meta, 0); + + /* metatable.__index = _methods */ + luaL_newlib(L, l_selection_methods); + lua_setfield(L, meta_id, "__index"); + + /* metatable.__metatable = _meta */ + luaL_newlib(L, l_selection_meta); + lua_setfield(L, meta_id, "__metatable"); + + /* class.__metatable = metatable */ + lua_setmetatable(L, lib_id); + + /* _G["selection"] = newclass */ + lua_setglobal(L, "selection"); + + return 0; +} diff --git a/src/nhlua.c b/src/nhlua.c new file mode 100644 index 000000000..edbde987e --- /dev/null +++ b/src/nhlua.c @@ -0,0 +1,1030 @@ +/* NetHack 3.7 nhlua.c $NHDT-Date: 1575246766 2019/12/02 00:32:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.16 $ */ +/* Copyright (c) 2018 by Pasi Kallinen */ +/* NetHack may be freely redistributed. See license for details. */ + +#include "hack.h" +#include "dlb.h" + +/* +#- include +#- include +#- include +*/ + +/* */ + +/* lua_CFunction prototypes */ +static int FDECL(nhl_test, (lua_State *)); +static int FDECL(nhl_getmap, (lua_State *)); +static int FDECL(nhl_gettrap, (lua_State *)); +static int FDECL(nhl_deltrap, (lua_State *)); +#if 0 +static int FDECL(nhl_setmap, (lua_State *)); +#endif +static int FDECL(nhl_pline, (lua_State *)); +static int FDECL(nhl_verbalize, (lua_State *)); +static int FDECL(nhl_menu, (lua_State *)); +static int FDECL(nhl_getlin, (lua_State *)); +static int FDECL(nhl_makeplural, (lua_State *)); +static int FDECL(nhl_makesingular, (lua_State *)); +static int FDECL(nhl_s_suffix, (lua_State *)); +static int FDECL(nhl_ing_suffix, (lua_State *)); +static int FDECL(nhl_an, (lua_State *)); +static int FDECL(nhl_meta_u_index, (lua_State *)); +static int FDECL(nhl_meta_u_newindex, (lua_State *)); +static int FDECL(traceback_handler, (lua_State *)); + +void +nhl_error(L, msg) +lua_State *L; +const char *msg; +{ + lua_Debug ar; + char buf[BUFSZ]; + + lua_getstack(L, 1, &ar); + lua_getinfo(L, "lS", &ar); + Sprintf(buf, "%s (line %i%s)", msg, ar.currentline, ar.source); + lua_pushstring(L, buf); + (void) lua_error(L); + /*NOTREACHED*/ +} + +/* Check that parameters are nothing but single table, + or if no parameters given, put empty table there */ +void +lcheck_param_table(L) +lua_State *L; +{ + int argc = lua_gettop(L); + + if (argc < 1) + lua_createtable(L, 0, 0); + + /* discard any extra arguments passed in */ + lua_settop(L, 1); + + luaL_checktype(L, 1, LUA_TTABLE); +} + +schar +get_table_mapchr(L, name) +lua_State *L; +const char *name; +{ + char *ter; + xchar typ; + + ter = get_table_str(L, name); + typ = check_mapchr(ter); + if (typ == INVALID_TYPE) + nhl_error(L, "Erroneous map char"); + if (ter) + free(ter); + return typ; +} + +schar +get_table_mapchr_opt(L, name, defval) +lua_State *L; +const char *name; +schar defval; +{ + char *ter; + xchar typ; + + ter = get_table_str_opt(L, name, emptystr); + if (name && *ter) { + typ = check_mapchr(ter); + if (typ == INVALID_TYPE) + nhl_error(L, "Erroneous map char"); + } else + typ = defval; + if (ter) + free(ter); + return typ; +} + +void +nhl_add_table_entry_int(L, name, value) +lua_State *L; +const char *name; +int value; +{ + lua_pushstring(L, name); + lua_pushinteger(L, value); + lua_rawset(L, -3); +} + +void +nhl_add_table_entry_char(L, name, value) +lua_State *L; +const char *name; +char value; +{ + char buf[2]; + Sprintf(buf, "%c", value); + lua_pushstring(L, name); + lua_pushstring(L, buf); + lua_rawset(L, -3); +} + +void +nhl_add_table_entry_str(L, name, value) +lua_State *L; +const char *name; +const char *value; +{ + lua_pushstring(L, name); + lua_pushstring(L, value); + lua_rawset(L, -3); +} +void +nhl_add_table_entry_bool(L, name, value) +lua_State *L; +const char *name; +boolean value; +{ + lua_pushstring(L, name); + lua_pushboolean(L, value); + lua_rawset(L, -3); +} + +/* converting from special level "map character" to levl location type + and back. order here is important. */ +const struct { + char ch; + schar typ; +} char2typ[] = { + { ' ', STONE }, + { '#', CORR }, + { '.', ROOM }, + { '-', HWALL }, + { '-', TLCORNER }, + { '-', TRCORNER }, + { '-', BLCORNER }, + { '-', BRCORNER }, + { '-', CROSSWALL }, + { '-', TUWALL }, + { '-', TDWALL }, + { '-', TLWALL }, + { '-', TRWALL }, + { '-', DBWALL }, + { '|', VWALL }, + { '+', DOOR }, + { 'A', AIR }, + { 'C', CLOUD }, + { 'S', SDOOR }, + { 'H', SCORR }, + { '{', FOUNTAIN }, + { '\\', THRONE }, + { 'K', SINK }, + { '}', MOAT }, + { 'P', POOL }, + { 'L', LAVAPOOL }, + { 'I', ICE }, + { 'W', WATER }, + { 'T', TREE }, + { 'F', IRONBARS }, /* Fe = iron */ + { 'x', MAX_TYPE }, /* "see-through" */ + { 'B', CROSSWALL }, /* hack: boundary location */ + { '\0', STONE }, +}; + +schar +splev_chr2typ(c) +char c; +{ + int i; + + for (i = 0; char2typ[i].ch; i++) + if (c == char2typ[i].ch) + return char2typ[i].typ; + return (INVALID_TYPE); +} + +schar +check_mapchr(s) +const char *s; +{ + if (s && strlen(s) == 1) + return splev_chr2typ(s[0]); + return INVALID_TYPE; +} + +char +splev_typ2chr(typ) +schar typ; +{ + int i; + + for (i = 0; char2typ[i].typ < MAX_TYPE; i++) + if (typ == char2typ[i].typ) + return char2typ[i].ch; + return 'x'; +} + +/* local t = gettrap(x,y); */ +static int +nhl_gettrap(L) +lua_State *L; +{ + int argc = lua_gettop(L); + + if (argc == 2) { + int x = (int) lua_tointeger(L, 1); + int y = (int) lua_tointeger(L, 2); + + if (x >= 0 && x < COLNO && y >= 0 && y < ROWNO) { + struct trap *ttmp = t_at(x,y); + + if (ttmp) { + lua_newtable(L); + + nhl_add_table_entry_int(L, "tx", ttmp->tx); + nhl_add_table_entry_int(L, "ty", ttmp->ty); + nhl_add_table_entry_int(L, "ttyp", ttmp->ttyp); + nhl_add_table_entry_str(L, "ttyp_name", get_trapname_bytype(ttmp->ttyp)); + nhl_add_table_entry_int(L, "tseen", ttmp->tseen); + nhl_add_table_entry_int(L, "madeby_u", ttmp->madeby_u); + switch (ttmp->ttyp) { + case SQKY_BOARD: + nhl_add_table_entry_int(L, "tnote", ttmp->tnote); + break; + case ROLLING_BOULDER_TRAP: + nhl_add_table_entry_int(L, "launchx", ttmp->launch.x); + nhl_add_table_entry_int(L, "launchy", ttmp->launch.y); + nhl_add_table_entry_int(L, "launch2x", ttmp->launch2.x); + nhl_add_table_entry_int(L, "launch2y", ttmp->launch2.y); + break; + case PIT: + case SPIKED_PIT: + nhl_add_table_entry_int(L, "conjoined", ttmp->conjoined); + break; + } + return 1; + } else + nhl_error(L, "No trap at location"); + } else + nhl_error(L, "Coordinates out of range"); + } else + nhl_error(L, "Wrong args"); + return 0; +} + +/* deltrap(x,y); */ +static int +nhl_deltrap(L) +lua_State *L; +{ + int argc = lua_gettop(L); + + if (argc == 2) { + int x = (int) lua_tointeger(L, 1); + int y = (int) lua_tointeger(L, 2); + + if (x >= 0 && x < COLNO && y >= 0 && y < ROWNO) { + struct trap *ttmp = t_at(x,y); + + if (ttmp) + deltrap(ttmp); + } + } + return 0; +} + +/* local loc = getmap(x,y) */ +static int +nhl_getmap(L) +lua_State *L; +{ + int argc = lua_gettop(L); + + if (argc == 2) { + int x = (int) lua_tointeger(L, 1); + int y = (int) lua_tointeger(L, 2); + + if (x >= 0 && x < COLNO && y >= 0 && y < ROWNO) { + char buf[BUFSZ]; + lua_newtable(L); + + /* FIXME: some should be boolean values */ + nhl_add_table_entry_int(L, "glyph", levl[x][y].glyph); + nhl_add_table_entry_int(L, "typ", levl[x][y].typ); + nhl_add_table_entry_str(L, "typ_name", levltyp_to_name(levl[x][y].typ)); + Sprintf(buf, "%c", splev_typ2chr(levl[x][y].typ)); + nhl_add_table_entry_str(L, "mapchr", buf); + nhl_add_table_entry_int(L, "seenv", levl[x][y].seenv); + nhl_add_table_entry_bool(L, "horizontal", levl[x][y].horizontal); + nhl_add_table_entry_bool(L, "lit", levl[x][y].lit); + nhl_add_table_entry_bool(L, "waslit", levl[x][y].waslit); + nhl_add_table_entry_int(L, "roomno", levl[x][y].roomno); + nhl_add_table_entry_bool(L, "edge", levl[x][y].edge); + nhl_add_table_entry_bool(L, "candig", levl[x][y].candig); + + nhl_add_table_entry_int(L, "has_trap", t_at(x,y) ? 1 : 0); + + /* TODO: FIXME: levl[x][y].flags */ + + lua_pushliteral(L, "flags"); + lua_newtable(L); + + if (IS_DOOR(levl[x][y].typ)) { + nhl_add_table_entry_bool(L, "nodoor", (levl[x][y].flags & D_NODOOR)); + nhl_add_table_entry_bool(L, "broken", (levl[x][y].flags & D_BROKEN)); + nhl_add_table_entry_bool(L, "isopen", (levl[x][y].flags & D_ISOPEN)); + nhl_add_table_entry_bool(L, "closed", (levl[x][y].flags & D_CLOSED)); + nhl_add_table_entry_bool(L, "locked", (levl[x][y].flags & D_LOCKED)); + nhl_add_table_entry_bool(L, "trapped", (levl[x][y].flags & D_TRAPPED)); + } else if (IS_ALTAR(levl[x][y].typ)) { + /* TODO: bits 0, 1, 2 */ + nhl_add_table_entry_bool(L, "shrine", (levl[x][y].flags & AM_SHRINE)); + } else if (IS_THRONE(levl[x][y].typ)) { + nhl_add_table_entry_bool(L, "looted", (levl[x][y].flags & T_LOOTED)); + } else if (levl[x][y].typ == TREE) { + nhl_add_table_entry_bool(L, "looted", (levl[x][y].flags & TREE_LOOTED)); + nhl_add_table_entry_bool(L, "swarm", (levl[x][y].flags & TREE_SWARM)); + } else if (IS_FOUNTAIN(levl[x][y].typ)) { + nhl_add_table_entry_bool(L, "looted", (levl[x][y].flags & F_LOOTED)); + nhl_add_table_entry_bool(L, "warned", (levl[x][y].flags & F_WARNED)); + } else if (IS_SINK(levl[x][y].typ)) { + nhl_add_table_entry_bool(L, "pudding", (levl[x][y].flags & S_LPUDDING)); + nhl_add_table_entry_bool(L, "dishwasher", (levl[x][y].flags & S_LDWASHER)); + nhl_add_table_entry_bool(L, "ring", (levl[x][y].flags & S_LRING)); + } + /* TODO: drawbridges, walls, ladders, room=>ICED_xxx */ + + lua_settable(L, -3); + + return 1; + } else { + /* TODO: return zerorm instead? */ + nhl_error(L, "Coordinates out of range"); + return 0; + } + } else { + nhl_error(L, "Incorrect arguments"); + return 0; + } + return 1; +} + +/* pline("It hits!") */ +static int +nhl_pline(L) +lua_State *L; +{ + int argc = lua_gettop(L); + + if (argc == 1) + pline("%s", luaL_checkstring(L, 1)); + else + nhl_error(L, "Wrong args"); + + return 0; +} + +/* verbalize("Fool!") */ +static int +nhl_verbalize(L) +lua_State *L; +{ + int argc = lua_gettop(L); + + if (argc == 1) + verbalize("%s", luaL_checkstring(L, 1)); + else + nhl_error(L, "Wrong args"); + + return 0; +} + +/* + str = getlin("What do you want to call this dungeon level?"); + */ +static int +nhl_getlin(L) +lua_State *L; +{ + int argc = lua_gettop(L); + + if (argc == 1) { + const char *prompt = luaL_checkstring(L, 1); + char buf[BUFSZ]; + + getlin(prompt, buf); + lua_pushstring(L, buf); + return 1; + } + + nhl_error(L, "Wrong args"); + return 0; +} + +/* + selected = menu("prompt", default, pickX, { "a" = "option a", "b" = "option b", ...}) + pickX = 0,1,2, or "none", "one", "any" (PICK_X in code) + + selected = menu("prompt", default, pickX, + { {key:"a", text:"option a"}, {key:"b", text:"option b"}, ... } ) */ +static int +nhl_menu(L) +lua_State *L; +{ + int argc = lua_gettop(L); + const char *prompt; + const char *defval = ""; + const char *const pickX[] = {"none", "one", "any"}; /* PICK_NONE, PICK_ONE, PICK_ANY */ + int pick = PICK_ONE, pick_cnt; + winid tmpwin; + anything any; + menu_item *picks = (menu_item *) 0; + + if (argc < 2 || argc > 4) { + nhl_error(L, "Wrong args"); + return 0; + } + + prompt = luaL_checkstring(L, 1); + if (lua_isstring(L, 2)) + defval = luaL_checkstring(L, 2); + if (lua_isstring(L, 3)) + pick = luaL_checkoption(L, 3, "one", pickX); + luaL_checktype(L, argc, LUA_TTABLE); + + tmpwin = create_nhwindow(NHW_MENU); + start_menu(tmpwin); + + lua_pushnil(L); /* first key */ + while (lua_next(L, argc) != 0) { + const char *str = ""; + const char *key = ""; + + /* key @ index -2, value @ index -1 */ + if (lua_istable(L, -1)) { + lua_pushliteral(L, "key"); + lua_gettable(L, -2); + key = lua_tostring(L, -1); + lua_pop(L, 1); + + lua_pushliteral(L, "text"); + lua_gettable(L, -2); + str = lua_tostring(L, -1); + lua_pop(L, 1); + + /* TODO: glyph, attr, accel, group accel (all optional) */ + } else if (lua_isstring(L, -1)) { + str = luaL_checkstring(L, -1); + key = luaL_checkstring(L, -2); + } + + any = cg.zeroany; + if (*key) + any.a_char = key[0]; + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, str, + (*defval && *key && defval[0] == key[0]) ? MENU_SELECTED : MENU_UNSELECTED); + + lua_pop(L, 1); /* removes 'value'; keeps 'key' for next iteration */ + } + + end_menu(tmpwin, prompt); + pick_cnt = select_menu(tmpwin, pick, &picks); + destroy_nhwindow(tmpwin); + + if (pick_cnt > 0) { + char buf[2]; + buf[0] = picks[0].item.a_char; + + if (pick == PICK_ONE && pick_cnt > 1 && *defval && defval[0] == picks[0].item.a_char) + buf[0] = picks[1].item.a_char; + + buf[1] = '\0'; + lua_pushstring(L, buf); + /* TODO: pick any */ + } else { + char buf[2]; + buf[0] = defval[0]; + buf[1] = '\0'; + lua_pushstring(L, buf); + } + + return 1; +} + +/* makeplural("zorkmid") */ +static int +nhl_makeplural(L) +lua_State *L; +{ + int argc = lua_gettop(L); + + if (argc == 1) + lua_pushstring(L, makeplural(luaL_checkstring(L, 1))); + else + nhl_error(L, "Wrong args"); + + return 1; +} + +/* makesingular("zorkmids") */ +static int +nhl_makesingular(L) +lua_State *L; +{ + int argc = lua_gettop(L); + + if (argc == 1) + lua_pushstring(L, makesingular(luaL_checkstring(L, 1))); + else + nhl_error(L, "Wrong args"); + + return 1; +} + +/* s_suffix("foo") */ +static int +nhl_s_suffix(L) +lua_State *L; +{ + int argc = lua_gettop(L); + + if (argc == 1) + lua_pushstring(L, s_suffix(luaL_checkstring(L, 1))); + else + nhl_error(L, "Wrong args"); + + return 1; +} + +/* ing_suffix("foo") */ +static int +nhl_ing_suffix(L) +lua_State *L; +{ + int argc = lua_gettop(L); + + if (argc == 1) + lua_pushstring(L, ing_suffix(luaL_checkstring(L, 1))); + else + nhl_error(L, "Wrong args"); + + return 1; +} + +/* an("foo") */ +static int +nhl_an(L) +lua_State *L; +{ + int argc = lua_gettop(L); + + if (argc == 1) + lua_pushstring(L, an(luaL_checkstring(L, 1))); + else + nhl_error(L, "Wrong args"); + + return 1; +} + +/* get mandatory integer value from table */ +int +get_table_int(L, name) +lua_State *L; +const char *name; +{ + int ret; + + lua_getfield(L, -1, name); + ret = (int) luaL_checkinteger(L, -1); + lua_pop(L, 1); + return ret; +} + +/* get optional integer value from table */ +int +get_table_int_opt(L, name, defval) +lua_State *L; +const char *name; +int defval; +{ + int ret = defval; + + lua_getfield(L, -1, name); + if (!lua_isnil(L, -1)) { + ret = (int) luaL_checkinteger(L, -1); + } + lua_pop(L, 1); + return ret; +} + +char * +get_table_str(L, name) +lua_State *L; +const char *name; +{ + char *ret; + + lua_getfield(L, -1, name); + ret = dupstr(luaL_checkstring(L, -1)); + lua_pop(L, 1); + return ret; +} + +/* get optional string value from table. + return value must be freed by caller. */ +char * +get_table_str_opt(L, name, defval) +lua_State *L; +const char *name; +char *defval; +{ + const char *ret; + + lua_getfield(L, -1, name); + ret = luaL_optstring(L, -1, defval); + if (ret) { + lua_pop(L, 1); + return dupstr(ret); + } + lua_pop(L, 1); + return NULL; +} + +int +get_table_boolean(L, name) +lua_State *L; +const char *name; +{ + int ltyp; + int ret = -1; + + lua_getfield(L, -1, name); + ltyp = lua_type(L, -1); + if (ltyp == LUA_TSTRING) { + const char *const boolstr[] = { "true", "false", "yes", "no", NULL }; + /* const int boolstr2i[] = { TRUE, FALSE, TRUE, FALSE, -1 }; */ + + ret = luaL_checkoption(L, -1, NULL, boolstr); + /* nhUse(boolstr2i[0]); */ + } else if (ltyp == LUA_TBOOLEAN) { + ret = lua_toboolean(L, -1); + } else if (ltyp == LUA_TNUMBER) { + ret = (int) luaL_checkinteger(L, -1); + if ( ret < 0 || ret > 1) + ret = -1; + } + lua_pop(L, 1); + if (ret == -1) + nhl_error(L, "Expected a boolean"); + return ret; +} + +int +get_table_boolean_opt(L, name, defval) +lua_State *L; +const char *name; +int defval; +{ + int ret = defval; + + lua_getfield(L, -1, name); + if (lua_type(L, -1) != LUA_TNIL) { + lua_pop(L, 1); + return get_table_boolean(L, name); + } + lua_pop(L, 1); + return ret; +} + +int +get_table_option(L, name, defval, opts) +lua_State *L; +const char *name; +const char *defval; +const char *const opts[]; /* NULL-terminated list */ +{ + int ret; + + lua_getfield(L, -1, name); + ret = luaL_checkoption(L, -1, defval, opts); + lua_pop(L, 1); + return ret; +} + +/* + test( { x = 123, y = 456 } ); +*/ +static int +nhl_test(L) +lua_State *L; +{ + int x, y; + char *name, Player[] = "Player"; + + /* discard any extra arguments passed in */ + lua_settop(L, 1); + + luaL_checktype(L, 1, LUA_TTABLE); + + x = get_table_int(L, "x"); + y = get_table_int(L, "y"); + name = get_table_str_opt(L, "name", Player); + + pline("TEST:{ x=%i, y=%i, name=\"%s\" }", x,y, name); + + free(name); + + return 1; +} + +static const struct luaL_Reg nhl_functions[] = { + {"test", nhl_test}, + + {"getmap", nhl_getmap}, +#if 0 + {"setmap", nhl_setmap}, +#endif + {"gettrap", nhl_gettrap}, + {"deltrap", nhl_deltrap}, + + {"pline", nhl_pline}, + {"verbalize", nhl_verbalize}, + {"menu", nhl_menu}, + {"getlin", nhl_getlin}, + + {"makeplural", nhl_makeplural}, + {"makesingular", nhl_makesingular}, + {"s_suffix", nhl_s_suffix}, + {"ing_suffix", nhl_ing_suffix}, + {"an", nhl_an}, + {NULL, NULL} +}; + +static const struct { + const char *name; + long value; +} nhl_consts[] = { + { "COLNO", COLNO }, + { "ROWNO", ROWNO }, + { NULL, 0 }, +}; + +/* register and init the constants table */ +void +init_nhc_data(L) +lua_State *L; +{ + int i; + + lua_newtable(L); + + for (i = 0; nhl_consts[i].name; i++) { + lua_pushstring(L, nhl_consts[i].name); + lua_pushinteger(L, nhl_consts[i].value); + lua_rawset(L, -3); + } + + lua_setglobal(L, "nhc"); +} + +int +nhl_push_anything(L, anytype, src) +lua_State *L; +int anytype; +void *src; +{ + anything any = cg.zeroany; + switch (anytype) { + case ANY_INT: any.a_int = *(int *)src; lua_pushinteger(L, any.a_int); break; + case ANY_UCHAR: any.a_uchar = *(uchar *)src; lua_pushinteger(L, any.a_uchar); break; + case ANY_SCHAR: any.a_schar = *(schar *)src; lua_pushinteger(L, any.a_schar); break; + } + return 1; +} + +static int +nhl_meta_u_index(L) +lua_State *L; +{ + const char *tkey = luaL_checkstring(L, 2); + const struct { + const char *name; + void *ptr; + int type; + } ustruct[] = { + { "ux", &(u.ux), ANY_UCHAR }, + { "uy", &(u.uy), ANY_UCHAR }, + { "dx", &(u.dx), ANY_SCHAR }, + { "dy", &(u.dy), ANY_SCHAR }, + { "dz", &(u.dz), ANY_SCHAR }, + { "tx", &(u.tx), ANY_UCHAR }, + { "ty", &(u.ty), ANY_UCHAR }, + { "ulevel", &(u.ulevel), ANY_INT }, + { "ulevelmax", &(u.ulevelmax), ANY_INT }, + { "uhunger", &(u.uhunger), ANY_INT }, + { "nv_range", &(u.nv_range), ANY_INT }, + { "xray_range", &(u.xray_range), ANY_INT }, + { "umonster", &(u.umonster), ANY_INT }, + { "umonnum", &(u.umonnum), ANY_INT }, + { "mh", &(u.mh), ANY_INT }, + { "mhmax", &(u.mhmax), ANY_INT }, + { "mtimedone", &(u.mtimedone), ANY_INT }, + }; + int i; + + /* FIXME: doesn't really work, eg. negative values for u.dx */ + for (i = 0; i < SIZE(ustruct); i++) + if (!strcmp(tkey, ustruct[i].name)) { + return nhl_push_anything(L, ustruct[i].type, ustruct[i].ptr); + } + + nhl_error(L, "Unknown u table index"); + return 0; +} + +static int +nhl_meta_u_newindex(L) +lua_State *L; +{ + nhl_error(L, "Cannot set u table values"); + return 0; +} + +void +init_u_data(L) +lua_State *L; +{ + lua_newtable(L); + lua_newtable(L); + lua_pushcfunction(L, nhl_meta_u_index); + lua_setfield(L, -2, "__index"); + lua_pushcfunction(L, nhl_meta_u_newindex); + lua_setfield(L, -2, "__newindex"); + lua_setmetatable(L, -2); + lua_setglobal(L, "u"); +} + +int +nhl_set_package_path(L, path) +lua_State *L; +const char *path; +{ + lua_getglobal(L, "package"); + lua_pushstring(L, path); + lua_setfield(L, -2, "path"); + lua_pop(L, 1); + return 0; +} + +static int +traceback_handler(L) +lua_State *L; +{ + luaL_traceback(L, L, lua_tostring(L, 1), 0); + /* TODO: call impossible() if fuzzing? */ + return 1; +} + +boolean +nhl_loadlua(L, fname) +lua_State *L; +const char *fname; +{ + boolean ret = TRUE; + dlb *fh; + char *buf = (char *) 0; + long buflen; + int cnt, llret; + + fh = dlb_fopen(fname, "r"); + if (!fh) { + impossible("nhl_loadlua: Error loading %s", fname); + ret = FALSE; + goto give_up; + } + + dlb_fseek(fh, 0L, SEEK_END); + buflen = dlb_ftell(fh); + buf = (char *) alloc(buflen + 1); + dlb_fseek(fh, 0L, SEEK_SET); + + if ((cnt = dlb_fread(buf, 1, buflen, fh)) != buflen) { + impossible("nhl_loadlua: Error loading %s, got %i/%li bytes", + fname, cnt, buflen); + ret = FALSE; + goto give_up; + } + buf[buflen] = '\0'; + (void) dlb_fclose(fh); + + llret = luaL_loadstring(L, buf); + if (llret != LUA_OK) { + impossible("luaL_loadstring: Error loading %s (errcode %i)", + fname, llret); + ret = FALSE; + goto give_up; + } else { + lua_pushcfunction(L, traceback_handler); + lua_insert(L, 1); + if (lua_pcall(L, 0, LUA_MULTRET, -2)) { + impossible("Lua error: %s", lua_tostring(L, -1)); + ret = FALSE; + goto give_up; + } + } + + give_up: + if (buf) { + free(buf); + buf = (char *) 0; + buflen = 0; + } + return ret; +} + +lua_State * +nhl_init() +{ + lua_State *L = luaL_newstate(); + luaL_openlibs(L); + + nhl_set_package_path(L, "./?.lua"); + + /* register nh -table, and functions for it */ + lua_newtable(L); + luaL_setfuncs(L, nhl_functions, 0); + lua_setglobal(L, "nh"); + + /* init nhc -table */ + init_nhc_data(L); + + /* init u -table */ + init_u_data(L); + + l_selection_register(L); + l_register_des(L); + + l_obj_register(L); + + if (!nhl_loadlua(L, "nhlib.lua")) { + lua_close(L); + return (lua_State *) 0; + } + + return L; +} + +boolean +load_lua(name) +const char *name; +{ + boolean ret = TRUE; + lua_State *L = nhl_init(); + + if (!L) { + ret = FALSE; + goto give_up; + } + + if (!nhl_loadlua(L, name)) { + ret = FALSE; + goto give_up; + } + + give_up: + lua_close(L); + + return ret; +} + +const char * +get_lua_version() +{ + size_t len = (size_t) 0; + const char *vs = (const char *) 0; + lua_State *L; + + if (g.lua_ver[0] == 0) { + L = nhl_init(); + + if (L) { + lua_getglobal(L, "_VERSION"); + if (lua_isstring(L, -1)) + vs = lua_tolstring (L, -1, &len); + if (vs && len < sizeof g.lua_ver) { + if (!strncmpi(vs, "Lua", 3)) { + vs += 3; + if (*vs == '-' || *vs == ' ') + vs += 1; + } + Strcpy(g.lua_ver, vs); + } + } + lua_close(L); +#ifdef LUA_COPYRIGHT + if (sizeof LUA_COPYRIGHT <= sizeof g.lua_copyright) + Strcpy(g.lua_copyright, LUA_COPYRIGHT); +#endif + } + return (const char *) g.lua_ver; +} diff --git a/src/o_init.c b/src/o_init.c index 35b268c17..7f9931ae8 100644 --- a/src/o_init.c +++ b/src/o_init.c @@ -4,9 +4,6 @@ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" -#include "lev.h" /* save & restore info */ -#include "sfproto.h" - static void FDECL(setgemprobs, (d_level *)); static void FDECL(shuffle, (int, int, BOOLEAN_P)); @@ -291,7 +288,7 @@ void savenames(nhfp) NHFILE *nhfp; { - int i, j; + int i; unsigned int len; if (perform_bwrite(nhfp)) { @@ -301,14 +298,6 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t)objects, sizeof(struct objclass) * NUM_OBJECTS); } - if (nhfp->fieldlevel) { - for (i = 0; i < MAXOCLASSES; ++i) - sfo_int(nhfp, &g.bases[i], "names", "g.bases", 1); - for (i = 0; i < NUM_OBJECTS; ++i) - sfo_short(nhfp, &g.disco[i], "names", "g.disco", 1); - for (i = 0; i < NUM_OBJECTS; ++i) - sfo_objclass(nhfp, &objects[i], "names", "objclass", 1); - } } /* as long as we use only one version of Hack we need not save oc_name and oc_descr, but we must save @@ -321,11 +310,6 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t)&len, sizeof len); bwrite(nhfp->fd, (genericptr_t)objects[i].oc_uname, len); } - if (nhfp->fieldlevel) { - sfo_unsigned(nhfp, &len, "names", "len", 1); - for (j = 0; (unsigned) j < len; ++j) - sfo_char(nhfp, &objects[i].oc_uname[j], "names", "oc_uname", 1); - } } if (release_data(nhfp)) { free((genericptr_t) objects[i].oc_uname); @@ -338,8 +322,8 @@ void restnames(nhfp) NHFILE *nhfp; { - int i, j; - unsigned int len; + int i; + unsigned int len = 0; if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) g.bases, sizeof g.bases); @@ -347,31 +331,15 @@ NHFILE *nhfp; mread(nhfp->fd, (genericptr_t) objects, sizeof(struct objclass) * NUM_OBJECTS); } - if (nhfp->fieldlevel) { - for (i = 0; i < MAXOCLASSES; ++i) - sfi_int(nhfp, &g.bases[i], "names", "g.bases", 1); - for (i = 0; i < NUM_OBJECTS; ++i) - sfi_short(nhfp, &g.disco[i], "names", "g.disco", 1); - for (i = 0; i < NUM_OBJECTS; ++i) - sfi_objclass(nhfp, &objects[i], "names", "objclass", 1); - } for (i = 0; i < NUM_OBJECTS; i++) { if (objects[i].oc_uname) { if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) &len, sizeof len); } - if (nhfp->fieldlevel) { - sfi_unsigned(nhfp, &len, "names", "len", 1); - } objects[i].oc_uname = (char *) alloc(len); if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t)objects[i].oc_uname, len); } - if (nhfp->fieldlevel) { - for (j = 0; (unsigned) j < len; ++j) - sfi_char(nhfp, &objects[i].oc_uname[j], - "names", "oc_uname", 1); - } } } #ifdef USE_TILES diff --git a/src/objects.c b/src/objects.c index 984a67e3e..adb86dc80 100644 --- a/src/objects.c +++ b/src/objects.c @@ -876,7 +876,7 @@ SCROLL(None, "STRC PRST SKRZ KRK", 1, 0, 100), /* Czech and Slovak tongue-twister */ /* These must come last because they have special fixed descriptions. */ -#ifdef MAIL +#ifdef MAIL_STRUCTURES SCROLL("mail", "stamped", 0, 0, 0), #endif SCROLL("blank paper", "unlabeled", 0, 28, 60), diff --git a/src/objnam.c b/src/objnam.c index e91639d2a..50f64ebb7 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 objnam.c $NHDT-Date: 1562186589 2019/07/03 20:43:09 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.245 $ */ +/* NetHack 3.7 objnam.c $NHDT-Date: 1576638500 2019/12/18 03:08:20 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.257 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -429,7 +429,7 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */ buf = nextobuf() + PREFIX; /* leave room for "17 -3 " */ if (Role_if(PM_SAMURAI) && Japanese_item_name(typ)) actualn = Japanese_item_name(typ); - /* 3.6.2: this used to be part of 'dn's initialization, but it + /* As of 3.6.2: this used to be part of 'dn's initialization, but it needs to come after possibly overriding 'actualn' */ if (!dn) dn = actualn; @@ -1013,7 +1013,7 @@ unsigned doname_flags; || ((!known || !objects[obj->otyp].oc_charged || obj->oclass == ARMOR_CLASS || obj->oclass == RING_CLASS) -#ifdef MAIL +#ifdef MAIL_STRUCTURES && obj->otyp != SCR_MAIL #endif && obj->otyp != FAKE_AMULET_OF_YENDOR @@ -1041,7 +1041,7 @@ unsigned doname_flags; /* we count the number of separate stacks, which corresponds to the number of inventory slots needed to be able to take everything out if no merges occur */ - long itemcount = count_contents(obj, FALSE, FALSE, TRUE); + long itemcount = count_contents(obj, FALSE, FALSE, TRUE, FALSE); Sprintf(eos(bp), " containing %ld item%s", itemcount, plur(itemcount)); @@ -1053,7 +1053,7 @@ unsigned doname_flags; Strcat(bp, " (being worn)"); break; case ARMOR_CLASS: - if (obj->owornmask & W_ARMOR) + if (obj->owornmask & W_ARMOR) { Strcat(bp, (obj == uskin) ? " (embedded in your skin)" /* in case of perm_invent update while Wear/Takeoff is in progress; check doffing() before donning() @@ -1061,6 +1061,13 @@ unsigned doname_flags; : doffing(obj) ? " (being doffed)" : donning(obj) ? " (being donned)" : " (being worn)"); + /* slippery fingers is an intrinsic condition of the hero + rather than extrinsic condition of objects, but gloves + are described as slippery when hero has slippery fingers */ + if (obj == uarmg && Glib) /* just appended "(something)", + * change to "(something; slippery)" */ + Strcpy(rindex(bp, ')'), "; slippery)"); + } /*FALLTHRU*/ case WEAPON_CLASS: if (ispoisoned) @@ -1319,7 +1326,7 @@ struct obj *otmp; return FALSE; /* always fully ID'd */ /* check fundamental ID hallmarks first */ if (!otmp->known || !otmp->dknown -#ifdef MAIL +#ifdef MAIL_STRUCTURES || (!otmp->bknown && otmp->otyp != SCR_MAIL) #else || !otmp->bknown @@ -2192,7 +2199,11 @@ const char *const *alt_as_is; /* another set like as_is[] */ } } - /* avoid false hit on one_off[].plur == "lice" or .sing == "goose"; + /* Leave "craft" as a suffix as-is (aircraft, hovercraft); + "craft" itself is (arguably) not included in our likely context */ + if ((baselen > 5) && (!BSTRCMPI(basestr, endstring - 5, "craft"))) + return TRUE; + /* avoid false hit on one_off[].plur == "lice" or .sing == "goose"; if more of these turn up, one_off[] entries will need to flagged as to which are whole words and which are matchable as suffices then matching in the loop below will end up becoming more complex */ @@ -2299,7 +2310,7 @@ const char *oldstr; register char *spot; char lo_c, *str = nextobuf(); const char *excess = (char *) 0; - int len; + int len, i; if (oldstr) while (*oldstr == ' ') @@ -2309,6 +2320,26 @@ const char *oldstr; Strcpy(str, "s"); return str; } + /* makeplural() is sometimes used on monsters rather than objects + and sometimes pronouns are used for monsters, so check those; + unfortunately, "her" (which matches genders[1].him and [1].his) + and "it" (which matches genders[2].he and [2].him) are ambiguous; + we'll live with that; caller can fix things up if necessary */ + *str = '\0'; + for (i = 0; i <= 2; ++i) { + if (!strcmpi(genders[i].he, oldstr)) + Strcpy(str, genders[3].he); /* "they" */ + else if (!strcmpi(genders[i].him, oldstr)) + Strcpy(str, genders[3].him); /* "them" */ + else if (!strcmpi(genders[i].his, oldstr)) + Strcpy(str, genders[3].his); /* "their" */ + if (*str) { + if (oldstr[0] == highc(oldstr[0])) + str[0] = highc(str[0]); + return str; + } + } + Strcpy(str, oldstr); /* @@ -2420,9 +2451,25 @@ const char *oldstr; lo_c = lowc(*spot); + /* codex/spadix/neocortex and the like */ + if (len >= 5 + && (!strcmpi(spot - 2, "dex") + ||!strcmpi(spot - 2, "dix") + ||!strcmpi(spot - 2, "tex")) + /* indices would have been ok too, but stick with indexes */ + && (strcmpi(spot - 4,"index") != 0)) { + Strcasecpy(spot - 1, "ices"); /* ex|ix -> ices */ + goto bottom; + } /* Ends in z, x, s, ch, sh; add an "es" */ if (index("zxs", lo_c) - || (len >= 2 && lo_c == 'h' && index("cs", lowc(*(spot - 1)))) + || (len >= 2 && lo_c == 'h' && index("cs", lowc(*(spot - 1))) + /* 21st century k-sound */ + && !(len >= 4 && + ((lowc(*(spot - 2)) == 'e' + && index("mt", lowc(*(spot - 3)))) || + (lowc(*(spot - 2)) == 'o' + && index("lp", lowc(*(spot - 3))))))) /* Kludge to get "tomatoes" and "potatoes" right */ || (len >= 4 && !strcmpi(spot - 2, "ato")) || (len >= 5 && !strcmpi(spot - 4, "dingo"))) { @@ -2471,6 +2518,20 @@ const char *oldstr; str[0] = '\0'; return str; } + /* makeplural() of pronouns isn't reversible but at least we can + force a singular value */ + *str = '\0'; + if (!strcmpi(genders[3].he, oldstr)) /* "they" */ + Strcpy(str, genders[2].he); /* "it" */ + else if (!strcmpi(genders[3].him, oldstr)) /* "them" */ + Strcpy(str, genders[2].him); /* also "it" */ + else if (!strcmpi(genders[3].his, oldstr)) /* "their" */ + Strcpy(str, genders[2].his); /* "its" */ + if (*str) { + if (oldstr[0] == highc(oldstr[0])) + str[0] = highc(str[0]); + return str; + } bp = strcpy(str, oldstr); @@ -3612,14 +3673,17 @@ struct obj *no_wish; goto typfnd; } } -/* Let wizards wish for traps and furniture. - * Must come after objects check so wizards can still wish for - * trap objects like beartraps. - * Disallow such topology tweaks for WIZKIT startup wishes. - */ + + /* + * Let wizards wish for traps and furniture. + * Must come after objects check so wizards can still wish for + * trap objects like beartraps. + * Disallow such topology tweaks for WIZKIT startup wishes. + */ wiztrap: if (wizard && !g.program_state.wizkit_wishing) { struct rm *lev; + boolean madeterrain = FALSE; int trap, x = u.ux, y = u.uy; for (trap = NO_TRAP + 1; trap < TRAPNUM; trap++) { @@ -3642,7 +3706,8 @@ struct obj *no_wish; return (struct obj *) &cg.zeroobj; } - /* furniture and terrain */ + /* furniture and terrain (use at your own risk; can clobber stairs + or place furniture on existing traps which shouldn't be allowed) */ lev = &levl[x][y]; p = eos(bp); if (!BSTRCMPI(bp, p - 8, "fountain")) { @@ -3651,43 +3716,36 @@ struct obj *no_wish; if (!strncmpi(bp, "magic ", 6)) lev->blessedftn = 1; pline("A %sfountain.", lev->blessedftn ? "magic " : ""); - newsym(x, y); - return (struct obj *) &cg.zeroobj; - } - if (!BSTRCMPI(bp, p - 6, "throne")) { + madeterrain = TRUE; + } else if (!BSTRCMPI(bp, p - 6, "throne")) { lev->typ = THRONE; pline("A throne."); - newsym(x, y); - return (struct obj *) &cg.zeroobj; - } - if (!BSTRCMPI(bp, p - 4, "sink")) { + madeterrain = TRUE; + } else if (!BSTRCMPI(bp, p - 4, "sink")) { lev->typ = SINK; g.level.flags.nsinks++; pline("A sink."); - newsym(x, y); - return (struct obj *) &cg.zeroobj; - } + madeterrain = TRUE; + /* ("water" matches "potion of water" rather than terrain) */ - if (!BSTRCMPI(bp, p - 4, "pool") || !BSTRCMPI(bp, p - 4, "moat")) { + } else if (!BSTRCMPI(bp, p - 4, "pool") + || !BSTRCMPI(bp, p - 4, "moat")) { lev->typ = !BSTRCMPI(bp, p - 4, "pool") ? POOL : MOAT; del_engr_at(x, y); pline("A %s.", (lev->typ == POOL) ? "pool" : "moat"); /* Must manually make kelp! */ water_damage_chain(g.level.objects[x][y], TRUE); - newsym(x, y); - return (struct obj *) &cg.zeroobj; - } - if (!BSTRCMPI(bp, p - 4, "lava")) { /* also matches "molten lava" */ + madeterrain = TRUE; + + /* also matches "molten lava" */ + } else if (!BSTRCMPI(bp, p - 4, "lava")) { lev->typ = LAVAPOOL; del_engr_at(x, y); pline("A pool of molten lava."); if (!(Levitation || Flying)) - (void) lava_effects(); - newsym(x, y); - return (struct obj *) &cg.zeroobj; - } - - if (!BSTRCMPI(bp, p - 5, "altar")) { + pooleffects(FALSE); + madeterrain = TRUE; + } else if (!BSTRCMPI(bp, p - 5, "altar")) { aligntyp al; lev->typ = ALTAR; @@ -3700,37 +3758,43 @@ struct obj *no_wish; else if (!strncmpi(bp, "unaligned ", 10)) al = A_NONE; else /* -1 - A_CHAOTIC, 0 - A_NEUTRAL, 1 - A_LAWFUL */ - al = (!rn2(6)) ? A_NONE : rn2((int) A_LAWFUL + 2) - 1; + al = !rn2(6) ? A_NONE : (rn2((int) A_LAWFUL + 2) - 1); lev->altarmask = Align2amask(al); pline("%s altar.", An(align_str(al))); - newsym(x, y); - return (struct obj *) &cg.zeroobj; - } - - if (!BSTRCMPI(bp, p - 5, "grave") - || !BSTRCMPI(bp, p - 9, "headstone")) { + madeterrain = TRUE; + } else if (!BSTRCMPI(bp, p - 5, "grave") + || !BSTRCMPI(bp, p - 9, "headstone")) { make_grave(x, y, (char *) 0); pline("%s.", IS_GRAVE(lev->typ) ? "A grave" : "Can't place a grave here"); - newsym(x, y); - return (struct obj *) &cg.zeroobj; - } - - if (!BSTRCMPI(bp, p - 4, "tree")) { + madeterrain = TRUE; + } else if (!BSTRCMPI(bp, p - 4, "tree")) { lev->typ = TREE; pline("A tree."); - newsym(x, y); block_point(x, y); - return (struct obj *) &cg.zeroobj; - } - - if (!BSTRCMPI(bp, p - 4, "bars")) { + madeterrain = TRUE; + } else if (!BSTRCMPI(bp, p - 4, "bars")) { lev->typ = IRONBARS; pline("Iron bars."); - newsym(x, y); + madeterrain = TRUE; + } + + if (madeterrain) { + feel_newsym(x, y); /* map the spot where the wish occurred */ + /* hero started at but might not be there anymore (create + lava, decline to die, and get teleported away to safety) */ + if (u.uinwater && !is_pool(u.ux, u.uy)) { + u.uinwater = 0; /* leave the water */ + docrt(); + g.vision_full_recalc = 1; + } else if (u.utrap && u.utraptype == TT_LAVA + && !is_lava(u.ux, u.uy)) { + reset_utrap(FALSE); + } + /* cast 'const' away; caller won't modify this */ return (struct obj *) &cg.zeroobj; } - } + } /* end of wizard mode traps and terrain */ if (!oclass && !typ) { if (!strncmpi(bp, "polearm", 7)) { @@ -3852,7 +3916,7 @@ struct obj *no_wish; case STATUE: /* otmp->cobj already done in mksobj() */ break; -#ifdef MAIL +#ifdef MAIL_STRUCTURES case SCR_MAIL: /* 0: delivered in-game via external event (or randomly for fake mail); 1: from bones or wishing; 2: written with marker */ @@ -3900,7 +3964,7 @@ struct obj *no_wish; break; case FIGURINE: if (!(mons[mntmp].geno & G_UNIQ) && !is_human(&mons[mntmp]) -#ifdef MAIL +#ifdef MAIL_STRUCTURES && mntmp != PM_MAIL_DAEMON #endif ) @@ -4158,6 +4222,85 @@ struct obj *helmet; return (helmet && !is_metallic(helmet)) ? "hat" : "helm"; } +/* gloves vs gauntlets; depends upon discovery state */ +const char * +gloves_simple_name(gloves) +struct obj *gloves; +{ + static const char gauntlets[] = "gauntlets"; + + if (gloves && gloves->dknown) { + int otyp = gloves->otyp; + struct objclass *ocl = &objects[otyp]; + const char *actualn = OBJ_NAME(*ocl), + *descrpn = OBJ_DESCR(*ocl); + + if (strstri(objects[otyp].oc_name_known ? actualn : descrpn, + gauntlets)) + return gauntlets; + } + return "gloves"; +} + +/* boots vs shoes; depends upon discovery state */ +const char * +boots_simple_name(boots) +struct obj *boots; +{ + static const char shoes[] = "shoes"; + + if (boots && boots->dknown) { + int otyp = boots->otyp; + struct objclass *ocl = &objects[otyp]; + const char *actualn = OBJ_NAME(*ocl), + *descrpn = OBJ_DESCR(*ocl); + + if (strstri(descrpn, shoes) + || (objects[otyp].oc_name_known && strstri(actualn, shoes))) + return shoes; + } + return "boots"; +} + +/* simplified shield for messages */ +const char * +shield_simple_name(shield) +struct obj *shield; +{ + if (shield) { + /* xname() describes unknown (unseen) reflection as smooth */ + if (shield->otyp == SHIELD_OF_REFLECTION) + return shield->dknown ? "silver shield" : "smooth shield"; + /* + * We might distinguish between wooden vs metallic or + * light vs heavy to give small benefit to spell casters. + * Fighter types probably care more about the former for + * vulnerability to fire or rust. + * + * We could do that both ways: light wooden shield, light + * metallic shield (there aren't any), heavy wooden shield, + * and heavy metallic shield but that's getting away from + * "simple name" which is intended to be shorter as well + * as less detailed than xname(). + */ +#if 0 + /* spellcasting uses a division like this */ + return (weight(shield) > (int) objects[SMALL_SHIELD].oc_weight) + ? "heavy shield" + : "light shield"; +#endif + } + return "shield"; +} + +/* for completness */ +const char * +shirt_simple_name(shirt) +struct obj *shirt UNUSED; +{ + return "shirt"; +} + const char * mimic_obj_name(mtmp) struct monst *mtmp; diff --git a/src/options.c b/src/options.c index 2ba829eb1..357902582 100644 --- a/src/options.c +++ b/src/options.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 options.c $NHDT-Date: 1567240693 2019/08/31 08:38:13 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.369 $ */ +/* NetHack 3.7 options.c $NHDT-Date: 1575245078 2019/12/02 00:04:38 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.391 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2008. */ /* NetHack may be freely redistributed. See license for details. */ @@ -18,7 +18,6 @@ NEARDATA struct instance_flags iflags; /* provide linkage */ #include "tcap.h" #include #endif -#include "sfprocs.h" #define BACKWARD_COMPAT @@ -108,9 +107,9 @@ static const struct Bool_Opt { { "clicklook", &iflags.clicklook, FALSE, SET_IN_GAME }, { "cmdassist", &iflags.cmdassist, TRUE, SET_IN_GAME }, #if defined(MICRO) || defined(WIN32) || defined(CURSES_GRAPHICS) - { "color", &iflags.wc_color, TRUE, SET_IN_GAME }, /*WC*/ + { "color", &iflags.wc_color, TRUE, SET_IN_GAME }, /* on/off: use WC or not */ #else /* systems that support multiple terminals, many monochrome */ - { "color", &iflags.wc_color, FALSE, SET_IN_GAME }, /*WC*/ + { "color", &iflags.wc_color, FALSE, SET_IN_GAME }, #endif { "confirm", &flags.confirm, TRUE, SET_IN_GAME }, { "dark_room", &flags.dark_room, TRUE, SET_IN_GAME }, @@ -134,7 +133,7 @@ static const struct Bool_Opt { #endif { "force_invmenu", &iflags.force_invmenu, FALSE, SET_IN_GAME }, { "fullscreen", &iflags.wc2_fullscreen, FALSE, SET_IN_FILE }, /*WC2*/ - { "goldX", &iflags.goldX, FALSE, SET_IN_GAME }, + { "goldX", &flags.goldX, FALSE, SET_IN_GAME }, { "guicolor", &iflags.wc2_guicolor, TRUE, SET_IN_GAME}, /*WC2*/ { "help", &flags.help, TRUE, SET_IN_GAME }, { "herecmd_menu", &iflags.herecmd_menu, FALSE, SET_IN_GAME }, @@ -151,7 +150,7 @@ static const struct Bool_Opt { { "legacy", &flags.legacy, TRUE, DISP_IN_GAME }, { "lit_corridor", &flags.lit_corridor, FALSE, SET_IN_GAME }, { "lootabc", &flags.lootabc, FALSE, SET_IN_GAME }, -#ifdef MAIL +#ifdef MAIL_STRUCTURES { "mail", &flags.biff, TRUE, SET_IN_GAME }, #else { "mail", (boolean *) 0, TRUE, SET_IN_FILE }, @@ -179,7 +178,7 @@ static const struct Bool_Opt { #else { "page_wait", (boolean *) 0, FALSE, SET_IN_FILE }, #endif - /* 3.6.2: move perm_invent from flags to iflags and out of save file */ + /* moved perm_invent from flags to iflags and out of save file in 3.6.2 */ { "perm_invent", &iflags.perm_invent, FALSE, SET_IN_GAME }, { "pickup_thrown", &flags.pickup_thrown, TRUE, SET_IN_GAME }, { "popup_dialog", &iflags.wc_popup_dialog, FALSE, SET_IN_GAME }, /*WC*/ @@ -393,7 +392,7 @@ static struct Comp_Opt { }, { "statuslines", #ifdef CURSES_GRAPHICS - "2 or 3 lines for horizonal (bottom or top) status display", + "2 or 3 lines for horizontal (bottom or top) status display", 20, SET_IN_GAME #else "2 or 3 lines for status display", @@ -661,7 +660,7 @@ initoptions() /* ... and _must_ parse correctly. */ if (!read_config_file(SYSCF_FILE, SET_IN_SYS)) { - if (config_error_done()) + if (config_error_done() && !iflags.initoptions_noterminate) nh_terminate(EXIT_FAILURE); } config_error_done(); @@ -698,8 +697,6 @@ initoptions_init() if (boolopt[i].addr) *(boolopt[i].addr) = boolopt[i].initvalue; } - /* initialize the function pointers for fieldlevel saves */ - sf_init(); #ifdef SYSFLAGS Strcpy(sysflags.sysflagsid, "sysflags"); @@ -728,11 +725,12 @@ initoptions_init() flags.initrole = flags.initrace = flags.initgend = flags.initalign = ROLE_NONE; + init_ov_primary_symbols(); + init_ov_rogue_symbols(); /* Set the default monster and object class symbols. */ init_symbols(); for (i = 0; i < WARNCOUNT; i++) g.warnsyms[i] = def_warnsyms[i].sym; - iflags.bouldersym = 0; /* for "special achievement" tracking (see obj.h, create_object(sp_lev.c), addinv_core1(invent.c) */ @@ -750,7 +748,7 @@ initoptions_init() for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++) flags.end_disclose[i] = DISCLOSE_PROMPT_DEFAULT_NO; switch_symbols(FALSE); /* set default characters */ - init_r_symbols(); + init_rogue_symbols(); #if defined(UNIX) && defined(TTY_GRAPHICS) /* * Set defaults for some options depending on what we can @@ -761,9 +759,9 @@ initoptions_init() */ /* this detects the IBM-compatible console on most 386 boxes */ if ((opts = nh_getenv("TERM")) && !strncmp(opts, "AT", 2)) { - if (!g.symset[PRIMARY].name) + if (!g.symset[PRIMARY].explicitly) load_symset("IBMGraphics", PRIMARY); - if (!g.symset[ROGUESET].name) + if (!g.symset[ROGUESET].explicitly) load_symset("RogueIBM", ROGUESET); switch_symbols(TRUE); #ifdef TEXTCOLOR @@ -778,7 +776,7 @@ initoptions_init() /* [could also check "xterm" which emulates vtXXX by default] */ && !strncmpi(opts, "vt", 2) && AS && AE && index(AS, '\016') && index(AE, '\017')) { - if (!g.symset[PRIMARY].name) + if (!g.symset[PRIMARY].explicitly) load_symset("DECGraphics", PRIMARY); switch_symbols(TRUE); } @@ -787,15 +785,13 @@ initoptions_init() #if defined(MSDOS) || defined(WIN32) /* Use IBM defaults. Can be overridden via config file */ - if (!g.symset[PRIMARY].name) { + if (!g.symset[PRIMARY].explicitly) load_symset("IBMGraphics_2", PRIMARY); - } - if (!g.symset[ROGUESET].name) { + if (!g.symset[ROGUESET].explicitly) load_symset("RogueEpyx", ROGUESET); - } #endif #ifdef MAC_GRAPHICS_ENV - if (!symset[PRIMARY].name) + if (!g.symset[PRIMARY].explicitly) load_symset("MACGraphics", PRIMARY); switch_symbols(TRUE); #endif /* MAC_GRAPHICS_ENV */ @@ -803,8 +799,9 @@ initoptions_init() iflags.wc_align_message = ALIGN_TOP; iflags.wc_align_status = ALIGN_BOTTOM; - /* these are currently only used by curses */ + /* used by tty and curses */ iflags.wc2_statuslines = 2; + /* only used by curses */ iflags.wc2_windowborders = 2; /* 'Auto' */ /* since this is done before init_objects(), do partial init here */ @@ -815,6 +812,7 @@ initoptions_init() void initoptions_finish() { + nhsym sym = 0; #ifndef MAC char *opts = getenv("NETHACKOPTIONS"); @@ -858,8 +856,10 @@ initoptions_finish() */ obj_descr[SLIME_MOLD].oc_name = "fruit"; - if (iflags.bouldersym) - update_bouldersym(); + sym = get_othersym(SYM_BOULDER, + Is_rogue_level(&u.uz) ? ROGUESET : PRIMARY); + if (sym) + g.showsyms[SYM_BOULDER + SYM_OFF_X] = sym; reglyph_darkroom(); #ifdef STATUS_HILITES @@ -1287,12 +1287,13 @@ static const struct paranoia_opts { and "d"ie vs "d"eath, synonyms for each other so doesn't matter; (also "p"ray vs "P"aranoia, "pray" takes precedence since "Paranoia" is just a synonym for "Confirm"); "b"ones vs "br"eak-wand, the - latter requires at least two letters; "wand"-break vs "Were"-change, + latter requires at least two letters; "e"at vs "ex"plore, + "cont"inue eating vs "C"onfirm; "wand"-break vs "Were"-change, both require at least two letters during config processing and use case-senstivity for 'O's interactive menu */ { PARANOID_CONFIRM, "Confirm", 1, "Paranoia", 2, "for \"yes\" confirmations, require \"no\" to reject" }, - { PARANOID_QUIT, "quit", 1, "explore", 1, + { PARANOID_QUIT, "quit", 1, "explore", 2, "yes vs y to quit or to enter explore mode" }, { PARANOID_DIE, "die", 1, "death", 2, "yes vs y to die (explore mode or debug mode)" }, @@ -1302,6 +1303,8 @@ static const struct paranoia_opts { "yes vs y to attack a peaceful monster" }, { PARANOID_BREAKWAND, "wand-break", 2, "break-wand", 2, "yes vs y to break a wand via (a)pply" }, + { PARANOID_EATING, "eat", 1, "continue", 4, + "yes vs y to continue eating after first bite when satiated" }, { PARANOID_WERECHANGE, "Were-change", 2, (const char *) 0, 0, "yes vs y to change form when lycanthropy is controllable" }, { PARANOID_PRAY, "pray", 1, 0, 0, @@ -2589,7 +2592,7 @@ boolean tinitial, tfrom_file; } if (!op) return FALSE; - /* 3.6.2: strip leading and trailing spaces, condense internal ones */ + /* stripped leading and trailing spaces, condensed internal ones in 3.6.2 */ mungspaces(op); if (!g.opt_initial) { struct fruit *f; @@ -2730,12 +2733,16 @@ boolean tinitial, tfrom_file; /* * Override the default boulder symbol. */ - iflags.bouldersym = (uchar) opts[0]; - /* for 'initial', update_bouldersym() is done in + g.ov_primary_syms[SYM_BOULDER + SYM_OFF_X] = (nhsym) opts[0]; + g.ov_rogue_syms[SYM_BOULDER + SYM_OFF_X] = (nhsym) opts[0]; + /* for 'initial', update of BOULDER symbol is done in initoptions_finish(), after all symset options have been processed */ if (!g.opt_initial) { - update_bouldersym(); + nhsym sym = get_othersym(SYM_BOULDER, + Is_rogue_level(&u.uz) ? ROGUESET : PRIMARY); + if (sym) + g.showsyms[SYM_BOULDER + SYM_OFF_X] = sym; g.opt_need_redraw = TRUE; } } @@ -3238,8 +3245,12 @@ boolean tinitial, tfrom_file; config_error_add("Unknown %s parameter '%s'", fullname, op); return FALSE; } - while (letter(*++op) || *op == ' ') - continue; + /* "3a" is sufficient but accept "3around" (or "3abracadabra") */ + while (letter(*op)) + op++; + /* t, a, and o can be separated by space(s) or slash or both */ + while (*op == ' ') + op++; if (*op == '/') op++; } @@ -3343,7 +3354,8 @@ boolean tinitial, tfrom_file; /* WINCAP * * map_mode:[tiles|ascii4x6|ascii6x8|ascii8x8|ascii16x8|ascii7x12 - * |ascii8x12|ascii16x12|ascii12x16|ascii10x18|fit_to_screen] + * |ascii8x12|ascii16x12|ascii12x16|ascii10x18|fit_to_screen + * |ascii_fit_to_screen|tiles_fit_to_screen] */ fullname = "map_mode"; if (match_optname(opts, fullname, sizeof "map_mode" - 1, TRUE)) { @@ -3351,7 +3363,7 @@ boolean tinitial, tfrom_file; complain_about_duplicate(opts, 1); op = string_for_opt(opts, negated); if (op && !negated) { - if (!strncmpi(op, "tiles", sizeof "tiles" - 1)) + if (!strcmpi(op, "tiles")) iflags.wc_map_mode = MAP_MODE_TILES; else if (!strncmpi(op, "ascii4x6", sizeof "ascii4x6" - 1)) iflags.wc_map_mode = MAP_MODE_ASCII4x6; @@ -3374,6 +3386,12 @@ boolean tinitial, tfrom_file; else if (!strncmpi(op, "fit_to_screen", sizeof "fit_to_screen" - 1)) iflags.wc_map_mode = MAP_MODE_ASCII_FIT_TO_SCREEN; + else if (!strncmpi(op, "ascii_fit_to_screen", + sizeof "ascii_fit_to_screen" - 1)) + iflags.wc_map_mode = MAP_MODE_ASCII_FIT_TO_SCREEN; + else if (!strncmpi(op, "tiles_fit_to_screen", + sizeof "tiles_fit_to_screen" - 1)) + iflags.wc_map_mode = MAP_MODE_TILES_FIT_TO_SCREEN; else { config_error_add("Unknown %s parameter '%s'", fullname, op); return FALSE; @@ -3819,10 +3837,13 @@ boolean tinitial, tfrom_file; } fullname = "DECgraphics"; - if (match_optname(opts, fullname, 3, TRUE)) { + if (match_optname(opts, fullname, 3, FALSE) + || match_optname(opts, "cursesgraphics", 4, FALSE)) { #ifdef BACKWARD_COMPAT boolean badflag = FALSE; + if (lowc(*opts) == 'c') + fullname = "curses"; /* symbol set name is shorter than optname */ if (duplicate) complain_about_duplicate(opts, 1); if (!negated) { @@ -4031,9 +4052,6 @@ boolean tinitial, tfrom_file; || boolopt[i].addr == &iflags.use_inverse || boolopt[i].addr == &iflags.hilite_pile || boolopt[i].addr == &iflags.perm_invent -#ifdef CURSES_GRAPHICS - || boolopt[i].addr == &iflags.cursesgraphics -#endif || boolopt[i].addr == &iflags.wc_ascii_map || boolopt[i].addr == &iflags.wc_tiled_map) { g.opt_need_redraw = TRUE; @@ -4074,7 +4092,7 @@ boolean tinitial, tfrom_file; } /* Is it a symbol? */ - if (strstr(opts, "S_") == opts && parsesymbols(opts)) { + if (strstr(opts, "S_") == opts && parsesymbols(opts, PRIMARY)) { switch_symbols(TRUE); check_gold_symbol(); return retval; @@ -5268,8 +5286,8 @@ boolean setinitial, setfromfile; MENU_UNSELECTED); for (i = 0; i < numapes && ape; i++) { any.a_void = (opt_idx == 1) ? 0 : ape; - /* length of pattern plus quotes (plus '<'/'>') is less than - BUFSZ */ + /* length of pattern plus quotes (plus '<'/'>') is + less than BUFSZ */ Sprintf(apebuf, "\"%c%s\"", ape->grab ? '<' : '>', ape->pattern); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, apebuf, @@ -5302,7 +5320,7 @@ boolean setinitial, setfromfile; nothing_to_do = FALSE; char *symset_name, fmtstr[20]; struct symsetentry *sl; - int res, which_set, setcount = 0, chosen = -2; + int res, which_set, setcount = 0, chosen = -2, defindx = 0; which_set = rogueflag ? ROGUESET : PRIMARY; g.symset_list = (struct symsetentry *) 0; @@ -5315,18 +5333,27 @@ boolean setinitial, setfromfile; g.symset[which_set].name = symset_name; if (res && g.symset_list) { - int thissize, biggest = 0; + int thissize, + biggest = (int) (sizeof "Default Symbols" - sizeof ""), + big_desc = 0; for (sl = g.symset_list; sl; sl = sl->next) { /* check restrictions */ if (rogueflag ? sl->primary : sl->rogue) continue; +#ifndef MAC_GRAPHICS_ENV + if (sl->handling == H_MAC) + continue; +#endif setcount++; /* find biggest name */ thissize = sl->name ? (int) strlen(sl->name) : 0; if (thissize > biggest) biggest = thissize; + thissize = sl->desc ? (int) strlen(sl->desc) : 0; + if (thissize > big_desc) + big_desc = thissize; } if (!setcount) { pline("There are no appropriate %s symbol sets available.", @@ -5334,32 +5361,54 @@ boolean setinitial, setfromfile; return TRUE; } - Sprintf(fmtstr, "%%-%ds %%s", biggest + 5); + Sprintf(fmtstr, "%%-%ds %%s", biggest + 2); tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin); any = cg.zeroany; - any.a_int = 1; + any.a_int = 1; /* -1 + 2 [see 'if (sl->name) {' below]*/ + if (!symset_name) + defindx = any.a_int; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - "Default Symbols", MENU_UNSELECTED); + "Default Symbols", + (any.a_int == defindx) ? MENU_SELECTED + : MENU_UNSELECTED); for (sl = g.symset_list; sl; sl = sl->next) { /* check restrictions */ if (rogueflag ? sl->primary : sl->rogue) continue; - +#ifndef MAC_GRAPHICS_ENV + if (sl->handling == H_MAC) + continue; +#endif if (sl->name) { + /* +2: sl->idx runs from 0 to N-1 for N symsets; + +1 because Defaults are implicitly in slot [0]; + +1 again so that valid data is never 0 */ any.a_int = sl->idx + 2; + if (symset_name && !strcmpi(sl->name, symset_name)) + defindx = any.a_int; Sprintf(buf, fmtstr, sl->name, sl->desc ? sl->desc : ""); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - buf, MENU_UNSELECTED); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + (any.a_int == defindx) ? MENU_SELECTED + : MENU_UNSELECTED); } } Sprintf(buf, "Select %ssymbol set:", rogueflag ? "rogue level " : ""); end_menu(tmpwin, buf); - if (select_menu(tmpwin, PICK_ONE, &symset_pick) > 0) { - chosen = symset_pick->item.a_int - 2; + n = select_menu(tmpwin, PICK_ONE, &symset_pick); + if (n > 0) { + chosen = symset_pick[0].item.a_int; + /* if picking non-preselected entry yields 2, make sure + that we're going with the non-preselected one */ + if (n == 2 && chosen == defindx) + chosen = symset_pick[1].item.a_int; + chosen -= 2; /* convert menu index to symset index; + * "Default symbols" have index -1 */ free((genericptr_t) symset_pick); + } else if (n == 0 && defindx > 0) { + chosen = defindx - 2; } destroy_nhwindow(tmpwin); @@ -5407,9 +5456,9 @@ boolean setinitial, setfromfile; /* Set default symbols and clear the handling value */ if (rogueflag) - init_r_symbols(); + init_rogue_symbols(); else - init_l_symbols(); + init_primary_symbols(); if (g.symset[which_set].name) { /* non-default symbols */ @@ -5476,8 +5525,8 @@ char *buf; #ifdef BACKWARD_COMPAT else if (!strcmp(optname, "boulder")) Sprintf(buf, "%c", - iflags.bouldersym - ? iflags.bouldersym + g.ov_primary_syms[SYM_BOULDER + SYM_OFF_X] + ? g.ov_primary_syms[SYM_BOULDER + SYM_OFF_X] : g.showsyms[(int) objects[BOULDER].oc_class + SYM_OFF_O]); #endif else if (!strcmp(optname, "catname")) @@ -5958,8 +6007,9 @@ free_symsets() /* Parse the value of a SYMBOLS line from a config file */ boolean -parsesymbols(opts) +parsesymbols(opts, which_set) register char *opts; +int which_set; { int val; char *op, *symname, *strval; @@ -5967,7 +6017,7 @@ register char *opts; if ((op = index(opts, ',')) != 0) { *op++ = 0; - if (!parsesymbols(op)) + if (!parsesymbols(op, which_set)) return FALSE; } @@ -5990,7 +6040,10 @@ register char *opts; if (symp->range && symp->range != SYM_CONTROL) { val = sym_val(strval); - update_l_symset(symp, val); + if (which_set == ROGUESET) + update_ov_rogue_symset(symp, val); + else + update_ov_primary_symset(symp, val); } return TRUE; } diff --git a/src/pager.c b/src/pager.c index 5823e4287..140769c64 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pager.c $NHDT-Date: 1562632673 2019/07/09 00:37:53 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.154 $ */ +/* NetHack 3.6 pager.c $NHDT-Date: 1575830188 2019/12/08 18:36:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.175 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -190,12 +190,19 @@ struct obj **obj_p; otmp->quan = 2L; /* to force pluralization */ else if (otmp->otyp == SLIME_MOLD) otmp->spe = g.context.current_fruit; /* give it a type */ - if (mtmp && has_mcorpsenm(mtmp)) /* mimic as corpse/statue */ - otmp->corpsenm = MCORPSENM(mtmp); - else if (otmp->otyp == CORPSE && glyph_is_body(glyph)) + if (mtmp && has_mcorpsenm(mtmp)) { /* mimic as corpse/statue */ + if (otmp->otyp == SLIME_MOLD) + /* override g.context.current_fruit to avoid + look, use 'O' to make new named fruit, look again + giving different results when current_fruit changes */ + otmp->spe = MCORPSENM(mtmp); + else + otmp->corpsenm = MCORPSENM(mtmp); + } else if (otmp->otyp == CORPSE && glyph_is_body(glyph)) { otmp->corpsenm = glyph - GLYPH_BODY_OFF; - else if (otmp->otyp == STATUE && glyph_is_statue(glyph)) + } else if (otmp->otyp == STATUE && glyph_is_statue(glyph)) { otmp->corpsenm = glyph - GLYPH_STATUE_OFF; + } if (otmp->otyp == LEASH) otmp->leashmon = 0; /* extra fields needed for shop price with doname() formatting */ @@ -469,17 +476,21 @@ char *buf, *monbuf; Strcpy(buf, def_warnsyms[warnindx].explanation); } else if (!glyph_is_cmap(glyph)) { Strcpy(buf, "unexplored area"); - } else + } else { + int amsk; + aligntyp algn; + switch (glyph_to_cmap(glyph)) { case S_altar: + amsk = altarmask_at(x, y); + algn = Amask2align(amsk & AM_MASK); Sprintf(buf, "%s %saltar", /* like endgame high priests, endgame high altars are only recognizable when immediately adjacent */ (Is_astralevel(&u.uz) && distu(x, y) > 2) ? "aligned" - : align_str( - Amask2align(levl[x][y].altarmask & ~AM_SHRINE)), - ((levl[x][y].altarmask & AM_SHRINE) + : align_str(algn), + ((amsk & AM_SHRINE) != 0 && (Is_astralevel(&u.uz) || Is_sanctum(&u.uz))) ? "high " : ""); @@ -514,7 +525,7 @@ char *buf, *monbuf; Strcpy(buf, defsyms[glyph_to_cmap(glyph)].explanation); break; } - + } return (pm && !Hallucination) ? pm : (struct permonst *) 0; } @@ -805,11 +816,12 @@ struct permonst **for_supplement; unreconnoitered[] = "unreconnoitered"; static char look_buf[BUFSZ]; char prefix[BUFSZ]; - int i, alt_i, glyph = NO_GLYPH, + int i, alt_i, j, glyph = NO_GLYPH, skipped_venom = 0, found = 0; /* count of matching syms found */ boolean hit_trap, need_to_look = FALSE, submerged = (Underwater && !Is_waterlevel(&u.uz)); const char *x_str; + nhsym tmpsym; if (looked) { int oc; @@ -817,7 +829,7 @@ struct permonst **for_supplement; glyph = glyph_at(cc.x, cc.y); /* Convert glyph at selected position to a symbol for use below. */ - (void) mapglyph(glyph, &sym, &oc, &os, cc.x, cc.y); + (void) mapglyph(glyph, &sym, &oc, &os, cc.x, cc.y, 0); Sprintf(prefix, "%s ", encglyph(glyph)); } else @@ -873,7 +885,7 @@ struct permonst **for_supplement; if (x_str == unreconnoitered) goto didlook; } - + check_monsters: /* Check for monsters */ if (!iflags.terrainmode || (iflags.terrainmode & TER_MON) != 0) { for (i = 1; i < MAXMCLASSES; i++) { @@ -1026,8 +1038,44 @@ struct permonst **for_supplement; } } + /* Finally, handle some optional overriding symbols */ + for (j = SYM_OFF_X; j < SYM_MAX; ++j) { + if (j == (SYM_INVISIBLE + SYM_OFF_X)) + continue; /* already handled above */ + tmpsym = Is_rogue_level(&u.uz) ? g.ov_rogue_syms[j] + : g.ov_primary_syms[j]; + if (tmpsym && sym == tmpsym) { + switch (j) { + case SYM_BOULDER + SYM_OFF_X: + if (!found) { + *firstmatch = "boulder"; + Sprintf(out_str, "%s%s", prefix, an(*firstmatch)); + found++; + } else { + found += append_str(out_str, "boulder"); + } + break; + case SYM_PET_OVERRIDE + SYM_OFF_X: + if (looked) { + int oc = 0; + unsigned os = 0; + + /* convert to symbol without override in effect */ + (void) mapglyph(glyph, &sym, &oc, &os, + cc.x, cc.y, MG_FLAG_NOOVERRIDE); + goto check_monsters; + } + break; + case SYM_HERO_OVERRIDE + SYM_OFF_X: + sym = g.showsyms[S_HUMAN + SYM_OFF_M]; + goto check_monsters; + } + } + } +#if 0 /* handle optional boulder symbol as a special case */ - if (iflags.bouldersym && sym == iflags.bouldersym) { + if (o_syms[SYM_BOULDER + SYM_OFF_X] + && sym == o_syms[SYM_BOULDER + SYM_OFF_X]) { if (!found) { *firstmatch = "boulder"; Sprintf(out_str, "%s%s", prefix, an(*firstmatch)); @@ -1036,6 +1084,7 @@ struct permonst **for_supplement; found += append_str(out_str, "boulder"); } } +#endif /* * If we are looking at the screen, follow multiple possibilities or @@ -1573,7 +1622,7 @@ whatdoes_help() { dlb *fp; char *p, buf[BUFSZ]; - winid tmpwin = create_nhwindow(NHW_TEXT); + winid tmpwin; fp = dlb_fopen(KEYHELP, "r"); if (!fp) { @@ -1581,6 +1630,7 @@ whatdoes_help() display_nhwindow(WIN_MESSAGE, TRUE); return; } + tmpwin = create_nhwindow(NHW_TEXT); while (dlb_fgets(buf, (int) sizeof buf, fp)) { if (*buf == '#') continue; diff --git a/src/pickup.c b/src/pickup.c index 999f34bb1..6d932912d 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pickup.c $NHDT-Date: 1562203851 2019/07/04 01:30:51 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.229 $ */ +/* NetHack 3.6 pickup.c $NHDT-Date: 1576282488 2019/12/14 00:14:48 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.237 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -392,7 +392,7 @@ struct obj *obj; : g.shop_filter /* coins are never unpaid, but check anyway */ ? (obj->unpaid ? TRUE : FALSE) : g.bucx_filter - ? (index(g.valid_menu_classes, iflags.goldX ? 'X' : 'U') + ? (index(g.valid_menu_classes, flags.goldX ? 'X' : 'U') ? TRUE : FALSE) : TRUE; /* catchall: no filters specified, so accept */ @@ -509,7 +509,7 @@ int what; /* should be a long */ if (!can_reach_floor(TRUE)) { if ((g.multi && !g.context.run) || (autopickup && !flags.pickup) || ((ttmp = t_at(u.ux, u.uy)) != 0 - && uteetering_at_seen_pit(ttmp))) + && (uteetering_at_seen_pit(ttmp) || uescaped_shaft(ttmp)))) read_engr_at(u.ux, u.uy); return 0; } @@ -1051,11 +1051,13 @@ int how; /* type of query */ if (curr) { *pick_list = (menu_item *) alloc(sizeof(menu_item)); (*pick_list)->item.a_int = curr->oclass; - return 1; + n = 1; } else { debugpline0("query_category: no single object match"); + n = 0; } - return 0; + /* early return is ok; there's no temp window yet */ + return n; } win = create_nhwindow(NHW_MENU); @@ -1108,7 +1110,8 @@ int how; /* type of query */ pack++; if (invlet >= 'u') { impossible("query_category: too many categories"); - return 0; + n = 0; + goto query_done; } } while (*pack); @@ -1168,6 +1171,7 @@ int how; /* type of query */ } end_menu(win, qstr); n = select_menu(win, how, pick_list); + query_done: destroy_nhwindow(win); if (n < 0) n = 0; /* caller's don't expect -1 */ @@ -1190,7 +1194,8 @@ int qflags; for (curr = olist; curr; curr = FOLLOW(curr, qflags)) { if (curr->oclass == *pack) { if ((qflags & WORN_TYPES) - && !(curr->owornmask & (W_ARMOR | W_ACCESSORY | W_WEAPON))) + && !(curr->owornmask & (W_ARMOR | W_ACCESSORY + | W_WEAPONS))) continue; if (!counted_category) { ccount++; @@ -1407,7 +1412,14 @@ boolean telekinesis; /* [exception for gold coins will have to change if silver/copper ones ever get implemented] */ && inv_cnt(FALSE) >= 52 && !merge_choice(g.invent, obj)) { - Your("knapsack cannot accommodate any more items."); + /* if there is some gold here (and we haven't already skipped it), + we aren't limited by the 52 item limit for it, but caller and + "grandcaller" aren't prepared to skip stuff and then pickup + just gold, so the best we can do here is vary the message */ + Your("knapsack cannot accommodate any more items%s.", + /* floor follows by nexthere, otherwise container so by nobj */ + nxtobj(obj, GOLD_PIECE, (boolean) (obj->where == OBJ_FLOOR)) + ? " (except gold)" : ""); result = -1; /* nothing lifted */ } else { result = 1; diff --git a/src/pline.c b/src/pline.c index 6f3bfa537..a12aae3c5 100644 --- a/src/pline.c +++ b/src/pline.c @@ -357,7 +357,7 @@ VA_DECL(const char *, line) else if (Unaware) YouPrefix(tmp, "You dream that you hear ", line); else - YouPrefix(tmp, "You hear ", line); + YouPrefix(tmp, "You hear ", line); /* Deaf-aware */ vpline(strcat(tmp, line), VA_ARGS); VA_END(); } diff --git a/src/polyself.c b/src/polyself.c index 8517307d8..6c0f5c732 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 polyself.c $NHDT-Date: 1559664952 2019/06/04 16:15:52 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.133 $ */ +/* NetHack 3.6 polyself.c $NHDT-Date: 1573290419 2019/11/09 09:06:59 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.135 $ */ /* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */ /* NetHack may be freely redistributed. See license for details. */ @@ -23,6 +23,7 @@ static void FDECL(check_strangling, (BOOLEAN_P)); static void FDECL(polyman, (const char *, const char *)); +static void FDECL(dropp, (struct obj *)); static void NDECL(break_armor); static void FDECL(drop_weapon, (int)); static int FDECL(armor_to_dragon, (int)); @@ -708,7 +709,7 @@ int mntmp; } check_strangling(FALSE); /* maybe stop strangling */ if (nohands(g.youmonst.data)) - Glib = 0; + make_glib(0); /* mlvl = adj_lev(&mons[mntmp]); @@ -876,6 +877,33 @@ int mntmp; return 1; } +/* dropx() jacket for break_armor() */ +static void +dropp(obj) +struct obj *obj; +{ + struct obj *otmp; + + /* + * Dropping worn armor while polymorphing might put hero into water + * (loss of levitation boots or water walking boots that the new + * form can't wear), where emergency_disrobe() could remove it from + * inventory. Without this, dropx() could trigger an 'object lost' + * panic. Right now, boots are the only armor which might encounter + * this situation, but handle it for all armor. + * + * Hypothetically, 'obj' could have merged with something (not + * applicable for armor) and no longer be a valid pointer, so scan + * inventory for it instead of trusting obj->where. + */ + for (otmp = g.invent; otmp; otmp = otmp->nobj) { + if (otmp == obj) { + dropx(obj); + break; + } + } +} + static void break_armor() { @@ -894,7 +922,7 @@ break_armor() if (otmp->oartifact) { Your("%s falls off!", cloak_simple_name(otmp)); (void) Cloak_off(); - dropx(otmp); + dropp(otmp); } else { Your("%s tears apart!", cloak_simple_name(otmp)); (void) Cloak_off(); @@ -911,7 +939,7 @@ break_armor() cancel_don(); Your("armor falls around you!"); (void) Armor_gone(); - dropx(otmp); + dropp(otmp); } if ((otmp = uarmc) != 0) { if (is_whirly(g.youmonst.data)) @@ -919,7 +947,7 @@ break_armor() else You("shrink out of your %s!", cloak_simple_name(otmp)); (void) Cloak_off(); - dropx(otmp); + dropp(otmp); } if ((otmp = uarmu) != 0) { if (is_whirly(g.youmonst.data)) @@ -927,7 +955,7 @@ break_armor() else You("become much too small for your shirt!"); setworn((struct obj *) 0, otmp->owornmask & W_ARMU); - dropx(otmp); + dropp(otmp); } } if (has_horns(g.youmonst.data)) { @@ -945,7 +973,7 @@ break_armor() Your("%s falls to the %s!", helm_simple_name(otmp), surface(u.ux, u.uy)); (void) Helmet_off(); - dropx(otmp); + dropp(otmp); } } } @@ -957,12 +985,13 @@ break_armor() You("drop your gloves%s!", uwep ? " and weapon" : ""); drop_weapon(0); (void) Gloves_off(); - dropx(otmp); + /* Glib manipulation (ends immediately) handled by Gloves_off */ + dropp(otmp); } if ((otmp = uarms) != 0) { You("can no longer hold your shield!"); (void) Shield_off(); - dropx(otmp); + dropp(otmp); } if ((otmp = uarmh) != 0) { if (donning(otmp)) @@ -970,7 +999,7 @@ break_armor() Your("%s falls to the %s!", helm_simple_name(otmp), surface(u.ux, u.uy)); (void) Helmet_off(); - dropx(otmp); + dropp(otmp); } } if (nohands(g.youmonst.data) || verysmall(g.youmonst.data) @@ -984,7 +1013,7 @@ break_armor() Your("boots %s off your feet!", verysmall(g.youmonst.data) ? "slide" : "are pushed"); (void) Boots_off(); - dropx(otmp); + dropp(otmp); } } } @@ -1037,6 +1066,10 @@ int alone; updateinv = FALSE; else if (candropwep) dropx(otmp); + /* [note: dropp vs dropx -- if heart of ahriman is wielded, we + might be losing levitation by dropping it; but that won't + happen until the drop, unlike Boots_off() dumping hero into + water and triggering emergency_disrobe() before dropx()] */ if (updateinv) update_inventory(); diff --git a/src/potion.c b/src/potion.c index c2a6c88df..d4058d583 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 potion.c $NHDT-Date: 1560850774 2019/06/18 09:39:34 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.162 $ */ +/* NetHack 3.6 potion.c $NHDT-Date: 1573848199 2019/11/15 20:03:19 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.167 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -437,6 +437,17 @@ boolean talk; } } +/* set or clear "slippery fingers" */ +void +make_glib(xtime) +int xtime; +{ + set_itimeout(&Glib, xtime); + /* may change "(being worn)" to "(being worn; slippery)" or vice versa */ + if (uarmg) + update_inventory(); +} + void self_invis_message() { @@ -1265,6 +1276,15 @@ const char *objphrase; /* "Your widget glows" or "Steed's saddle glows" */ pline("%s %s.", objphrase, glowcolor); iflags.last_msg = PLNMSG_OBJ_GLOWS; targobj->bknown = !Hallucination; + } else { + /* didn't see what happened: forget the BUC state if that was + known unless the bless/curse state of the water is known; + without this, hero would know the new state even without + seeing the glow; priest[ess] will immediately relearn it */ + if (!potion->bknown || !potion->dknown) + targobj->bknown = 0; + /* [should the bknown+dknown exception require that water + be discovered or at least named?] */ } /* potions of water are the only shop goods whose price depends on their curse/bless state */ @@ -1766,41 +1786,33 @@ static short mixtype(o1, o2) register struct obj *o1, *o2; { + int o1typ = o1->otyp, o2typ = o2->otyp; + /* cut down on the number of cases below */ if (o1->oclass == POTION_CLASS - && (o2->otyp == POT_GAIN_LEVEL || o2->otyp == POT_GAIN_ENERGY - || o2->otyp == POT_HEALING || o2->otyp == POT_EXTRA_HEALING - || o2->otyp == POT_FULL_HEALING || o2->otyp == POT_ENLIGHTENMENT - || o2->otyp == POT_FRUIT_JUICE)) { - struct obj *swp; - - swp = o1; - o1 = o2; - o2 = swp; + && (o2typ == POT_GAIN_LEVEL || o2typ == POT_GAIN_ENERGY + || o2typ == POT_HEALING || o2typ == POT_EXTRA_HEALING + || o2typ == POT_FULL_HEALING || o2typ == POT_ENLIGHTENMENT + || o2typ == POT_FRUIT_JUICE)) { + /* swap o1 and o2 */ + o1typ = o2->otyp; + o2typ = o1->otyp; } - switch (o1->otyp) { + switch (o1typ) { case POT_HEALING: - switch (o2->otyp) { - case POT_SPEED: - case POT_GAIN_LEVEL: - case POT_GAIN_ENERGY: + if (o2typ == POT_SPEED) return POT_EXTRA_HEALING; - } + /*FALLTHRU*/ case POT_EXTRA_HEALING: - switch (o2->otyp) { - case POT_GAIN_LEVEL: - case POT_GAIN_ENERGY: - return POT_FULL_HEALING; - } case POT_FULL_HEALING: - switch (o2->otyp) { - case POT_GAIN_LEVEL: - case POT_GAIN_ENERGY: - return POT_GAIN_ABILITY; - } + if (o2typ == POT_GAIN_LEVEL || o2typ == POT_GAIN_ENERGY) + return (o1typ == POT_HEALING) ? POT_EXTRA_HEALING + : (o1typ == POT_EXTRA_HEALING) ? POT_FULL_HEALING + : POT_GAIN_ABILITY; + /*FALLTHRU*/ case UNICORN_HORN: - switch (o2->otyp) { + switch (o2typ) { case POT_SICKNESS: return POT_FRUIT_JUICE; case POT_HALLUCINATION: @@ -1810,12 +1822,12 @@ register struct obj *o1, *o2; } break; case AMETHYST: /* "a-methyst" == "not intoxicated" */ - if (o2->otyp == POT_BOOZE) + if (o2typ == POT_BOOZE) return POT_FRUIT_JUICE; break; case POT_GAIN_LEVEL: case POT_GAIN_ENERGY: - switch (o2->otyp) { + switch (o2typ) { case POT_CONFUSION: return (rn2(3) ? POT_BOOZE : POT_ENLIGHTENMENT); case POT_HEALING: @@ -1831,7 +1843,7 @@ register struct obj *o1, *o2; } break; case POT_FRUIT_JUICE: - switch (o2->otyp) { + switch (o2typ) { case POT_SICKNESS: return POT_SICKNESS; case POT_ENLIGHTENMENT: @@ -1843,7 +1855,7 @@ register struct obj *o1, *o2; } break; case POT_ENLIGHTENMENT: - switch (o2->otyp) { + switch (o2typ) { case POT_LEVITATION: if (rn2(3)) return POT_GAIN_LEVEL; @@ -2015,7 +2027,7 @@ dodip() around for potionbreathe() [and we can't set obj->in_use to 'amt' because that's not implemented] */ obj->in_use = 1; - pline("BOOM! They explode!"); + pline("%sThey explode!", !Deaf ? "BOOM! " : ""); wake_nearto(u.ux, u.uy, (BOLT_LIM + 1) * (BOLT_LIM + 1)); exercise(A_STR, FALSE); if (!breathless(g.youmonst.data) || haseyes(g.youmonst.data)) @@ -2033,6 +2045,8 @@ dodip() if (mixture != STRANGE_OBJECT) { obj->otyp = mixture; } else { + struct obj *otmp; + switch (obj->odiluted ? 1 : rnd(8)) { case 1: obj->otyp = POT_WATER; @@ -2041,17 +2055,15 @@ dodip() case 3: obj->otyp = POT_SICKNESS; break; - case 4: { - struct obj *otmp = mkobj(POTION_CLASS, FALSE); - + case 4: + otmp = mkobj(POTION_CLASS, FALSE); obj->otyp = otmp->otyp; obfree(otmp, (struct obj *) 0); break; - } default: useupall(obj); - if (!Blind) - pline_The("mixture glows brightly and evaporates."); + pline_The("mixture %sevaporates.", + !Blind ? "glows brightly and " : ""); return 1; } } @@ -2077,11 +2089,16 @@ dodip() } if (potion->otyp == POT_ACID && obj->otyp == CORPSE - && obj->corpsenm == PM_LICHEN && !Blind) { + && obj->corpsenm == PM_LICHEN) { pline("%s %s %s around the edges.", The(cxname(obj)), - otense(obj, "turn"), - potion->odiluted ? hcolor(NH_ORANGE) : hcolor(NH_RED)); + otense(obj, "turn"), Blind ? "wrinkled" + : potion->odiluted ? hcolor(NH_ORANGE) + : hcolor(NH_RED)); potion->in_use = FALSE; /* didn't go poof */ + if (potion->dknown + && !objects[potion->otyp].oc_name_known + && !objects[potion->otyp].oc_uname) + docall(potion); return 1; } @@ -2123,8 +2140,8 @@ dodip() fire_damage(obj, TRUE, u.ux, u.uy); } else if (potion->cursed) { pline_The("potion spills and covers your %s with oil.", - makeplural(body_part(FINGER))); - incr_itimeout(&Glib, d(2, 10)); + fingers_or_gloves(TRUE)); + make_glib((int) (Glib & TIMEOUT) + d(2, 10)); } else if (obj->oclass != WEAPON_CLASS && !is_weptool(obj)) { /* the following cases apply only to weapons */ goto more_dips; @@ -2135,10 +2152,14 @@ dodip() } else if ((!is_rustprone(obj) && !is_corrodeable(obj)) || is_ammo(obj) || (!obj->oeroded && !obj->oeroded2)) { /* uses up potion, doesn't set obj->greased */ - pline("%s %s with an oily sheen.", Yname2(obj), - otense(obj, "gleam")); + if (!Blind) + pline("%s %s with an oily sheen.", Yname2(obj), + otense(obj, "gleam")); + else /*if (!uarmg)*/ + pline("%s %s oily.", Yname2(obj), otense(obj, "feel")); } else { - pline("%s %s less %s.", Yname2(obj), otense(obj, "are"), + pline("%s %s less %s.", Yname2(obj), + otense(obj, !Blind ? "are" : "feel"), (obj->oeroded && obj->oeroded2) ? "corroded and rusty" : obj->oeroded ? "rusty" : "corroded"); @@ -2149,7 +2170,8 @@ dodip() wisx = TRUE; } exercise(A_WIS, wisx); - makeknown(potion->otyp); + if (potion->dknown) + makeknown(potion->otyp); useup(potion); return 1; } @@ -2185,7 +2207,8 @@ dodip() useup(potion); exercise(A_WIS, TRUE); } - makeknown(POT_OIL); + if (potion->dknown) + makeknown(POT_OIL); obj->spe = 1; update_inventory(); return 1; @@ -2223,16 +2246,24 @@ dodip() singlepotion->dknown = FALSE; } else { singlepotion->dknown = !Hallucination; + *newbuf = '\0'; if (mixture == POT_WATER && singlepotion->dknown) Sprintf(newbuf, "clears"); - else + else if (!Blind) Sprintf(newbuf, "turns %s", hcolor(OBJ_DESCR(objects[mixture]))); - pline_The("%spotion%s %s.", oldbuf, - more_than_one ? " that you dipped into" : "", newbuf); - if (!objects[old_otyp].oc_uname - && !objects[old_otyp].oc_name_known && old_dknown) { + if (*newbuf) + pline_The("%spotion%s %s.", oldbuf, + more_than_one ? " that you dipped into" : "", + newbuf); + else + pline("Something happens."); + + if (old_dknown + && !objects[old_otyp].oc_name_known + && !objects[old_otyp].oc_uname) { struct obj fakeobj; + fakeobj = cg.zeroobj; fakeobj.dknown = 1; fakeobj.otyp = old_otyp; @@ -2254,7 +2285,8 @@ dodip() return 1; poof: - if (!objects[potion->otyp].oc_name_known + if (potion->dknown + && !objects[potion->otyp].oc_name_known && !objects[potion->otyp].oc_uname) docall(potion); useup(potion); diff --git a/src/pray.c b/src/pray.c index c438f99d3..0562cd7ec 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pray.c $NHDT-Date: 1564532667 2019/07/31 00:24:27 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.117 $ */ +/* NetHack 3.6 pray.c $NHDT-Date: 1575830189 2019/12/08 18:36:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.134 $ */ /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -489,6 +489,12 @@ int trouble; impossible("fix_worst_trouble: nothing to uncurse."); return; } + if (otmp == uarmg && Glib) { + make_glib(0); + Your("%s are no longer slippery.", gloves_simple_name(uarmg)); + if (!otmp->cursed) + break; + } if (!Blind || (otmp == ublindf && Blindfolded_only)) { pline("%s %s.", what ? what : (const char *) Yobjnam2(otmp, "softly glow"), @@ -1378,6 +1384,7 @@ dosacrifice() /* curse the lawful/neutral altar */ pline_The("altar is stained with %s blood.", g.urace.adj); levl[u.ux][u.uy].altarmask = AM_CHAOTIC; + newsym(u.ux, u.uy); /* in case Invisible to self */ angry_priest(); } else { struct monst *dmon; @@ -1634,15 +1641,16 @@ dosacrifice() a_gname()); if (rn2(8 + u.ulevel) > 5) { struct monst *pri; + boolean shrine; + You_feel("the power of %s increase.", u_gname()); exercise(A_WIS, TRUE); change_luck(1); - /* Yes, this is supposed to be &=, not |= */ - levl[u.ux][u.uy].altarmask &= AM_SHRINE; - /* the following accommodates stupid compilers */ - levl[u.ux][u.uy].altarmask = - levl[u.ux][u.uy].altarmask - | (Align2amask(u.ualign.type)); + shrine = on_shrine(); + levl[u.ux][u.uy].altarmask = Align2amask(u.ualign.type); + if (shrine) + levl[u.ux][u.uy].altarmask |= AM_SHRINE; + newsym(u.ux, u.uy); /* in case Invisible to self */ if (!Blind) pline_The("altar glows %s.", hcolor((u.ualign.type == A_LAWFUL) @@ -2069,6 +2077,24 @@ doturn() return 1; } +int +altarmask_at(x, y) +int x, y; +{ + int res = 0; + + if (isok(x, y)) { + struct monst *mon = m_at(x, y); + + if (mon && M_AP_TYPE(mon) == M_AP_FURNITURE + && mon->mappearance == S_altar) + res = has_mcorpsenm(mon) ? MCORPSENM(mon) : 0; + else if (IS_ALTAR(levl[x][y].typ)) + res = levl[x][y].altarmask; + } + return res; +} + const char * a_gname() { diff --git a/src/priest.c b/src/priest.c index 08853e982..895443c92 100644 --- a/src/priest.c +++ b/src/priest.c @@ -118,6 +118,8 @@ pick_move: } if (nix != omx || niy != omy) { + if (MON_AT(nix, niy)) + return 0; remove_monster(omx, omy); place_monster(mtmp, nix, niy); newsym(nix, niy); diff --git a/src/quest.c b/src/quest.c index 42f2db639..a74cdf41b 100644 --- a/src/quest.c +++ b/src/quest.c @@ -7,7 +7,6 @@ /* quest dungeon branch routines. */ #include "quest.h" -#include "qtext.h" #define Not_firsttime (on_level(&u.uz0, &u.uz)) #define Qstat(x) (g.quest_status.x) @@ -27,13 +26,13 @@ static void on_start() { if (!Qstat(first_start)) { - qt_pager(QT_FIRSTTIME); + qt_pager("firsttime"); Qstat(first_start) = TRUE; } else if ((u.uz0.dnum != u.uz.dnum) || (u.uz0.dlevel < u.uz.dlevel)) { if (Qstat(not_ready) <= 2) - qt_pager(QT_NEXTTIME); + qt_pager("nexttime"); else - qt_pager(QT_OTHERTIME); + qt_pager("othertime"); } } @@ -48,14 +47,14 @@ on_locate() return; } else if (!Qstat(first_locate)) { if (from_above) - qt_pager(QT_FIRSTLOCATE); + qt_pager("locate_first"); /* if we've arrived from below this will be a lie, but there won't be any point in delivering the message upon a return visit from above later since the level has now been seen */ Qstat(first_locate) = TRUE; } else { if (from_above) - qt_pager(QT_NEXTLOCATE); + qt_pager("locate_next"); } } @@ -65,7 +64,7 @@ on_goal() if (Qstat(killed_nemesis)) { return; } else if (!Qstat(made_goal)) { - qt_pager(QT_FIRSTGOAL); + qt_pager("goal_first"); Qstat(made_goal) = 1; } else { /* @@ -81,7 +80,7 @@ on_goal() | (1 << OBJ_BURIED)); struct obj *qarti = find_quest_artifact(whichobjchains); - qt_pager(qarti ? QT_NEXTGOAL : QT_ALTGOAL); + qt_pager(qarti ? "goal_next" : "goal_alt"); if (Qstat(made_goal) < 7) Qstat(made_goal)++; } @@ -109,7 +108,7 @@ nemdead() { if (!Qstat(killed_nemesis)) { Qstat(killed_nemesis) = TRUE; - qt_pager(QT_KILLEDNEM); + qt_pager("killed_nemesis"); } } @@ -123,7 +122,7 @@ struct obj *obj; obj->dknown = 1; /* only give this message once */ Qstat(touched_artifact) = TRUE; - qt_pager(QT_GOTIT); + qt_pager("gotit"); exercise(A_WIS, TRUE); } } @@ -221,16 +220,16 @@ struct obj *obj; /* quest artifact; possibly null if carrying Amulet */ struct obj *otmp; if (u.uhave.amulet) { /* unlikely but not impossible */ - qt_pager(QT_HASAMULET); + qt_pager("hasamulet"); /* leader IDs the real amulet but ignores any fakes */ if ((otmp = carrying(AMULET_OF_YENDOR)) != 0) fully_identify_obj(otmp); } else { - qt_pager(!Qstat(got_thanks) ? QT_OFFEREDIT : QT_OFFEREDIT2); + qt_pager(!Qstat(got_thanks) ? "offeredit" : "offeredit2"); /* should have obtained bell during quest; if not, suggest returning for it now */ if ((otmp = carrying(BELL_OF_OPENING)) == 0) - com_pager(5); + com_pager("quest_complete_no_bell"); } Qstat(got_thanks) = TRUE; @@ -260,7 +259,7 @@ chat_with_leader() /* Rule 2: You've gone back before going for the amulet. */ else - qt_pager(QT_POSTHANKS); + qt_pager("posthanks"); /* Rule 3: You've got the artifact and are back to return it. */ } else if (u.uhave.questart) { @@ -274,16 +273,16 @@ chat_with_leader() /* Rule 4: You haven't got the artifact yet. */ } else if (Qstat(got_quest)) { - qt_pager(rn1(10, QT_ENCOURAGE)); + qt_pager("encourage"); /* Rule 5: You aren't yet acceptable - or are you? */ } else { if (!Qstat(met_leader)) { - qt_pager(QT_FIRSTLEADER); + qt_pager("leader_first"); Qstat(met_leader) = TRUE; Qstat(not_ready) = 0; } else - qt_pager(QT_NEXTLEADER); + qt_pager("leader_next"); /* the quest leader might have passed through the portal into the regular dungeon; none of the remaining make sense there */ @@ -291,16 +290,16 @@ chat_with_leader() return; if (not_capable()) { - qt_pager(QT_BADLEVEL); + qt_pager("badlevel"); exercise(A_WIS, TRUE); expulsion(FALSE); } else if (is_pure(TRUE) < 0) { - com_pager(QT_BANISHED); + com_pager("banished"); expulsion(TRUE); } else if (is_pure(TRUE) == 0) { - qt_pager(QT_BADALIGN); + qt_pager("badalign"); if (Qstat(not_ready) == MAX_QUEST_TRIES) { - qt_pager(QT_LASTLEADER); + qt_pager("leader_last"); expulsion(TRUE); } else { Qstat(not_ready)++; @@ -308,7 +307,7 @@ chat_with_leader() expulsion(FALSE); } } else { /* You are worthy! */ - qt_pager(QT_ASSIGNQUEST); + qt_pager("assignquest"); exercise(A_WIS, TRUE); Qstat(got_quest) = TRUE; } @@ -330,7 +329,7 @@ struct monst *mtmp; return; if (Qstat(pissed_off)) { - qt_pager(QT_LASTLEADER); + qt_pager("leader_last"); expulsion(TRUE); } else chat_with_leader(); @@ -340,7 +339,7 @@ static void chat_with_nemesis() { /* The nemesis will do most of the talking, but... */ - qt_pager(rn1(10, QT_DISCOURAGE)); + qt_pager("discourage"); if (!Qstat(met_nemesis)) Qstat(met_nemesis++); } @@ -350,21 +349,21 @@ nemesis_speaks() { if (!Qstat(in_battle)) { if (u.uhave.questart) - qt_pager(QT_NEMWANTSIT); + qt_pager("nemesis_wantsit"); else if (Qstat(made_goal) == 1 || !Qstat(met_nemesis)) - qt_pager(QT_FIRSTNEMESIS); + qt_pager("nemesis_first"); else if (Qstat(made_goal) < 4) - qt_pager(QT_NEXTNEMESIS); + qt_pager("nemesis_next"); else if (Qstat(made_goal) < 7) - qt_pager(QT_OTHERNEMESIS); + qt_pager("nemesis_other"); else if (!rn2(5)) - qt_pager(rn1(10, QT_DISCOURAGE)); + qt_pager("discourage"); if (Qstat(made_goal) < 7) Qstat(made_goal)++; Qstat(met_nemesis) = TRUE; } else /* he will spit out random maledictions */ if (!rn2(5)) - qt_pager(rn1(10, QT_DISCOURAGE)); + qt_pager("discourage"); } static void @@ -372,9 +371,9 @@ chat_with_guardian() { /* These guys/gals really don't have much to say... */ if (u.uhave.questart && Qstat(killed_nemesis)) - qt_pager(rn1(5, QT_GUARDTALK2)); + qt_pager("guardtalk_after"); else - qt_pager(rn1(5, QT_GUARDTALK)); + qt_pager("guardtalk_before"); } static void diff --git a/src/questpgr.c b/src/questpgr.c index f0cf6283f..85c272557 100644 --- a/src/questpgr.c +++ b/src/questpgr.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 questpgr.c $NHDT-Date: 1505172128 2017/09/11 23:22:08 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.38 $ */ +/* NetHack 3.6 questpgr.c $NHDT-Date: 1575830005 2019/12/08 18:33:25 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.67 $ */ /* Copyright 1991, M. Stephenson */ /* NetHack may be freely redistributed. See license for details. */ @@ -7,143 +7,24 @@ /* quest-specific pager routines. */ -#include "qtext.h" - -#define QTEXT_FILE "quest.dat" +#define QTEXT_FILE "quest.lua" #ifdef TTY_GRAPHICS #include "wintty.h" #endif -static void NDECL(dump_qtlist); -static void FDECL(Fread, (genericptr_t, int, int, dlb *)); -static struct qtmsg *FDECL(construct_qtlist, (long)); static const char *NDECL(intermed); static struct obj *FDECL(find_qarti, (struct obj *)); static const char *NDECL(neminame); static const char *NDECL(guardname); static const char *NDECL(homebase); static void FDECL(qtext_pronoun, (CHAR_P, CHAR_P)); -static struct qtmsg *FDECL(msg_in, (struct qtmsg *, int)); static void FDECL(convert_arg, (CHAR_P)); static void FDECL(convert_line, (char *,char *)); -static void FDECL(deliver_by_pline, (struct qtmsg *)); -static void FDECL(deliver_by_window, (struct qtmsg *, int)); +static void FDECL(deliver_by_pline, (const char *)); +static void FDECL(deliver_by_window, (const char *, int)); static boolean FDECL(skip_pager, (BOOLEAN_P)); -/* dump the character msg list to check appearance; - build with DEBUG enabled and use DEBUGFILES=questpgr.c - in sysconf file or environment */ -static void -dump_qtlist() -{ -#ifdef DEBUG - struct qtmsg *msg; - - if (!explicitdebug(__FILE__)) - return; - - for (msg = g.qt_list.chrole; msg->msgnum > 0; msg++) { - (void) dlb_fseek(g.msg_file, msg->offset, SEEK_SET); - deliver_by_window(msg, NHW_MAP); - } -#endif /* DEBUG */ - return; -} - -static void -Fread(ptr, size, nitems, stream) -genericptr_t ptr; -int size, nitems; -dlb *stream; -{ - int cnt; - - if ((cnt = dlb_fread(ptr, size, nitems, stream)) != nitems) { - panic("PREMATURE EOF ON QUEST TEXT FILE! Expected %d bytes, got %d", - (size * nitems), (size * cnt)); - } -} - -static struct qtmsg * -construct_qtlist(hdr_offset) -long hdr_offset; -{ - struct qtmsg *msg_list; - int n_msgs; - - (void) dlb_fseek(g.msg_file, hdr_offset, SEEK_SET); - Fread(&n_msgs, sizeof(int), 1, g.msg_file); - msg_list = (struct qtmsg *) alloc((unsigned) (n_msgs + 1) - * sizeof (struct qtmsg)); - - /* - * Load up the list. - */ - Fread((genericptr_t) msg_list, n_msgs * sizeof (struct qtmsg), 1, - g.msg_file); - - msg_list[n_msgs].msgnum = -1; - return msg_list; -} - -void -load_qtlist() -{ - int n_classes, i; - char qt_classes[N_HDR][LEN_HDR]; - long qt_offsets[N_HDR]; - - g.msg_file = dlb_fopen(QTEXT_FILE, RDBMODE); - if (!g.msg_file) - panic("CANNOT OPEN QUEST TEXT FILE %s.", QTEXT_FILE); - - /* - * Read in the number of classes, then the ID's & offsets for - * each header. - */ - - Fread(&n_classes, sizeof (int), 1, g.msg_file); - Fread(&qt_classes[0][0], sizeof (char) * LEN_HDR, n_classes, g.msg_file); - Fread(qt_offsets, sizeof (long), n_classes, g.msg_file); - - /* - * Now construct the message lists for quick reference later - * on when we are actually paging the messages out. - */ - - g.qt_list.common = g.qt_list.chrole = (struct qtmsg *) 0; - - for (i = 0; i < n_classes; i++) { - if (!strncmp(COMMON_ID, qt_classes[i], LEN_HDR)) - g.qt_list.common = construct_qtlist(qt_offsets[i]); - else if (!strncmp(g.urole.filecode, qt_classes[i], LEN_HDR)) - g.qt_list.chrole = construct_qtlist(qt_offsets[i]); -#if 0 /* UNUSED but available */ - else if (!strncmp(g.urace.filecode, qt_classes[i], LEN_HDR)) - g.qt_list.chrace = construct_qtlist(qt_offsets[i]); -#endif - } - - if (!g.qt_list.common || !g.qt_list.chrole) - impossible("load_qtlist: cannot load quest text."); - dump_qtlist(); - return; /* no ***DON'T*** close the msg_file */ -} - -/* called at program exit */ -void -unload_qtlist() -{ - if (g.msg_file) - (void) dlb_fclose(g.msg_file), g.msg_file = 0; - if (g.qt_list.common) - free((genericptr_t) g.qt_list.common), g.qt_list.common = 0; - if (g.qt_list.chrole) - free((genericptr_t) g.qt_list.chrole), g.qt_list.chrole = 0; - return; -} - short quest_info(typ) int typ; @@ -304,20 +185,6 @@ char who, /* 'd' => deity, 'l' => leader, 'n' => nemesis, 'o' => artifact */ return; } -static struct qtmsg * -msg_in(qtm_list, msgnum) -struct qtmsg *qtm_list; -int msgnum; -{ - struct qtmsg *qt_msg; - - for (qt_msg = qtm_list; qt_msg->msgnum > 0; qt_msg++) - if (qt_msg->msgnum == msgnum) - return qt_msg; - - return (struct qtmsg *) 0; -} - static void convert_arg(c) char c; @@ -415,10 +282,9 @@ convert_line(in_line, out_line) char *in_line, *out_line; { char *c, *cc; - char xbuf[BUFSZ]; cc = out_line; - for (c = xcrypt(in_line, xbuf); *c; c++) { + for (c = in_line; *c; c++) { *cc = 0; switch (*c) { case '\r': @@ -505,142 +371,171 @@ char *in_line, *out_line; } static void -deliver_by_pline(qt_msg) -struct qtmsg *qt_msg; +deliver_by_pline(str) +const char *str; { - long size; + const char *msgp = str; + const char *msgend = eos((char *)str); char in_line[BUFSZ], out_line[BUFSZ]; - *in_line = '\0'; - for (size = 0; size < qt_msg->size; size += (long) strlen(in_line)) { - (void) dlb_fgets(in_line, sizeof in_line, g.msg_file); + while (msgp && msgp != msgend) { + int i = 0; + while (*msgp != '\0' && *msgp != '\n' && (i < BUFSZ-2)) { + in_line[i] = *msgp; + i++; + msgp++; + } + if (*msgp == '\n') + msgp++; + in_line[i] = '\0'; convert_line(in_line, out_line); pline("%s", out_line); } } static void -deliver_by_window(qt_msg, how) -struct qtmsg *qt_msg; +deliver_by_window(msg, how) +const char *msg; int how; { - long size; + const char *msgp = msg; + const char *msgend = eos((char *)msg); char in_line[BUFSZ], out_line[BUFSZ]; - boolean qtdump = (how == NHW_MAP); - winid datawin = create_nhwindow(qtdump ? NHW_TEXT : how); + winid datawin = create_nhwindow(how); -#ifdef DEBUG - if (qtdump) { - char buf[BUFSZ]; - - /* when dumping quest messages at startup, all of them are passed to - * deliver_by_window(), even if normally given to deliver_by_pline() - */ - Sprintf(buf, "msgnum: %d, delivery: %c", - qt_msg->msgnum, qt_msg->delivery); - putstr(datawin, 0, buf); - putstr(datawin, 0, ""); - } -#endif - for (size = 0; size < qt_msg->size; size += (long) strlen(in_line)) { - (void) dlb_fgets(in_line, sizeof in_line, g.msg_file); + while (msgp && msgp != msgend) { + int i = 0; + while (*msgp != '\0' && *msgp != '\n' && (i < BUFSZ-2)) { + in_line[i] = *msgp; + i++; + msgp++; + } + if (*msgp == '\n') + msgp++; + in_line[i] = '\0'; convert_line(in_line, out_line); putstr(datawin, 0, out_line); } + display_nhwindow(datawin, TRUE); destroy_nhwindow(datawin); - - /* block messages delivered by window aren't kept in message history - but have a one-line summary which is put there for ^P recall */ - *out_line = '\0'; - if (qt_msg->summary_size) { - (void) dlb_fgets(in_line, sizeof in_line, g.msg_file); - convert_line(in_line, out_line); -#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) - } else if (qt_msg->delivery == 'c') { /* skip for 'qtdump' of 'p' */ - /* delivery 'c' and !summary_size, summary expected but not present; - this doesn't prefix the number with role code vs 'general' - but should be good enough for summary verification purposes */ - Sprintf(out_line, "[missing block message summary for #%05d]", - qt_msg->msgnum); -#endif - } - if (*out_line) - putmsghistory(out_line, FALSE); } static boolean skip_pager(common) -boolean common; +boolean common UNUSED; { /* WIZKIT: suppress plot feedback if starting with quest artifact */ if (g.program_state.wizkit_wishing) return TRUE; - if (!(common ? g.qt_list.common : g.qt_list.chrole)) { - panic("%s: no %s quest text data available", - common ? "com_pager" : "qt_pager", - common ? "common" : "role-specific"); - /*NOTREACHED*/ - return TRUE; - } return FALSE; } -void -com_pager(msgnum) -int msgnum; +boolean +com_pager_core(section, msgid) +const char *section; +const char *msgid; { - struct qtmsg *qt_msg; + const char *const howtoput[] = { "pline", "window", "text", "menu", "default", NULL }; + const int howtoput2i[] = { 1, 2, 2, 3, 0, 0 }; + int output; + lua_State *L; + char *synopsis; + char *text; if (skip_pager(TRUE)) - return; + return FALSE; - if (!(qt_msg = msg_in(g.qt_list.common, msgnum))) { - impossible("com_pager: message %d not found.", msgnum); - return; + L = nhl_init(); + + if (!nhl_loadlua(L, QTEXT_FILE)) { + impossible("com_pager: %s not found.", QTEXT_FILE); + lua_close(L); + return FALSE; } - (void) dlb_fseek(g.msg_file, qt_msg->offset, SEEK_SET); - if (qt_msg->delivery == 'p') - deliver_by_pline(qt_msg); - else if (msgnum == 1) - deliver_by_window(qt_msg, NHW_MENU); + lua_settop(L, 0); + lua_getglobal(L, "questtext"); + if (!lua_istable(L, -1)) { + impossible("com_pager: questtext in %s is not a lua table", QTEXT_FILE); + lua_close(L); + return FALSE; + } + + lua_getfield(L, -1, section); + if (!lua_istable(L, -1)) { + impossible("com_pager: questtext[%s] in %s is not a lua table", section, QTEXT_FILE); + lua_close(L); + return FALSE; + } + + lua_getfield(L, -1, msgid); + if (!lua_istable(L, -1)) { + impossible("com_pager: questtext[%s][%s] in %s is not a lua table", section, msgid, QTEXT_FILE); + lua_close(L); + return FALSE; + } + + synopsis = get_table_str_opt(L, "synopsis", NULL); + text = get_table_str_opt(L, "text", NULL); + output = howtoput2i[get_table_option(L, "output", "default", howtoput)]; + + if (!synopsis && !text) { + int nelems; + + lua_len(L, -1); + nelems = (int) lua_tointeger(L, -1); + lua_pop(L, 1); + if (nelems < 2) { + impossible( + "com_pager: questtext[%s][%s] in %s in not an array of strings", + section, msgid, QTEXT_FILE); + lua_close(L); + return FALSE; + } + nelems = rn2(nelems) + 1; + lua_pushinteger(L, nelems); + lua_gettable(L, -2); + text = dupstr(luaL_checkstring(L, -1)); + } + + if (output == 0 && (index(text, '\n') || (strlen(text) >= (BUFSZ - 1)))) + output = 2; + + if (output == 0 || output == 1) + deliver_by_pline(text); + else if (output == 3) + deliver_by_window(text, NHW_MENU); else - deliver_by_window(qt_msg, NHW_TEXT); - return; + deliver_by_window(text, NHW_TEXT); + + if (synopsis) { + char in_line[BUFSZ], out_line[BUFSZ]; + + Strcpy(in_line, synopsis); + convert_line(in_line, out_line); + putmsghistory(out_line, FALSE); + free(synopsis); + } + + free(text); + lua_close(L); + return TRUE; } void -qt_pager(msgnum) -int msgnum; +com_pager(msgid) +const char *msgid; { - struct qtmsg *qt_msg; + com_pager_core("common", msgid); +} - if (skip_pager(FALSE)) - return; - - qt_msg = msg_in(g.qt_list.chrole, msgnum); - if (!qt_msg) { - /* some roles have an alternate message for return to the goal - level when the quest artifact is absent (handled by caller) - but some don't; for the latter, use the normal goal message; - note: for first visit, artifact is assumed to always be - present which might not be true for wizard mode but we don't - worry about quest message references in that situation */ - if (msgnum == QT_ALTGOAL) - qt_msg = msg_in(g.qt_list.chrole, QT_NEXTGOAL); - } - if (!qt_msg) { - impossible("qt_pager: message %d not found.", msgnum); - return; - } - - (void) dlb_fseek(g.msg_file, qt_msg->offset, SEEK_SET); - if (qt_msg->delivery == 'p' && strcmp(windowprocs.name, "X11")) - deliver_by_pline(qt_msg); - else - deliver_by_window(qt_msg, NHW_TEXT); - return; +void +qt_pager(msgid) +const char *msgid; +{ + if (!com_pager_core(g.urole.filecode, msgid)) + com_pager_core("common", msgid); } struct permonst * @@ -674,8 +569,6 @@ deliver_splev_message() /* copying will stop at newline if one is present */ copynchars(in_line, str, (int) (sizeof in_line) - 1); - /* convert_line() expects encrypted input */ - (void) xcrypt(in_line, in_line); convert_line(in_line, out_line); pline("%s", out_line); diff --git a/src/region.c b/src/region.c index d918b27d9..cc2215e7e 100644 --- a/src/region.c +++ b/src/region.c @@ -1,11 +1,8 @@ -/* NetHack 3.6 region.c $NHDT-Date: 1543455828 2018/11/29 01:43:48 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.43 $ */ +/* NetHack 3.6 region.c $NHDT-Date: 1573957877 2019/11/17 02:31:17 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.45 $ */ /* Copyright (c) 1996 by Jean-Christophe Collet */ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" -#include "lev.h" -#include "sfproto.h" - /* * This should really go into the level structure, but @@ -338,6 +335,11 @@ NhRegion *reg; if (i == g.n_regions) return; + /* remove region before potential newsym() calls, but don't free it yet */ + if (--g.n_regions != i) + g.regions[i] = g.regions[g.n_regions]; + g.regions[g.n_regions] = (NhRegion *) 0; + /* Update screen if necessary */ reg->ttl = -2L; /* for visible_region_at */ if (reg->visible) @@ -347,9 +349,6 @@ NhRegion *reg; newsym(x, y); free_region(reg); - g.regions[i] = g.regions[g.n_regions - 1]; - g.regions[g.n_regions - 1] = (NhRegion *) 0; - g.n_regions--; } /* @@ -426,26 +425,27 @@ boolean in_out_region(x, y) xchar x, y; { - int i, f_indx; + int i, f_indx = 0; - /* First check if we can do the move */ + /* First check if hero can do the move */ for (i = 0; i < g.n_regions; i++) { - if (inside_region(g.regions[i], x, y) && !hero_inside(g.regions[i]) - && !g.regions[i]->attach_2_u) { - if ((f_indx = g.regions[i]->can_enter_f) != NO_CALLBACK) - if (!(*callbacks[f_indx])(g.regions[i], (genericptr_t) 0)) - return FALSE; - } else if (hero_inside(g.regions[i]) && !inside_region(g.regions[i], x, y) - && !g.regions[i]->attach_2_u) { - if ((f_indx = g.regions[i]->can_leave_f) != NO_CALLBACK) - if (!(*callbacks[f_indx])(g.regions[i], (genericptr_t) 0)) - return FALSE; + if (g.regions[i]->attach_2_u) + continue; + if (inside_region(g.regions[i], x, y) + ? (!hero_inside(g.regions[i]) + && (f_indx = g.regions[i]->can_enter_f) != NO_CALLBACK) + : (hero_inside(g.regions[i]) + && (f_indx = g.regions[i]->can_leave_f) != NO_CALLBACK)) { + if (!(*callbacks[f_indx])(g.regions[i], (genericptr_t) 0)) + return FALSE; } } - /* Callbacks for the regions we do leave */ - for (i = 0; i < g.n_regions; i++) - if (hero_inside(g.regions[i]) && !g.regions[i]->attach_2_u + /* Callbacks for the regions hero does leave */ + for (i = 0; i < g.n_regions; i++) { + if (g.regions[i]->attach_2_u) + continue; + if (hero_inside(g.regions[i]) && !inside_region(g.regions[i], x, y)) { clear_hero_inside(g.regions[i]); if (g.regions[i]->leave_msg != (const char *) 0) @@ -453,10 +453,13 @@ xchar x, y; if ((f_indx = g.regions[i]->leave_f) != NO_CALLBACK) (void) (*callbacks[f_indx])(g.regions[i], (genericptr_t) 0); } + } - /* Callbacks for the regions we do enter */ - for (i = 0; i < g.n_regions; i++) - if (!hero_inside(g.regions[i]) && !g.regions[i]->attach_2_u + /* Callbacks for the regions hero does enter */ + for (i = 0; i < g.n_regions; i++) { + if (g.regions[i]->attach_2_u) + continue; + if (!hero_inside(g.regions[i]) && inside_region(g.regions[i], x, y)) { set_hero_inside(g.regions[i]); if (g.regions[i]->enter_msg != (const char *) 0) @@ -464,53 +467,59 @@ xchar x, y; if ((f_indx = g.regions[i]->enter_f) != NO_CALLBACK) (void) (*callbacks[f_indx])(g.regions[i], (genericptr_t) 0); } + } + return TRUE; } /* - * check whether a monster enters/leaves one or more region. -*/ + * check whether a monster enters/leaves one or more regions. + */ boolean m_in_out_region(mon, x, y) struct monst *mon; xchar x, y; { - int i, f_indx; + int i, f_indx = 0; - /* First check if we can do the move */ + /* First check if mon can do the move */ for (i = 0; i < g.n_regions; i++) { - if (inside_region(g.regions[i], x, y) && !mon_in_region(g.regions[i], mon) - && g.regions[i]->attach_2_m != mon->m_id) { - if ((f_indx = g.regions[i]->can_enter_f) != NO_CALLBACK) - if (!(*callbacks[f_indx])(g.regions[i], mon)) - return FALSE; - } else if (mon_in_region(g.regions[i], mon) - && !inside_region(g.regions[i], x, y) - && g.regions[i]->attach_2_m != mon->m_id) { - if ((f_indx = g.regions[i]->can_leave_f) != NO_CALLBACK) - if (!(*callbacks[f_indx])(g.regions[i], mon)) - return FALSE; + if (g.regions[i]->attach_2_m == mon->m_id) + continue; + if (inside_region(g.regions[i], x, y) + ? (!mon_in_region(g.regions[i], mon) + && (f_indx = g.regions[i]->can_enter_f) != NO_CALLBACK) + : (mon_in_region(g.regions[i], mon) + && (f_indx = g.regions[i]->can_leave_f) != NO_CALLBACK)) { + if (!(*callbacks[f_indx])(g.regions[i], mon)) + return FALSE; } } - /* Callbacks for the regions we do leave */ - for (i = 0; i < g.n_regions; i++) + /* Callbacks for the regions mon does leave */ + for (i = 0; i < g.n_regions; i++) { + if (g.regions[i]->attach_2_m == mon->m_id) + continue; if (mon_in_region(g.regions[i], mon) - && g.regions[i]->attach_2_m != mon->m_id && !inside_region(g.regions[i], x, y)) { remove_mon_from_reg(g.regions[i], mon); if ((f_indx = g.regions[i]->leave_f) != NO_CALLBACK) (void) (*callbacks[f_indx])(g.regions[i], mon); } + } - /* Callbacks for the regions we do enter */ - for (i = 0; i < g.n_regions; i++) - if (!hero_inside(g.regions[i]) && !g.regions[i]->attach_2_u + /* Callbacks for the regions mon does enter */ + for (i = 0; i < g.n_regions; i++) { + if (g.regions[i]->attach_2_m == mon->m_id) + continue; + if (!mon_in_region(g.regions[i], mon) && inside_region(g.regions[i], x, y)) { add_mon_to_reg(g.regions[i], mon); if ((f_indx = g.regions[i]->enter_f) != NO_CALLBACK) (void) (*callbacks[f_indx])(g.regions[i], mon); } + } + return TRUE; } @@ -596,10 +605,12 @@ xchar x, y; { register int i; - for (i = 0; i < g.n_regions; i++) - if (inside_region(g.regions[i], x, y) && g.regions[i]->visible - && g.regions[i]->ttl != -2L) + for (i = 0; i < g.n_regions; i++) { + if (!g.regions[i]->visible || g.regions[i]->ttl == -2L) + continue; + if (inside_region(g.regions[i], x, y)) return g.regions[i]; + } return (NhRegion *) 0; } @@ -627,64 +638,40 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) &g.moves, sizeof (g.moves)); /* timestamp */ bwrite(nhfp->fd, (genericptr_t) &g.n_regions, sizeof (g.n_regions)); } - if (nhfp->fieldlevel) { - sfo_long(nhfp, &g.moves, "regions", "tmstamp", 1); - sfo_int(nhfp, &g.n_regions, "regions", "region_count", 1); - } for (i = 0; i < g.n_regions; i++) { if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->bounding_box, sizeof (NhRect)); bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->nrects, sizeof (short)); } - if (nhfp->fieldlevel) { - sfo_nhrect(nhfp, &g.regions[i]->bounding_box, "g.regions", "bounding_box", 1); - sfo_short(nhfp, &g.regions[i]->nrects, "g.regions", "nrects", 1); - } for (j = 0; j < g.regions[i]->nrects; j++) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->rects[j], sizeof (NhRect)); - if (nhfp->fieldlevel) - sfo_nhrect(nhfp, &g.regions[i]->rects[j], "g.regions", "rect", 1); } if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->attach_2_u, sizeof (boolean)); - if (nhfp->fieldlevel) - sfo_boolean(nhfp, &g.regions[i]->attach_2_u, "g.regions", "attach_2_u", 1); n = 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->attach_2_m, sizeof (unsigned)); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &g.regions[i]->attach_2_m, "g.regions", "attach_2_m", 1); n = g.regions[i]->enter_msg != (const char *)0 ? strlen(g.regions[i]->enter_msg) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &n, sizeof n); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &n, "g.regions", "enter_msg_length", 1); if (n > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) g.regions[i]->enter_msg, n); - if (nhfp->fieldlevel) - sfo_char(nhfp, g.regions[i]->enter_msg, "g.regions", "enter_msg", 1); } n = g.regions[i]->leave_msg != (const char *)0 ? strlen(g.regions[i]->leave_msg) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &n, sizeof n); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &n, "g.regions", "leave_msg_length", 1); if (n > 0) { if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) g.regions[i]->leave_msg, n); } - if (nhfp->fieldlevel) { - for (j = 0; j < (int) n; ++j) - sfo_char(nhfp, &g.regions[i]->leave_msg[j], "g.regions", "leave_msg", 1); - } } if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->ttl, sizeof (long)); @@ -697,34 +684,16 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->player_flags, sizeof (unsigned int)); bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->n_monst, sizeof (short)); } - if (nhfp->fieldlevel) { - sfo_long(nhfp, &g.regions[i]->ttl, "g.regions", "ttl", 1); - sfo_short(nhfp, &g.regions[i]->expire_f, "g.regions", "expire_f", 1); - sfo_short(nhfp, &g.regions[i]->can_enter_f, "g.regions", "can_enter_f", 1); - sfo_short(nhfp, &g.regions[i]->enter_f, "g.regions", "enter_f", 1); - sfo_short(nhfp, &g.regions[i]->can_leave_f, "g.regions", "can_leave_f", 1); - sfo_short(nhfp, &g.regions[i]->leave_f, "g.regions", "leave_f", 1); - sfo_short(nhfp, &g.regions[i]->inside_f, "g.regions", "inside_f", 1); - sfo_unsigned(nhfp, &g.regions[i]->player_flags, "g.regions", "player_flags", 1); - sfo_short(nhfp, &g.regions[i]->n_monst, "g.regions", "monster_count", 1); - } for (j = 0; j < g.regions[i]->n_monst; j++) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->monsters[j], sizeof (unsigned)); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &g.regions[i]->monsters[j], "g.regions", "monster", 1); } if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->visible, sizeof (boolean)); bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->glyph, sizeof (int)); bwrite(nhfp->fd, (genericptr_t) &g.regions[i]->arg, sizeof (anything)); } - if (nhfp->fieldlevel) { - sfo_boolean(nhfp, &g.regions[i]->visible, "g.regions", "visible", 1); - sfo_int(nhfp, &g.regions[i]->glyph, "g.regions", "glyph", 1); - sfo_any(nhfp, &g.regions[i]->arg, "g.regions", "arg", 1); - } } skip_lots: @@ -738,15 +707,13 @@ NHFILE *nhfp; boolean ghostly; /* If a bones file restore */ { int i, j; - unsigned n; - long tmstamp; + unsigned n = 0; + long tmstamp = 0L; char *msg_buf; clear_regions(); /* Just for security */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &tmstamp, sizeof (tmstamp)); - if (nhfp->fieldlevel) - sfi_long(nhfp, &tmstamp, "regions", "tmstamp", 1); if (ghostly) tmstamp = 0; else @@ -754,8 +721,6 @@ boolean ghostly; /* If a bones file restore */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.n_regions, sizeof (g.n_regions)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &g.n_regions, "regions", "region_count", 1); g.max_regions = g.n_regions; if (g.n_regions > 0) @@ -766,41 +731,25 @@ boolean ghostly; /* If a bones file restore */ mread(nhfp->fd, (genericptr_t) &g.regions[i]->bounding_box, sizeof (NhRect)); mread(nhfp->fd, (genericptr_t) &g.regions[i]->nrects, sizeof (short)); } - if (nhfp->fieldlevel) { - sfi_nhrect(nhfp, &g.regions[i]->bounding_box, "g.regions", "bounding box", 1); - sfi_short(nhfp, &g.regions[i]->nrects, "g.regions", "nrects", 1); - } if (g.regions[i]->nrects > 0) g.regions[i]->rects = (NhRect *) alloc(sizeof (NhRect) * g.regions[i]->nrects); for (j = 0; j < g.regions[i]->nrects; j++) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.regions[i]->rects[j], sizeof (NhRect)); - if (nhfp->fieldlevel) - sfi_nhrect(nhfp, &g.regions[i]->rects[j], "g.regions", "rect", 1); } if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) &g.regions[i]->attach_2_u, sizeof (boolean)); mread(nhfp->fd, (genericptr_t) &g.regions[i]->attach_2_m, sizeof (unsigned)); } - if (nhfp->fieldlevel) { - sfi_boolean(nhfp, &g.regions[i]->attach_2_u, "g.regions", "attach_2_u", 1); - sfi_unsigned(nhfp, &g.regions[i]->attach_2_m, "g.regions", "attach_2_m", 1); - } if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &n, sizeof n); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, &n, "g.regions", "enter_msg_length", 1); if (n > 0) { msg_buf = (char *) alloc(n + 1); if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) msg_buf, n); } - if (nhfp->fieldlevel) { - for (j = 0; (unsigned) j < n; ++j) - sfi_char(nhfp, &msg_buf[j], "g.regions", "enter_msg", 1); - } msg_buf[n] = '\0'; g.regions[i]->enter_msg = (const char *) msg_buf; } else @@ -808,17 +757,11 @@ boolean ghostly; /* If a bones file restore */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &n, sizeof n); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, &n, "g.regions", "leave_msg_length", 1); - if (n > 0) { + if (n > 0) { msg_buf = (char *) alloc(n + 1); if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) msg_buf, n); } - if (nhfp->fieldlevel) { - for (j = 0; (unsigned) j < n; ++j) - sfi_char(nhfp, &msg_buf[j], "g.regions", "leave_msg", 1); - } msg_buf[n] = '\0'; g.regions[i]->leave_msg = (const char *) msg_buf; } else @@ -826,8 +769,6 @@ boolean ghostly; /* If a bones file restore */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.regions[i]->ttl, sizeof (long)); - if (nhfp->fieldlevel) - sfi_long(nhfp, &g.regions[i]->ttl, "g.regions", "ttl", 1); /* check for expired region */ if (g.regions[i]->ttl >= 0L) g.regions[i]->ttl = @@ -848,23 +789,12 @@ boolean ghostly; /* If a bones file restore */ mread(nhfp->fd, (genericptr_t) &g.regions[i]->player_flags, sizeof (unsigned int)); } - if (nhfp->fieldlevel) { - sfi_short(nhfp, &g.regions[i]->expire_f, "g.regions", "expire_f", 1); - sfi_short(nhfp, &g.regions[i]->can_enter_f, "g.regions", "can_enter_f", 1); - sfi_short(nhfp, &g.regions[i]->enter_f, "g.regions", "enter_f", 1); - sfi_short(nhfp, &g.regions[i]->can_leave_f, "g.regions", "can_leave_f", 1); - sfi_short(nhfp, &g.regions[i]->leave_f, "g.regions", "leave_f", 1); - sfi_short(nhfp, &g.regions[i]->inside_f, "g.regions", "inside_f", 1); - sfi_unsigned(nhfp, &g.regions[i]->player_flags, "g.regions", "player_flags", 1); - } if (ghostly) { /* settings pertained to old player */ clear_hero_inside(g.regions[i]); clear_heros_fault(g.regions[i]); } if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.regions[i]->n_monst, sizeof (short)); - if (nhfp->fieldlevel) - sfi_short(nhfp, &g.regions[i]->n_monst, "g.regions", "monster_count", 1); if (g.regions[i]->n_monst > 0) g.regions[i]->monsters = (unsigned *) alloc(sizeof (unsigned) * g.regions[i]->n_monst); @@ -875,19 +805,12 @@ boolean ghostly; /* If a bones file restore */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.regions[i]->monsters[j], sizeof (unsigned)); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, &g.regions[i]->monsters[j], "g.regions", "monster", 1); } if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) &g.regions[i]->visible, sizeof (boolean)); mread(nhfp->fd, (genericptr_t) &g.regions[i]->glyph, sizeof (int)); mread(nhfp->fd, (genericptr_t) &g.regions[i]->arg, sizeof (anything)); } - if (nhfp->fieldlevel) { - sfi_boolean(nhfp, &g.regions[i]->visible, "g.regions", "visible", 1); - sfi_int(nhfp, &g.regions[i]->glyph, "g.regions", "glyph", 1); - sfi_any(nhfp, &g.regions[i]->arg, "g.regions", "arg", 1); - } } /* remove expired regions, do not trigger the expire_f callback (yet!); also update monster lists if this data is coming from a bones file */ diff --git a/src/restore.c b/src/restore.c index fd44f2ea1..635286cc0 100644 --- a/src/restore.c +++ b/src/restore.c @@ -1,14 +1,10 @@ -/* NetHack 3.6 restore.c $NHDT-Date: 1561485720 2019/06/25 18:02:00 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.131 $ */ +/* NetHack 3.7 restore.c $NHDT-Date: 1575245087 2019/12/02 00:04:47 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.136 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2009. */ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" -#include "lev.h" #include "tcap.h" /* for TERMLIB and ASCIIGRAPH */ -#include "sfproto.h" - - #if defined(MICRO) extern int dotcnt; /* shared with save */ @@ -122,21 +118,17 @@ static void restlevchn(nhfp) NHFILE *nhfp; { - int cnt; + int cnt = 0; s_level *tmplev, *x; g.sp_levchn = (s_level *) 0; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &cnt, sizeof(int)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &cnt, "levchn", "lev_count", 1); for (; cnt > 0; cnt--) { tmplev = (s_level *) alloc(sizeof(s_level)); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) tmplev, sizeof(s_level)); - if (nhfp->fieldlevel) - sfi_s_level(nhfp, tmplev, "levchn", "s_level", 1); if (!g.sp_levchn) g.sp_levchn = tmplev; @@ -154,14 +146,12 @@ restdamage(nhfp, ghostly) NHFILE *nhfp; boolean ghostly; { - unsigned int dmgcount; + unsigned int dmgcount = 0; int counter; struct damage *tmp_dam; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &dmgcount, sizeof(dmgcount)); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, &dmgcount, "damage", "damage_count", 1); counter = (int) dmgcount; if (!counter) @@ -172,8 +162,6 @@ boolean ghostly; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) tmp_dam, sizeof(*tmp_dam)); - if (nhfp->fieldlevel) - sfi_damage(nhfp, tmp_dam, "damage", "damage", 1); if (ghostly) tmp_dam->when += (g.monstermoves - g.omoves); @@ -208,12 +196,10 @@ restobj(nhfp, otmp) NHFILE *nhfp; struct obj *otmp; { - int buflen; + int buflen = 0; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) otmp, sizeof(struct obj)); - if (nhfp->fieldlevel) - sfi_obj(nhfp, otmp, "obj", "obj", 1); /* next object pointers are invalid; otmp->cobj needs to be left as is--being non-null is key to restoring container contents */ @@ -225,22 +211,16 @@ struct obj *otmp; /* oname - object's name */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "obj", "oname_length", 1); if (buflen > 0) { /* includes terminating '\0' */ new_oname(otmp, buflen); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) ONAME(otmp), buflen); - if (nhfp->fieldlevel) - sfi_str(nhfp, ONAME(otmp), "obj", "oname", buflen); } /* omonst - corpse or statue might retain full monster details */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "obj", "omonst_length", 1); if (buflen > 0) { newomonst(otmp); /* this is actually a monst struct, so we @@ -251,42 +231,30 @@ struct obj *otmp; /* omid - monster id number, connecting corpse to ghost */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "obj", "omid_length", 1); if (buflen > 0) { newomid(otmp); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) OMID(otmp), buflen); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, OMID(otmp), "obj", "omid", 1); } /* olong - temporary gold */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "obj", "olong_length", 1); if (buflen > 0) { newolong(otmp); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) OLONG(otmp), buflen); - if (nhfp->fieldlevel) - sfi_long(nhfp, OLONG(otmp), "obj", "olong", 1); } /* omailcmd - feedback mechanism for scroll of mail */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "obj", "omailcmd_length", 1); if (buflen > 0) { char *omailcmd = (char *) alloc(buflen); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) omailcmd, buflen); - if (nhfp->fieldlevel) - sfi_str(nhfp, omailcmd, "obj", "omailcmd", buflen); new_omailcmd(otmp, omailcmd); free((genericptr_t) omailcmd); } @@ -300,13 +268,11 @@ boolean ghostly, frozen; { register struct obj *otmp, *otmp2 = 0; register struct obj *first = (struct obj *) 0; - int buflen; + int buflen = 0; while (1) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "obj", "obj_length", 1); if (buflen == -1) break; @@ -346,7 +312,7 @@ boolean ghostly, frozen; /* * TODO: Remove this after 3.6.x save compatibility is dropped. * - * For 3.6.2, SchroedingersBox() always has a cat corpse in it. + * As of 3.6.2, SchroedingersBox() always has a cat corpse in it. * For 3.6.[01], it was empty and its weight was falsified * to have the value it would have had if there was one inside. * Put a non-rotting cat corpse in this box to convert to 3.6.2. @@ -389,12 +355,10 @@ restmon(nhfp, mtmp) NHFILE *nhfp; struct monst *mtmp; { - int buflen; + int buflen = 0; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) mtmp, sizeof(struct monst)); - if (nhfp->fieldlevel) - sfi_monst(nhfp, mtmp, "mon", "monst_length", 1); /* next monster pointer is invalid */ mtmp->nmon = (struct monst *) 0; @@ -405,82 +369,56 @@ struct monst *mtmp; /* mname - monster's name */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "mon", "mname_length", 1); if (buflen > 0) { /* includes terminating '\0' */ new_mname(mtmp, buflen); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) MNAME(mtmp), buflen); - if (nhfp->fieldlevel) - sfi_str(nhfp, MNAME(mtmp), "mon", "mname", buflen); } /* egd - vault guard */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "mon", "egd_length", 1); if (buflen > 0) { newegd(mtmp); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) EGD(mtmp), sizeof(struct egd)); - if (nhfp->fieldlevel) - sfi_egd(nhfp, EGD(mtmp), "mon", "egd", 1); } /* epri - temple priest */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "mon", "epri_length", 1); if (buflen > 0) { newepri(mtmp); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) EPRI(mtmp), sizeof(struct epri)); - if (nhfp->fieldlevel) - sfi_epri(nhfp, EPRI(mtmp), "mon", "epri", 1); } /* eshk - shopkeeper */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "mon", "eshk_length", 1); if (buflen > 0) { neweshk(mtmp); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) ESHK(mtmp), sizeof(struct eshk)); - if (nhfp->fieldlevel) - sfi_eshk(nhfp, ESHK(mtmp), "mon", "eshk", 1); } /* emin - minion */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "mon", "emin_length", 1); if (buflen > 0) { newemin(mtmp); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) EMIN(mtmp), sizeof(struct emin)); - if (nhfp->fieldlevel) - sfi_emin(nhfp, EMIN(mtmp), "mon", "emin", 1); } /* edog - pet */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "mon", "edog_length", 1); if (buflen > 0) { newedog(mtmp); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) EDOG(mtmp), sizeof(struct edog)); - if (nhfp->fieldlevel) - sfi_edog(nhfp, EDOG(mtmp), "mon", "edog", 1); } /* mcorpsenm - obj->corpsenm for mimic posing as corpse or statue (inline int rather than pointer to something) */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &MCORPSENM(mtmp), sizeof MCORPSENM(mtmp)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &MCORPSENM(mtmp), "mon", "mcorpsenm", 1); } /* mextra */ } @@ -491,13 +429,11 @@ boolean ghostly; { register struct monst *mtmp, *mtmp2 = 0; register struct monst *first = (struct monst *) 0; - int offset, buflen; + int offset, buflen = 0; while (1) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &buflen, sizeof(buflen)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &buflen, "mon", "monst_length", 1); if (buflen == -1) break; @@ -565,21 +501,18 @@ static struct fruit * loadfruitchn(nhfp) NHFILE *nhfp; { - register struct fruit *flist, *fnext = (struct fruit *) 0; - boolean keepgoing; + register struct fruit *flist, *fnext; flist = 0; - keepgoing = TRUE; - while (fnext = newfruit(), keepgoing) { + for (;;) { + fnext = newfruit(); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t)fnext, sizeof *fnext); - if (nhfp->fieldlevel) - sfi_fruit(nhfp, fnext, "fruit", "fruit", 1); if (fnext->fid != 0) { fnext->nextf = flist; flist = fnext; } else - keepgoing = FALSE; + break; } dealloc_fruit(fnext); return flist; @@ -634,16 +567,11 @@ unsigned int *stuckid, *steedid; struct obj *otmp; struct obj *bc_obj; char timebuf[15]; - unsigned long uid; + unsigned long uid = 0; boolean defer_perm_invent; - if (nhfp->fieldlevel && nhfp->addinfo) - sfi_addinfo(nhfp, "gamestate", "start", "", 0); - if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &uid, sizeof uid); - if (nhfp->fieldlevel) - sfi_ulong(nhfp, &uid, "gamestate", "uid", 1); if (SYSOPT_CHECK_SAVE_UID && uid != (unsigned long) getuid()) { /* strange ... */ @@ -657,8 +585,6 @@ unsigned int *stuckid, *steedid; newgamecontext = g.context; /* copy statically init'd context */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.context, sizeof (struct context_info)); - if (nhfp->fieldlevel) - sfi_context_info(nhfp, &g.context, "gamestate", "g.context", 1); g.context.warntype.species = (g.context.warntype.speciesidx >= LOW_PM) ? &mons[g.context.warntype.speciesidx] : (struct permonst *) 0; @@ -672,8 +598,6 @@ unsigned int *stuckid, *steedid; newgameflags = flags; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &flags, sizeof (struct flag)); - if (nhfp->fieldlevel) - sfi_flag(nhfp, &flags, "gamestate", "flags", 1); /* avoid keeping permanent inventory window up to date during restore (setworn() calls update_inventory); attempting to include the cost @@ -700,9 +624,6 @@ unsigned int *stuckid, *steedid; newgamesysflags = sysflags; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &sysflags, sizeof(struct sysflag)); - if (nhfp->fieldlevel) - sfi_sysflag(nhfp, &sysflags, "gamestate", "sysflags", 1); - mread(fd, (genericptr_t) &sysflags, sizeof(struct sysflag)); #endif role_init(); /* Reset the initial role, race, gender, and alignment */ @@ -711,25 +632,17 @@ unsigned int *stuckid, *steedid; #endif if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &u, sizeof(struct you)); - if (nhfp->fieldlevel) - sfi_you(nhfp, &u, "gamestate", "you", 1); g.youmonst.cham = u.mcham; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) timebuf, 14); - if (nhfp->fieldlevel) - sfi_str(nhfp, timebuf, "gamestate", "ubirthday", 14); timebuf[14] = '\0'; ubirthday = time_from_yyyymmddhhmmss(timebuf); if (nhfp->structlevel) mread(nhfp->fd, &urealtime.realtime, sizeof urealtime.realtime); - if (nhfp->fieldlevel) - sfi_long(nhfp, &urealtime.realtime, "gamestate", "realtime", 1); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) timebuf, 14); - if (nhfp->fieldlevel) - sfi_str(nhfp, timebuf, "gamestate", "start_timing", 14); timebuf[14] = '\0'; urealtime.start_timing = time_from_yyyymmddhhmmss(timebuf); @@ -768,8 +681,6 @@ unsigned int *stuckid, *steedid; restore_timers(nhfp, RANGE_GLOBAL, FALSE, 0L); restore_light_sources(nhfp); - if (nhfp->fieldlevel && nhfp->addinfo) - sfi_addinfo(nhfp, "objchain", "start", "invent", 0); g.invent = restobjchn(nhfp, FALSE, FALSE); /* restore dangling (not on floor or in inventory) ball and/or chain */ @@ -788,12 +699,6 @@ unsigned int *stuckid, *steedid; if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) g.mvitals, sizeof g.mvitals); } - if (nhfp->fieldlevel) { - int i; - - for (i = 0; i < NUMMONS; ++i) - sfi_mvitals(nhfp, &g.mvitals[i], "gamestate", "g.mvitals", 1); - } /* * There are some things after this that can have unintended display @@ -825,41 +730,20 @@ unsigned int *stuckid, *steedid; mread(nhfp->fd, (genericptr_t) &g.quest_status, sizeof (struct q_score)); mread(nhfp->fd, (genericptr_t) g.spl_book, (MAXSPELL + 1) * sizeof (struct spell)); } - if (nhfp->fieldlevel) { - int i; - struct spell *sptmp; - - sfi_long(nhfp, &g.moves, "gamestate", "g.moves", 1); - sfi_long(nhfp, &g.monstermoves, "gamestate", "g.monstermoves", 1); - sfi_q_score(nhfp, &g.quest_status, "gamestate", "g.quest_status", 1); - sptmp = g.spl_book; - for (i = 0; i < (MAXSPELL + 1); ++i) - sfi_spell(nhfp, sptmp++, "gamestate", "g.spl_book", 1); - } restore_artifacts(nhfp); restore_oracles(nhfp); if (u.ustuck) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) stuckid, sizeof *stuckid); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, stuckid, "gamestate", "ustuck_id", 1); } if (u.usteed) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) steedid, sizeof *steedid); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, steedid, "gamestate", "usteed_id", 1); } if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) g.pl_character, sizeof g.pl_character); mread(nhfp->fd, (genericptr_t) g.pl_fruit, sizeof g.pl_fruit); } - if (nhfp->fieldlevel) { - sfi_char(nhfp, g.pl_character, "gamestate", "g.pl_character", - sizeof g.pl_character); - sfi_char(nhfp, g.pl_fruit, "gamestate", "g.pl_fruit", - sizeof g.pl_fruit); - } freefruitchn(g.ffruit); /* clean up fruit(s) made by initoptions() */ g.ffruit = loadfruitchn(nhfp); @@ -972,7 +856,7 @@ dorecover(nhfp) NHFILE *nhfp; { unsigned int stuckid = 0, steedid = 0; /* not a register */ - xchar ltmp; + xchar ltmp = 0; int rtmp; struct obj *otmp; @@ -1040,11 +924,6 @@ NHFILE *nhfp; if (restoreinfo.mread_flags == -1) break; } - if (nhfp->fieldlevel) { - sfi_xchar(nhfp, <mp, "gamestate", "level_number", 1); - if (nhfp->eof) - break; - } getlev(nhfp, 0, ltmp, FALSE); #ifdef MICRO curs(WIN_MAP, 1 + dotcnt++, dotrow); @@ -1062,9 +941,6 @@ NHFILE *nhfp; return rtmp; /* dorecover called recursively */ } restoreinfo.mread_flags = 0; - if (nhfp->fieldlevel && nhfp->addinfo) - sfi_addinfo(nhfp, "NetHack", "end", "savefile", 0); - rewind_nhfile(nhfp); /* return to beginning of file */ (void) validate(nhfp, (char *) 0); get_plname_from_file(nhfp, g.plname); @@ -1104,7 +980,6 @@ NHFILE *nhfp; */ inven_inuse(FALSE); - load_qtlist(); /* re-load the quest text info */ /* Set up the vision internals, after levl[] data is loaded but before docrt(). */ reglyph_darkroom(); @@ -1128,20 +1003,16 @@ NHFILE *nhfp; struct cemetery **cemeteryaddr; { struct cemetery *bonesinfo, **bonesaddr; - int cflag; + int cflag = 0; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &cflag, sizeof cflag); - if (nhfp->fieldlevel) - sfi_int(nhfp, &cflag, "cemetery", "cemetery_flag", 1); if (cflag == 0) { bonesaddr = cemeteryaddr; do { bonesinfo = (struct cemetery *) alloc(sizeof *bonesinfo); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) bonesinfo, sizeof *bonesinfo); - if (nhfp->fieldlevel) - sfi_cemetery(nhfp, bonesinfo, "bones", "bonesinfo", 1); *bonesaddr = bonesinfo; bonesaddr = &(*bonesaddr)->next; } while (*bonesaddr); @@ -1177,10 +1048,6 @@ boolean rlecomp; mread(nhfp->fd, (genericptr_t) &len, sizeof(uchar)); mread(nhfp->fd, (genericptr_t) &r, sizeof(struct rm)); } - if (nhfp->fieldlevel) { - sfi_uchar(nhfp, &len, "room", "levl", 1); - sfi_rm(nhfp, &r, "room", "rm", 1); - } } } j = 0; @@ -1194,13 +1061,6 @@ boolean rlecomp; if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) levl, sizeof levl); } - if (nhfp->fieldlevel) { - int c, r; - - for (c = 0; c < COLNO; ++c) - for (r = 0; r < ROWNO; ++r) - sfi_rm(nhfp, &levl[c][r], "room", "levl", 1); - } } void @@ -1225,10 +1085,9 @@ boolean ghostly; register struct monst *mtmp; long elapsed; branch *br; - int hpid; - xchar dlvl; + int hpid = 0; + xchar dlvl = 0; int x, y; - boolean keepgoing; #ifdef TOS short tlev; #endif @@ -1249,21 +1108,15 @@ boolean ghostly; /* First some sanity checks */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &hpid, sizeof(hpid)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &hpid, "gamestate", "g.hackpid", 1); /* CHECK: This may prevent restoration */ #ifdef TOS if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &tlev, sizeof(tlev)); - if (nhfp->fieldlevel) - sfi_short(nhfp, &tlev, "gamestate", "tlev", 1); dlvl = tlev & 0x00ff; #else if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &dlvl, sizeof(dlvl)); - if (nhfp->fieldlevel) - sfi_xchar(nhfp, &dlvl, "gamestate", "dlvl", 1); #endif if ((pid && pid != hpid) || (lev && dlvl != lev)) { char trickbuf[BUFSZ]; @@ -1284,15 +1137,6 @@ boolean ghostly; mread(nhfp->fd, (genericptr_t) g.lastseentyp, sizeof(g.lastseentyp)); mread(nhfp->fd, (genericptr_t) &g.omoves, sizeof(g.omoves)); } - if (nhfp->fieldlevel) { - int c, r; - - for (c = 0; c < COLNO; ++c) - for (r = 0; r < ROWNO; ++r) - sfi_schar(nhfp, &g.lastseentyp[c][r], "lev", "g.lastseentyp", 1); - - sfi_long(nhfp, &g.omoves, "lev", "timestmp", 1); - } elapsed = g.monstermoves - g.omoves; if (nhfp->structlevel) { @@ -1306,20 +1150,6 @@ boolean ghostly; mread(nhfp->fd, (genericptr_t)&g.level.flags, sizeof(g.level.flags)); mread(nhfp->fd, (genericptr_t)g.doors, sizeof(g.doors)); } - if (nhfp->fieldlevel) { - int i; - - sfi_stairway(nhfp, &g.upstair, "lev", "g.upstair", 1); - sfi_stairway(nhfp, &g.dnstair, "lev", "g.dnstair", 1); - sfi_stairway(nhfp, &g.upladder, "lev", "g.upladder", 1); - sfi_stairway(nhfp, &g.dnladder, "lev", "g.dnladder", 1); - sfi_stairway(nhfp, &g.sstairs, "lev", "g.sstairs", 1); - sfi_dest_area(nhfp, &g.updest, "lev", "g.updest", 1); - sfi_dest_area(nhfp, &g.dndest, "lev", "g.dndest", 1); - sfi_levelflags(nhfp, &g.level.flags, "lev", "g.level.flags", 1); - for (i = 0; i < DOORMAX; ++i) - sfi_nhcoord(nhfp, &g.doors[i], "lev", "g.doors", 1); - } rest_rooms(nhfp); /* No joke :-) */ if (g.nroom) g.doorindex = g.rooms[g.nroom - 1].fdoor + g.rooms[g.nroom - 1].doorct; @@ -1332,20 +1162,20 @@ boolean ghostly; /* rest_worm(fd); */ /* restore worm information */ rest_worm(nhfp); /* restore worm information */ + g.ftrap = 0; - keepgoing = TRUE; - while (trap = newtrap(), keepgoing) { + for (;;) { + trap = newtrap(); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t)trap, sizeof(struct trap)); - if (nhfp->fieldlevel) - sfi_trap(nhfp, trap, "trap", "trap", 1); if (trap->tx != 0) { trap->ntrap = g.ftrap; g.ftrap = trap; } else - keepgoing = FALSE; + break; } dealloc_trap(trap); + fobj = restobjchn(nhfp, ghostly, FALSE); find_lev_obj(); /* restobjchn()'s `frozen' argument probably ought to be a callback @@ -1461,10 +1291,6 @@ char *plbuf; (void) read(nhfp->fd, (genericptr_t) &pltmpsiz, sizeof(pltmpsiz)); (void) read(nhfp->fd, (genericptr_t) plbuf, pltmpsiz); } - if (nhfp->fieldlevel) { - sfi_int(nhfp, &pltmpsiz, "plname", "plname_size", 1); - sfi_str(nhfp, plbuf, "plname", "g.plname", pltmpsiz); - } return; } @@ -1472,22 +1298,18 @@ static void restore_msghistory(nhfp) NHFILE *nhfp; { - int msgsize, msgcount = 0; + int msgsize = 0, msgcount = 0; char msg[BUFSZ]; while (1) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &msgsize, sizeof(msgsize)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &msgsize, "msghistory", "msghistory_length", 1); if (msgsize == -1) break; if (msgsize > (BUFSZ - 1)) panic("restore_msghistory: msg too big (%d)", msgsize); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) msg, msgsize); - if (nhfp->fieldlevel) - sfi_str(nhfp, msg, "msghistory", "msg", msgsize); msg[msgsize] = '\0'; putmsghistory(msg, TRUE); ++msgcount; @@ -1671,21 +1493,14 @@ const char *name; if (nhfp->structlevel) utdflags |= UTD_CHECKSIZES; - if (nhfp->fieldlevel) - utdflags |= UTD_CHECKFIELDCOUNTS | - UTD_SKIP_SANITY1 | UTD_SKIP_SAVEFILEINFO; if (!(reslt = uptodate(nhfp, name, utdflags))) return 1; if ((nhfp->mode & WRITING) == 0) { if (nhfp->structlevel) rlen = read(nhfp->fd, (genericptr_t) &sfi, sizeof sfi); - if (nhfp->fieldlevel) - sfi_savefile_info(nhfp, &sfi, "savefileinfo", "savefile_info", 1); } else { if (nhfp->structlevel) rlen = read(nhfp->fd, (genericptr_t) &sfi, sizeof sfi); - if (nhfp->fieldlevel) - sfi_savefile_info(nhfp, &sfi, "savefileinfo", "savefile_info", 1); minit(); /* ZEROCOMP */ if (rlen == 0) { if (verbose) { diff --git a/src/role.c b/src/role.c index 487999ac7..a62d042a7 100644 --- a/src/role.c +++ b/src/role.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 role.c $NHDT-Date: 1547086250 2019/01/10 02:10:50 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.56 $ */ +/* NetHack 3.6 role.c $NHDT-Date: 1574648943 2019/11/25 02:29:03 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.65 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985-1999. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -701,7 +701,9 @@ const struct Race races[] = { const struct Gender genders[] = { { "male", "he", "him", "his", "Mal", ROLE_MALE }, { "female", "she", "her", "her", "Fem", ROLE_FEMALE }, - { "neuter", "it", "it", "its", "Ntr", ROLE_NEUTER } + { "neuter", "it", "it", "its", "Ntr", ROLE_NEUTER }, + /* used by pronoun_gender() when hallucinating */ + { "group", "they", "them", "their", "Grp", 0 }, }; /* Table of all alignments */ @@ -2084,7 +2086,7 @@ struct monst *mtmp; return "Aloha"; /* Hawaiian */ case PM_VALKYRIE: return -#ifdef MAIL +#ifdef MAIL_STRUCTURES (mtmp && mtmp->data == &mons[PM_MAIL_DAEMON]) ? "Hallo" : #endif "Velkommen"; /* Norse */ diff --git a/src/rumors.c b/src/rumors.c index b5be74ff4..b11c39d31 100644 --- a/src/rumors.c +++ b/src/rumors.c @@ -4,10 +4,7 @@ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" -#include "lev.h" #include "dlb.h" -#include "sfproto.h" - /* [note: this comment is fairly old, but still accurate for 3.1] * Rumors have been entirely rewritten to speed up the access. This is @@ -388,21 +385,13 @@ void save_oracles(nhfp) NHFILE *nhfp; { - int i; - if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.oracle_cnt, sizeof g.oracle_cnt); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &g.oracle_cnt, "oracles", "g.oracle_cnt", 1); if (g.oracle_cnt) { if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t)g.oracle_loc, g.oracle_cnt * sizeof (long)); } - if (nhfp->fieldlevel) { - for (i = 0; (unsigned) i < g.oracle_cnt; ++i) - sfo_ulong(nhfp, &g.oracle_loc[i], "oracles", "oracle loc", 1); - } } } if (release_data(nhfp)) { @@ -417,21 +406,14 @@ void restore_oracles(nhfp) NHFILE *nhfp; { - int i; if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.oracle_cnt, sizeof g.oracle_cnt); - if (nhfp->fieldlevel) - sfi_unsigned(nhfp, &g.oracle_cnt, "oracles", "g.oracle_cnt", 1); if (g.oracle_cnt) { g.oracle_loc = (unsigned long *) alloc(g.oracle_cnt * sizeof(long)); if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) g.oracle_loc, g.oracle_cnt * sizeof (long)); } - if (nhfp->fieldlevel) { - for (i = 0; (unsigned) i < g.oracle_cnt; ++i) - sfi_ulong(nhfp, &g.oracle_loc[i], "oracles", "g.oracle_loc", 1); - } g.oracle_flg = 1; /* no need to call init_oracles() */ } } diff --git a/src/save.c b/src/save.c index 2b36da546..aff484987 100644 --- a/src/save.c +++ b/src/save.c @@ -4,9 +4,6 @@ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" -#include "lev.h" -#include "sfproto.h" - #ifndef NO_SIGNAL #include @@ -149,10 +146,6 @@ dosave0() (void) delete_savefile(); /* ab@unido */ return 0; } -#ifdef SAVEFILE_DEBUGGING - if (nhfp && nhfp->fieldlevel && nhfp->fplog) - (void) fprintf(nhfp->fplog, "# just opened\n"); -#endif vision_recalc(2); /* shut down vision to prevent problems in the event of an impossible() call */ @@ -202,9 +195,6 @@ dosave0() } #endif /* MFLOPPY */ - if (nhfp->fieldlevel && nhfp->addinfo && (nhfp->mode & WRITING)) - sfo_addinfo(nhfp, "NetHack", "start", "savefile", 0); - nhfp->mode = WRITING | FREEING; store_version(nhfp); store_savefileinfo(nhfp); @@ -259,8 +249,6 @@ dosave0() close_nhfile(onhfp); if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) <mp, sizeof ltmp); /* level number*/ - if (nhfp->fieldlevel) - sfo_xchar(nhfp, <mp, "gamestate", "level_number", 1); /* xchar */ savelev(nhfp, ltmp); /* actual level*/ delete_levelfile(ltmp); } @@ -294,14 +282,6 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) &flags, sizeof flags); #ifdef SYSFLAGS bwrite(nhfp->fd, (genericptr_t) &sysflags, sysflags); -#endif - } - if (nhfp->fieldlevel) { - sfo_ulong(nhfp, &uid, "gamestate", "uid", 1); - sfo_context_info(nhfp, &g.context, "gamestate", "g.context", 1); - sfo_flag(nhfp, &flags, "gamestate" , "flags", 1); -#ifdef SYSFLAGS - sfo_flag(nhfp, &sysflags, "gamestate" , "sysflags", 1); #endif } urealtime.finish_time = getnow(); @@ -318,12 +298,6 @@ NHFILE *nhfp; sizeof urealtime.realtime); bwrite(nhfp->fd, yyyymmddhhmmss(urealtime.start_timing), 14); } - if (nhfp->fieldlevel) { - sfo_you(nhfp, &u, "gamestate", "you", 1); - sfo_str(nhfp, yyyymmddhhmmss(ubirthday), "gamestate", "ubirthday", 14); - sfo_long(nhfp, &urealtime.realtime, "gamestate", "realtime", 1); - sfo_str(nhfp, yyyymmddhhmmss(urealtime.start_timing), "gamestate", "start_timing", 14); - } /* this is the value to use for the next update of urealtime.realtime */ urealtime.start_timing = urealtime.finish_time; save_killers(nhfp); @@ -355,12 +329,6 @@ NHFILE *nhfp; } if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) g.mvitals, sizeof g.mvitals); - if (nhfp->fieldlevel) { - int i; - - for (i = 0; i < NUMMONS; ++i) - sfo_mvitals(nhfp, &g.mvitals[i], "gamestate", "g.mvitals", 1); - } save_dungeon(nhfp, (boolean) !!perform_bwrite(nhfp), (boolean) !!release_data(nhfp)); savelevchn(nhfp); @@ -371,39 +339,20 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) g.spl_book, sizeof (struct spell) * (MAXSPELL + 1)); } - if (nhfp->fieldlevel) { - int i; - struct spell *sptmp; - - sfo_long(nhfp, &g.moves, "gamestate", "g.moves", 1); - sfo_long(nhfp, &g.monstermoves, "gamestate", "g.monstermoves", 1); - sfo_q_score(nhfp, &g.quest_status, "gamestate", "g.quest_status", 1); - sptmp = g.spl_book; - for (i = 0; i < (MAXSPELL + 1); ++i) - sfo_spell(nhfp, sptmp++, "gamestate", "g.spl_book", 1); - } save_artifacts(nhfp); save_oracles(nhfp); if (g.ustuck_id) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.ustuck_id, sizeof g.ustuck_id); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &g.ustuck_id, "gamestate", "g.ustuck_id", 1); } if (g.usteed_id) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.usteed_id, sizeof g.usteed_id); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &g.usteed_id, "gamestate", "g.usteed_id", 1); } if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) g.pl_character, sizeof g.pl_character); bwrite(nhfp->fd, (genericptr_t) g.pl_fruit, sizeof g.pl_fruit); } - if (nhfp->fieldlevel) { - sfo_char(nhfp, g.pl_character, "gamestate", "g.pl_character", sizeof g.pl_character); - sfo_char(nhfp, g.pl_fruit, "gamestate", "g.pl_fruit", sizeof g.pl_fruit); - } savefruitchn(nhfp); savenames(nhfp); save_waterlevel(nhfp); @@ -478,15 +427,11 @@ savestateinlock() nhfp->mode = WRITING; if (nhfp->structlevel) (void) write(nhfp->fd, (genericptr_t) &g.hackpid, sizeof g.hackpid); - if (nhfp->fieldlevel) - sfo_int(nhfp, &g.hackpid, "gamestate", "g.hackpid", 1); if (flags.ins_chkpt) { int currlev = ledger_no(&u.uz); if (nhfp->structlevel) (void) write(nhfp->fd, (genericptr_t) &currlev, sizeof currlev); - if (nhfp->fieldlevel) - sfo_int(nhfp, &currlev, "gamestate", "savestateinlock", 1); save_savefile_name(nhfp); store_version(nhfp); store_savefileinfo(nhfp); @@ -582,20 +527,14 @@ xchar lev; g.level_info[lev].flags |= VISITED; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.hackpid, sizeof g.hackpid); - if (nhfp->fieldlevel) - sfo_int(nhfp, &g.hackpid, "gamestate", "g.hackpid", 1); #ifdef TOS tlev = lev; tlev &= 0x00ff; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &tlev, sizeof tlev); - if (nhfp->fieldlevel) - sfo_short(nhfp, &tlev, "gamestate", "tlev", 1); #else if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &lev, sizeof lev); - if (nhfp->fieldlevel) - sfo_xchar(nhfp, &lev, "gamestate", "dlvl", 1); #endif } @@ -623,24 +562,6 @@ xchar lev; bwrite(nhfp->fd, (genericptr_t) &g.level.flags, sizeof g.level.flags); bwrite(nhfp->fd, (genericptr_t) g.doors, sizeof g.doors); } - if (nhfp->fieldlevel) { - int i, c, r; - - for (c = 0; c < COLNO; ++c) - for (r = 0; r < ROWNO; ++r) - sfo_schar(nhfp, &g.lastseentyp[c][r], "lev", "g.lastseentyp", 1); - sfo_long(nhfp, &g.monstermoves, "lev", "timestmp", 1); - sfo_stairway(nhfp, &g.upstair, "lev", "g.upstair", 1); - sfo_stairway(nhfp, &g.dnstair, "lev", "g.dnstair", 1); - sfo_stairway(nhfp, &g.upladder, "lev", "g.upladder", 1); - sfo_stairway(nhfp, &g.dnladder, "lev", "g.dnladder", 1); - sfo_stairway(nhfp, &g.sstairs, "lev", "g.sstairs", 1); - sfo_dest_area(nhfp, &g.updest, "lev", "g.updest", 1); - sfo_dest_area(nhfp, &g.dndest, "lev", "g.dndest", 1); - sfo_levelflags(nhfp, &g.level.flags, "lev", "g.level.flags", 1); - for (i = 0; i < DOORMAX; ++i) - sfo_nhcoord(nhfp, &g.doors[i], "lev", "door", 1); - } save_rooms(nhfp); /* no dynamic memory to reclaim */ /* from here on out, saving also involves allocated memory cleanup */ @@ -657,10 +578,14 @@ xchar lev; saveobjchn(nhfp, g.billobjs); if (release_data(nhfp)) { int x,y; - + /* TODO: maybe use clear_level_structures() */ for (y = 0; y < ROWNO; y++) - for (x = 0; x < COLNO; x++) + for (x = 0; x < COLNO; x++) { g.level.monsters[x][y] = 0; + g.level.objects[x][y] = 0; + levl[x][y].seenv = 0; + levl[x][y].glyph = cmap_to_glyph(S_stone); + } fmon = 0; g.ftrap = 0; fobj = 0; @@ -715,10 +640,6 @@ boolean rlecomp; bwrite(nhfp->fd, (genericptr_t) &match, sizeof (uchar)); bwrite(nhfp->fd, (genericptr_t) rgrm, sizeof (struct rm)); } - if (nhfp->fieldlevel) { - sfo_uchar(nhfp, &match, "levl", "match", 1); - sfo_rm(nhfp, rgrm, "levl", "rgrm", 1); - } /* start encoding again. we have at least 1 rm in the next run, viz. this one. */ match = 1; @@ -731,10 +652,6 @@ boolean rlecomp; bwrite(nhfp->fd, (genericptr_t) &match, sizeof (uchar)); bwrite(nhfp->fd, (genericptr_t) rgrm, sizeof (struct rm)); } - if (nhfp->fieldlevel) { - sfo_uchar(nhfp, &match, "levl", "match", 1); - sfo_rm(nhfp, rgrm, "levl", "rgrm", 1); - } } return; } @@ -744,13 +661,6 @@ boolean rlecomp; if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) levl, sizeof levl); } - if (nhfp->fieldlevel) { - int c, r; - - for (c = 0; c < COLNO; ++c) - for (r = 0; r < ROWNO; ++r) - sfo_rm(nhfp, &g.level.locations[c][r], "room", "levl", 1); - } } /* used when saving a level and also when saving dungeon overview data */ @@ -766,8 +676,6 @@ struct cemetery **cemeteryaddr; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &flag, sizeof flag); - if (nhfp->fieldlevel) - sfo_int(nhfp, &flag, "cemetery", "cemetery_flag", 1); } nextbones = *cemeteryaddr; while ((thisbones = nextbones) != 0) { @@ -775,8 +683,6 @@ struct cemetery **cemeteryaddr; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) thisbones, sizeof *thisbones); - if (nhfp->fieldlevel) - sfo_cemetery(nhfp, thisbones, "cemetery", "cemetery", 1); } if (release_data(nhfp)) free((genericptr_t) thisbones); @@ -798,15 +704,11 @@ NHFILE *nhfp; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &xl, sizeof xl); - if (nhfp->fieldlevel) - sfo_unsigned(nhfp, &xl, "damage", "damage_count", 1); } while (xl--) { if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) damageptr, sizeof *damageptr); - if (nhfp->fieldlevel) - sfo_damage(nhfp, damageptr, "damage", "damage", 1); } tmp_dam = damageptr; damageptr = damageptr->next; @@ -829,22 +731,14 @@ struct obj *otmp; bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); bwrite(nhfp->fd, (genericptr_t) otmp, buflen); } - if (nhfp->fieldlevel) { - sfo_int(nhfp, &buflen, "obj", "obj_length", 1); - sfo_obj(nhfp, otmp, "obj", "obj", 1); - } if (otmp->oextra) { buflen = ONAME(otmp) ? (int) strlen(ONAME(otmp)) + 1 : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "obj", "oname_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) ONAME(otmp), buflen); - if (nhfp->fieldlevel) - sfo_str(nhfp, ONAME(otmp), "obj", "oname", buflen); } /* defer to savemon() for this one */ if (OMONST(otmp)) { @@ -852,43 +746,29 @@ struct obj *otmp; } else { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &zerobuf, sizeof zerobuf); - if (nhfp->fieldlevel) - sfo_int(nhfp, &zerobuf, "obj", "omonst_length", 1); } buflen = OMID(otmp) ? (int) sizeof (unsigned) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "obj", "omid_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) OMID(otmp), buflen); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "obj", "omid_length", 1); } /* TODO: post 3.6.x, get rid of this */ buflen = OLONG(otmp) ? (int) sizeof (long) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "obj", "olong_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) OLONG(otmp), buflen); - if (nhfp->fieldlevel) - sfo_long(nhfp, OLONG(otmp), "obj", "olong", 1); } buflen = OMAILCMD(otmp) ? (int) strlen(OMAILCMD(otmp)) + 1 : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "obj", "omailcmd_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) OMAILCMD(otmp), buflen); - if (nhfp->fieldlevel) - sfo_str(nhfp, OMAILCMD(otmp), "obj", "omailcmd", buflen); } } } @@ -939,8 +819,6 @@ register struct obj *otmp; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &minusone, sizeof (int)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &minusone, "obj", "obj_length", 1); } } @@ -958,83 +836,53 @@ struct monst *mtmp; bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); bwrite(nhfp->fd, (genericptr_t) mtmp, buflen); } - if (nhfp->fieldlevel) { - sfo_int(nhfp, &buflen, "mon", "monst_length", 1); - sfo_monst(nhfp, mtmp, "mon", "monst", 1); - } if (mtmp->mextra) { buflen = MNAME(mtmp) ? (int) strlen(MNAME(mtmp)) + 1 : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "mon", "mname_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) MNAME(mtmp), buflen); - if (nhfp->fieldlevel) - sfo_str(nhfp, MNAME(mtmp), "mon", "mname", buflen); } buflen = EGD(mtmp) ? (int) sizeof (struct egd) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "mon", "egd_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) EGD(mtmp), buflen); - if (nhfp->fieldlevel) - sfo_egd(nhfp, EGD(mtmp), "mon", "egd", 1); } buflen = EPRI(mtmp) ? (int) sizeof (struct epri) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "mon", "epri_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) EPRI(mtmp), buflen); - if (nhfp->fieldlevel) - sfo_epri(nhfp, EPRI(mtmp), "mon", "epri", 1); } buflen = ESHK(mtmp) ? (int) sizeof (struct eshk) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof (int)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "mon", "eshk_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) ESHK(mtmp), buflen); - if (nhfp->fieldlevel) - sfo_eshk(nhfp, ESHK(mtmp), "mon", "eshk", 1); } buflen = EMIN(mtmp) ? (int) sizeof (struct emin) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof (int)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "mon", "emin_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) EMIN(mtmp), buflen); - if (nhfp->fieldlevel) - sfo_emin(nhfp, EMIN(mtmp), "mon", "emin", 1); } buflen = EDOG(mtmp) ? (int) sizeof (struct edog) : 0; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof (int)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &buflen, "mon", "edog_length", 1); if (buflen > 0) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) EDOG(mtmp), buflen); - if (nhfp->fieldlevel) - sfo_edog(nhfp, EDOG(mtmp), "mon", "edog", 1); } /* mcorpsenm is inline int rather than pointer to something, so doesn't need to be preceded by a length field */ if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &MCORPSENM(mtmp), sizeof MCORPSENM(mtmp)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &MCORPSENM(mtmp), "mon", "mcorpsenm", 1); } } @@ -1069,8 +917,6 @@ register struct monst *mtmp; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &minusone, sizeof (int)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &minusone, "mon", "monst_length", 1); } } @@ -1088,8 +934,6 @@ register struct trap *trap; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) trap, sizeof *trap); - if (nhfp->fieldlevel) - sfo_trap(nhfp, trap, "trap", "trap", 1); } if (release_data(nhfp)) dealloc_trap(trap); @@ -1098,8 +942,6 @@ register struct trap *trap; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &zerotrap, sizeof zerotrap); - if (nhfp->fieldlevel) - sfo_trap(nhfp, &zerotrap, "trap", "trap", 1); } } @@ -1121,8 +963,6 @@ NHFILE *nhfp; if (f1->fid >= 0 && perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) f1, sizeof *f1); - if (nhfp->fieldlevel) - sfo_fruit(nhfp, f1, "fruit", "fruit", 1); } if (release_data(nhfp)) dealloc_fruit(f1); @@ -1131,8 +971,6 @@ NHFILE *nhfp; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &zerofruit, sizeof zerofruit); - if (nhfp->fieldlevel) - sfo_fruit(nhfp, &zerofruit, "fruit", "terminator", 1); } if (release_data(nhfp)) g.ffruit = 0; @@ -1152,16 +990,12 @@ NHFILE *nhfp; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &cnt, sizeof cnt); - if (nhfp->fieldlevel) - sfo_int(nhfp, &cnt, "levchn", "lev_count", 1); } for (tmplev = g.sp_levchn; tmplev; tmplev = tmplev2) { tmplev2 = tmplev->next; if (perform_bwrite(nhfp)) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) tmplev, sizeof *tmplev); - if (nhfp->fieldlevel) - sfo_s_level(nhfp, tmplev, "levchn", "s_level", 1); } if (release_data(nhfp)) free((genericptr_t) tmplev); @@ -1183,10 +1017,6 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) g.plname, plsiztmp); bufon(nhfp->fd); } - if (nhfp->fieldlevel) { - sfo_int(nhfp, &plsiztmp, "plname", "plname_size", 1); - sfo_str(nhfp, g.plname, "plname", "g.plname", plsiztmp); - } return; } @@ -1214,16 +1044,10 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) &msglen, sizeof msglen); bwrite(nhfp->fd, (genericptr_t) msg, msglen); } - if (nhfp->fieldlevel) { - sfo_int(nhfp, &msglen, "msghistory", "msghistory_length", 1); - sfo_str(nhfp, msg, "msghistory", "msg", msglen); - } ++msgcount; } if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &minusone, sizeof (int)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &minusone, "msghistory", "msghistory_length", 1); } debugpline1("Stored %d messages into savefile.", msgcount); /* note: we don't attempt to handle release_data() here */ @@ -1250,9 +1074,6 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) &sfsaveinfo, (unsigned) sizeof sfsaveinfo); bufon(nhfp->fd); } - if (nhfp->fieldlevel) { - sfo_savefile_info(nhfp, &sfsaveinfo, "savefileinfo", "savefile_info", 1); - } return; } @@ -1281,7 +1102,6 @@ freedynamicdata() #endif zero_nhfile(&tnhfp); /* also sets fd to -1 */ tnhfp.mode = FREEING; - unload_qtlist(); free_menu_coloring(); free_invbuf(); /* let_to_name (invent.c) */ free_youbuf(); /* You_buf,&c (pline.c) */ diff --git a/src/sfascii.c b/src/sfascii.c deleted file mode 100644 index 22508db4a..000000000 --- a/src/sfascii.c +++ /dev/null @@ -1,1151 +0,0 @@ -/* NetHack 3.6 sfascii.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ -/* Copyright (c) Michael Allison, 2019. */ -/* NetHack may be freely redistributed. See license for details. */ - -#include "hack.h" -#include "integer.h" -#include "sfprocs.h" - -#ifdef MACOSX -extern long long FDECL(atoll, (const char *)); -#endif - -static void FDECL(put_savefield, (NHFILE *, char *, size_t)); -char *FDECL(get_savefield, (NHFILE *, char *, size_t)); -#ifdef SAVEFILE_DEBUGGING -void FDECL(report_problem_ascii, (NHFILE *, const char *, const char *, const char *)); -#endif - -struct sf_procs ascii_sfo_procs = { - ".ascii", - { - ascii_sfo_aligntyp, - ascii_sfo_any, - ascii_sfo_bitfield, - ascii_sfo_boolean, - ascii_sfo_char, - ascii_sfo_genericptr, - ascii_sfo_int, - ascii_sfo_long, - ascii_sfo_schar, - ascii_sfo_short, - ascii_sfo_size_t, - ascii_sfo_time_t, - ascii_sfo_unsigned, - ascii_sfo_uchar, - ascii_sfo_uint, - ascii_sfo_ulong, - ascii_sfo_ushort, - ascii_sfo_xchar, - ascii_sfo_str, - ascii_sfo_addinfo, - } -}; - -struct sf_procs ascii_sfi_procs = -{ - ".ascii", - { - ascii_sfi_aligntyp, - ascii_sfi_any, - ascii_sfi_bitfield, - ascii_sfi_boolean, - ascii_sfi_char, - ascii_sfi_genericptr, - ascii_sfi_int, - ascii_sfi_long, - ascii_sfi_schar, - ascii_sfi_short, - ascii_sfi_size_t, - ascii_sfi_time_t, - ascii_sfi_unsigned, - ascii_sfi_uchar, - ascii_sfi_uint, - ascii_sfi_ulong, - ascii_sfi_ushort, - ascii_sfi_xchar, - ascii_sfi_str, - ascii_sfi_addinfo, - } -}; - -static char linebuf[BUFSZ]; -static char outbuf[BUFSZ]; - -/* - *---------------------------------------------------------------------------- - * sfo_def_ routines - * - * Default output routines. - * - *---------------------------------------------------------------------------- - */ - -void -ascii_sfo_any(nhfp, d_any, myparent, myname, cnt) -NHFILE *nhfp; -union any *d_any; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - const char *parent = "any"; - - nhUse(parent); - Sprintf(outbuf, "%llx", (unsigned long long) d_any->a_void); - put_savefield(nhfp, outbuf, BUFSZ); - - Sprintf(outbuf, "%lu", d_any->a_ulong); - put_savefield(nhfp, outbuf, BUFSZ); - - Sprintf(outbuf, "%ld", d_any->a_long); - put_savefield(nhfp, outbuf, BUFSZ); - - Sprintf(outbuf, "%d", d_any->a_uint); - put_savefield(nhfp, outbuf, BUFSZ); - - Sprintf(outbuf, "%d", d_any->a_int);; - put_savefield(nhfp, outbuf, BUFSZ); - - Sprintf(outbuf, "%hd", (short) d_any->a_char); - put_savefield(nhfp, outbuf, BUFSZ); - -#if 0 - sfo_genericptr(nhfp, d_any->a_void, parent, "a_void", 1); /* (genericptr_t) */ - sfo_genericptr(nhfp, d_any->a_obj, parent, "a_obj", 1); /* (struct obj *) */ - sfo_genericptr(nhfp, d_any->a_monst, parent, "a_monst", 1); /* (struct monst *) */ - sfo_int(nhfp, &d_any->a_int, parent, "a_int", 1); /* (int) */ - sfo_char(nhfp, &d_any->a_char, parent, "a_char", 1); /* (char) */ - sfo_schar(nhfp, &d_any->a_schar, parent, "a_schar", 1); /* (schar) */ - sfo_uchar(nhfp, &d_any->a_uchar, parent, "a_uchar", 1); /* (uchar) */ - sfo_uint(nhfp, &d_any->a_uint, parent, "a_uint", 1); /* (unsigned int) */ - sfo_long(nhfp, &d_any->a_long, parent, "a_long", 1); /* (long) */ - sfo_ulong(nhfp, &d_any->a_ulong, parent, "a_ulong", 1); /* (unsigned long) */ - sfo_genericptr(nhfp, d_any->a_iptr, parent, "a_iptr", 1); /* (int *) */ - sfo_genericptr(nhfp, d_any->a_lptr, parent, "a_lptr", 1); /* (long *) */ - sfo_genericptr(nhfp, d_any->a_ulptr, parent, "a_ulptr", 1); /* (unsigned long *) */ - sfo_genericptr(nhfp, d_any->a_uptr, parent, "a_uptr", 1); /* (unsigned *) */my - sfo_genericptr(nhfp, d_any->a_string, parent, "a_string", 1); /* (const char *) */ - sfo_ulong(nhfp, &d_any->a_mask32, parent, "a_mask32", 1); /* (unsigned long) */ -#endif -} - -void -ascii_sfo_aligntyp(nhfp, d_aligntyp, myparent, myname, cnt) -NHFILE *nhfp; -aligntyp *d_aligntyp; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - int itmp; - const char *parent = "aligntyp"; - - nhUse(parent); - itmp = (int) *d_aligntyp; - Sprintf(outbuf, "%d", (short) itmp); - put_savefield(nhfp, outbuf, BUFSZ); -} - -void -ascii_sfo_bitfield(nhfp, d_bitfield, myparent, myname, cnt) -NHFILE *nhfp; -uint8_t *d_bitfield; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - const char *parent = "bitfield"; - - nhUse(parent); - /* for bitfields, cnt is the number of bits, not an array */ - Sprintf(outbuf, "%hu", (unsigned short) *d_bitfield); - put_savefield(nhfp, outbuf, BUFSZ); -} - -void -ascii_sfo_boolean(nhfp, d_boolean, myparent, myname, cnt) -NHFILE *nhfp; -boolean *d_boolean; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "boolean"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%s)\n", (*d_boolean) ? "TRUE" : "FALSE"); - Sprintf(outbuf, "%s", *d_boolean ? "true" : "false"); - put_savefield(nhfp, outbuf, BUFSZ); - d_boolean++; - } -} - -void -ascii_sfo_char(nhfp, d_char, myparent, myname, cnt) -NHFILE *nhfp; -char *d_char; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i = cnt; - const char *parent = "char"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%s)\n", d_char ? d_char : ""); - Sprintf(outbuf, "%hd", (short) *d_char); - put_savefield(nhfp, outbuf, BUFSZ); - d_char++; - } -} - -void -ascii_sfo_genericptr(nhfp, d_genericptr, myparent, myname, cnt) -NHFILE *nhfp; -genericptr_t *d_genericptr; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - unsigned long tmp; - char *byteptr = (char *) d_genericptr; - const char *parent = "genericptr"; - - nhUse(parent); - /* - * sbrooms is an array of pointers to mkroom. - * That array dimension is MAX_SUBROOMS. - * Even though the pointers themselves won't - * be valid, we need to account for the existence - * of that array and perhaps zero or non-zero. - */ - for (i = 0; i < cnt; ++i) { - tmp = (*d_genericptr) ? 1UL : 0UL; - Sprintf(outbuf, "%08lu", tmp); - put_savefield(nhfp, outbuf, BUFSZ); - if (cnt > 1) { - byteptr += sizeof(void *); - d_genericptr = (genericptr_t) byteptr; - } - } -} - -void -ascii_sfo_int(nhfp, d_int, myparent, myname, cnt) -NHFILE *nhfp; -int *d_int; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "int"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - Sprintf(outbuf, "%d", *d_int); - put_savefield(nhfp, outbuf, BUFSZ); - d_int++; - } -} - -void -ascii_sfo_long(nhfp, d_long, myparent, myname, cnt) -NHFILE *nhfp; -long *d_long; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "long"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - Sprintf(outbuf, "%ld", *d_long); - put_savefield(nhfp, outbuf, BUFSZ); - d_long++; - } -} - -void -ascii_sfo_schar(nhfp, d_schar, myparent, myname, cnt) -NHFILE *nhfp; -schar *d_schar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i, itmp; - const char *parent = "schar"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - itmp = (int) *d_schar; - Sprintf(outbuf, "%d", itmp); - put_savefield(nhfp, outbuf, BUFSZ); - d_schar++; - } -} - -void -ascii_sfo_short(nhfp, d_short, myparent, myname, cnt) -NHFILE *nhfp; -short *d_short; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "short"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - Sprintf(outbuf, "%hd", *d_short); - put_savefield(nhfp, outbuf, BUFSZ); - d_short++; - } -} - -void -ascii_sfo_size_t(nhfp, d_size_t, myparent, myname, cnt) -NHFILE *nhfp; -size_t *d_size_t; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "size_t"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - unsigned long ul = (unsigned long) *d_size_t; - - Sprintf(outbuf, "%lu", ul); - put_savefield(nhfp, outbuf, BUFSZ); - d_size_t++; - } -} - -void -ascii_sfo_time_t(nhfp, d_time_t, myparent, myname, cnt) -NHFILE *nhfp; -time_t *d_time_t; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - const char *parent = "time_t"; - - nhUse(parent); - Sprintf(outbuf, "%s", yyyymmddhhmmss(*d_time_t)); - put_savefield(nhfp, outbuf, BUFSZ); -} - -void -ascii_sfo_unsigned(nhfp, d_unsigned, myparent, myname, cnt) -NHFILE *nhfp; -unsigned *d_unsigned; -const char *myparent; -const char *myname; -int cnt; -{ - ascii_sfo_uint(nhfp, d_unsigned, myparent, myname, cnt); -} - -void -ascii_sfo_uchar(nhfp, d_uchar, myparent, myname, cnt) -NHFILE *nhfp; -unsigned char *d_uchar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "uchar"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - unsigned short us = (unsigned short) *d_uchar; - - Sprintf(outbuf, "%hu", us); - put_savefield(nhfp, outbuf, BUFSZ); - d_uchar++; - } -} - -void -ascii_sfo_uint(nhfp, d_uint, myparent, myname, cnt) -NHFILE *nhfp; -unsigned int *d_uint; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "uint"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - Sprintf(outbuf, "%u", *d_uint); - put_savefield(nhfp, outbuf, BUFSZ); - d_uint++; - } -} - -void -ascii_sfo_ulong(nhfp, d_ulong, myparent, myname, cnt) -NHFILE *nhfp; -unsigned long *d_ulong; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "ulong"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - Sprintf(outbuf, "%lu", *d_ulong); - put_savefield(nhfp, outbuf, BUFSZ); - d_ulong++; - } -} - -void -ascii_sfo_ushort(nhfp, d_ushort, myparent, myname, cnt) -NHFILE *nhfp; -unsigned short *d_ushort; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "ushort"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - Sprintf(outbuf, "%hu", *d_ushort); - put_savefield(nhfp, outbuf, BUFSZ); - d_ushort++; - } -} - -void -ascii_sfo_xchar(nhfp, d_xchar, myparent, myname, cnt) -NHFILE *nhfp; -xchar *d_xchar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "xchar"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - short tmp; - - tmp = (short) *d_xchar; - Sprintf(outbuf, "%hu", tmp); - put_savefield(nhfp, outbuf, BUFSZ); - d_xchar++; - } -} - -static char strbuf[BUFSZ * 4]; - -void -ascii_sfo_str(nhfp, d_str, myparent, myname, cnt) -NHFILE *nhfp; -char *d_str; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i, j, intval; - const char *parent = "str"; - char sval[QBUFSZ], *src = d_str, *dest = strbuf; - - nhUse(parent); - /* cnt is the number of characters */ - for (i = 0; i < cnt; ++i) { - if ((*src < 32) || (*src == '\\') || (*src > 127)) { - *dest++ = '\\'; - intval = (int) *src++; - Sprintf(sval, "%03d", intval); - for (j = 0; j < 3; ++j) - *dest++ = sval[j]; - } else { - *dest++ = *src++; - } - } - put_savefield(nhfp, strbuf, BUFSZ * 4); -} - -void -ascii_sfo_addinfo(nhfp, parent, action, myname, indx) -NHFILE *nhfp UNUSED; -const char *parent UNUSED, *action UNUSED, *myname UNUSED; -int indx UNUSED; -{ - /* ignored */ -} - - -static void -put_savefield(nhfp, obuf, outbufsz) -NHFILE *nhfp; -char *obuf; -size_t outbufsz UNUSED; -{ - nhfp->count++; - fprintf(nhfp->fpdef, "%07ld|%s\n", nhfp->count, obuf); -} - -/* - *---------------------------------------------------------------------------- - * ascii_sfi_ routines called from functions in sfi_base.c - *---------------------------------------------------------------------------- - */ - -void -ascii_sfi_any(nhfp, d_any, myparent, myname, cnt) -NHFILE *nhfp; -union any *d_any; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - char *rstr; - long long tmp; - const char *parent = "any"; - - nhUse(parent); - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = atoll(rstr); - d_any->a_void = (void *) tmp; - - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = atoll(rstr); - d_any->a_ulong = (unsigned long) tmp; - - rstr = get_savefield(nhfp, linebuf, BUFSZ); - d_any->a_long = atol(rstr); - - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = atoll(rstr); - d_any->a_uint = (unsigned int) tmp; - - rstr = get_savefield(nhfp, linebuf, BUFSZ); - d_any->a_int = atoi(rstr); - - rstr = get_savefield(nhfp, linebuf, BUFSZ); - d_any->a_char = (char) atoi(rstr); - -#if 0 - sfi_genericptr(nhfp, d_any->a_void, parent, "a_void", 1); - sfi_genericptr(nhfp, d_any->a_obj, parent, "a_obj", 1); - sfi_genericptr(nhfp, d_any->a_monst, parent, "a_monst", 1); - sfi_int(nhfp, &d_any->a_int, parent, "a_int", 1); - sfi_char(nhfp, &d_any->a_char, parent, "a_char", 1); - sfi_schar(nhfp, &d_any->a_schar, parent, "a_schar", 1); - sfi_uchar(nhfp, &d_any->a_uchar, parent, "a_uchar", 1); - sfi_uint(nhfp, &d_any->a_uint, parent, "a_uint", 1); - sfi_long(nhfp, &d_any->a_long, parent, "a_long", 1); - sfi_ulong(nhfp, &d_any->a_ulong, parent, "a_ulong", 1); - sfi_genericptr(nhfp, d_any->a_iptr, parent, "a_iptr", 1); - sfi_genericptr(nhfp, d_any->a_lptr, parent, "a_lptr", 1); - sfi_genericptr(nhfp, d_any->a_ulptr, parent, "a_ulptr", 1); - sfi_genericptr(nhfp, d_any->a_uptr, parent, "a_uptr", 1); - sfi_genericptr(nhfp, d_any->a_string, parent, "a_string", 1); - sfi_ulong(nhfp, &d_any->a_mask32, parent, "a_mask32", 1); -#endif -} - -void -ascii_sfi_aligntyp(nhfp, d_aligntyp, myparent, myname, cnt) -NHFILE *nhfp; -aligntyp *d_aligntyp; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - char *rstr; - aligntyp tmp; - long long lltmp; - const char *parent = "aligntyp"; - - nhUse(parent); - rstr = get_savefield(nhfp, linebuf, BUFSZ); - lltmp = atoll(rstr); - tmp = (aligntyp) lltmp; -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_aligntyp) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_aligntyp = tmp; -} - -void -ascii_sfi_bitfield(nhfp, d_bitfield, myparent, myname, cnt) -NHFILE *nhfp; -uint8_t *d_bitfield; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - char *rstr; - uint8_t tmp; - const char *parent = "bitfield"; - - nhUse(parent); - /* cnt is the number of bits in the bitfield, not an array dimension */ - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = (uint8_t) atoi(rstr); -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_bitfield) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_bitfield = tmp; -} - -void -ascii_sfi_boolean(nhfp, d_boolean, myparent, myname, cnt) -NHFILE *nhfp; -boolean *d_boolean; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - char *rstr; - int i; - const char *parent = "boolean"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); -#ifdef SAVEFILE_DEBUGGING - if (!strcmpi(rstr, "false") && - !strcmpi(rstr, "true")) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - if (!strcmpi(rstr, "false")) - *d_boolean = FALSE; - else - *d_boolean = TRUE; - d_boolean++; - } -} - -void -ascii_sfi_char(nhfp, d_char, myparent, myname, cnt) -NHFILE *nhfp; -char *d_char; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - char *rstr; - int i; - char tmp; - const char *parent = "char"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = (char) atoi(rstr); -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_char) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_char = tmp; - d_char++; - } -} - -void -ascii_sfi_genericptr(nhfp, d_genericptr, myparent, myname, cnt) -NHFILE *nhfp; -genericptr_t *d_genericptr; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - long long lltmp; - char *rstr; - const char *parent = "genericptr"; - static const char *glorkum = "glorkum"; - char *byteptr = (char *) d_genericptr; - - nhUse(parent); - /* - * sbrooms is an array of pointers to mkroom. - * That array dimension is MAX_SUBROOMS. - * Even though the pointers themselves won't - * be valid, we need to account for the existence - * of that array. - */ - for (i = 0; i < cnt; ++i) { - /* these pointers can't actually be valid */ - byteptr = (char *) d_genericptr; - rstr = get_savefield(nhfp, linebuf, BUFSZ); - lltmp = atoll(rstr); - *d_genericptr = lltmp ? (genericptr_t) glorkum : (genericptr_t) 0; - if (cnt > 1) { - byteptr += sizeof(void *); - d_genericptr = (genericptr_t) byteptr; - } - } -} - -void -ascii_sfi_int(nhfp, d_int, myparent, myname, cnt) -NHFILE *nhfp; -int *d_int; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i, tmp; - char *rstr; - long long lltmp; - const char *parent = "int"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - lltmp = atoll(rstr); - tmp = (int) lltmp; -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_int) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_int = tmp; - d_int++; - } -} - -void -ascii_sfi_long(nhfp, d_long, myparent, myname, cnt) -NHFILE *nhfp; -long *d_long; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - long tmp; - long long lltmp; - char *rstr; - const char *parent = "long"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - lltmp = atoll(rstr); - tmp = (long) lltmp; -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_long) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_long = tmp; - d_long++; - } -} - -void -ascii_sfi_schar(nhfp, d_schar, myparent, myname, cnt) -NHFILE *nhfp; -schar *d_schar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - schar tmp; - char *rstr; - const char *parent = "schar"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = (schar) atoi(rstr); -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_schar) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_schar = tmp; - d_schar++; - } -} - -void -ascii_sfi_short(nhfp, d_short, myparent, myname, cnt) -NHFILE *nhfp; -short *d_short; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - short tmp; - char *rstr; - const char *parent = "short"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = (short) atoi(rstr); -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_short) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_short = tmp; - d_short++; - } -} - -void -ascii_sfi_size_t(nhfp, d_size_t, myparent, myname, cnt) -NHFILE *nhfp; -size_t *d_size_t; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - size_t tmp; - char *rstr; - const char *parent = "size_t"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = (size_t) atol(rstr); -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_size_t) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_size_t = tmp; - d_size_t++; - } -} - -void -ascii_sfi_time_t(nhfp, d_time_t, myparent, myname, cnt) -NHFILE *nhfp; -time_t *d_time_t; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - int i; - time_t tmp; - char *rstr; - const char *parent = "time_t"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - tmp = time_from_yyyymmddhhmmss(rstr); -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_time_t) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_time_t = tmp; - d_time_t++; - } -} - -void -ascii_sfi_unsigned(nhfp, d_unsigned, myparent, myname, cnt) -NHFILE *nhfp; -unsigned *d_unsigned; -const char *myparent; -const char *myname; -int cnt; -{ - /* deferal */ - ascii_sfi_uint(nhfp, d_unsigned, myparent, myname, cnt); -} - -void -ascii_sfi_uchar(nhfp, d_uchar, myparent, myname, cnt) -NHFILE *nhfp; -unsigned char *d_uchar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - uchar tmp; - int i, itmp; - char *rstr; - const char *parent = "uchar"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - itmp = atoi(rstr); - tmp = (char ) itmp; -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_uchar) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_uchar = tmp; - d_uchar++; - } -} - -void -ascii_sfi_uint(nhfp, d_uint, myparent, myname, cnt) -NHFILE *nhfp; -unsigned int *d_uint; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - char *rstr; - unsigned int tmp; - long long lltmp; - const char *parent = "uint"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - lltmp = atoll(rstr); - tmp = (unsigned int) lltmp; -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_uint) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_uint = tmp; - d_uint++; - } -} - -void -ascii_sfi_ulong(nhfp, d_ulong, myparent, myname, cnt) -NHFILE *nhfp; -unsigned long *d_ulong; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - unsigned long tmp; - long long lltmp; - char *rstr; - const char *parent = "ulong"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - lltmp = atoll(rstr); - tmp = (unsigned long) lltmp; -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_ulong) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_ulong = tmp; - d_ulong++; - } -} - -void -ascii_sfi_ushort(nhfp, d_ushort, myparent, myname, cnt) -NHFILE *nhfp; -unsigned short *d_ushort; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - short tmp; - long long lltmp; - char *rstr; - const char *parent = "ushort"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - lltmp = atoll(rstr); - tmp = (unsigned short) lltmp; -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_ushort) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_ushort = tmp; - d_ushort++; - } -} - -void -ascii_sfi_xchar(nhfp, d_xchar, myparent, myname, cnt) -NHFILE *nhfp; -xchar *d_xchar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - xchar tmp; - int i, itmp; - char *rstr; - const char *parent = "xchar"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - rstr = get_savefield(nhfp, linebuf, BUFSZ); - itmp = atoi(rstr); - tmp = (xchar) itmp; -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel && tmp != *d_xchar) - report_problem_ascii(nhfp, myparent, myname, parent); - else -#endif - *d_xchar = tmp; - d_xchar++; - } -} - -static char strbuf[BUFSZ * 4]; - -void -ascii_sfi_str(nhfp, d_str, myparent, myname, cnt) -NHFILE *nhfp; -char *d_str; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i, j, sval; - char n[4], *rstr; - const char *parent = "str"; - char *src, *dest; -#ifdef SAVEFILE_DEBUGGING - boolean match; - char testbuf[BUFSZ]; -#endif - - nhUse(parent); - /* cnt is the length of the string */ - rstr = get_savefield(nhfp, strbuf, BUFSZ * 4); - src = rstr; - dest = -#ifdef SAVEFILE_DEBUGGING - testbuf; -#else - d_str; -#endif - - for (i = 0; i < cnt; ++i) { - if (*src == '\\') { - src++; - for (j = 0; j < 4; ++j) { - if (j < 3) - n[j] = *src++; - else - n[j] = '\0'; - } - sval = atoi(n); - *dest++ = (char) sval; - } else - *dest++ = *src++; - } -#ifdef SAVEFILE_DEBUGGING - if (nhfp->structlevel) { - src = testbuf; - dest = d_str; - match = TRUE; - for (i = 0; i < cnt; ++i) { - if (*src++ != *dest++) - match = FALSE; - } - if (!match) - report_problem_ascii(nhfp, myparent, myname, parent); - else { - src = testbuf; - dest = d_str; - for (i = 0; i < cnt; ++i) - *dest++ = *src++; - } - } -#endif -} - -void -ascii_sfi_addinfo(nhfp, myparent, action, myname, indx) -NHFILE *nhfp UNUSED; -const char *myparent UNUSED, *action UNUSED, *myname UNUSED; -int indx UNUSED; -{ - /* not doing anything here */ -} - -char * -get_savefield(nhfp, inbuf, inbufsz) -NHFILE *nhfp; -char *inbuf; -size_t inbufsz; -{ - char *ep, *sep; - - if (fgets(inbuf, (int) inbufsz, nhfp->fpdef)) { - nhfp->count++; - ep = index(inbuf, '\n'); - if (!ep) { /* newline missing */ - if (strlen(inbuf) < (inbufsz - 2)) { - /* likely the last line of file is just - missing a newline; process it anyway */ - ep = eos(inbuf); - } - } - if (ep) - *ep = '\0'; /* remove newline */ - sep = index(inbuf, '|'); - if (sep) - sep++; - - return sep; - } - inbuf[0] = '\0'; - nhfp->eof = TRUE; - return inbuf; -} - -#ifdef SAVEFILE_DEBUGGING -void -report_problem_ascii(nhfp, s1, s2, s3) -NHFILE *nhfp; -const char *s1, *s2, *s3; -{ - fprintf(nhfp->fpdebug, "faulty value preservation " - "(%ld, %s, %s, %s)\n", nhfp->count, s1, s2, s3); -} -#endif - - diff --git a/src/sfbase.c b/src/sfbase.c deleted file mode 100644 index 8f81817b3..000000000 --- a/src/sfbase.c +++ /dev/null @@ -1,646 +0,0 @@ -/* NetHack 3.6 sf_base.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ -/* Copyright (c) Michael Allison, 2019. */ -/* NetHack may be freely redistributed. See license for details. */ - -#include "hack.h" -#include "integer.h" -#include "sfprocs.h" - -struct sf_procs sfoprocs[4], sfiprocs[4], - zerosfoprocs = {0}, zerosfiprocs = {0}; - -void FDECL(sfi_log, (NHFILE *, const char *, const char *, const char *, int)); - -/* - *---------------------------------------------------------------------------- - * initialize the function pointers. These are called from initoptions_init(). - *---------------------------------------------------------------------------- - */ - -void -sf_init() -{ - sfoprocs[invalid] = zerosfoprocs; - sfiprocs[invalid] = zerosfiprocs; - sfoprocs[historical] = zerosfoprocs; - sfiprocs[historical] = zerosfiprocs; - sfoprocs[lendian] = lendian_sfo_procs; - sfiprocs[lendian] = lendian_sfi_procs; - sfoprocs[ascii] = ascii_sfo_procs; - sfiprocs[ascii] = ascii_sfi_procs; -} - -/* - *---------------------------------------- - * routines called from engine core and - * from functions in generated sfdata.c - *---------------------------------------- - */ - -void -sfo_any(nhfp, d_any, myparent, myname, cnt) - NHFILE *nhfp; -union any *d_any; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_any)(nhfp, d_any, myparent, myname, cnt); -} - -void -sfo_aligntyp(nhfp, d_aligntyp, myparent, myname, cnt) -NHFILE *nhfp; -aligntyp *d_aligntyp; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_aligntyp)(nhfp, d_aligntyp, myparent, myname, cnt); -} - -void -sfo_bitfield(nhfp, d_bitfield, myparent, myname, cnt) -NHFILE *nhfp; -uint8_t *d_bitfield; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_bitfield)(nhfp, d_bitfield, myparent, myname, cnt); -} - -void -sfo_boolean(nhfp, d_boolean, myparent, myname, cnt) -NHFILE *nhfp; -boolean *d_boolean; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_boolean)(nhfp, d_boolean, myparent, myname, cnt); -} - -void -sfo_char(nhfp, d_char, myparent, myname, cnt) -NHFILE *nhfp; -char *d_char; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_char)(nhfp, d_char, myparent, myname, cnt); -} - -void -sfo_genericptr(nhfp, d_genericptr, myparent, myname, cnt) -NHFILE *nhfp; -genericptr_t d_genericptr; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_genericptr)(nhfp, d_genericptr, myparent, myname, cnt); -} - -void -sfo_int(nhfp, d_int, myparent, myname, cnt) -NHFILE *nhfp; -int *d_int; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_int)(nhfp, d_int, myparent, myname, cnt); -} - -void -sfo_long(nhfp, d_long, myparent, myname, cnt) -NHFILE *nhfp; -long *d_long; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_long)(nhfp, d_long, myparent, myname, cnt); -} - -void -sfo_schar(nhfp, d_schar, myparent, myname, cnt) -NHFILE *nhfp; -schar *d_schar; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_schar)(nhfp, d_schar, myparent, myname, cnt); -} - -void -sfo_short(nhfp, d_short, myparent, myname, cnt) -NHFILE *nhfp; -short *d_short; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_short)(nhfp, d_short, myparent, myname, cnt); -} - -void -sfo_size_t(nhfp, d_size_t, myparent, myname, cnt) -NHFILE *nhfp; -size_t *d_size_t; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_size_t)(nhfp, d_size_t, myparent, myname, cnt); -} - -void -sfo_time_t(nhfp, d_time_t, myparent, myname, cnt) -NHFILE *nhfp; -time_t *d_time_t; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_time_t)(nhfp, d_time_t, myparent, myname, cnt); -} - -void -sfo_unsigned(nhfp, d_unsigned, myparent, myname, cnt) -NHFILE *nhfp; -unsigned *d_unsigned; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_unsigned)(nhfp, d_unsigned, myparent, myname, cnt); -} - -void -sfo_uchar(nhfp, d_uchar, myparent, myname, cnt) -NHFILE *nhfp; -unsigned char *d_uchar; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_uchar)(nhfp, d_uchar, myparent, myname, cnt); -} - -void -sfo_uint(nhfp, d_uint, myparent, myname, cnt) -NHFILE *nhfp; -unsigned int *d_uint; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_uint)(nhfp, d_uint, myparent, myname, cnt); -} - -void -sfo_ulong(nhfp, d_ulong, myparent, myname, cnt) -NHFILE *nhfp; -unsigned long *d_ulong; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_ulong)(nhfp, d_ulong, myparent, myname, cnt); -} - -void -sfo_ushort(nhfp, d_ushort, myparent, myname, cnt) -NHFILE *nhfp; -unsigned short *d_ushort; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_ushort)(nhfp, d_ushort, myparent, myname, cnt); -} - -void -sfo_xchar(nhfp, d_xchar, myparent, myname, cnt) -NHFILE *nhfp; -xchar *d_xchar; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_xchar)(nhfp, d_xchar, myparent, myname, cnt); -} - -void -sfo_str(nhfp, d_str, myparent, myname, cnt) -NHFILE *nhfp; -char *d_str; -const char *myparent; -const char *myname; -int cnt; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_str)(nhfp, d_str, myparent, myname, cnt); -} - -void -sfo_addinfo(nhfp, parent, action, myname, index) -NHFILE *nhfp; -const char *parent, *action, *myname; -int index; -{ - (*sfoprocs[nhfp->fnidx].fn.sf_addinfo)(nhfp, parent, action, myname, index); -} - -/* - *---------------------------------------------------------------------------- - * routines called from core and from functions in generated sfi_data.c - *---------------------------------------------------------------------------- - */ - -void -sfi_any(nhfp, d_any, myparent, myname, cnt) -NHFILE *nhfp; -union any *d_any; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "any"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_any)(nhfp, d_any, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%ld)\n", d_any->a_long); -#endif -} - -void -sfi_aligntyp(nhfp, d_aligntyp, myparent, myname, cnt) -NHFILE *nhfp; -aligntyp *d_aligntyp; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "aligntyp"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_aligntyp)(nhfp, d_aligntyp, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%d)\n", *d_aligntyp); -#endif -} - -void -sfi_bitfield(nhfp, d_bitfield, myparent, myname, cnt) -NHFILE *nhfp; -uint8_t *d_bitfield; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "bitfield"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_bitfield)(nhfp, d_bitfield, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%hd)\n", *d_bitfield); -#endif -} - -void -sfi_boolean(nhfp, d_boolean, myparent, myname, cnt) -NHFILE *nhfp; -boolean *d_boolean; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "boolean"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_boolean)(nhfp, d_boolean, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%s)\n", (*d_boolean) ? "true" : "false"); -#endif -} - -void -sfi_char(nhfp, d_char, myparent, myname, cnt) -NHFILE *nhfp; -char *d_char; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "char"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_char)(nhfp, d_char, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%s)\n", d_char ? d_char : ""); -#endif -} - -void -sfi_genericptr(nhfp, d_genericptr, myparent, myname, cnt) -NHFILE *nhfp; -genericptr_t d_genericptr; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "genericptr"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_genericptr)(nhfp, d_genericptr, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%s)\n", (d_genericptr) ? "set" : "null"); -#endif -} - -void -sfi_int(nhfp, d_int, myparent, myname, cnt) -NHFILE *nhfp; -int *d_int; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "int"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_int)(nhfp, d_int, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%d)\n", *d_int); -#endif -} - -void -sfi_long(nhfp, d_long, myparent, myname, cnt) -NHFILE *nhfp; -long *d_long; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "long"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_long)(nhfp, d_long, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%ld)\n", *d_long); -#endif -} - -void -sfi_schar(nhfp, d_schar, myparent, myname, cnt) -NHFILE *nhfp; -schar *d_schar; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "schar"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_schar)(nhfp, d_schar, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%hd)\n", (short) *d_schar); -#endif -} - -void -sfi_short(nhfp, d_short, myparent, myname, cnt) -NHFILE *nhfp; -short *d_short; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "short"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_short)(nhfp, d_short, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%hd)\n", *d_short); -#endif -} - -void -sfi_size_t(nhfp, d_size_t, myparent, myname, cnt) -NHFILE *nhfp; -size_t *d_size_t; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "size_t"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_size_t)(nhfp, d_size_t, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%lu)\n", (unsigned long) *d_size_t); -#endif -} - -void -sfi_time_t(nhfp, d_time_t, myparent, myname, cnt) -NHFILE *nhfp; -time_t *d_time_t; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "time_t"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_time_t)(nhfp, d_time_t, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%s)\n", yyyymmddhhmmss(*d_time_t)); -#endif -} - -void -sfi_unsigned(nhfp, d_unsigned, myparent, myname, cnt) -NHFILE *nhfp; -unsigned *d_unsigned; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "unsigned"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_unsigned)(nhfp, d_unsigned, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%u)\n", *d_unsigned); -#endif -} - -void -sfi_uchar(nhfp, d_uchar, myparent, myname, cnt) -NHFILE *nhfp; -unsigned char *d_uchar; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "uchar"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_uchar)(nhfp, d_uchar, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%hu)\n", (unsigned short) *d_uchar); -#endif -} - -void -sfi_uint(nhfp, d_uint, myparent, myname, cnt) -NHFILE *nhfp; -unsigned int *d_uint; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "uint"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_uint)(nhfp, d_uint, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%u)\n", *d_uint); -#endif -} - -void -sfi_ulong(nhfp, d_ulong, myparent, myname, cnt) -NHFILE *nhfp; -unsigned long *d_ulong; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "ulong"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_ulong)(nhfp, d_ulong, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%lu)\n", *d_ulong); -#endif -} - -void -sfi_ushort(nhfp, d_ushort, myparent, myname, cnt) -NHFILE *nhfp; -unsigned short *d_ushort; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "ushort"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_ushort)(nhfp, d_ushort, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%hu)\n", *d_ushort); -#endif -} - -void -sfi_xchar(nhfp, d_xchar, myparent, myname, cnt) -NHFILE *nhfp; -xchar *d_xchar; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "xchar"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_xchar)(nhfp, d_xchar, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(%hd)\n", (short) *d_xchar); -#endif -} - -void -sfi_str(nhfp, d_str, myparent, myname, cnt) -NHFILE *nhfp; -char *d_str; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "str"; - - sfi_log(nhfp, myparent, myname, parent, cnt); - (*sfiprocs[nhfp->fnidx].fn.sf_str)(nhfp, d_str, myparent, myname, cnt); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - fprintf(nhfp->fpdebug, "(\"%s\")\n", d_str); -#endif -} - -void -sfi_addinfo(nhfp, myparent, action, myname, index) -NHFILE *nhfp; -const char *myparent, *action, *myname; -int index; -{ - if (nhfp) { - if (nhfp->fplog) - (void) fprintf(nhfp->fplog, "# %s %s %s %d\n", myparent, action, myname, index); -#ifdef DO_DEBUG - if (nhfp->fpdebug) - (void) fprintf(nhfp->fpdebug, "# %s %s %s %d\n", myparent, action, myname, index); -#endif - } - (*sfiprocs[nhfp->fnidx].fn.sf_addinfo)(nhfp, myparent, action, myname, index); -} - -void -sfi_log(nhfp, t1, t2, t3, cnt) -NHFILE *nhfp; -const char *t1, *t2, *t3; -int cnt; -{ -#ifdef DO_DEBUG -#ifdef SAVEFILE_DEBUGGING - if (nhfp) { - if (nhfp->fplog) - (void) fprintf(nhfp->fplog, "%s %s %s cnt=%d\n", t1, t2, t3, cnt); - if (nhfp->fpdebug) - (void) fprintf(nhfp->fpdebug, "%s %s %s cnt=%d ", t1, t2, t3, cnt); - } -#endif -#else - nhUse(nhfp); - nhUse(t1); - nhUse(t2); - nhUse(t3); - nhUse(cnt); -#endif -} - diff --git a/src/sfdata.c b/src/sfdata.c deleted file mode 100644 index 4ebf3d9c0..000000000 --- a/src/sfdata.c +++ /dev/null @@ -1,6049 +0,0 @@ -/* NetHack 3.7 sfdata.c $Date$ $Revision$ */ -/* Copyright (c) NetHack Development Team 2018. */ -/* NetHack may be freely redistributed. See license for details. */ - -/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE! */ - -#include "hack.h" -#include "artifact.h" -#include "func_tab.h" -#include "lev.h" -#include "integer.h" -#include "wintype.h" -#include "sfproto.h" - -#define BUILD_DATE "Tue Jun 25 09:57:33 2019" -#define BUILD_TIME (1561471053L) - -#define NHTYPE_SIMPLE 1 -#define NHTYPE_COMPLEX 2 -struct nhdatatypes_t { - unsigned int dtclass; - char *dtype; - size_t dtsize; -}; - -static uint8_t bitfield = 0; - -void -sfo_align(nhfp, d_align, myparent, myname, cnt) -NHFILE *nhfp; -struct align *d_align; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "align"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "align", 1); - - sfo_aligntyp(nhfp, &d_align->type, parent, "type", 1); /* (aligntyp) */ - sfo_int(nhfp, &d_align->record, parent, "record", 1); /* (int) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "align", 1); -} - -void -sfo_attribs(nhfp, d_attribs, myparent, myname, cnt) -NHFILE *nhfp; -struct attribs *d_attribs; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "attribs"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "attribs", 1); - - sfo_schar(nhfp, d_attribs->a, parent, "a", A_MAX); /* (schar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "attribs", 1); -} - -void -sfo_bill_x(nhfp, d_bill_x, myparent, myname, cnt) -NHFILE *nhfp; -struct bill_x *d_bill_x; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "bill_x"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "bill_x", 1); - - sfo_unsigned(nhfp, &d_bill_x->bo_id, parent, "bo_id", 1); /* (unsigned) */ - sfo_boolean(nhfp, &d_bill_x->useup, parent, "useup", 1); /* (boolean) */ - sfo_long(nhfp, &d_bill_x->price, parent, "price", 1); /* (long) */ - sfo_long(nhfp, &d_bill_x->bquan, parent, "bquan", 1); /* (long) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "bill_x", 1); -} - -void -sfo_book_info(nhfp, d_book_info, myparent, myname, cnt) -NHFILE *nhfp; -struct book_info *d_book_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "book_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "book_info", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_book_info->book, parent, "book", 1);/* (struct obj *) */ - sfo_unsigned(nhfp, &d_book_info->o_id, parent, "o_id", 1); /* (unsigned) */ - sfo_schar(nhfp, &d_book_info->delay, parent, "delay", 1); /* (schar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "book_info", 1); -} - -void -sfo_branch(nhfp, d_branch, myparent, myname, cnt) -NHFILE *nhfp; -struct branch *d_branch; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "branch"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "branch", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_branch->next, parent, "next", 1);/* (struct branch *) */ - sfo_int(nhfp, &d_branch->id, parent, "id", 1); /* (int) */ - sfo_int(nhfp, &d_branch->type, parent, "type", 1); /* (int) */ - sfo_d_level(nhfp, &d_branch->end1, parent, "end1", 1); /* (d_level) */ - sfo_d_level(nhfp, &d_branch->end2, parent, "end2", 1); /* (d_level) */ - sfo_boolean(nhfp, &d_branch->end1_up, parent, "end1_up", 1); /* (boolean) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "branch", 1); -} - -void -sfo_bubble(nhfp, d_bubble, myparent, myname, cnt) -NHFILE *nhfp; -struct bubble *d_bubble; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "bubble"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "bubble", 1); - - sfo_xchar(nhfp, &d_bubble->x, parent, "x", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_bubble->y, parent, "y", 1); /* (xchar) */ - sfo_schar(nhfp, &d_bubble->dx, parent, "dx", 1); /* (schar) */ - sfo_schar(nhfp, &d_bubble->dy, parent, "dy", 1); /* (schar) */ - sfo_uchar(nhfp, d_bubble->bm, parent, "bm", MAX_BMASK + 2); /* (uchar) */ - sfo_genericptr(nhfp, (genericptr_t) &d_bubble->prev, parent, "prev", 1);/* (struct bubble *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_bubble->next, parent, "next", 1);/* (struct bubble *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_bubble->cons, parent, "cons", 1);/* (struct container *) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "bubble", 1); -} - -void -sfo_cemetery(nhfp, d_cemetery, myparent, myname, cnt) -NHFILE *nhfp; -struct cemetery *d_cemetery; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "cemetery"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "cemetery", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_cemetery->next, parent, "next", 1);/* (struct cemetery *) */ - sfo_char(nhfp, d_cemetery->who, parent, "who", PL_NSIZ + 4 * (1 + 3) + 1);/* (char) */ - sfo_char(nhfp, d_cemetery->how, parent, "how", 100 + 1); /* (char) */ - sfo_char(nhfp, d_cemetery->when, parent, "when", 4 + 2 + 2 + 2 + 2 + 2 + 1);/* (char) */ - sfo_schar(nhfp, &d_cemetery->frpx, parent, "frpx", 1); /* (schar) */ - sfo_schar(nhfp, &d_cemetery->frpy, parent, "frpy", 1); /* (schar) */ - sfo_boolean(nhfp, &d_cemetery->bonesknown, parent, "bonesknown", 1);/* (boolean) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "cemetery", 1); -} - -void -sfo_context_info(nhfp, d_context_info, myparent, myname, cnt) -NHFILE *nhfp; -struct context_info *d_context_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "context_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "context_info", 1); - - sfo_unsigned(nhfp, &d_context_info->ident, parent, "ident", 1);/* (unsigned) */ - sfo_unsigned(nhfp, &d_context_info->no_of_wizards, parent, "no_of_wizards", 1);/* (unsigned) */ - sfo_unsigned(nhfp, &d_context_info->run, parent, "run", 1); /* (unsigned) */ - sfo_unsigned(nhfp, &d_context_info->startingpet_mid, parent, "startingpet_mid", 1);/* (unsigned) */ - sfo_int(nhfp, &d_context_info->current_fruit, parent, "current_fruit", 1);/* (int) */ - sfo_int(nhfp, &d_context_info->warnlevel, parent, "warnlevel", 1);/* (int) */ - sfo_int(nhfp, &d_context_info->rndencode, parent, "rndencode", 1);/* (int) */ - sfo_long(nhfp, &d_context_info->next_attrib_check, parent, "next_attrib_check", 1);/* (long) */ - sfo_long(nhfp, &d_context_info->stethoscope_move, parent, "stethoscope_move", 1);/* (long) */ - sfo_short(nhfp, &d_context_info->stethoscope_movement, parent, "stethoscope_movement", 1);/* (short) */ - sfo_boolean(nhfp, &d_context_info->travel, parent, "travel", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_context_info->travel1, parent, "travel1", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_context_info->forcefight, parent, "forcefight", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_context_info->nopick, parent, "nopick", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_context_info->made_amulet, parent, "made_amulet", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_context_info->mon_moving, parent, "mon_moving", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_context_info->move, parent, "move", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_context_info->mv, parent, "mv", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_context_info->bypasses, parent, "bypasses", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_context_info->botl, parent, "botl", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_context_info->botlx, parent, "botlx", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_context_info->door_opened, parent, "door_opened", 1);/* (boolean) */ - sfo_dig_info(nhfp, &d_context_info->digging, parent, "digging", 1);/* (dig_info) */ - sfo_victual_info(nhfp, &d_context_info->victual, parent, "victual", 1);/* (victual_info) */ - sfo_tin_info(nhfp, &d_context_info->tin, parent, "tin", 1); /* (tin_info) */ - sfo_book_info(nhfp, &d_context_info->spbook, parent, "spbook", 1);/* (book_info) */ - sfo_takeoff_info(nhfp, &d_context_info->takeoff, parent, "takeoff", 1);/* (takeoff_info) */ - sfo_warntype_info(nhfp, &d_context_info->warntype, parent, "warntype", 1);/* (warntype_info) */ - sfo_polearm_info(nhfp, &d_context_info->polearm, parent, "polearm", 1);/* (polearm_info) */ - sfo_obj_split(nhfp, &d_context_info->objsplit, parent, "objsplit", 1);/* (obj_split) */ - sfo_tribute_info(nhfp, &d_context_info->tribute, parent, "tribute", 1);/* (tribute_info) */ - sfo_novel_tracking(nhfp, &d_context_info->novel, parent, "novel", 1);/* (novel_tracking) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "context_info", 1); -} - -void -sfo_d_flags(nhfp, d_d_flags, myparent, myname, cnt) -NHFILE *nhfp; -struct d_flags *d_d_flags; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "d_flags"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "d_flags", 1); - - bitfield = d_d_flags->town; /* (Bitfield(town, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "town", 1); - bitfield = d_d_flags->hellish; /* (Bitfield(hellish, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "hellish", 1); - bitfield = d_d_flags->maze_like; /* (Bitfield(maze_like, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "maze_like", 1); - bitfield = d_d_flags->rogue_like; /* (Bitfield(rogue_like, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "rogue_like", 1); - bitfield = d_d_flags->align; /* (Bitfield(align, 3)) */ - sfo_bitfield(nhfp, &bitfield, parent, "align", 3); - bitfield = d_d_flags->unused; /* (Bitfield(unused, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "unused", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "d_flags", 1); -} - -void -sfo_d_level(nhfp, d_d_level, myparent, myname, cnt) -NHFILE *nhfp; -struct d_level *d_d_level; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "d_level"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "d_level", 1); - - sfo_xchar(nhfp, &d_d_level->dnum, parent, "dnum", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_d_level->dlevel, parent, "dlevel", 1); /* (xchar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "d_level", 1); -} - -void -sfo_damage(nhfp, d_damage, myparent, myname, cnt) -NHFILE *nhfp; -struct damage *d_damage; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "damage"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "damage", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_damage->next, parent, "next", 1);/* (struct damage *) */ - sfo_long(nhfp, &d_damage->when, parent, "when", 1); /* (long) */ - sfo_long(nhfp, &d_damage->cost, parent, "cost", 1); /* (long) */ - sfo_nhcoord(nhfp, &d_damage->place, parent, "place", 1); /* (nhcoord) */ - sfo_schar(nhfp, &d_damage->typ, parent, "typ", 1); /* (schar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "damage", 1); -} - -void -sfo_dest_area(nhfp, d_dest_area, myparent, myname, cnt) -NHFILE *nhfp; -struct dest_area *d_dest_area; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "dest_area"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "dest_area", 1); - - sfo_xchar(nhfp, &d_dest_area->lx, parent, "lx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_dest_area->ly, parent, "ly", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_dest_area->hx, parent, "hx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_dest_area->hy, parent, "hy", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_dest_area->nlx, parent, "nlx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_dest_area->nly, parent, "nly", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_dest_area->nhx, parent, "nhx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_dest_area->nhy, parent, "nhy", 1); /* (xchar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "dest_area", 1); -} - -void -sfo_dgn_topology(nhfp, d_dgn_topology, myparent, myname, cnt) -NHFILE *nhfp; -struct dgn_topology *d_dgn_topology; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "dgn_topology"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "dgn_topology", 1); - - sfo_d_level(nhfp, &d_dgn_topology->d_oracle_level, parent, "d_oracle_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_bigroom_level, parent, "d_bigroom_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_rogue_level, parent, "d_rogue_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_medusa_level, parent, "d_medusa_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_stronghold_level, parent, "d_stronghold_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_valley_level, parent, "d_valley_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_wiz1_level, parent, "d_wiz1_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_wiz2_level, parent, "d_wiz2_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_wiz3_level, parent, "d_wiz3_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_juiblex_level, parent, "d_juiblex_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_orcus_level, parent, "d_orcus_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_baalzebub_level, parent, "d_baalzebub_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_asmodeus_level, parent, "d_asmodeus_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_portal_level, parent, "d_portal_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_sanctum_level, parent, "d_sanctum_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_earth_level, parent, "d_earth_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_water_level, parent, "d_water_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_fire_level, parent, "d_fire_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_air_level, parent, "d_air_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_astral_level, parent, "d_astral_level", 1);/* (d_level) */ - sfo_xchar(nhfp, &d_dgn_topology->d_tower_dnum, parent, "d_tower_dnum", 1);/* (xchar) */ - sfo_xchar(nhfp, &d_dgn_topology->d_sokoban_dnum, parent, "d_sokoban_dnum", 1);/* (xchar) */ - sfo_xchar(nhfp, &d_dgn_topology->d_mines_dnum, parent, "d_mines_dnum", 1);/* (xchar) */ - sfo_xchar(nhfp, &d_dgn_topology->d_quest_dnum, parent, "d_quest_dnum", 1);/* (xchar) */ - sfo_d_level(nhfp, &d_dgn_topology->d_qstart_level, parent, "d_qstart_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_qlocate_level, parent, "d_qlocate_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_nemesis_level, parent, "d_nemesis_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_knox_level, parent, "d_knox_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_mineend_level, parent, "d_mineend_level", 1);/* (d_level) */ - sfo_d_level(nhfp, &d_dgn_topology->d_sokoend_level, parent, "d_sokoend_level", 1);/* (d_level) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "dgn_topology", 1); -} - -void -sfo_dig_info(nhfp, d_dig_info, myparent, myname, cnt) -NHFILE *nhfp; -struct dig_info *d_dig_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "dig_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "dig_info", 1); - - sfo_int(nhfp, &d_dig_info->effort, parent, "effort", 1); /* (int) */ - sfo_d_level(nhfp, &d_dig_info->level, parent, "level", 1); /* (d_level) */ - sfo_nhcoord(nhfp, &d_dig_info->pos, parent, "pos", 1); /* (nhcoord) */ - sfo_long(nhfp, &d_dig_info->lastdigtime, parent, "lastdigtime", 1);/* (long) */ - sfo_boolean(nhfp, &d_dig_info->down, parent, "down", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_dig_info->chew, parent, "chew", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_dig_info->warned, parent, "warned", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_dig_info->quiet, parent, "quiet", 1); /* (boolean) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "dig_info", 1); -} - -void -sfo_dungeon(nhfp, d_dungeon, myparent, myname, cnt) -NHFILE *nhfp; -struct dungeon *d_dungeon; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "dungeon"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "dungeon", 1); - - sfo_char(nhfp, d_dungeon->dname, parent, "dname", 24); /* (char) */ - sfo_char(nhfp, d_dungeon->proto, parent, "proto", 15); /* (char) */ - sfo_char(nhfp, &d_dungeon->boneid, parent, "boneid", 1); /* (char) */ - sfo_d_flags(nhfp, &d_dungeon->flags, parent, "flags", 1); /* (d_flags) */ - sfo_xchar(nhfp, &d_dungeon->entry_lev, parent, "entry_lev", 1);/* (xchar) */ - sfo_xchar(nhfp, &d_dungeon->num_dunlevs, parent, "num_dunlevs", 1);/* (xchar) */ - sfo_xchar(nhfp, &d_dungeon->dunlev_ureached, parent, "dunlev_ureached", 1);/* (xchar) */ - sfo_int(nhfp, &d_dungeon->ledger_start, parent, "ledger_start", 1);/* (int) */ - sfo_int(nhfp, &d_dungeon->depth_start, parent, "depth_start", 1);/* (int) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "dungeon", 1); -} - -void -sfo_edog(nhfp, d_edog, myparent, myname, cnt) -NHFILE *nhfp; -struct edog *d_edog; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "edog"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "edog", 1); - - sfo_long(nhfp, &d_edog->droptime, parent, "droptime", 1); /* (long) */ - sfo_unsigned(nhfp, &d_edog->dropdist, parent, "dropdist", 1);/* (unsigned) */ - sfo_int(nhfp, &d_edog->apport, parent, "apport", 1); /* (int) */ - sfo_long(nhfp, &d_edog->whistletime, parent, "whistletime", 1);/* (long) */ - sfo_long(nhfp, &d_edog->hungrytime, parent, "hungrytime", 1);/* (long) */ - sfo_nhcoord(nhfp, &d_edog->ogoal, parent, "ogoal", 1); /* (nhcoord) */ - sfo_int(nhfp, &d_edog->abuse, parent, "abuse", 1); /* (int) */ - sfo_int(nhfp, &d_edog->revivals, parent, "revivals", 1); /* (int) */ - sfo_int(nhfp, &d_edog->mhpmax_penalty, parent, "mhpmax_penalty", 1);/* (int) */ - bitfield = d_edog->killed_by_u; /* (Bitfield(killed_by_u, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "killed_by_u", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "edog", 1); -} - -void -sfo_egd(nhfp, d_egd, myparent, myname, cnt) -NHFILE *nhfp; -struct egd *d_egd; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "egd"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "egd", 1); - - sfo_int(nhfp, &d_egd->fcbeg, parent, "fcbeg", 1); /* (int) */ - sfo_int(nhfp, &d_egd->fcend, parent, "fcend", 1); /* (int) */ - sfo_int(nhfp, &d_egd->vroom, parent, "vroom", 1); /* (int) */ - sfo_xchar(nhfp, &d_egd->gdx, parent, "gdx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_egd->gdy, parent, "gdy", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_egd->ogx, parent, "ogx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_egd->ogy, parent, "ogy", 1); /* (xchar) */ - sfo_d_level(nhfp, &d_egd->gdlevel, parent, "gdlevel", 1); /* (d_level) */ - sfo_xchar(nhfp, &d_egd->warncnt, parent, "warncnt", 1); /* (xchar) */ - bitfield = d_egd->gddone; /* (Bitfield(gddone, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "gddone", 1); - bitfield = d_egd->witness; /* (Bitfield(witness, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "witness", 2); - bitfield = d_egd->unused; /* (Bitfield(unused, 5)) */ - sfo_bitfield(nhfp, &bitfield, parent, "unused", 5); - for (i = 0; i < FCSIZ; ++i) - sfo_fakecorridor(nhfp, &d_egd->fakecorr[i], parent, "fakecorr", 1);/* (fakecorridor) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "egd", 1); -} - -void -sfo_emin(nhfp, d_emin, myparent, myname, cnt) -NHFILE *nhfp; -struct emin *d_emin; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "emin"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "emin", 1); - - sfo_aligntyp(nhfp, &d_emin->min_align, parent, "min_align", 1);/* (aligntyp) */ - sfo_boolean(nhfp, &d_emin->renegade, parent, "renegade", 1); /* (boolean) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "emin", 1); -} - -void -sfo_engr(nhfp, d_engr, myparent, myname, cnt) -NHFILE *nhfp; -struct engr *d_engr; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "engr"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "engr", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_engr->nxt_engr, parent, "nxt_engr", 1);/* (struct engr *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_engr->engr_txt, parent, "engr_txt", 1);/* (char *) */ - sfo_xchar(nhfp, &d_engr->engr_x, parent, "engr_x", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_engr->engr_y, parent, "engr_y", 1); /* (xchar) */ - sfo_unsigned(nhfp, &d_engr->engr_lth, parent, "engr_lth", 1);/* (unsigned) */ - sfo_long(nhfp, &d_engr->engr_time, parent, "engr_time", 1); /* (long) */ - sfo_xchar(nhfp, &d_engr->engr_type, parent, "engr_type", 1); /* (xchar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "engr", 1); -} - -void -sfo_epri(nhfp, d_epri, myparent, myname, cnt) -NHFILE *nhfp; -struct epri *d_epri; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "epri"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "epri", 1); - - sfo_aligntyp(nhfp, &d_epri->shralign, parent, "shralign", 1);/* (aligntyp) */ - sfo_schar(nhfp, &d_epri->shroom, parent, "shroom", 1); /* (schar) */ - sfo_nhcoord(nhfp, &d_epri->shrpos, parent, "shrpos", 1); /* (nhcoord) */ - sfo_d_level(nhfp, &d_epri->shrlevel, parent, "shrlevel", 1); /* (d_level) */ - sfo_long(nhfp, &d_epri->intone_time, parent, "intone_time", 1);/* (long) */ - sfo_long(nhfp, &d_epri->enter_time, parent, "enter_time", 1);/* (long) */ - sfo_long(nhfp, &d_epri->hostile_time, parent, "hostile_time", 1);/* (long) */ - sfo_long(nhfp, &d_epri->peaceful_time, parent, "peaceful_time", 1);/* (long) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "epri", 1); -} - -void -sfo_eshk(nhfp, d_eshk, myparent, myname, cnt) -NHFILE *nhfp; -struct eshk *d_eshk; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "eshk"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "eshk", 1); - - sfo_long(nhfp, &d_eshk->robbed, parent, "robbed", 1); /* (long) */ - sfo_long(nhfp, &d_eshk->credit, parent, "credit", 1); /* (long) */ - sfo_long(nhfp, &d_eshk->debit, parent, "debit", 1); /* (long) */ - sfo_long(nhfp, &d_eshk->loan, parent, "loan", 1); /* (long) */ - sfo_int(nhfp, &d_eshk->shoptype, parent, "shoptype", 1); /* (int) */ - sfo_schar(nhfp, &d_eshk->shoproom, parent, "shoproom", 1); /* (schar) */ - sfo_schar(nhfp, &d_eshk->unused, parent, "unused", 1); /* (schar) */ - sfo_boolean(nhfp, &d_eshk->following, parent, "following", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_eshk->surcharge, parent, "surcharge", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_eshk->dismiss_kops, parent, "dismiss_kops", 1);/* (boolean) */ - sfo_nhcoord(nhfp, &d_eshk->shk, parent, "shk", 1); /* (nhcoord) */ - sfo_nhcoord(nhfp, &d_eshk->shd, parent, "shd", 1); /* (nhcoord) */ - sfo_d_level(nhfp, &d_eshk->shoplevel, parent, "shoplevel", 1);/* (d_level) */ - sfo_int(nhfp, &d_eshk->billct, parent, "billct", 1); /* (int) */ - for (i = 0; i < BILLSZ; ++i) - sfo_bill_x(nhfp, &d_eshk->bill[i], parent, "bill", 1); /* (bill_x) */ - sfo_genericptr(nhfp, (genericptr_t) &d_eshk->bill_p, parent, "bill_p", 1);/* (struct bill_x *) */ - sfo_int(nhfp, &d_eshk->visitct, parent, "visitct", 1); /* (int) */ - sfo_char(nhfp, d_eshk->customer, parent, "customer", PL_NSIZ);/* (char) */ - sfo_char(nhfp, d_eshk->shknam, parent, "shknam", PL_NSIZ); /* (char) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "eshk", 1); -} - -void -sfo_fakecorridor(nhfp, d_fakecorridor, myparent, myname, cnt) -NHFILE *nhfp; -struct fakecorridor *d_fakecorridor; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "fakecorridor"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "fakecorridor", 1); - - sfo_xchar(nhfp, &d_fakecorridor->fx, parent, "fx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_fakecorridor->fy, parent, "fy", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_fakecorridor->ftyp, parent, "ftyp", 1); /* (xchar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "fakecorridor", 1); -} - -void -sfo_fe(nhfp, d_fe, myparent, myname, cnt) -NHFILE *nhfp; -struct fe *d_fe; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "fe"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "fe", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_fe->next, parent, "next", 1);/* (struct fe *) */ - sfo_long(nhfp, &d_fe->timeout, parent, "timeout", 1); /* (long) */ - sfo_ulong(nhfp, &d_fe->tid, parent, "tid", 1); /* (unsigned long) */ - sfo_short(nhfp, &d_fe->kind, parent, "kind", 1); /* (short) */ - sfo_short(nhfp, &d_fe->func_index, parent, "func_index", 1); /* (short) */ - sfo_any(nhfp, &d_fe->arg, parent, "arg", 1); /* (any) */ - bitfield = d_fe->needs_fixup; /* (Bitfield(needs_fixup, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "needs_fixup", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "fe", 1); -} - -void -sfo_flag(nhfp, d_flag, myparent, myname, cnt) -NHFILE *nhfp; -struct flag *d_flag; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "flag"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "flag", 1); - - sfo_boolean(nhfp, &d_flag->acoustics, parent, "acoustics", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->autodig, parent, "autodig", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->autoquiver, parent, "autoquiver", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->autoopen, parent, "autoopen", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->beginner, parent, "beginner", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->biff, parent, "biff", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->bones, parent, "bones", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->confirm, parent, "confirm", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->dark_room, parent, "dark_room", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->debug, parent, "debug", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->end_own, parent, "end_own", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->explore, parent, "explore", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->female, parent, "female", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->friday13, parent, "friday13", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->help, parent, "help", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->ignintr, parent, "ignintr", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->ins_chkpt, parent, "ins_chkpt", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->invlet_constant, parent, "invlet_constant", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->legacy, parent, "legacy", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->lit_corridor, parent, "lit_corridor", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->nap, parent, "nap", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->null, parent, "null", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->p__obsolete, parent, "p__obsolete", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->pickup, parent, "pickup", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->pickup_thrown, parent, "pickup_thrown", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->pushweapon, parent, "pushweapon", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->rest_on_space, parent, "rest_on_space", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->safe_dog, parent, "safe_dog", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->showexp, parent, "showexp", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->showscore, parent, "showscore", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->silent, parent, "silent", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->sortpack, parent, "sortpack", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->sparkle, parent, "sparkle", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->standout, parent, "standout", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->time, parent, "time", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->tombstone, parent, "tombstone", 1);/* (boolean) */ - sfo_boolean(nhfp, &d_flag->verbose, parent, "verbose", 1); /* (boolean) */ - sfo_int(nhfp, &d_flag->end_top, parent, "end_top", 1); /* (int) */ - sfo_int(nhfp, &d_flag->end_around, parent, "end_around", 1); /* (int) */ - sfo_unsigned(nhfp, &d_flag->moonphase, parent, "moonphase", 1);/* (unsigned) */ - sfo_ulong(nhfp, &d_flag->suppress_alert, parent, "suppress_alert", 1);/* (unsigned long) */ - sfo_unsigned(nhfp, &d_flag->paranoia_bits, parent, "paranoia_bits", 1);/* (unsigned) */ - sfo_int(nhfp, &d_flag->pickup_burden, parent, "pickup_burden", 1);/* (int) */ - sfo_int(nhfp, &d_flag->pile_limit, parent, "pile_limit", 1); /* (int) */ - sfo_char(nhfp, &d_flag->sortloot, parent, "sortloot", 1); /* (char) */ - sfo_char(nhfp, d_flag->inv_order, parent, "inv_order", MAXOCLASSES);/* (char) */ - sfo_char(nhfp, d_flag->pickup_types, parent, "pickup_types", MAXOCLASSES);/* (char) */ - sfo_char(nhfp, d_flag->end_disclose, parent, "end_disclose", NUM_DISCLOSURE_OPTIONS + 1);/* (char) */ - sfo_char(nhfp, &d_flag->menu_style, parent, "menu_style", 1);/* (char) */ - sfo_boolean(nhfp, &d_flag->made_fruit, parent, "made_fruit", 1);/* (boolean) */ - sfo_int(nhfp, &d_flag->initrole, parent, "initrole", 1); /* (int) */ - sfo_int(nhfp, &d_flag->initrace, parent, "initrace", 1); /* (int) */ - sfo_int(nhfp, &d_flag->initgend, parent, "initgend", 1); /* (int) */ - sfo_int(nhfp, &d_flag->initalign, parent, "initalign", 1); /* (int) */ - sfo_int(nhfp, &d_flag->randomall, parent, "randomall", 1); /* (int) */ - sfo_int(nhfp, &d_flag->pantheon, parent, "pantheon", 1); /* (int) */ - sfo_boolean(nhfp, &d_flag->lootabc, parent, "lootabc", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->showrace, parent, "showrace", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_flag->travelcmd, parent, "travelcmd", 1);/* (boolean) */ - sfo_int(nhfp, &d_flag->runmode, parent, "runmode", 1); /* (int) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "flag", 1); -} - -void -sfo_fruit(nhfp, d_fruit, myparent, myname, cnt) -NHFILE *nhfp; -struct fruit *d_fruit; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "fruit"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "fruit", 1); - - sfo_char(nhfp, d_fruit->fname, parent, "fname", PL_FSIZ); /* (char) */ - sfo_int(nhfp, &d_fruit->fid, parent, "fid", 1); /* (int) */ - sfo_genericptr(nhfp, (genericptr_t) &d_fruit->nextf, parent, "nextf", 1);/* (struct fruit *) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "fruit", 1); -} - -void -sfo_kinfo(nhfp, d_kinfo, myparent, myname, cnt) -NHFILE *nhfp; -struct kinfo *d_kinfo; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "kinfo"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "kinfo", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_kinfo->next, parent, "next", 1);/* (struct kinfo *) */ - sfo_int(nhfp, &d_kinfo->id, parent, "id", 1); /* (int) */ - sfo_int(nhfp, &d_kinfo->format, parent, "format", 1); /* (int) */ - sfo_char(nhfp, d_kinfo->name, parent, "name", BUFSZ); /* (char) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "kinfo", 1); -} - -void -sfo_levelflags(nhfp, d_levelflags, myparent, myname, cnt) -NHFILE *nhfp; -struct levelflags *d_levelflags; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "levelflags"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "levelflags", 1); - - sfo_uchar(nhfp, &d_levelflags->nfountains, parent, "nfountains", 1);/* (uchar) */ - sfo_uchar(nhfp, &d_levelflags->nsinks, parent, "nsinks", 1); /* (uchar) */ - bitfield = d_levelflags->has_shop; /* (Bitfield(has_shop, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_shop", 1); - bitfield = d_levelflags->has_vault; /* (Bitfield(has_vault, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_vault", 1); - bitfield = d_levelflags->has_zoo; /* (Bitfield(has_zoo, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_zoo", 1); - bitfield = d_levelflags->has_court; /* (Bitfield(has_court, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_court", 1); - bitfield = d_levelflags->has_morgue; /* (Bitfield(has_morgue, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_morgue", 1); - bitfield = d_levelflags->has_beehive; /* (Bitfield(has_beehive, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_beehive", 1); - bitfield = d_levelflags->has_barracks; /* (Bitfield(has_barracks, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_barracks", 1); - bitfield = d_levelflags->has_temple; /* (Bitfield(has_temple, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_temple", 1); - bitfield = d_levelflags->has_swamp; /* (Bitfield(has_swamp, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "has_swamp", 1); - bitfield = d_levelflags->noteleport; /* (Bitfield(noteleport, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "noteleport", 1); - bitfield = d_levelflags->hardfloor; /* (Bitfield(hardfloor, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "hardfloor", 1); - bitfield = d_levelflags->nommap; /* (Bitfield(nommap, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "nommap", 1); - bitfield = d_levelflags->hero_memory; /* (Bitfield(hero_memory, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "hero_memory", 1); - bitfield = d_levelflags->shortsighted; /* (Bitfield(shortsighted, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "shortsighted", 1); - bitfield = d_levelflags->graveyard; /* (Bitfield(graveyard, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "graveyard", 1); - bitfield = d_levelflags->sokoban_rules; /* (Bitfield(sokoban_rules, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "sokoban_rules", 1); - bitfield = d_levelflags->is_maze_lev; /* (Bitfield(is_maze_lev, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "is_maze_lev", 1); - bitfield = d_levelflags->is_cavernous_lev; /* (Bitfield(is_cavernous_lev, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "is_cavernous_lev", 1); - bitfield = d_levelflags->arboreal; /* (Bitfield(arboreal, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "arboreal", 1); - bitfield = d_levelflags->wizard_bones; /* (Bitfield(wizard_bones, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "wizard_bones", 1); - bitfield = d_levelflags->corrmaze; /* (Bitfield(corrmaze, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "corrmaze", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "levelflags", 1); -} - -void -sfo_linfo(nhfp, d_linfo, myparent, myname, cnt) -NHFILE *nhfp; -struct linfo *d_linfo; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "linfo"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "linfo", 1); - - sfo_uchar(nhfp, &d_linfo->flags, parent, "flags", 1); /* (unsigned char) */ -#ifdef MFLOPPY - sfo_int(nhfp, &d_linfo->where, parent, "where", 1); /* (int) */ - sfo_long(nhfp, &d_linfo->time, parent, "time", 1); /* (long) */ - sfo_long(nhfp, &d_linfo->size, parent, "size", 1); /* (long) */ -#endif /*MFLOPPY*/ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "linfo", 1); -} - -void -sfo_ls_t(nhfp, d_ls_t, myparent, myname, cnt) -NHFILE *nhfp; -struct ls_t *d_ls_t; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "ls_t"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "ls_t", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_ls_t->next, parent, "next", 1);/* (struct ls_t *) */ - sfo_xchar(nhfp, &d_ls_t->x, parent, "x", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_ls_t->y, parent, "y", 1); /* (xchar) */ - sfo_short(nhfp, &d_ls_t->range, parent, "range", 1); /* (short) */ - sfo_short(nhfp, &d_ls_t->flags, parent, "flags", 1); /* (short) */ - sfo_short(nhfp, &d_ls_t->type, parent, "type", 1); /* (short) */ - sfo_any(nhfp, &d_ls_t->id, parent, "id", 1); /* (any) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "ls_t", 1); -} - -void -sfo_mapseen_feat(nhfp, d_mapseen_feat, myparent, myname, cnt) -NHFILE *nhfp; -struct mapseen_feat *d_mapseen_feat; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mapseen_feat"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "mapseen_feat", 1); - - bitfield = d_mapseen_feat->nfount; /* (Bitfield(nfount, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "nfount", 2); - bitfield = d_mapseen_feat->nsink; /* (Bitfield(nsink, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "nsink", 2); - bitfield = d_mapseen_feat->naltar; /* (Bitfield(naltar, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "naltar", 2); - bitfield = d_mapseen_feat->nthrone; /* (Bitfield(nthrone, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "nthrone", 2); - bitfield = d_mapseen_feat->ngrave; /* (Bitfield(ngrave, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ngrave", 2); - bitfield = d_mapseen_feat->ntree; /* (Bitfield(ntree, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ntree", 2); - bitfield = d_mapseen_feat->water; /* (Bitfield(water, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "water", 2); - bitfield = d_mapseen_feat->lava; /* (Bitfield(lava, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "lava", 2); - bitfield = d_mapseen_feat->ice; /* (Bitfield(ice, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ice", 2); - bitfield = d_mapseen_feat->nshop; /* (Bitfield(nshop, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "nshop", 2); - bitfield = d_mapseen_feat->ntemple; /* (Bitfield(ntemple, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ntemple", 2); - bitfield = d_mapseen_feat->msalign; /* (Bitfield(msalign, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "msalign", 2); - bitfield = d_mapseen_feat->shoptype; /* (Bitfield(shoptype, 5)) */ - sfo_bitfield(nhfp, &bitfield, parent, "shoptype", 5); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "mapseen_feat", 1); -} - -void -sfo_mapseen_flags(nhfp, d_mapseen_flags, myparent, myname, cnt) -NHFILE *nhfp; -struct mapseen_flags *d_mapseen_flags; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mapseen_flags"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "mapseen_flags", 1); - - bitfield = d_mapseen_flags->unreachable; /* (Bitfield(unreachable, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "unreachable", 1); - bitfield = d_mapseen_flags->forgot; /* (Bitfield(forgot, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "forgot", 1); - bitfield = d_mapseen_flags->knownbones; /* (Bitfield(knownbones, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "knownbones", 1); - bitfield = d_mapseen_flags->oracle; /* (Bitfield(oracle, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oracle", 1); - bitfield = d_mapseen_flags->sokosolved; /* (Bitfield(sokosolved, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "sokosolved", 1); - bitfield = d_mapseen_flags->bigroom; /* (Bitfield(bigroom, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "bigroom", 1); - bitfield = d_mapseen_flags->castle; /* (Bitfield(castle, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "castle", 1); - bitfield = d_mapseen_flags->castletune; /* (Bitfield(castletune, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "castletune", 1); - bitfield = d_mapseen_flags->valley; /* (Bitfield(valley, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "valley", 1); - bitfield = d_mapseen_flags->msanctum; /* (Bitfield(msanctum, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "msanctum", 1); - bitfield = d_mapseen_flags->ludios; /* (Bitfield(ludios, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ludios", 1); - bitfield = d_mapseen_flags->roguelevel; /* (Bitfield(roguelevel, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "roguelevel", 1); - bitfield = d_mapseen_flags->quest_summons; /* (Bitfield(quest_summons, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "quest_summons", 1); - bitfield = d_mapseen_flags->questing; /* (Bitfield(questing, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "questing", 1); - bitfield = d_mapseen_flags->vibrating_square; /* (Bitfield(vibrating_square, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "vibrating_square", 1); - bitfield = d_mapseen_flags->spare1; /* (Bitfield(spare1, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "spare1", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "mapseen_flags", 1); -} - -void -sfo_mapseen_rooms(nhfp, d_mapseen_rooms, myparent, myname, cnt) -NHFILE *nhfp; -struct mapseen_rooms *d_mapseen_rooms; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mapseen_rooms"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "mapseen_rooms", 1); - - bitfield = d_mapseen_rooms->seen; /* (Bitfield(seen, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "seen", 1); - bitfield = d_mapseen_rooms->untended; /* (Bitfield(untended, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "untended", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "mapseen_rooms", 1); -} - -void -sfo_mapseen(nhfp, d_mapseen, myparent, myname, cnt) -NHFILE *nhfp; -struct mapseen *d_mapseen; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mapseen"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "mapseen", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_mapseen->next, parent, "next", 1);/* (struct mapseen *) */ - sfo_branch(nhfp, d_mapseen->br, parent, "br", 1); /* (branch *) */ - sfo_d_level(nhfp, &d_mapseen->lev, parent, "lev", 1); /* (d_level) */ - sfo_mapseen_feat(nhfp, &d_mapseen->feat, parent, "feat", 1); /* (}) */ - sfo_mapseen_flags(nhfp, &d_mapseen->flags, parent, "flags", 1);/* (}) */ - sfo_char(nhfp, d_mapseen->custom, parent, "custom", 1); /* (char *) */ - sfo_unsigned(nhfp, &d_mapseen->custom_lth, parent, "custom_lth", 1);/* (unsigned) */ - for (i = 0; i < (MAXNROFROOMS + 1) * 2; ++i) - sfo_mapseen_rooms(nhfp, &d_mapseen->msrooms[i], parent, "msrooms", 1);/* (}) */ - sfo_genericptr(nhfp, (genericptr_t) &d_mapseen->final_resting_place, parent, "final_resting_place", 1);/* (struct cemetery *) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "mapseen", 1); -} - -void -sfo_mextra(nhfp, d_mextra, myparent, myname, cnt) -NHFILE *nhfp; -struct mextra *d_mextra; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mextra"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "mextra", 1); - - sfo_char(nhfp, d_mextra->mname, parent, "mname", 1); /* (char *) */ - sfo_egd(nhfp, d_mextra->egd, parent, "egd", 1); /* (struct egd *) */ - sfo_epri(nhfp, d_mextra->epri, parent, "epri", 1); /* (struct epri *) */ - sfo_eshk(nhfp, d_mextra->eshk, parent, "eshk", 1); /* (struct eshk *) */ - sfo_emin(nhfp, d_mextra->emin, parent, "emin", 1); /* (struct emin *) */ - sfo_edog(nhfp, d_mextra->edog, parent, "edog", 1); /* (struct edog *) */ - sfo_int(nhfp, &d_mextra->mcorpsenm, parent, "mcorpsenm", 1); /* (int) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "mextra", 1); -} - -void -sfo_mkroom(nhfp, d_mkroom, myparent, myname, cnt) -NHFILE *nhfp; -struct mkroom *d_mkroom; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mkroom"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "mkroom", 1); - - sfo_schar(nhfp, &d_mkroom->lx, parent, "lx", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->hx, parent, "hx", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->ly, parent, "ly", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->hy, parent, "hy", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->rtype, parent, "rtype", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->orig_rtype, parent, "orig_rtype", 1);/* (schar) */ - sfo_schar(nhfp, &d_mkroom->rlit, parent, "rlit", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->needfill, parent, "needfill", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->needjoining, parent, "needjoining", 1);/* (schar) */ - sfo_schar(nhfp, &d_mkroom->doorct, parent, "doorct", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->fdoor, parent, "fdoor", 1); /* (schar) */ - sfo_schar(nhfp, &d_mkroom->nsubrooms, parent, "nsubrooms", 1);/* (schar) */ - sfo_boolean(nhfp, &d_mkroom->irregular, parent, "irregular", 1);/* (boolean) */ - sfo_genericptr(nhfp, (genericptr_t) &d_mkroom->sbrooms[0], parent, "sbrooms", MAX_SUBROOMS);/* (struct mkroom *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_mkroom->resident, parent, "resident", 1);/* (struct monst *) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "mkroom", 1); -} - -void -sfo_monst(nhfp, d_monst, myparent, myname, cnt) -NHFILE *nhfp; -struct monst *d_monst; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "monst"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "monst", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_monst->nmon, parent, "nmon", 1);/* (struct monst *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_monst->data, parent, "data", 1);/* (struct permonst *) */ - sfo_unsigned(nhfp, &d_monst->m_id, parent, "m_id", 1); /* (unsigned) */ - sfo_short(nhfp, &d_monst->mnum, parent, "mnum", 1); /* (short) */ - sfo_short(nhfp, &d_monst->cham, parent, "cham", 1); /* (short) */ - sfo_short(nhfp, &d_monst->movement, parent, "movement", 1); /* (short) */ - sfo_uchar(nhfp, &d_monst->m_lev, parent, "m_lev", 1); /* (uchar) */ - sfo_aligntyp(nhfp, &d_monst->malign, parent, "malign", 1); /* (aligntyp) */ - sfo_xchar(nhfp, &d_monst->mx, parent, "mx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_monst->my, parent, "my", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_monst->mux, parent, "mux", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_monst->muy, parent, "muy", 1); /* (xchar) */ - for (i = 0; i < MTSZ; ++i) - sfo_nhcoord(nhfp, &d_monst->mtrack[i], parent, "mtrack", 1);/* (nhcoord) */ - sfo_int(nhfp, &d_monst->mhp, parent, "mhp", 1); /* (int) */ - sfo_int(nhfp, &d_monst->mhpmax, parent, "mhpmax", 1); /* (int) */ - sfo_unsigned(nhfp, &d_monst->mappearance, parent, "mappearance", 1);/* (unsigned) */ - sfo_uchar(nhfp, &d_monst->m_ap_type, parent, "m_ap_type", 1);/* (uchar) */ - sfo_schar(nhfp, &d_monst->mtame, parent, "mtame", 1); /* (schar) */ - sfo_ushort(nhfp, &d_monst->mextrinsics, parent, "mextrinsics", 1);/* (unsigned short) */ - sfo_int(nhfp, &d_monst->mspec_used, parent, "mspec_used", 1);/* (int) */ - bitfield = d_monst->female; /* (Bitfield(female, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "female", 1); - bitfield = d_monst->minvis; /* (Bitfield(minvis, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "minvis", 1); - bitfield = d_monst->invis_blkd; /* (Bitfield(invis_blkd, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "invis_blkd", 1); - bitfield = d_monst->perminvis; /* (Bitfield(perminvis, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "perminvis", 1); - bitfield = d_monst->mcan; /* (Bitfield(mcan, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mcan", 1); - bitfield = d_monst->mburied; /* (Bitfield(mburied, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mburied", 1); - bitfield = d_monst->mundetected; /* (Bitfield(mundetected, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mundetected", 1); - bitfield = d_monst->mcansee; /* (Bitfield(mcansee, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mcansee", 1); - bitfield = d_monst->mspeed; /* (Bitfield(mspeed, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mspeed", 2); - bitfield = d_monst->permspeed; /* (Bitfield(permspeed, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "permspeed", 2); - bitfield = d_monst->mrevived; /* (Bitfield(mrevived, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mrevived", 1); - bitfield = d_monst->mcloned; /* (Bitfield(mcloned, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mcloned", 1); - bitfield = d_monst->mavenge; /* (Bitfield(mavenge, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mavenge", 1); - bitfield = d_monst->mflee; /* (Bitfield(mflee, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mflee", 1); - bitfield = d_monst->mfleetim; /* (Bitfield(mfleetim, 7)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mfleetim", 7); - bitfield = d_monst->msleeping; /* (Bitfield(msleeping, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "msleeping", 1); - bitfield = d_monst->mblinded; /* (Bitfield(mblinded, 7)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mblinded", 7); - bitfield = d_monst->mstun; /* (Bitfield(mstun, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mstun", 1); - bitfield = d_monst->mfrozen; /* (Bitfield(mfrozen, 7)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mfrozen", 7); - bitfield = d_monst->mcanmove; /* (Bitfield(mcanmove, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mcanmove", 1); - bitfield = d_monst->mconf; /* (Bitfield(mconf, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mconf", 1); - bitfield = d_monst->mpeaceful; /* (Bitfield(mpeaceful, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mpeaceful", 1); - bitfield = d_monst->mtrapped; /* (Bitfield(mtrapped, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mtrapped", 1); - bitfield = d_monst->mleashed; /* (Bitfield(mleashed, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mleashed", 1); - bitfield = d_monst->isshk; /* (Bitfield(isshk, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "isshk", 1); - bitfield = d_monst->isminion; /* (Bitfield(isminion, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "isminion", 1); - bitfield = d_monst->isgd; /* (Bitfield(isgd, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "isgd", 1); - bitfield = d_monst->ispriest; /* (Bitfield(ispriest, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ispriest", 1); - bitfield = d_monst->iswiz; /* (Bitfield(iswiz, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "iswiz", 1); - bitfield = d_monst->wormno; /* (Bitfield(wormno, 5)) */ - sfo_bitfield(nhfp, &bitfield, parent, "wormno", 5); - bitfield = d_monst->mtemplit; /* (Bitfield(mtemplit, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mtemplit", 1); - sfo_ulong(nhfp, &d_monst->mstrategy, parent, "mstrategy", 1);/* (unsigned long) */ - sfo_long(nhfp, &d_monst->mtrapseen, parent, "mtrapseen", 1); /* (long) */ - sfo_long(nhfp, &d_monst->mlstmv, parent, "mlstmv", 1); /* (long) */ - sfo_long(nhfp, &d_monst->mspare1, parent, "mspare1", 1); /* (long) */ - sfo_genericptr(nhfp, (genericptr_t) &d_monst->minvent, parent, "minvent", 1);/* (struct obj *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_monst->mw, parent, "mw", 1);/* (struct obj *) */ - sfo_long(nhfp, &d_monst->misc_worn_check, parent, "misc_worn_check", 1);/* (long) */ - sfo_xchar(nhfp, &d_monst->weapon_check, parent, "weapon_check", 1);/* (xchar) */ - sfo_int(nhfp, &d_monst->meating, parent, "meating", 1); /* (int) */ - sfo_genericptr(nhfp, (genericptr_t) &d_monst->mextra, parent, "mextra", 1);/* (struct mextra *) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "monst", 1); -} - -void -sfo_mvitals(nhfp, d_mvitals, myparent, myname, cnt) -NHFILE *nhfp; -struct mvitals *d_mvitals; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mvitals"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "mvitals", 1); - - sfo_uchar(nhfp, &d_mvitals->born, parent, "born", 1); /* (uchar) */ - sfo_uchar(nhfp, &d_mvitals->died, parent, "died", 1); /* (uchar) */ - sfo_uchar(nhfp, &d_mvitals->mvflags, parent, "mvflags", 1); /* (uchar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "mvitals", 1); -} - -void -sfo_nhcoord(nhfp, d_nhcoord, myparent, myname, cnt) -NHFILE *nhfp; -struct nhcoord *d_nhcoord; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "nhcoord"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "nhcoord", 1); - - sfo_xchar(nhfp, &d_nhcoord->x, parent, "x", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_nhcoord->y, parent, "y", 1); /* (xchar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "nhcoord", 1); -} - -void -sfo_nhrect(nhfp, d_nhrect, myparent, myname, cnt) -NHFILE *nhfp; -struct nhrect *d_nhrect; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "nhrect"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "nhrect", 1); - - sfo_xchar(nhfp, &d_nhrect->lx, parent, "lx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_nhrect->ly, parent, "ly", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_nhrect->hx, parent, "hx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_nhrect->hy, parent, "hy", 1); /* (xchar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "nhrect", 1); -} - -void -sfo_novel_tracking(nhfp, d_novel_tracking, myparent, myname, cnt) -NHFILE *nhfp; -struct novel_tracking *d_novel_tracking; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "novel_tracking"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "novel_tracking", 1); - - sfo_unsigned(nhfp, &d_novel_tracking->id, parent, "id", 1); /* (unsigned) */ - sfo_int(nhfp, &d_novel_tracking->count, parent, "count", 1); /* (int) */ - sfo_xchar(nhfp, d_novel_tracking->pasg, parent, "pasg", 30); /* (xchar) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "novel_tracking", 1); -} - -void -sfo_obj(nhfp, d_obj, myparent, myname, cnt) -NHFILE *nhfp; -struct obj *d_obj; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "obj"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "obj", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_obj->nobj, parent, "nobj", 1);/* (struct obj *) */ - sfo_vptrs(nhfp, &d_obj->v, parent, "v", 1); /* (vptrs) */ - sfo_genericptr(nhfp, (genericptr_t) &d_obj->cobj, parent, "cobj", 1);/* (struct obj *) */ - sfo_unsigned(nhfp, &d_obj->o_id, parent, "o_id", 1); /* (unsigned) */ - sfo_xchar(nhfp, &d_obj->ox, parent, "ox", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_obj->oy, parent, "oy", 1); /* (xchar) */ - sfo_short(nhfp, &d_obj->otyp, parent, "otyp", 1); /* (short) */ - sfo_unsigned(nhfp, &d_obj->owt, parent, "owt", 1); /* (unsigned) */ - sfo_long(nhfp, &d_obj->quan, parent, "quan", 1); /* (long) */ - sfo_schar(nhfp, &d_obj->spe, parent, "spe", 1); /* (schar) */ - sfo_char(nhfp, &d_obj->oclass, parent, "oclass", 1); /* (char) */ - sfo_char(nhfp, &d_obj->invlet, parent, "invlet", 1); /* (char) */ - sfo_char(nhfp, &d_obj->oartifact, parent, "oartifact", 1); /* (char) */ - sfo_xchar(nhfp, &d_obj->where, parent, "where", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_obj->timed, parent, "timed", 1); /* (xchar) */ - bitfield = d_obj->cursed; /* (Bitfield(cursed, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "cursed", 1); - bitfield = d_obj->blessed; /* (Bitfield(blessed, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "blessed", 1); - bitfield = d_obj->unpaid; /* (Bitfield(unpaid, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "unpaid", 1); - bitfield = d_obj->no_charge; /* (Bitfield(no_charge, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "no_charge", 1); - bitfield = d_obj->known; /* (Bitfield(known, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "known", 1); - bitfield = d_obj->dknown; /* (Bitfield(dknown, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "dknown", 1); - bitfield = d_obj->bknown; /* (Bitfield(bknown, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "bknown", 1); - bitfield = d_obj->rknown; /* (Bitfield(rknown, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "rknown", 1); - bitfield = d_obj->oeroded; /* (Bitfield(oeroded, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oeroded", 2); - bitfield = d_obj->oeroded2; /* (Bitfield(oeroded2, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oeroded2", 2); - bitfield = d_obj->oerodeproof; /* (Bitfield(oerodeproof, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oerodeproof", 1); - bitfield = d_obj->olocked; /* (Bitfield(olocked, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "olocked", 1); - bitfield = d_obj->obroken; /* (Bitfield(obroken, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "obroken", 1); - bitfield = d_obj->otrapped; /* (Bitfield(otrapped, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "otrapped", 1); - bitfield = d_obj->recharged; /* (Bitfield(recharged, 3)) */ - sfo_bitfield(nhfp, &bitfield, parent, "recharged", 3); - bitfield = d_obj->lamplit; /* (Bitfield(lamplit, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "lamplit", 1); - bitfield = d_obj->globby; /* (Bitfield(globby, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "globby", 1); - bitfield = d_obj->greased; /* (Bitfield(greased, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "greased", 1); - bitfield = d_obj->nomerge; /* (Bitfield(nomerge, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "nomerge", 1); - bitfield = d_obj->was_thrown; /* (Bitfield(was_thrown, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "was_thrown", 1); - bitfield = d_obj->in_use; /* (Bitfield(in_use, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "in_use", 1); - bitfield = d_obj->bypass; /* (Bitfield(bypass, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "bypass", 1); - bitfield = d_obj->cknown; /* (Bitfield(cknown, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "cknown", 1); - bitfield = d_obj->lknown; /* (Bitfield(lknown, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "lknown", 1); - sfo_int(nhfp, &d_obj->corpsenm, parent, "corpsenm", 1); /* (int) */ - sfo_int(nhfp, &d_obj->usecount, parent, "usecount", 1); /* (int) */ - sfo_unsigned(nhfp, &d_obj->oeaten, parent, "oeaten", 1); /* (unsigned) */ - sfo_long(nhfp, &d_obj->age, parent, "age", 1); /* (long) */ - sfo_long(nhfp, &d_obj->owornmask, parent, "owornmask", 1); /* (long) */ - sfo_genericptr(nhfp, (genericptr_t) &d_obj->oextra, parent, "oextra", 1);/* (struct oextra *) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "obj", 1); -} - -void -sfo_objclass(nhfp, d_objclass, myparent, myname, cnt) -NHFILE *nhfp; -struct objclass *d_objclass; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "objclass"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "objclass", 1); - - sfo_short(nhfp, &d_objclass->oc_name_idx, parent, "oc_name_idx", 1);/* (short) */ - sfo_short(nhfp, &d_objclass->oc_descr_idx, parent, "oc_descr_idx", 1);/* (short) */ - sfo_genericptr(nhfp, (genericptr_t) &d_objclass->oc_uname, parent, "oc_uname", 1);/* (char *) */ - bitfield = d_objclass->oc_name_known; /* (Bitfield(oc_name_known, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_name_known", 1); - bitfield = d_objclass->oc_merge; /* (Bitfield(oc_merge, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_merge", 1); - bitfield = d_objclass->oc_uses_known; /* (Bitfield(oc_uses_known, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_uses_known", 1); - bitfield = d_objclass->oc_pre_discovered; /* (Bitfield(oc_pre_discovered, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_pre_discovered", 1); - bitfield = d_objclass->oc_magic; /* (Bitfield(oc_magic, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_magic", 1); - bitfield = d_objclass->oc_charged; /* (Bitfield(oc_charged, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_charged", 1); - bitfield = d_objclass->oc_unique; /* (Bitfield(oc_unique, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_unique", 1); - bitfield = d_objclass->oc_nowish; /* (Bitfield(oc_nowish, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_nowish", 1); - bitfield = d_objclass->oc_big; /* (Bitfield(oc_big, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_big", 1); - bitfield = d_objclass->oc_tough; /* (Bitfield(oc_tough, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_tough", 1); - bitfield = d_objclass->oc_dir; /* (Bitfield(oc_dir, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_dir", 2); - bitfield = d_objclass->oc_material; /* (Bitfield(oc_material, 5)) */ - sfo_bitfield(nhfp, &bitfield, parent, "oc_material", 5); - sfo_schar(nhfp, &d_objclass->oc_subtyp, parent, "oc_subtyp", 1);/* (schar) */ - sfo_uchar(nhfp, &d_objclass->oc_oprop, parent, "oc_oprop", 1);/* (uchar) */ - sfo_char(nhfp, &d_objclass->oc_class, parent, "oc_class", 1);/* (char) */ - sfo_schar(nhfp, &d_objclass->oc_delay, parent, "oc_delay", 1);/* (schar) */ - sfo_uchar(nhfp, &d_objclass->oc_color, parent, "oc_color", 1);/* (uchar) */ - sfo_short(nhfp, &d_objclass->oc_prob, parent, "oc_prob", 1); /* (short) */ - sfo_ushort(nhfp, &d_objclass->oc_weight, parent, "oc_weight", 1);/* (unsigned short) */ - sfo_short(nhfp, &d_objclass->oc_cost, parent, "oc_cost", 1); /* (short) */ - sfo_schar(nhfp, &d_objclass->oc_wsdam, parent, "oc_wsdam", 1);/* (schar) */ - sfo_schar(nhfp, &d_objclass->oc_wldam, parent, "oc_wldam", 1);/* (schar) */ - sfo_schar(nhfp, &d_objclass->oc_oc1, parent, "oc_oc1", 1); /* (schar) */ - sfo_schar(nhfp, &d_objclass->oc_oc2, parent, "oc_oc2", 1); /* (schar) */ - sfo_ushort(nhfp, &d_objclass->oc_nutrition, parent, "oc_nutrition", 1);/* (unsigned short) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "objclass", 1); -} - -void -sfo_obj_split(nhfp, d_obj_split, myparent, myname, cnt) -NHFILE *nhfp; -struct obj_split *d_obj_split; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "obj_split"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "obj_split", 1); - - sfo_unsigned(nhfp, &d_obj_split->parent_oid, parent, "parent_oid", 1);/* (unsigned) */ - sfo_unsigned(nhfp, &d_obj_split->child_oid, parent, "child_oid", 1);/* (unsigned) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "obj_split", 1); -} - -void -sfo_oextra(nhfp, d_oextra, myparent, myname, cnt) -NHFILE *nhfp; -struct oextra *d_oextra; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "oextra"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "oextra", 1); - - sfo_char(nhfp, d_oextra->oname, parent, "oname", 1); /* (char *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_oextra->omonst, parent, "omonst", 1);/* (struct monst *) */ - sfo_unsigned(nhfp, d_oextra->omid, parent, "omid", 1); /* (unsigned *) */ - sfo_long(nhfp, d_oextra->olong, parent, "olong", 1); /* (long *) */ - sfo_char(nhfp, d_oextra->omailcmd, parent, "omailcmd", 1); /* (char *) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "oextra", 1); -} - -void -sfo_polearm_info(nhfp, d_polearm_info, myparent, myname, cnt) -NHFILE *nhfp; -struct polearm_info *d_polearm_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "polearm_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "polearm_info", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_polearm_info->hitmon, parent, "hitmon", 1);/* (struct monst *) */ - sfo_unsigned(nhfp, &d_polearm_info->m_id, parent, "m_id", 1);/* (unsigned) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "polearm_info", 1); -} - -void -sfo_prop(nhfp, d_prop, myparent, myname, cnt) -NHFILE *nhfp; -struct prop *d_prop; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "prop"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "prop", 1); - - sfo_long(nhfp, &d_prop->extrinsic, parent, "extrinsic", 1); /* (long) */ - sfo_long(nhfp, &d_prop->blocked, parent, "blocked", 1); /* (long) */ - sfo_long(nhfp, &d_prop->intrinsic, parent, "intrinsic", 1); /* (long) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "prop", 1); -} - -void -sfo_q_score(nhfp, d_q_score, myparent, myname, cnt) -NHFILE *nhfp; -struct q_score *d_q_score; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "q_score"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "q_score", 1); - - bitfield = d_q_score->first_start; /* (Bitfield(first_start, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "first_start", 1); - bitfield = d_q_score->met_leader; /* (Bitfield(met_leader, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "met_leader", 1); - bitfield = d_q_score->not_ready; /* (Bitfield(not_ready, 3)) */ - sfo_bitfield(nhfp, &bitfield, parent, "not_ready", 3); - bitfield = d_q_score->pissed_off; /* (Bitfield(pissed_off, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "pissed_off", 1); - bitfield = d_q_score->got_quest; /* (Bitfield(got_quest, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "got_quest", 1); - bitfield = d_q_score->first_locate; /* (Bitfield(first_locate, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "first_locate", 1); - bitfield = d_q_score->met_intermed; /* (Bitfield(met_intermed, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "met_intermed", 1); - bitfield = d_q_score->got_final; /* (Bitfield(got_final, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "got_final", 1); - bitfield = d_q_score->made_goal; /* (Bitfield(made_goal, 3)) */ - sfo_bitfield(nhfp, &bitfield, parent, "made_goal", 3); - bitfield = d_q_score->met_nemesis; /* (Bitfield(met_nemesis, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "met_nemesis", 1); - bitfield = d_q_score->killed_nemesis; /* (Bitfield(killed_nemesis, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "killed_nemesis", 1); - bitfield = d_q_score->in_battle; /* (Bitfield(in_battle, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "in_battle", 1); - bitfield = d_q_score->cheater; /* (Bitfield(cheater, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "cheater", 1); - bitfield = d_q_score->touched_artifact; /* (Bitfield(touched_artifact, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "touched_artifact", 1); - bitfield = d_q_score->offered_artifact; /* (Bitfield(offered_artifact, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "offered_artifact", 1); - bitfield = d_q_score->got_thanks; /* (Bitfield(got_thanks, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "got_thanks", 1); - bitfield = d_q_score->ldrgend; /* (Bitfield(ldrgend, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ldrgend", 2); - bitfield = d_q_score->nemgend; /* (Bitfield(nemgend, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "nemgend", 2); - bitfield = d_q_score->godgend; /* (Bitfield(godgend, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "godgend", 2); - bitfield = d_q_score->leader_is_dead; /* (Bitfield(leader_is_dead, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "leader_is_dead", 1); - sfo_unsigned(nhfp, &d_q_score->leader_m_id, parent, "leader_m_id", 1);/* (unsigned) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "q_score", 1); -} - -void -sfo_rm(nhfp, d_rm, myparent, myname, cnt) -NHFILE *nhfp; -struct rm *d_rm; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "rm"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "rm", 1); - - sfo_int(nhfp, &d_rm->glyph, parent, "glyph", 1); /* (int) */ - sfo_schar(nhfp, &d_rm->typ, parent, "typ", 1); /* (schar) */ - sfo_uchar(nhfp, &d_rm->seenv, parent, "seenv", 1); /* (uchar) */ - bitfield = d_rm->flags; /* (Bitfield(flags, 5)) */ - sfo_bitfield(nhfp, &bitfield, parent, "flags", 5); - bitfield = d_rm->horizontal; /* (Bitfield(horizontal, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "horizontal", 1); - bitfield = d_rm->lit; /* (Bitfield(lit, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "lit", 1); - bitfield = d_rm->waslit; /* (Bitfield(waslit, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "waslit", 1); - bitfield = d_rm->roomno; /* (Bitfield(roomno, 6)) */ - sfo_bitfield(nhfp, &bitfield, parent, "roomno", 6); - bitfield = d_rm->edge; /* (Bitfield(edge, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "edge", 1); - bitfield = d_rm->candig; /* (Bitfield(candig, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "candig", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "rm", 1); -} - -void -sfo_s_level(nhfp, d_s_level, myparent, myname, cnt) -NHFILE *nhfp; -struct s_level *d_s_level; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "s_level"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "s_level", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_s_level->next, parent, "next", 1);/* (struct s_level *) */ - sfo_d_level(nhfp, &d_s_level->dlevel, parent, "dlevel", 1); /* (d_level) */ - sfo_char(nhfp, d_s_level->proto, parent, "proto", 15); /* (char) */ - sfo_char(nhfp, &d_s_level->boneid, parent, "boneid", 1); /* (char) */ - sfo_uchar(nhfp, &d_s_level->rndlevs, parent, "rndlevs", 1); /* (uchar) */ - sfo_d_flags(nhfp, &d_s_level->flags, parent, "flags", 1); /* (d_flags) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "s_level", 1); -} - -void -sfo_savefile_info(nhfp, d_savefile_info, myparent, myname, cnt) -NHFILE *nhfp; -struct savefile_info *d_savefile_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "savefile_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "savefile_info", 1); - - sfo_ulong(nhfp, &d_savefile_info->sfi1, parent, "sfi1", 1); /* (unsigned long) */ - sfo_ulong(nhfp, &d_savefile_info->sfi2, parent, "sfi2", 1); /* (unsigned long) */ - sfo_ulong(nhfp, &d_savefile_info->sfi3, parent, "sfi3", 1); /* (unsigned long) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "savefile_info", 1); -} - -void -sfo_skills(nhfp, d_skills, myparent, myname, cnt) -NHFILE *nhfp; -struct skills *d_skills; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "skills"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "skills", 1); - - sfo_xchar(nhfp, &d_skills->skill, parent, "skill", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_skills->max_skill, parent, "max_skill", 1);/* (xchar) */ - sfo_ushort(nhfp, &d_skills->advance, parent, "advance", 1); /* (unsigned short) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "skills", 1); -} - -void -sfo_spell(nhfp, d_spell, myparent, myname, cnt) -NHFILE *nhfp; -struct spell *d_spell; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "spell"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "spell", 1); - - sfo_short(nhfp, &d_spell->sp_id, parent, "sp_id", 1); /* (short) */ - sfo_xchar(nhfp, &d_spell->sp_lev, parent, "sp_lev", 1); /* (xchar) */ - sfo_int(nhfp, &d_spell->sp_know, parent, "sp_know", 1); /* (int) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "spell", 1); -} - -void -sfo_stairway(nhfp, d_stairway, myparent, myname, cnt) -NHFILE *nhfp; -struct stairway *d_stairway; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "stairway"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "stairway", 1); - - sfo_xchar(nhfp, &d_stairway->sx, parent, "sx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_stairway->sy, parent, "sy", 1); /* (xchar) */ - sfo_d_level(nhfp, &d_stairway->tolev, parent, "tolev", 1); /* (d_level) */ - sfo_char(nhfp, &d_stairway->up, parent, "up", 1); /* (char) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "stairway", 1); -} - -void -sfo_takeoff_info(nhfp, d_takeoff_info, myparent, myname, cnt) -NHFILE *nhfp; -struct takeoff_info *d_takeoff_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "takeoff_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "takeoff_info", 1); - - sfo_long(nhfp, &d_takeoff_info->mask, parent, "mask", 1); /* (long) */ - sfo_long(nhfp, &d_takeoff_info->what, parent, "what", 1); /* (long) */ - sfo_int(nhfp, &d_takeoff_info->delay, parent, "delay", 1); /* (int) */ - sfo_boolean(nhfp, &d_takeoff_info->cancelled_don, parent, "cancelled_don", 1);/* (boolean) */ - sfo_char(nhfp, d_takeoff_info->disrobing, parent, "disrobing", CONTEXTVERBSZ + 1);/* (char) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "takeoff_info", 1); -} - -void -sfo_tin_info(nhfp, d_tin_info, myparent, myname, cnt) -NHFILE *nhfp; -struct tin_info *d_tin_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "tin_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "tin_info", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_tin_info->tin, parent, "tin", 1);/* (struct obj *) */ - sfo_unsigned(nhfp, &d_tin_info->o_id, parent, "o_id", 1); /* (unsigned) */ - sfo_int(nhfp, &d_tin_info->usedtime, parent, "usedtime", 1); /* (int) */ - sfo_int(nhfp, &d_tin_info->reqtime, parent, "reqtime", 1); /* (int) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "tin_info", 1); -} - -void -sfo_trap(nhfp, d_trap, myparent, myname, cnt) -NHFILE *nhfp; -struct trap *d_trap; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "trap"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "trap", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_trap->ntrap, parent, "ntrap", 1);/* (struct trap *) */ - sfo_xchar(nhfp, &d_trap->tx, parent, "tx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_trap->ty, parent, "ty", 1); /* (xchar) */ - sfo_d_level(nhfp, &d_trap->dst, parent, "dst", 1); /* (d_level) */ - sfo_nhcoord(nhfp, &d_trap->launch, parent, "launch", 1); /* (nhcoord) */ - bitfield = d_trap->ttyp; /* (Bitfield(ttyp, 5)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ttyp", 5); - bitfield = d_trap->tseen; /* (Bitfield(tseen, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "tseen", 1); - bitfield = d_trap->once; /* (Bitfield(once, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "once", 1); - bitfield = d_trap->madeby_u; /* (Bitfield(madeby_u, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "madeby_u", 1); - sfo_vlaunchinfo(nhfp, &d_trap->vl, parent, "vl", 1); /* (vlaunchinfo) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "trap", 1); -} - -void -sfo_tribute_info(nhfp, d_tribute_info, myparent, myname, cnt) -NHFILE *nhfp; -struct tribute_info *d_tribute_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "tribute_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "tribute_info", 1); - - sfo_size_t(nhfp, &d_tribute_info->tributesz, parent, "tributesz", 1);/* (size_t) */ - sfo_boolean(nhfp, &d_tribute_info->enabled, parent, "enabled", 1);/* (boolean) */ - bitfield = d_tribute_info->bookstock; /* (Bitfield(bookstock, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "bookstock", 1); - bitfield = d_tribute_info->Deathnotice; /* (Bitfield(Deathnotice,1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "Deathnotice", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "tribute_info", 1); -} - -void -sfo_u_achieve(nhfp, d_u_achieve, myparent, myname, cnt) -NHFILE *nhfp; -struct u_achieve *d_u_achieve; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_achieve"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "u_achieve", 1); - - bitfield = d_u_achieve->amulet; /* (Bitfield(amulet, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "amulet", 1); - bitfield = d_u_achieve->bell; /* (Bitfield(bell, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "bell", 1); - bitfield = d_u_achieve->book; /* (Bitfield(book, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "book", 1); - bitfield = d_u_achieve->menorah; /* (Bitfield(menorah, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "menorah", 1); - bitfield = d_u_achieve->enter_gehennom; /* (Bitfield(enter_gehennom,1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "enter_gehennom", 1); - bitfield = d_u_achieve->ascended; /* (Bitfield(ascended, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ascended", 1); - bitfield = d_u_achieve->mines_luckstone; /* (Bitfield(mines_luckstone, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mines_luckstone", 1); - bitfield = d_u_achieve->finish_sokoban; /* (Bitfield(finish_sokoban, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "finish_sokoban", 1); - bitfield = d_u_achieve->killed_medusa; /* (Bitfield(killed_medusa, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "killed_medusa", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "u_achieve", 1); -} - -void -sfo_u_conduct(nhfp, d_u_conduct, myparent, myname, cnt) -NHFILE *nhfp; -struct u_conduct *d_u_conduct; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_conduct"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "u_conduct", 1); - - sfo_long(nhfp, &d_u_conduct->unvegetarian, parent, "unvegetarian", 1);/* (long) */ - sfo_long(nhfp, &d_u_conduct->unvegan, parent, "unvegan", 1); /* (long) */ - sfo_long(nhfp, &d_u_conduct->food, parent, "food", 1); /* (long) */ - sfo_long(nhfp, &d_u_conduct->gnostic, parent, "gnostic", 1); /* (long) */ - sfo_long(nhfp, &d_u_conduct->weaphit, parent, "weaphit", 1); /* (long) */ - sfo_long(nhfp, &d_u_conduct->killer, parent, "killer", 1); /* (long) */ - sfo_long(nhfp, &d_u_conduct->literate, parent, "literate", 1);/* (long) */ - sfo_long(nhfp, &d_u_conduct->polypiles, parent, "polypiles", 1);/* (long) */ - sfo_long(nhfp, &d_u_conduct->polyselfs, parent, "polyselfs", 1);/* (long) */ - sfo_long(nhfp, &d_u_conduct->wishes, parent, "wishes", 1); /* (long) */ - sfo_long(nhfp, &d_u_conduct->wisharti, parent, "wisharti", 1);/* (long) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "u_conduct", 1); -} - -void -sfo_u_event(nhfp, d_u_event, myparent, myname, cnt) -NHFILE *nhfp; -struct u_event *d_u_event; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_event"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "u_event", 1); - - bitfield = d_u_event->minor_oracle; /* (Bitfield(minor_oracle, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "minor_oracle", 1); - bitfield = d_u_event->major_oracle; /* (Bitfield(major_oracle, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "major_oracle", 1); - bitfield = d_u_event->read_tribute; /* (Bitfield(read_tribute, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "read_tribute", 1); - bitfield = d_u_event->qcalled; /* (Bitfield(qcalled, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "qcalled", 1); - bitfield = d_u_event->qexpelled; /* (Bitfield(qexpelled, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "qexpelled", 1); - bitfield = d_u_event->qcompleted; /* (Bitfield(qcompleted, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "qcompleted", 1); - bitfield = d_u_event->uheard_tune; /* (Bitfield(uheard_tune, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uheard_tune", 2); - bitfield = d_u_event->uopened_dbridge; /* (Bitfield(uopened_dbridge, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uopened_dbridge", 1); - bitfield = d_u_event->invoked; /* (Bitfield(invoked, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "invoked", 1); - bitfield = d_u_event->gehennom_entered; /* (Bitfield(gehennom_entered, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "gehennom_entered", 1); - bitfield = d_u_event->uhand_of_elbereth; /* (Bitfield(uhand_of_elbereth, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uhand_of_elbereth", 2); - bitfield = d_u_event->udemigod; /* (Bitfield(udemigod, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "udemigod", 1); - bitfield = d_u_event->uvibrated; /* (Bitfield(uvibrated, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uvibrated", 1); - bitfield = d_u_event->ascended; /* (Bitfield(ascended, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "ascended", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "u_event", 1); -} - -void -sfo_u_have(nhfp, d_u_have, myparent, myname, cnt) -NHFILE *nhfp; -struct u_have *d_u_have; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_have"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "u_have", 1); - - bitfield = d_u_have->amulet; /* (Bitfield(amulet, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "amulet", 1); - bitfield = d_u_have->bell; /* (Bitfield(bell, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "bell", 1); - bitfield = d_u_have->book; /* (Bitfield(book, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "book", 1); - bitfield = d_u_have->menorah; /* (Bitfield(menorah, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "menorah", 1); - bitfield = d_u_have->questart; /* (Bitfield(questart, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "questart", 1); - bitfield = d_u_have->unused; /* (Bitfield(unused, 3)) */ - sfo_bitfield(nhfp, &bitfield, parent, "unused", 3); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "u_have", 1); -} - -void -sfo_u_realtime(nhfp, d_u_realtime, myparent, myname, cnt) -NHFILE *nhfp; -struct u_realtime *d_u_realtime; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_realtime"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "u_realtime", 1); - - sfo_long(nhfp, &d_u_realtime->realtime, parent, "realtime", 1);/* (long) */ - sfo_time_t(nhfp, &d_u_realtime->start_timing, parent, "start_timing", 1);/* (time_t) */ - sfo_time_t(nhfp, &d_u_realtime->finish_time, parent, "finish_time", 1);/* (time_t) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "u_realtime", 1); -} - -void -sfo_u_roleplay(nhfp, d_u_roleplay, myparent, myname, cnt) -NHFILE *nhfp; -struct u_roleplay *d_u_roleplay; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_roleplay"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "u_roleplay", 1); - - sfo_boolean(nhfp, &d_u_roleplay->blind, parent, "blind", 1); /* (boolean) */ - sfo_boolean(nhfp, &d_u_roleplay->nudist, parent, "nudist", 1);/* (boolean) */ - sfo_long(nhfp, &d_u_roleplay->numbones, parent, "numbones", 1);/* (long) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "u_roleplay", 1); -} - -void -sfo_version_info(nhfp, d_version_info, myparent, myname, cnt) -NHFILE *nhfp; -struct version_info *d_version_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "version_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "version_info", 1); - - sfo_ulong(nhfp, &d_version_info->incarnation, parent, "incarnation", 1);/* (unsigned long) */ - sfo_ulong(nhfp, &d_version_info->feature_set, parent, "feature_set", 1);/* (unsigned long) */ - sfo_ulong(nhfp, &d_version_info->entity_count, parent, "entity_count", 1);/* (unsigned long) */ - sfo_ulong(nhfp, &d_version_info->struct_sizes1, parent, "struct_sizes1", 1);/* (unsigned long) */ - sfo_ulong(nhfp, &d_version_info->struct_sizes2, parent, "struct_sizes2", 1);/* (unsigned long) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "version_info", 1); -} - -void -sfo_victual_info(nhfp, d_victual_info, myparent, myname, cnt) -NHFILE *nhfp; -struct victual_info *d_victual_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "victual_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "victual_info", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_victual_info->piece, parent, "piece", 1);/* (struct obj *) */ - sfo_unsigned(nhfp, &d_victual_info->o_id, parent, "o_id", 1);/* (unsigned) */ - sfo_int(nhfp, &d_victual_info->usedtime, parent, "usedtime", 1);/* (int) */ - sfo_int(nhfp, &d_victual_info->reqtime, parent, "reqtime", 1);/* (int) */ - sfo_int(nhfp, &d_victual_info->nmod, parent, "nmod", 1); /* (int) */ - bitfield = d_victual_info->canchoke; /* (Bitfield(canchoke, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "canchoke", 1); - bitfield = d_victual_info->fullwarn; /* (Bitfield(fullwarn, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "fullwarn", 1); - bitfield = d_victual_info->eating; /* (Bitfield(eating, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "eating", 1); - bitfield = d_victual_info->doreset; /* (Bitfield(doreset, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "doreset", 1); - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "victual_info", 1); -} - -void -sfo_vlaunchinfo(nhfp, d_vlaunchinfo, myparent, myname, cnt) -NHFILE *nhfp; -union vlaunchinfo *d_vlaunchinfo; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "vlaunchinfo"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "vlaunchinfo", 1); - - sfo_short(nhfp, &d_vlaunchinfo->v_launch_otyp, parent, "v_launch_otyp", 1);/* (short) */ - sfo_nhcoord(nhfp, &d_vlaunchinfo->v_launch2, parent, "v_launch2", 1);/* (nhcoord) */ - sfo_uchar(nhfp, &d_vlaunchinfo->v_conjoined, parent, "v_conjoined", 1);/* (uchar) */ - sfo_short(nhfp, &d_vlaunchinfo->v_tnote, parent, "v_tnote", 1);/* (short) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "vlaunchinfo", 1); -} - -void -sfo_vptrs(nhfp, d_vptrs, myparent, myname, cnt) -NHFILE *nhfp; -union vptrs *d_vptrs; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "vptrs"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "vptrs", 1); - - sfo_genericptr(nhfp, (genericptr_t) &d_vptrs->v_nexthere, parent, "v_nexthere", 1);/* (struct obj *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_vptrs->v_ocontainer, parent, "v_ocontainer", 1);/* (struct obj *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_vptrs->v_ocarry, parent, "v_ocarry", 1);/* (struct monst *) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "vptrs", 1); -} - -void -sfo_warntype_info(nhfp, d_warntype_info, myparent, myname, cnt) -NHFILE *nhfp; -struct warntype_info *d_warntype_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "warntype_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "warntype_info", 1); - - sfo_ulong(nhfp, &d_warntype_info->obj, parent, "obj", 1); /* (unsigned long) */ - sfo_ulong(nhfp, &d_warntype_info->polyd, parent, "polyd", 1);/* (unsigned long) */ - sfo_genericptr(nhfp, (genericptr_t) &d_warntype_info->species, parent, "species", 1);/* (struct permonst *) */ - sfo_short(nhfp, &d_warntype_info->speciesidx, parent, "speciesidx", 1);/* (short) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "warntype_info", 1); -} - -void -sfo_you(nhfp, d_you, myparent, myname, cnt) -NHFILE *nhfp; -struct you *d_you; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "you"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "start", "you", 1); - - sfo_xchar(nhfp, &d_you->ux, parent, "ux", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_you->uy, parent, "uy", 1); /* (xchar) */ - sfo_schar(nhfp, &d_you->dx, parent, "dx", 1); /* (schar) */ - sfo_schar(nhfp, &d_you->dy, parent, "dy", 1); /* (schar) */ - sfo_schar(nhfp, &d_you->dz, parent, "dz", 1); /* (schar) */ - sfo_schar(nhfp, &d_you->di, parent, "di", 1); /* (schar) */ - sfo_xchar(nhfp, &d_you->tx, parent, "tx", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_you->ty, parent, "ty", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_you->ux0, parent, "ux0", 1); /* (xchar) */ - sfo_xchar(nhfp, &d_you->uy0, parent, "uy0", 1); /* (xchar) */ - sfo_d_level(nhfp, &d_you->uz, parent, "uz", 1); /* (d_level) */ - sfo_d_level(nhfp, &d_you->uz0, parent, "uz0", 1); /* (d_level) */ - sfo_d_level(nhfp, &d_you->utolev, parent, "utolev", 1); /* (d_level) */ - sfo_uchar(nhfp, &d_you->utotype, parent, "utotype", 1); /* (uchar) */ - sfo_boolean(nhfp, &d_you->umoved, parent, "umoved", 1); /* (boolean) */ - sfo_int(nhfp, &d_you->last_str_turn, parent, "last_str_turn", 1);/* (int) */ - sfo_int(nhfp, &d_you->ulevel, parent, "ulevel", 1); /* (int) */ - sfo_int(nhfp, &d_you->ulevelmax, parent, "ulevelmax", 1); /* (int) */ - sfo_unsigned(nhfp, &d_you->utrap, parent, "utrap", 1); /* (unsigned) */ - sfo_unsigned(nhfp, &d_you->utraptype, parent, "utraptype", 1);/* (unsigned) */ - sfo_char(nhfp, d_you->urooms, parent, "urooms", 5); /* (char) */ - sfo_char(nhfp, d_you->urooms0, parent, "urooms0", 5); /* (char) */ - sfo_char(nhfp, d_you->uentered, parent, "uentered", 5); /* (char) */ - sfo_char(nhfp, d_you->ushops, parent, "ushops", 5); /* (char) */ - sfo_char(nhfp, d_you->ushops0, parent, "ushops0", 5); /* (char) */ - sfo_char(nhfp, d_you->ushops_entered, parent, "ushops_entered", 5);/* (char) */ - sfo_char(nhfp, d_you->ushops_left, parent, "ushops_left", 5);/* (char) */ - sfo_int(nhfp, &d_you->uhunger, parent, "uhunger", 1); /* (int) */ - sfo_unsigned(nhfp, &d_you->uhs, parent, "uhs", 1); /* (unsigned) */ - sfo_prop(nhfp, d_you->uprops, parent, "uprops", LAST_PROP + 1);/* (prop) */ - sfo_unsigned(nhfp, &d_you->umconf, parent, "umconf", 1); /* (unsigned) */ - bitfield = d_you->usick_type; /* (Bitfield(usick_type, 2)) */ - sfo_bitfield(nhfp, &bitfield, parent, "usick_type", 2); - sfo_int(nhfp, &d_you->nv_range, parent, "nv_range", 1); /* (int) */ - sfo_int(nhfp, &d_you->xray_range, parent, "xray_range", 1); /* (int) */ - sfo_int(nhfp, &d_you->bglyph, parent, "bglyph", 1); /* (int) */ - sfo_int(nhfp, &d_you->cglyph, parent, "cglyph", 1); /* (int) */ - sfo_int(nhfp, &d_you->bc_order, parent, "bc_order", 1); /* (int) */ - sfo_int(nhfp, &d_you->bc_felt, parent, "bc_felt", 1); /* (int) */ - sfo_int(nhfp, &d_you->umonster, parent, "umonster", 1); /* (int) */ - sfo_int(nhfp, &d_you->umonnum, parent, "umonnum", 1); /* (int) */ - sfo_int(nhfp, &d_you->mh, parent, "mh", 1); /* (int) */ - sfo_int(nhfp, &d_you->mhmax, parent, "mhmax", 1); /* (int) */ - sfo_int(nhfp, &d_you->mtimedone, parent, "mtimedone", 1); /* (int) */ - sfo_attribs(nhfp, &d_you->macurr, parent, "macurr", 1); /* (attribs) */ - sfo_attribs(nhfp, &d_you->mamax, parent, "mamax", 1); /* (attribs) */ - sfo_int(nhfp, &d_you->ulycn, parent, "ulycn", 1); /* (int) */ - sfo_unsigned(nhfp, &d_you->ucreamed, parent, "ucreamed", 1); /* (unsigned) */ - sfo_unsigned(nhfp, &d_you->uswldtim, parent, "uswldtim", 1); /* (unsigned) */ - bitfield = d_you->uswallow; /* (Bitfield(uswallow, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uswallow", 1); - bitfield = d_you->uinwater; /* (Bitfield(uinwater, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uinwater", 1); - bitfield = d_you->uundetected; /* (Bitfield(uundetected, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uundetected", 1); - bitfield = d_you->mfemale; /* (Bitfield(mfemale, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "mfemale", 1); - bitfield = d_you->uinvulnerable; /* (Bitfield(uinvulnerable, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uinvulnerable", 1); - bitfield = d_you->uburied; /* (Bitfield(uburied, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uburied", 1); - bitfield = d_you->uedibility; /* (Bitfield(uedibility, 1)) */ - sfo_bitfield(nhfp, &bitfield, parent, "uedibility", 1); - sfo_unsigned(nhfp, &d_you->udg_cnt, parent, "udg_cnt", 1); /* (unsigned) */ - sfo_u_achieve(nhfp, &d_you->uachieve, parent, "uachieve", 1);/* (u_achieve) */ - sfo_u_event(nhfp, &d_you->uevent, parent, "uevent", 1); /* (u_event) */ - sfo_u_have(nhfp, &d_you->uhave, parent, "uhave", 1); /* (u_have) */ - sfo_u_conduct(nhfp, &d_you->uconduct, parent, "uconduct", 1);/* (u_conduct) */ - sfo_u_roleplay(nhfp, &d_you->uroleplay, parent, "uroleplay", 1);/* (u_roleplay) */ - sfo_attribs(nhfp, &d_you->acurr, parent, "acurr", 1); /* (attribs) */ - sfo_attribs(nhfp, &d_you->aexe, parent, "aexe", 1); /* (attribs) */ - sfo_attribs(nhfp, &d_you->abon, parent, "abon", 1); /* (attribs) */ - sfo_attribs(nhfp, &d_you->amax, parent, "amax", 1); /* (attribs) */ - sfo_attribs(nhfp, &d_you->atemp, parent, "atemp", 1); /* (attribs) */ - sfo_attribs(nhfp, &d_you->atime, parent, "atime", 1); /* (attribs) */ - sfo_align(nhfp, &d_you->ualign, parent, "ualign", 1); /* (align) */ - for (i = 0; i < CONVERT; ++i) - sfo_aligntyp(nhfp, &d_you->ualignbase[i], parent, "ualignbase", 1);/* (aligntyp) */ - sfo_schar(nhfp, &d_you->uluck, parent, "uluck", 1); /* (schar) */ - sfo_schar(nhfp, &d_you->moreluck, parent, "moreluck", 1); /* (schar) */ - sfo_schar(nhfp, &d_you->uhitinc, parent, "uhitinc", 1); /* (schar) */ - sfo_schar(nhfp, &d_you->udaminc, parent, "udaminc", 1); /* (schar) */ - sfo_schar(nhfp, &d_you->uac, parent, "uac", 1); /* (schar) */ - sfo_uchar(nhfp, &d_you->uspellprot, parent, "uspellprot", 1);/* (uchar) */ - sfo_uchar(nhfp, &d_you->usptime, parent, "usptime", 1); /* (uchar) */ - sfo_uchar(nhfp, &d_you->uspmtime, parent, "uspmtime", 1); /* (uchar) */ - sfo_int(nhfp, &d_you->uhp, parent, "uhp", 1); /* (int) */ - sfo_int(nhfp, &d_you->uhpmax, parent, "uhpmax", 1); /* (int) */ - sfo_int(nhfp, &d_you->uen, parent, "uen", 1); /* (int) */ - sfo_int(nhfp, &d_you->uenmax, parent, "uenmax", 1); /* (int) */ - sfo_xchar(nhfp, d_you->uhpinc, parent, "uhpinc", MAXULEV); /* (xchar) */ - sfo_xchar(nhfp, d_you->ueninc, parent, "ueninc", MAXULEV); /* (xchar) */ - sfo_int(nhfp, &d_you->ugangr, parent, "ugangr", 1); /* (int) */ - sfo_int(nhfp, &d_you->ugifts, parent, "ugifts", 1); /* (int) */ - sfo_int(nhfp, &d_you->ublessed, parent, "ublessed", 1); /* (int) */ - sfo_int(nhfp, &d_you->ublesscnt, parent, "ublesscnt", 1); /* (int) */ - sfo_long(nhfp, &d_you->umoney0, parent, "umoney0", 1); /* (long) */ - sfo_long(nhfp, &d_you->uspare1, parent, "uspare1", 1); /* (long) */ - sfo_long(nhfp, &d_you->uexp, parent, "uexp", 1); /* (long) */ - sfo_long(nhfp, &d_you->urexp, parent, "urexp", 1); /* (long) */ - sfo_long(nhfp, &d_you->ucleansed, parent, "ucleansed", 1); /* (long) */ - sfo_long(nhfp, &d_you->usleep, parent, "usleep", 1); /* (long) */ - sfo_int(nhfp, &d_you->uinvault, parent, "uinvault", 1); /* (int) */ - sfo_genericptr(nhfp, (genericptr_t) &d_you->ustuck, parent, "ustuck", 1);/* (struct monst *) */ - sfo_genericptr(nhfp, (genericptr_t) &d_you->usteed, parent, "usteed", 1);/* (struct monst *) */ - sfo_long(nhfp, &d_you->ugallop, parent, "ugallop", 1); /* (long) */ - sfo_int(nhfp, &d_you->urideturns, parent, "urideturns", 1); /* (int) */ - sfo_int(nhfp, &d_you->umortality, parent, "umortality", 1); /* (int) */ - sfo_int(nhfp, &d_you->ugrave_arise, parent, "ugrave_arise", 1);/* (int) */ - sfo_int(nhfp, &d_you->weapon_slots, parent, "weapon_slots", 1);/* (int) */ - sfo_int(nhfp, &d_you->skills_advanced, parent, "skills_advanced", 1);/* (int) */ - sfo_xchar(nhfp, d_you->skill_record, parent, "skill_record", P_SKILL_LIMIT);/* (xchar) */ - for (i = 0; i < P_NUM_SKILLS; ++i) - sfo_skills(nhfp, &d_you->weapon_skills[i], parent, "weapon_skills", 1);/* (skills) */ - sfo_boolean(nhfp, &d_you->twoweap, parent, "twoweap", 1); /* (boolean) */ - sfo_short(nhfp, &d_you->mcham, parent, "mcham", 1); /* (short) */ - - if (nhfp->addinfo) - sfo_addinfo(nhfp, myparent, "end", "you", 1); -} - -void -sfi_align(nhfp, d_align, myparent, myname, cnt) -NHFILE *nhfp; -struct align *d_align; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "align"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "align", 1); - - sfi_aligntyp(nhfp, &d_align->type, parent, "type", 1); - sfi_int(nhfp, &d_align->record, parent, "record", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "align", 1); -} - -void -sfi_attribs(nhfp, d_attribs, myparent, myname, cnt) -NHFILE *nhfp; -struct attribs *d_attribs; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "attribs"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "attribs", 1); - - sfi_schar(nhfp, d_attribs->a, parent, "a", A_MAX); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "attribs", 1); -} - -void -sfi_bill_x(nhfp, d_bill_x, myparent, myname, cnt) -NHFILE *nhfp; -struct bill_x *d_bill_x; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "bill_x"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "bill_x", 1); - - sfi_unsigned(nhfp, &d_bill_x->bo_id, parent, "bo_id", 1); - sfi_boolean(nhfp, &d_bill_x->useup, parent, "useup", 1); - sfi_long(nhfp, &d_bill_x->price, parent, "price", 1); - sfi_long(nhfp, &d_bill_x->bquan, parent, "bquan", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "bill_x", 1); -} - -void -sfi_book_info(nhfp, d_book_info, myparent, myname, cnt) -NHFILE *nhfp; -struct book_info *d_book_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "book_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "book_info", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_book_info->book, parent, "book", 1); - sfi_unsigned(nhfp, &d_book_info->o_id, parent, "o_id", 1); - sfi_schar(nhfp, &d_book_info->delay, parent, "delay", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "book_info", 1); -} - -void -sfi_branch(nhfp, d_branch, myparent, myname, cnt) -NHFILE *nhfp; -struct branch *d_branch; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "branch"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "branch", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_branch->next, parent, "next", 1); - sfi_int(nhfp, &d_branch->id, parent, "id", 1); - sfi_int(nhfp, &d_branch->type, parent, "type", 1); - sfi_d_level(nhfp, &d_branch->end1, parent, "end1", 1); - sfi_d_level(nhfp, &d_branch->end2, parent, "end2", 1); - sfi_boolean(nhfp, &d_branch->end1_up, parent, "end1_up", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "branch", 1); -} - -void -sfi_bubble(nhfp, d_bubble, myparent, myname, cnt) -NHFILE *nhfp; -struct bubble *d_bubble; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "bubble"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "bubble", 1); - - sfi_xchar(nhfp, &d_bubble->x, parent, "x", 1); - sfi_xchar(nhfp, &d_bubble->y, parent, "y", 1); - sfi_schar(nhfp, &d_bubble->dx, parent, "dx", 1); - sfi_schar(nhfp, &d_bubble->dy, parent, "dy", 1); - sfi_uchar(nhfp, d_bubble->bm, parent, "bm", MAX_BMASK + 2); - sfi_genericptr(nhfp, (genericptr_t) &d_bubble->prev, parent, "prev", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_bubble->next, parent, "next", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_bubble->cons, parent, "cons", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "bubble", 1); -} - -void -sfi_cemetery(nhfp, d_cemetery, myparent, myname, cnt) -NHFILE *nhfp; -struct cemetery *d_cemetery; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "cemetery"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "cemetery", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_cemetery->next, parent, "next", 1); - sfi_char(nhfp, d_cemetery->who, parent, "who", PL_NSIZ + 4 * (1 + 3) + 1); - sfi_char(nhfp, d_cemetery->how, parent, "how", 100 + 1); - sfi_char(nhfp, d_cemetery->when, parent, "when", 4 + 2 + 2 + 2 + 2 + 2 + 1); - sfi_schar(nhfp, &d_cemetery->frpx, parent, "frpx", 1); - sfi_schar(nhfp, &d_cemetery->frpy, parent, "frpy", 1); - sfi_boolean(nhfp, &d_cemetery->bonesknown, parent, "bonesknown", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "cemetery", 1); -} - -void -sfi_context_info(nhfp, d_context_info, myparent, myname, cnt) -NHFILE *nhfp; -struct context_info *d_context_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "context_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "context_info", 1); - - sfi_unsigned(nhfp, &d_context_info->ident, parent, "ident", 1); - sfi_unsigned(nhfp, &d_context_info->no_of_wizards, parent, "no_of_wizards", 1); - sfi_unsigned(nhfp, &d_context_info->run, parent, "run", 1); - sfi_unsigned(nhfp, &d_context_info->startingpet_mid, parent, "startingpet_mid", 1); - sfi_int(nhfp, &d_context_info->current_fruit, parent, "current_fruit", 1); - sfi_int(nhfp, &d_context_info->warnlevel, parent, "warnlevel", 1); - sfi_int(nhfp, &d_context_info->rndencode, parent, "rndencode", 1); - sfi_long(nhfp, &d_context_info->next_attrib_check, parent, "next_attrib_check", 1); - sfi_long(nhfp, &d_context_info->stethoscope_move, parent, "stethoscope_move", 1); - sfi_short(nhfp, &d_context_info->stethoscope_movement, parent, "stethoscope_movement", 1); - sfi_boolean(nhfp, &d_context_info->travel, parent, "travel", 1); - sfi_boolean(nhfp, &d_context_info->travel1, parent, "travel1", 1); - sfi_boolean(nhfp, &d_context_info->forcefight, parent, "forcefight", 1); - sfi_boolean(nhfp, &d_context_info->nopick, parent, "nopick", 1); - sfi_boolean(nhfp, &d_context_info->made_amulet, parent, "made_amulet", 1); - sfi_boolean(nhfp, &d_context_info->mon_moving, parent, "mon_moving", 1); - sfi_boolean(nhfp, &d_context_info->move, parent, "move", 1); - sfi_boolean(nhfp, &d_context_info->mv, parent, "mv", 1); - sfi_boolean(nhfp, &d_context_info->bypasses, parent, "bypasses", 1); - sfi_boolean(nhfp, &d_context_info->botl, parent, "botl", 1); - sfi_boolean(nhfp, &d_context_info->botlx, parent, "botlx", 1); - sfi_boolean(nhfp, &d_context_info->door_opened, parent, "door_opened", 1); - sfi_dig_info(nhfp, &d_context_info->digging, parent, "digging", 1); - sfi_victual_info(nhfp, &d_context_info->victual, parent, "victual", 1); - sfi_tin_info(nhfp, &d_context_info->tin, parent, "tin", 1); - sfi_book_info(nhfp, &d_context_info->spbook, parent, "spbook", 1); - sfi_takeoff_info(nhfp, &d_context_info->takeoff, parent, "takeoff", 1); - sfi_warntype_info(nhfp, &d_context_info->warntype, parent, "warntype", 1); - sfi_polearm_info(nhfp, &d_context_info->polearm, parent, "polearm", 1); - sfi_obj_split(nhfp, &d_context_info->objsplit, parent, "objsplit", 1); - sfi_tribute_info(nhfp, &d_context_info->tribute, parent, "tribute", 1); - sfi_novel_tracking(nhfp, &d_context_info->novel, parent, "novel", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "context_info", 1); -} - -void -sfi_d_flags(nhfp, d_d_flags, myparent, myname, cnt) -NHFILE *nhfp; -struct d_flags *d_d_flags; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "d_flags"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "d_flags", 1); - - bitfield = d_d_flags->town; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "town", 1); - d_d_flags->town = bitfield; - - bitfield = d_d_flags->hellish; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "hellish", 1); - d_d_flags->hellish = bitfield; - - bitfield = d_d_flags->maze_like; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "maze_like", 1); - d_d_flags->maze_like = bitfield; - - bitfield = d_d_flags->rogue_like; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "rogue_like", 1); - d_d_flags->rogue_like = bitfield; - - bitfield = d_d_flags->align; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "align", 3); - d_d_flags->align = bitfield; - - bitfield = d_d_flags->unused; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "unused", 1); - d_d_flags->unused = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "d_flags", 1); -} - -void -sfi_d_level(nhfp, d_d_level, myparent, myname, cnt) -NHFILE *nhfp; -struct d_level *d_d_level; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "d_level"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "d_level", 1); - - sfi_xchar(nhfp, &d_d_level->dnum, parent, "dnum", 1); - sfi_xchar(nhfp, &d_d_level->dlevel, parent, "dlevel", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "d_level", 1); -} - -void -sfi_damage(nhfp, d_damage, myparent, myname, cnt) -NHFILE *nhfp; -struct damage *d_damage; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "damage"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "damage", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_damage->next, parent, "next", 1); - sfi_long(nhfp, &d_damage->when, parent, "when", 1); - sfi_long(nhfp, &d_damage->cost, parent, "cost", 1); - sfi_nhcoord(nhfp, &d_damage->place, parent, "place", 1); - sfi_schar(nhfp, &d_damage->typ, parent, "typ", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "damage", 1); -} - -void -sfi_dest_area(nhfp, d_dest_area, myparent, myname, cnt) -NHFILE *nhfp; -struct dest_area *d_dest_area; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "dest_area"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "dest_area", 1); - - sfi_xchar(nhfp, &d_dest_area->lx, parent, "lx", 1); - sfi_xchar(nhfp, &d_dest_area->ly, parent, "ly", 1); - sfi_xchar(nhfp, &d_dest_area->hx, parent, "hx", 1); - sfi_xchar(nhfp, &d_dest_area->hy, parent, "hy", 1); - sfi_xchar(nhfp, &d_dest_area->nlx, parent, "nlx", 1); - sfi_xchar(nhfp, &d_dest_area->nly, parent, "nly", 1); - sfi_xchar(nhfp, &d_dest_area->nhx, parent, "nhx", 1); - sfi_xchar(nhfp, &d_dest_area->nhy, parent, "nhy", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "dest_area", 1); -} - -void -sfi_dgn_topology(nhfp, d_dgn_topology, myparent, myname, cnt) -NHFILE *nhfp; -struct dgn_topology *d_dgn_topology; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "dgn_topology"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "dgn_topology", 1); - - sfi_d_level(nhfp, &d_dgn_topology->d_oracle_level, parent, "d_oracle_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_bigroom_level, parent, "d_bigroom_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_rogue_level, parent, "d_rogue_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_medusa_level, parent, "d_medusa_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_stronghold_level, parent, "d_stronghold_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_valley_level, parent, "d_valley_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_wiz1_level, parent, "d_wiz1_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_wiz2_level, parent, "d_wiz2_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_wiz3_level, parent, "d_wiz3_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_juiblex_level, parent, "d_juiblex_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_orcus_level, parent, "d_orcus_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_baalzebub_level, parent, "d_baalzebub_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_asmodeus_level, parent, "d_asmodeus_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_portal_level, parent, "d_portal_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_sanctum_level, parent, "d_sanctum_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_earth_level, parent, "d_earth_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_water_level, parent, "d_water_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_fire_level, parent, "d_fire_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_air_level, parent, "d_air_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_astral_level, parent, "d_astral_level", 1); - sfi_xchar(nhfp, &d_dgn_topology->d_tower_dnum, parent, "d_tower_dnum", 1); - sfi_xchar(nhfp, &d_dgn_topology->d_sokoban_dnum, parent, "d_sokoban_dnum", 1); - sfi_xchar(nhfp, &d_dgn_topology->d_mines_dnum, parent, "d_mines_dnum", 1); - sfi_xchar(nhfp, &d_dgn_topology->d_quest_dnum, parent, "d_quest_dnum", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_qstart_level, parent, "d_qstart_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_qlocate_level, parent, "d_qlocate_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_nemesis_level, parent, "d_nemesis_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_knox_level, parent, "d_knox_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_mineend_level, parent, "d_mineend_level", 1); - sfi_d_level(nhfp, &d_dgn_topology->d_sokoend_level, parent, "d_sokoend_level", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "dgn_topology", 1); -} - -void -sfi_dig_info(nhfp, d_dig_info, myparent, myname, cnt) -NHFILE *nhfp; -struct dig_info *d_dig_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "dig_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "dig_info", 1); - - sfi_int(nhfp, &d_dig_info->effort, parent, "effort", 1); - sfi_d_level(nhfp, &d_dig_info->level, parent, "level", 1); - sfi_nhcoord(nhfp, &d_dig_info->pos, parent, "pos", 1); - sfi_long(nhfp, &d_dig_info->lastdigtime, parent, "lastdigtime", 1); - sfi_boolean(nhfp, &d_dig_info->down, parent, "down", 1); - sfi_boolean(nhfp, &d_dig_info->chew, parent, "chew", 1); - sfi_boolean(nhfp, &d_dig_info->warned, parent, "warned", 1); - sfi_boolean(nhfp, &d_dig_info->quiet, parent, "quiet", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "dig_info", 1); -} - -void -sfi_dungeon(nhfp, d_dungeon, myparent, myname, cnt) -NHFILE *nhfp; -struct dungeon *d_dungeon; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "dungeon"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "dungeon", 1); - - sfi_char(nhfp, d_dungeon->dname, parent, "dname", 24); - sfi_char(nhfp, d_dungeon->proto, parent, "proto", 15); - sfi_char(nhfp, &d_dungeon->boneid, parent, "boneid", 1); - sfi_d_flags(nhfp, &d_dungeon->flags, parent, "flags", 1); - sfi_xchar(nhfp, &d_dungeon->entry_lev, parent, "entry_lev", 1); - sfi_xchar(nhfp, &d_dungeon->num_dunlevs, parent, "num_dunlevs", 1); - sfi_xchar(nhfp, &d_dungeon->dunlev_ureached, parent, "dunlev_ureached", 1); - sfi_int(nhfp, &d_dungeon->ledger_start, parent, "ledger_start", 1); - sfi_int(nhfp, &d_dungeon->depth_start, parent, "depth_start", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "dungeon", 1); -} - -void -sfi_edog(nhfp, d_edog, myparent, myname, cnt) -NHFILE *nhfp; -struct edog *d_edog; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "edog"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "edog", 1); - - sfi_long(nhfp, &d_edog->droptime, parent, "droptime", 1); - sfi_unsigned(nhfp, &d_edog->dropdist, parent, "dropdist", 1); - sfi_int(nhfp, &d_edog->apport, parent, "apport", 1); - sfi_long(nhfp, &d_edog->whistletime, parent, "whistletime", 1); - sfi_long(nhfp, &d_edog->hungrytime, parent, "hungrytime", 1); - sfi_nhcoord(nhfp, &d_edog->ogoal, parent, "ogoal", 1); - sfi_int(nhfp, &d_edog->abuse, parent, "abuse", 1); - sfi_int(nhfp, &d_edog->revivals, parent, "revivals", 1); - sfi_int(nhfp, &d_edog->mhpmax_penalty, parent, "mhpmax_penalty", 1); - bitfield = d_edog->killed_by_u; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "killed_by_u", 1); - d_edog->killed_by_u = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "edog", 1); -} - -void -sfi_egd(nhfp, d_egd, myparent, myname, cnt) -NHFILE *nhfp; -struct egd *d_egd; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "egd"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "egd", 1); - - sfi_int(nhfp, &d_egd->fcbeg, parent, "fcbeg", 1); - sfi_int(nhfp, &d_egd->fcend, parent, "fcend", 1); - sfi_int(nhfp, &d_egd->vroom, parent, "vroom", 1); - sfi_xchar(nhfp, &d_egd->gdx, parent, "gdx", 1); - sfi_xchar(nhfp, &d_egd->gdy, parent, "gdy", 1); - sfi_xchar(nhfp, &d_egd->ogx, parent, "ogx", 1); - sfi_xchar(nhfp, &d_egd->ogy, parent, "ogy", 1); - sfi_d_level(nhfp, &d_egd->gdlevel, parent, "gdlevel", 1); - sfi_xchar(nhfp, &d_egd->warncnt, parent, "warncnt", 1); - bitfield = d_egd->gddone; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "gddone", 1); - d_egd->gddone = bitfield; - - bitfield = d_egd->witness; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "witness", 2); - d_egd->witness = bitfield; - - bitfield = d_egd->unused; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "unused", 5); - d_egd->unused = bitfield; - - for (i = 0; i < FCSIZ; ++i) - sfi_fakecorridor(nhfp, &d_egd->fakecorr[i], parent, "fakecorr", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "egd", 1); -} - -void -sfi_emin(nhfp, d_emin, myparent, myname, cnt) -NHFILE *nhfp; -struct emin *d_emin; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "emin"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "emin", 1); - - sfi_aligntyp(nhfp, &d_emin->min_align, parent, "min_align", 1); - sfi_boolean(nhfp, &d_emin->renegade, parent, "renegade", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "emin", 1); -} - -void -sfi_engr(nhfp, d_engr, myparent, myname, cnt) -NHFILE *nhfp; -struct engr *d_engr; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "engr"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "engr", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_engr->nxt_engr, parent, "nxt_engr", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_engr->engr_txt, parent, "engr_txt", 1); - sfi_xchar(nhfp, &d_engr->engr_x, parent, "engr_x", 1); - sfi_xchar(nhfp, &d_engr->engr_y, parent, "engr_y", 1); - sfi_unsigned(nhfp, &d_engr->engr_lth, parent, "engr_lth", 1); - sfi_long(nhfp, &d_engr->engr_time, parent, "engr_time", 1); - sfi_xchar(nhfp, &d_engr->engr_type, parent, "engr_type", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "engr", 1); -} - -void -sfi_epri(nhfp, d_epri, myparent, myname, cnt) -NHFILE *nhfp; -struct epri *d_epri; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "epri"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "epri", 1); - - sfi_aligntyp(nhfp, &d_epri->shralign, parent, "shralign", 1); - sfi_schar(nhfp, &d_epri->shroom, parent, "shroom", 1); - sfi_nhcoord(nhfp, &d_epri->shrpos, parent, "shrpos", 1); - sfi_d_level(nhfp, &d_epri->shrlevel, parent, "shrlevel", 1); - sfi_long(nhfp, &d_epri->intone_time, parent, "intone_time", 1); - sfi_long(nhfp, &d_epri->enter_time, parent, "enter_time", 1); - sfi_long(nhfp, &d_epri->hostile_time, parent, "hostile_time", 1); - sfi_long(nhfp, &d_epri->peaceful_time, parent, "peaceful_time", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "epri", 1); -} - -void -sfi_eshk(nhfp, d_eshk, myparent, myname, cnt) -NHFILE *nhfp; -struct eshk *d_eshk; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "eshk"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "eshk", 1); - - sfi_long(nhfp, &d_eshk->robbed, parent, "robbed", 1); - sfi_long(nhfp, &d_eshk->credit, parent, "credit", 1); - sfi_long(nhfp, &d_eshk->debit, parent, "debit", 1); - sfi_long(nhfp, &d_eshk->loan, parent, "loan", 1); - sfi_int(nhfp, &d_eshk->shoptype, parent, "shoptype", 1); - sfi_schar(nhfp, &d_eshk->shoproom, parent, "shoproom", 1); - sfi_schar(nhfp, &d_eshk->unused, parent, "unused", 1); - sfi_boolean(nhfp, &d_eshk->following, parent, "following", 1); - sfi_boolean(nhfp, &d_eshk->surcharge, parent, "surcharge", 1); - sfi_boolean(nhfp, &d_eshk->dismiss_kops, parent, "dismiss_kops", 1); - sfi_nhcoord(nhfp, &d_eshk->shk, parent, "shk", 1); - sfi_nhcoord(nhfp, &d_eshk->shd, parent, "shd", 1); - sfi_d_level(nhfp, &d_eshk->shoplevel, parent, "shoplevel", 1); - sfi_int(nhfp, &d_eshk->billct, parent, "billct", 1); - for (i = 0; i < BILLSZ; ++i) - sfi_bill_x(nhfp, &d_eshk->bill[i], parent, "bill", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_eshk->bill_p, parent, "bill_p", 1); - sfi_int(nhfp, &d_eshk->visitct, parent, "visitct", 1); - sfi_char(nhfp, d_eshk->customer, parent, "customer", PL_NSIZ); - sfi_char(nhfp, d_eshk->shknam, parent, "shknam", PL_NSIZ); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "eshk", 1); -} - -void -sfi_fakecorridor(nhfp, d_fakecorridor, myparent, myname, cnt) -NHFILE *nhfp; -struct fakecorridor *d_fakecorridor; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "fakecorridor"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "fakecorridor", 1); - - sfi_xchar(nhfp, &d_fakecorridor->fx, parent, "fx", 1); - sfi_xchar(nhfp, &d_fakecorridor->fy, parent, "fy", 1); - sfi_xchar(nhfp, &d_fakecorridor->ftyp, parent, "ftyp", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "fakecorridor", 1); -} - -void -sfi_fe(nhfp, d_fe, myparent, myname, cnt) -NHFILE *nhfp; -struct fe *d_fe; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "fe"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "fe", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_fe->next, parent, "next", 1); - sfi_long(nhfp, &d_fe->timeout, parent, "timeout", 1); - sfi_ulong(nhfp, &d_fe->tid, parent, "tid", 1); - sfi_short(nhfp, &d_fe->kind, parent, "kind", 1); - sfi_short(nhfp, &d_fe->func_index, parent, "func_index", 1); - sfi_any(nhfp, &d_fe->arg, parent, "arg", 1); - bitfield = d_fe->needs_fixup; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "needs_fixup", 1); - d_fe->needs_fixup = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "fe", 1); -} - -void -sfi_flag(nhfp, d_flag, myparent, myname, cnt) -NHFILE *nhfp; -struct flag *d_flag; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "flag"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "flag", 1); - - sfi_boolean(nhfp, &d_flag->acoustics, parent, "acoustics", 1); - sfi_boolean(nhfp, &d_flag->autodig, parent, "autodig", 1); - sfi_boolean(nhfp, &d_flag->autoquiver, parent, "autoquiver", 1); - sfi_boolean(nhfp, &d_flag->autoopen, parent, "autoopen", 1); - sfi_boolean(nhfp, &d_flag->beginner, parent, "beginner", 1); - sfi_boolean(nhfp, &d_flag->biff, parent, "biff", 1); - sfi_boolean(nhfp, &d_flag->bones, parent, "bones", 1); - sfi_boolean(nhfp, &d_flag->confirm, parent, "confirm", 1); - sfi_boolean(nhfp, &d_flag->dark_room, parent, "dark_room", 1); - sfi_boolean(nhfp, &d_flag->debug, parent, "debug", 1); - sfi_boolean(nhfp, &d_flag->end_own, parent, "end_own", 1); - sfi_boolean(nhfp, &d_flag->explore, parent, "explore", 1); - sfi_boolean(nhfp, &d_flag->female, parent, "female", 1); - sfi_boolean(nhfp, &d_flag->friday13, parent, "friday13", 1); - sfi_boolean(nhfp, &d_flag->help, parent, "help", 1); - sfi_boolean(nhfp, &d_flag->ignintr, parent, "ignintr", 1); - sfi_boolean(nhfp, &d_flag->ins_chkpt, parent, "ins_chkpt", 1); - sfi_boolean(nhfp, &d_flag->invlet_constant, parent, "invlet_constant", 1); - sfi_boolean(nhfp, &d_flag->legacy, parent, "legacy", 1); - sfi_boolean(nhfp, &d_flag->lit_corridor, parent, "lit_corridor", 1); - sfi_boolean(nhfp, &d_flag->nap, parent, "nap", 1); - sfi_boolean(nhfp, &d_flag->null, parent, "null", 1); - sfi_boolean(nhfp, &d_flag->p__obsolete, parent, "p__obsolete", 1); - sfi_boolean(nhfp, &d_flag->pickup, parent, "pickup", 1); - sfi_boolean(nhfp, &d_flag->pickup_thrown, parent, "pickup_thrown", 1); - sfi_boolean(nhfp, &d_flag->pushweapon, parent, "pushweapon", 1); - sfi_boolean(nhfp, &d_flag->rest_on_space, parent, "rest_on_space", 1); - sfi_boolean(nhfp, &d_flag->safe_dog, parent, "safe_dog", 1); - sfi_boolean(nhfp, &d_flag->showexp, parent, "showexp", 1); - sfi_boolean(nhfp, &d_flag->showscore, parent, "showscore", 1); - sfi_boolean(nhfp, &d_flag->silent, parent, "silent", 1); - sfi_boolean(nhfp, &d_flag->sortpack, parent, "sortpack", 1); - sfi_boolean(nhfp, &d_flag->sparkle, parent, "sparkle", 1); - sfi_boolean(nhfp, &d_flag->standout, parent, "standout", 1); - sfi_boolean(nhfp, &d_flag->time, parent, "time", 1); - sfi_boolean(nhfp, &d_flag->tombstone, parent, "tombstone", 1); - sfi_boolean(nhfp, &d_flag->verbose, parent, "verbose", 1); - sfi_int(nhfp, &d_flag->end_top, parent, "end_top", 1); - sfi_int(nhfp, &d_flag->end_around, parent, "end_around", 1); - sfi_unsigned(nhfp, &d_flag->moonphase, parent, "moonphase", 1); - sfi_ulong(nhfp, &d_flag->suppress_alert, parent, "suppress_alert", 1); - sfi_unsigned(nhfp, &d_flag->paranoia_bits, parent, "paranoia_bits", 1); - sfi_int(nhfp, &d_flag->pickup_burden, parent, "pickup_burden", 1); - sfi_int(nhfp, &d_flag->pile_limit, parent, "pile_limit", 1); - sfi_char(nhfp, &d_flag->sortloot, parent, "sortloot", 1); - sfi_char(nhfp, d_flag->inv_order, parent, "inv_order", MAXOCLASSES); - sfi_char(nhfp, d_flag->pickup_types, parent, "pickup_types", MAXOCLASSES); - sfi_char(nhfp, d_flag->end_disclose, parent, "end_disclose", NUM_DISCLOSURE_OPTIONS + 1); - sfi_char(nhfp, &d_flag->menu_style, parent, "menu_style", 1); - sfi_boolean(nhfp, &d_flag->made_fruit, parent, "made_fruit", 1); - sfi_int(nhfp, &d_flag->initrole, parent, "initrole", 1); - sfi_int(nhfp, &d_flag->initrace, parent, "initrace", 1); - sfi_int(nhfp, &d_flag->initgend, parent, "initgend", 1); - sfi_int(nhfp, &d_flag->initalign, parent, "initalign", 1); - sfi_int(nhfp, &d_flag->randomall, parent, "randomall", 1); - sfi_int(nhfp, &d_flag->pantheon, parent, "pantheon", 1); - sfi_boolean(nhfp, &d_flag->lootabc, parent, "lootabc", 1); - sfi_boolean(nhfp, &d_flag->showrace, parent, "showrace", 1); - sfi_boolean(nhfp, &d_flag->travelcmd, parent, "travelcmd", 1); - sfi_int(nhfp, &d_flag->runmode, parent, "runmode", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "flag", 1); -} - -void -sfi_fruit(nhfp, d_fruit, myparent, myname, cnt) -NHFILE *nhfp; -struct fruit *d_fruit; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "fruit"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "fruit", 1); - - sfi_char(nhfp, d_fruit->fname, parent, "fname", PL_FSIZ); - sfi_int(nhfp, &d_fruit->fid, parent, "fid", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_fruit->nextf, parent, "nextf", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "fruit", 1); -} - -void -sfi_kinfo(nhfp, d_kinfo, myparent, myname, cnt) -NHFILE *nhfp; -struct kinfo *d_kinfo; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "kinfo"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "kinfo", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_kinfo->next, parent, "next", 1); - sfi_int(nhfp, &d_kinfo->id, parent, "id", 1); - sfi_int(nhfp, &d_kinfo->format, parent, "format", 1); - sfi_char(nhfp, d_kinfo->name, parent, "name", BUFSZ); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "kinfo", 1); -} - -void -sfi_levelflags(nhfp, d_levelflags, myparent, myname, cnt) -NHFILE *nhfp; -struct levelflags *d_levelflags; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "levelflags"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "levelflags", 1); - - sfi_uchar(nhfp, &d_levelflags->nfountains, parent, "nfountains", 1); - sfi_uchar(nhfp, &d_levelflags->nsinks, parent, "nsinks", 1); - bitfield = d_levelflags->has_shop; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_shop", 1); - d_levelflags->has_shop = bitfield; - - bitfield = d_levelflags->has_vault; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_vault", 1); - d_levelflags->has_vault = bitfield; - - bitfield = d_levelflags->has_zoo; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_zoo", 1); - d_levelflags->has_zoo = bitfield; - - bitfield = d_levelflags->has_court; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_court", 1); - d_levelflags->has_court = bitfield; - - bitfield = d_levelflags->has_morgue; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_morgue", 1); - d_levelflags->has_morgue = bitfield; - - bitfield = d_levelflags->has_beehive; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_beehive", 1); - d_levelflags->has_beehive = bitfield; - - bitfield = d_levelflags->has_barracks; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_barracks", 1); - d_levelflags->has_barracks = bitfield; - - bitfield = d_levelflags->has_temple; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_temple", 1); - d_levelflags->has_temple = bitfield; - - bitfield = d_levelflags->has_swamp; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "has_swamp", 1); - d_levelflags->has_swamp = bitfield; - - bitfield = d_levelflags->noteleport; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "noteleport", 1); - d_levelflags->noteleport = bitfield; - - bitfield = d_levelflags->hardfloor; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "hardfloor", 1); - d_levelflags->hardfloor = bitfield; - - bitfield = d_levelflags->nommap; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "nommap", 1); - d_levelflags->nommap = bitfield; - - bitfield = d_levelflags->hero_memory; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "hero_memory", 1); - d_levelflags->hero_memory = bitfield; - - bitfield = d_levelflags->shortsighted; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "shortsighted", 1); - d_levelflags->shortsighted = bitfield; - - bitfield = d_levelflags->graveyard; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "graveyard", 1); - d_levelflags->graveyard = bitfield; - - bitfield = d_levelflags->sokoban_rules; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "sokoban_rules", 1); - d_levelflags->sokoban_rules = bitfield; - - bitfield = d_levelflags->is_maze_lev; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "is_maze_lev", 1); - d_levelflags->is_maze_lev = bitfield; - - bitfield = d_levelflags->is_cavernous_lev; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "is_cavernous_lev", 1); - d_levelflags->is_cavernous_lev = bitfield; - - bitfield = d_levelflags->arboreal; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "arboreal", 1); - d_levelflags->arboreal = bitfield; - - bitfield = d_levelflags->wizard_bones; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "wizard_bones", 1); - d_levelflags->wizard_bones = bitfield; - - bitfield = d_levelflags->corrmaze; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "corrmaze", 1); - d_levelflags->corrmaze = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "levelflags", 1); -} - -void -sfi_linfo(nhfp, d_linfo, myparent, myname, cnt) -NHFILE *nhfp; -struct linfo *d_linfo; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "linfo"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "linfo", 1); - - sfi_uchar(nhfp, &d_linfo->flags, parent, "flags", 1); -#ifdef MFLOPPY - sfi_int(nhfp, &d_linfo->where, parent, "where", 1); - sfi_long(nhfp, &d_linfo->time, parent, "time", 1); - sfi_long(nhfp, &d_linfo->size, parent, "size", 1); -#endif /*MFLOPPY*/ - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "linfo", 1); -} - -void -sfi_ls_t(nhfp, d_ls_t, myparent, myname, cnt) -NHFILE *nhfp; -struct ls_t *d_ls_t; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "ls_t"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "ls_t", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_ls_t->next, parent, "next", 1); - sfi_xchar(nhfp, &d_ls_t->x, parent, "x", 1); - sfi_xchar(nhfp, &d_ls_t->y, parent, "y", 1); - sfi_short(nhfp, &d_ls_t->range, parent, "range", 1); - sfi_short(nhfp, &d_ls_t->flags, parent, "flags", 1); - sfi_short(nhfp, &d_ls_t->type, parent, "type", 1); - sfi_any(nhfp, &d_ls_t->id, parent, "id", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "ls_t", 1); -} - -void -sfi_mapseen_feat(nhfp, d_mapseen_feat, myparent, myname, cnt) -NHFILE *nhfp; -struct mapseen_feat *d_mapseen_feat; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mapseen_feat"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "mapseen_feat", 1); - - bitfield = d_mapseen_feat->nfount; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "nfount", 2); - d_mapseen_feat->nfount = bitfield; - - bitfield = d_mapseen_feat->nsink; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "nsink", 2); - d_mapseen_feat->nsink = bitfield; - - bitfield = d_mapseen_feat->naltar; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "naltar", 2); - d_mapseen_feat->naltar = bitfield; - - bitfield = d_mapseen_feat->nthrone; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "nthrone", 2); - d_mapseen_feat->nthrone = bitfield; - - bitfield = d_mapseen_feat->ngrave; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ngrave", 2); - d_mapseen_feat->ngrave = bitfield; - - bitfield = d_mapseen_feat->ntree; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ntree", 2); - d_mapseen_feat->ntree = bitfield; - - bitfield = d_mapseen_feat->water; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "water", 2); - d_mapseen_feat->water = bitfield; - - bitfield = d_mapseen_feat->lava; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "lava", 2); - d_mapseen_feat->lava = bitfield; - - bitfield = d_mapseen_feat->ice; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ice", 2); - d_mapseen_feat->ice = bitfield; - - bitfield = d_mapseen_feat->nshop; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "nshop", 2); - d_mapseen_feat->nshop = bitfield; - - bitfield = d_mapseen_feat->ntemple; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ntemple", 2); - d_mapseen_feat->ntemple = bitfield; - - bitfield = d_mapseen_feat->msalign; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "msalign", 2); - d_mapseen_feat->msalign = bitfield; - - bitfield = d_mapseen_feat->shoptype; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "shoptype", 5); - d_mapseen_feat->shoptype = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "mapseen_feat", 1); -} - -void -sfi_mapseen_flags(nhfp, d_mapseen_flags, myparent, myname, cnt) -NHFILE *nhfp; -struct mapseen_flags *d_mapseen_flags; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mapseen_flags"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "mapseen_flags", 1); - - bitfield = d_mapseen_flags->unreachable; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "unreachable", 1); - d_mapseen_flags->unreachable = bitfield; - - bitfield = d_mapseen_flags->forgot; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "forgot", 1); - d_mapseen_flags->forgot = bitfield; - - bitfield = d_mapseen_flags->knownbones; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "knownbones", 1); - d_mapseen_flags->knownbones = bitfield; - - bitfield = d_mapseen_flags->oracle; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oracle", 1); - d_mapseen_flags->oracle = bitfield; - - bitfield = d_mapseen_flags->sokosolved; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "sokosolved", 1); - d_mapseen_flags->sokosolved = bitfield; - - bitfield = d_mapseen_flags->bigroom; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "bigroom", 1); - d_mapseen_flags->bigroom = bitfield; - - bitfield = d_mapseen_flags->castle; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "castle", 1); - d_mapseen_flags->castle = bitfield; - - bitfield = d_mapseen_flags->castletune; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "castletune", 1); - d_mapseen_flags->castletune = bitfield; - - bitfield = d_mapseen_flags->valley; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "valley", 1); - d_mapseen_flags->valley = bitfield; - - bitfield = d_mapseen_flags->msanctum; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "msanctum", 1); - d_mapseen_flags->msanctum = bitfield; - - bitfield = d_mapseen_flags->ludios; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ludios", 1); - d_mapseen_flags->ludios = bitfield; - - bitfield = d_mapseen_flags->roguelevel; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "roguelevel", 1); - d_mapseen_flags->roguelevel = bitfield; - - bitfield = d_mapseen_flags->quest_summons; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "quest_summons", 1); - d_mapseen_flags->quest_summons = bitfield; - - bitfield = d_mapseen_flags->questing; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "questing", 1); - d_mapseen_flags->questing = bitfield; - - bitfield = d_mapseen_flags->vibrating_square; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "vibrating_square", 1); - d_mapseen_flags->vibrating_square = bitfield; - - bitfield = d_mapseen_flags->spare1; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "spare1", 1); - d_mapseen_flags->spare1 = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "mapseen_flags", 1); -} - -void -sfi_mapseen_rooms(nhfp, d_mapseen_rooms, myparent, myname, cnt) -NHFILE *nhfp; -struct mapseen_rooms *d_mapseen_rooms; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mapseen_rooms"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "mapseen_rooms", 1); - - bitfield = d_mapseen_rooms->seen; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "seen", 1); - d_mapseen_rooms->seen = bitfield; - - bitfield = d_mapseen_rooms->untended; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "untended", 1); - d_mapseen_rooms->untended = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "mapseen_rooms", 1); -} - -void -sfi_mapseen(nhfp, d_mapseen, myparent, myname, cnt) -NHFILE *nhfp; -struct mapseen *d_mapseen; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mapseen"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "mapseen", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_mapseen->next, parent, "next", 1); - sfi_branch(nhfp, d_mapseen->br, parent, "br", 1); - sfi_d_level(nhfp, &d_mapseen->lev, parent, "lev", 1); - sfi_mapseen_feat(nhfp, &d_mapseen->feat, parent, "feat", 1); - sfi_mapseen_flags(nhfp, &d_mapseen->flags, parent, "flags", 1); - sfi_char(nhfp, d_mapseen->custom, parent, "custom", 1); - sfi_unsigned(nhfp, &d_mapseen->custom_lth, parent, "custom_lth", 1); - for (i = 0; i < (MAXNROFROOMS + 1) * 2; ++i) - sfi_mapseen_rooms(nhfp, &d_mapseen->msrooms[i], parent, "msrooms", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_mapseen->final_resting_place, parent, "final_resting_place", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "mapseen", 1); -} - -void -sfi_mextra(nhfp, d_mextra, myparent, myname, cnt) -NHFILE *nhfp; -struct mextra *d_mextra; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mextra"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "mextra", 1); - - sfi_char(nhfp, d_mextra->mname, parent, "mname", 1); - sfi_egd(nhfp, d_mextra->egd, parent, "egd", 1); - sfi_epri(nhfp, d_mextra->epri, parent, "epri", 1); - sfi_eshk(nhfp, d_mextra->eshk, parent, "eshk", 1); - sfi_emin(nhfp, d_mextra->emin, parent, "emin", 1); - sfi_edog(nhfp, d_mextra->edog, parent, "edog", 1); - sfi_int(nhfp, &d_mextra->mcorpsenm, parent, "mcorpsenm", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "mextra", 1); -} - -void -sfi_mkroom(nhfp, d_mkroom, myparent, myname, cnt) -NHFILE *nhfp; -struct mkroom *d_mkroom; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mkroom"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "mkroom", 1); - - sfi_schar(nhfp, &d_mkroom->lx, parent, "lx", 1); - sfi_schar(nhfp, &d_mkroom->hx, parent, "hx", 1); - sfi_schar(nhfp, &d_mkroom->ly, parent, "ly", 1); - sfi_schar(nhfp, &d_mkroom->hy, parent, "hy", 1); - sfi_schar(nhfp, &d_mkroom->rtype, parent, "rtype", 1); - sfi_schar(nhfp, &d_mkroom->orig_rtype, parent, "orig_rtype", 1); - sfi_schar(nhfp, &d_mkroom->rlit, parent, "rlit", 1); - sfi_schar(nhfp, &d_mkroom->needfill, parent, "needfill", 1); - sfi_schar(nhfp, &d_mkroom->needjoining, parent, "needjoining", 1); - sfi_schar(nhfp, &d_mkroom->doorct, parent, "doorct", 1); - sfi_schar(nhfp, &d_mkroom->fdoor, parent, "fdoor", 1); - sfi_schar(nhfp, &d_mkroom->nsubrooms, parent, "nsubrooms", 1); - sfi_boolean(nhfp, &d_mkroom->irregular, parent, "irregular", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_mkroom->sbrooms[0], parent, "sbrooms", MAX_SUBROOMS); - sfi_genericptr(nhfp, (genericptr_t) &d_mkroom->resident, parent, "resident", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "mkroom", 1); -} - -void -sfi_monst(nhfp, d_monst, myparent, myname, cnt) -NHFILE *nhfp; -struct monst *d_monst; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "monst"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "monst", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_monst->nmon, parent, "nmon", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_monst->data, parent, "data", 1); - sfi_unsigned(nhfp, &d_monst->m_id, parent, "m_id", 1); - sfi_short(nhfp, &d_monst->mnum, parent, "mnum", 1); - sfi_short(nhfp, &d_monst->cham, parent, "cham", 1); - sfi_short(nhfp, &d_monst->movement, parent, "movement", 1); - sfi_uchar(nhfp, &d_monst->m_lev, parent, "m_lev", 1); - sfi_aligntyp(nhfp, &d_monst->malign, parent, "malign", 1); - sfi_xchar(nhfp, &d_monst->mx, parent, "mx", 1); - sfi_xchar(nhfp, &d_monst->my, parent, "my", 1); - sfi_xchar(nhfp, &d_monst->mux, parent, "mux", 1); - sfi_xchar(nhfp, &d_monst->muy, parent, "muy", 1); - for (i = 0; i < MTSZ; ++i) - sfi_nhcoord(nhfp, &d_monst->mtrack[i], parent, "mtrack", 1); - sfi_int(nhfp, &d_monst->mhp, parent, "mhp", 1); - sfi_int(nhfp, &d_monst->mhpmax, parent, "mhpmax", 1); - sfi_unsigned(nhfp, &d_monst->mappearance, parent, "mappearance", 1); - sfi_uchar(nhfp, &d_monst->m_ap_type, parent, "m_ap_type", 1); - sfi_schar(nhfp, &d_monst->mtame, parent, "mtame", 1); - sfi_ushort(nhfp, &d_monst->mextrinsics, parent, "mextrinsics", 1); - sfi_int(nhfp, &d_monst->mspec_used, parent, "mspec_used", 1); - bitfield = d_monst->female; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "female", 1); - d_monst->female = bitfield; - - bitfield = d_monst->minvis; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "minvis", 1); - d_monst->minvis = bitfield; - - bitfield = d_monst->invis_blkd; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "invis_blkd", 1); - d_monst->invis_blkd = bitfield; - - bitfield = d_monst->perminvis; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "perminvis", 1); - d_monst->perminvis = bitfield; - - bitfield = d_monst->mcan; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mcan", 1); - d_monst->mcan = bitfield; - - bitfield = d_monst->mburied; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mburied", 1); - d_monst->mburied = bitfield; - - bitfield = d_monst->mundetected; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mundetected", 1); - d_monst->mundetected = bitfield; - - bitfield = d_monst->mcansee; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mcansee", 1); - d_monst->mcansee = bitfield; - - bitfield = d_monst->mspeed; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mspeed", 2); - d_monst->mspeed = bitfield; - - bitfield = d_monst->permspeed; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "permspeed", 2); - d_monst->permspeed = bitfield; - - bitfield = d_monst->mrevived; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mrevived", 1); - d_monst->mrevived = bitfield; - - bitfield = d_monst->mcloned; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mcloned", 1); - d_monst->mcloned = bitfield; - - bitfield = d_monst->mavenge; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mavenge", 1); - d_monst->mavenge = bitfield; - - bitfield = d_monst->mflee; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mflee", 1); - d_monst->mflee = bitfield; - - bitfield = d_monst->mfleetim; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mfleetim", 7); - d_monst->mfleetim = bitfield; - - bitfield = d_monst->msleeping; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "msleeping", 1); - d_monst->msleeping = bitfield; - - bitfield = d_monst->mblinded; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mblinded", 7); - d_monst->mblinded = bitfield; - - bitfield = d_monst->mstun; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mstun", 1); - d_monst->mstun = bitfield; - - bitfield = d_monst->mfrozen; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mfrozen", 7); - d_monst->mfrozen = bitfield; - - bitfield = d_monst->mcanmove; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mcanmove", 1); - d_monst->mcanmove = bitfield; - - bitfield = d_monst->mconf; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mconf", 1); - d_monst->mconf = bitfield; - - bitfield = d_monst->mpeaceful; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mpeaceful", 1); - d_monst->mpeaceful = bitfield; - - bitfield = d_monst->mtrapped; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mtrapped", 1); - d_monst->mtrapped = bitfield; - - bitfield = d_monst->mleashed; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mleashed", 1); - d_monst->mleashed = bitfield; - - bitfield = d_monst->isshk; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "isshk", 1); - d_monst->isshk = bitfield; - - bitfield = d_monst->isminion; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "isminion", 1); - d_monst->isminion = bitfield; - - bitfield = d_monst->isgd; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "isgd", 1); - d_monst->isgd = bitfield; - - bitfield = d_monst->ispriest; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ispriest", 1); - d_monst->ispriest = bitfield; - - bitfield = d_monst->iswiz; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "iswiz", 1); - d_monst->iswiz = bitfield; - - bitfield = d_monst->wormno; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "wormno", 5); - d_monst->wormno = bitfield; - - bitfield = d_monst->mtemplit; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mtemplit", 1); - d_monst->mtemplit = bitfield; - - sfi_ulong(nhfp, &d_monst->mstrategy, parent, "mstrategy", 1); - sfi_long(nhfp, &d_monst->mtrapseen, parent, "mtrapseen", 1); - sfi_long(nhfp, &d_monst->mlstmv, parent, "mlstmv", 1); - sfi_long(nhfp, &d_monst->mspare1, parent, "mspare1", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_monst->minvent, parent, "minvent", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_monst->mw, parent, "mw", 1); - sfi_long(nhfp, &d_monst->misc_worn_check, parent, "misc_worn_check", 1); - sfi_xchar(nhfp, &d_monst->weapon_check, parent, "weapon_check", 1); - sfi_int(nhfp, &d_monst->meating, parent, "meating", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_monst->mextra, parent, "mextra", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "monst", 1); -} - -void -sfi_mvitals(nhfp, d_mvitals, myparent, myname, cnt) -NHFILE *nhfp; -struct mvitals *d_mvitals; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "mvitals"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "mvitals", 1); - - sfi_uchar(nhfp, &d_mvitals->born, parent, "born", 1); - sfi_uchar(nhfp, &d_mvitals->died, parent, "died", 1); - sfi_uchar(nhfp, &d_mvitals->mvflags, parent, "mvflags", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "mvitals", 1); -} - -void -sfi_nhcoord(nhfp, d_nhcoord, myparent, myname, cnt) -NHFILE *nhfp; -struct nhcoord *d_nhcoord; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "nhcoord"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "nhcoord", 1); - - sfi_xchar(nhfp, &d_nhcoord->x, parent, "x", 1); - sfi_xchar(nhfp, &d_nhcoord->y, parent, "y", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "nhcoord", 1); -} - -void -sfi_nhrect(nhfp, d_nhrect, myparent, myname, cnt) -NHFILE *nhfp; -struct nhrect *d_nhrect; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "nhrect"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "nhrect", 1); - - sfi_xchar(nhfp, &d_nhrect->lx, parent, "lx", 1); - sfi_xchar(nhfp, &d_nhrect->ly, parent, "ly", 1); - sfi_xchar(nhfp, &d_nhrect->hx, parent, "hx", 1); - sfi_xchar(nhfp, &d_nhrect->hy, parent, "hy", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "nhrect", 1); -} - -void -sfi_novel_tracking(nhfp, d_novel_tracking, myparent, myname, cnt) -NHFILE *nhfp; -struct novel_tracking *d_novel_tracking; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "novel_tracking"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "novel_tracking", 1); - - sfi_unsigned(nhfp, &d_novel_tracking->id, parent, "id", 1); - sfi_int(nhfp, &d_novel_tracking->count, parent, "count", 1); - sfi_xchar(nhfp, d_novel_tracking->pasg, parent, "pasg", 30); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "novel_tracking", 1); -} - -void -sfi_obj(nhfp, d_obj, myparent, myname, cnt) -NHFILE *nhfp; -struct obj *d_obj; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "obj"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "obj", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_obj->nobj, parent, "nobj", 1); - sfi_vptrs(nhfp, &d_obj->v, parent, "v", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_obj->cobj, parent, "cobj", 1); - sfi_unsigned(nhfp, &d_obj->o_id, parent, "o_id", 1); - sfi_xchar(nhfp, &d_obj->ox, parent, "ox", 1); - sfi_xchar(nhfp, &d_obj->oy, parent, "oy", 1); - sfi_short(nhfp, &d_obj->otyp, parent, "otyp", 1); - sfi_unsigned(nhfp, &d_obj->owt, parent, "owt", 1); - sfi_long(nhfp, &d_obj->quan, parent, "quan", 1); - sfi_schar(nhfp, &d_obj->spe, parent, "spe", 1); - sfi_char(nhfp, &d_obj->oclass, parent, "oclass", 1); - sfi_char(nhfp, &d_obj->invlet, parent, "invlet", 1); - sfi_char(nhfp, &d_obj->oartifact, parent, "oartifact", 1); - sfi_xchar(nhfp, &d_obj->where, parent, "where", 1); - sfi_xchar(nhfp, &d_obj->timed, parent, "timed", 1); - bitfield = d_obj->cursed; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "cursed", 1); - d_obj->cursed = bitfield; - - bitfield = d_obj->blessed; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "blessed", 1); - d_obj->blessed = bitfield; - - bitfield = d_obj->unpaid; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "unpaid", 1); - d_obj->unpaid = bitfield; - - bitfield = d_obj->no_charge; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "no_charge", 1); - d_obj->no_charge = bitfield; - - bitfield = d_obj->known; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "known", 1); - d_obj->known = bitfield; - - bitfield = d_obj->dknown; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "dknown", 1); - d_obj->dknown = bitfield; - - bitfield = d_obj->bknown; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "bknown", 1); - d_obj->bknown = bitfield; - - bitfield = d_obj->rknown; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "rknown", 1); - d_obj->rknown = bitfield; - - bitfield = d_obj->oeroded; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oeroded", 2); - d_obj->oeroded = bitfield; - - bitfield = d_obj->oeroded2; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oeroded2", 2); - d_obj->oeroded2 = bitfield; - - bitfield = d_obj->oerodeproof; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oerodeproof", 1); - d_obj->oerodeproof = bitfield; - - bitfield = d_obj->olocked; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "olocked", 1); - d_obj->olocked = bitfield; - - bitfield = d_obj->obroken; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "obroken", 1); - d_obj->obroken = bitfield; - - bitfield = d_obj->otrapped; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "otrapped", 1); - d_obj->otrapped = bitfield; - - bitfield = d_obj->recharged; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "recharged", 3); - d_obj->recharged = bitfield; - - bitfield = d_obj->lamplit; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "lamplit", 1); - d_obj->lamplit = bitfield; - - bitfield = d_obj->globby; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "globby", 1); - d_obj->globby = bitfield; - - bitfield = d_obj->greased; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "greased", 1); - d_obj->greased = bitfield; - - bitfield = d_obj->nomerge; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "nomerge", 1); - d_obj->nomerge = bitfield; - - bitfield = d_obj->was_thrown; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "was_thrown", 1); - d_obj->was_thrown = bitfield; - - bitfield = d_obj->in_use; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "in_use", 1); - d_obj->in_use = bitfield; - - bitfield = d_obj->bypass; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "bypass", 1); - d_obj->bypass = bitfield; - - bitfield = d_obj->cknown; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "cknown", 1); - d_obj->cknown = bitfield; - - bitfield = d_obj->lknown; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "lknown", 1); - d_obj->lknown = bitfield; - - sfi_int(nhfp, &d_obj->corpsenm, parent, "corpsenm", 1); - sfi_int(nhfp, &d_obj->usecount, parent, "usecount", 1); - sfi_unsigned(nhfp, &d_obj->oeaten, parent, "oeaten", 1); - sfi_long(nhfp, &d_obj->age, parent, "age", 1); - sfi_long(nhfp, &d_obj->owornmask, parent, "owornmask", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_obj->oextra, parent, "oextra", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "obj", 1); -} - -void -sfi_objclass(nhfp, d_objclass, myparent, myname, cnt) -NHFILE *nhfp; -struct objclass *d_objclass; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "objclass"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "objclass", 1); - - sfi_short(nhfp, &d_objclass->oc_name_idx, parent, "oc_name_idx", 1); - sfi_short(nhfp, &d_objclass->oc_descr_idx, parent, "oc_descr_idx", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_objclass->oc_uname, parent, "oc_uname", 1); - bitfield = d_objclass->oc_name_known; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_name_known", 1); - d_objclass->oc_name_known = bitfield; - - bitfield = d_objclass->oc_merge; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_merge", 1); - d_objclass->oc_merge = bitfield; - - bitfield = d_objclass->oc_uses_known; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_uses_known", 1); - d_objclass->oc_uses_known = bitfield; - - bitfield = d_objclass->oc_pre_discovered; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_pre_discovered", 1); - d_objclass->oc_pre_discovered = bitfield; - - bitfield = d_objclass->oc_magic; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_magic", 1); - d_objclass->oc_magic = bitfield; - - bitfield = d_objclass->oc_charged; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_charged", 1); - d_objclass->oc_charged = bitfield; - - bitfield = d_objclass->oc_unique; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_unique", 1); - d_objclass->oc_unique = bitfield; - - bitfield = d_objclass->oc_nowish; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_nowish", 1); - d_objclass->oc_nowish = bitfield; - - bitfield = d_objclass->oc_big; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_big", 1); - d_objclass->oc_big = bitfield; - - bitfield = d_objclass->oc_tough; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_tough", 1); - d_objclass->oc_tough = bitfield; - - bitfield = d_objclass->oc_dir; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_dir", 2); - d_objclass->oc_dir = bitfield; - - bitfield = d_objclass->oc_material; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "oc_material", 5); - d_objclass->oc_material = bitfield; - - sfi_schar(nhfp, &d_objclass->oc_subtyp, parent, "oc_subtyp", 1); - sfi_uchar(nhfp, &d_objclass->oc_oprop, parent, "oc_oprop", 1); - sfi_char(nhfp, &d_objclass->oc_class, parent, "oc_class", 1); - sfi_schar(nhfp, &d_objclass->oc_delay, parent, "oc_delay", 1); - sfi_uchar(nhfp, &d_objclass->oc_color, parent, "oc_color", 1); - sfi_short(nhfp, &d_objclass->oc_prob, parent, "oc_prob", 1); - sfi_ushort(nhfp, &d_objclass->oc_weight, parent, "oc_weight", 1); - sfi_short(nhfp, &d_objclass->oc_cost, parent, "oc_cost", 1); - sfi_schar(nhfp, &d_objclass->oc_wsdam, parent, "oc_wsdam", 1); - sfi_schar(nhfp, &d_objclass->oc_wldam, parent, "oc_wldam", 1); - sfi_schar(nhfp, &d_objclass->oc_oc1, parent, "oc_oc1", 1); - sfi_schar(nhfp, &d_objclass->oc_oc2, parent, "oc_oc2", 1); - sfi_ushort(nhfp, &d_objclass->oc_nutrition, parent, "oc_nutrition", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "objclass", 1); -} - -void -sfi_obj_split(nhfp, d_obj_split, myparent, myname, cnt) -NHFILE *nhfp; -struct obj_split *d_obj_split; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "obj_split"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "obj_split", 1); - - sfi_unsigned(nhfp, &d_obj_split->parent_oid, parent, "parent_oid", 1); - sfi_unsigned(nhfp, &d_obj_split->child_oid, parent, "child_oid", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "obj_split", 1); -} - -void -sfi_oextra(nhfp, d_oextra, myparent, myname, cnt) -NHFILE *nhfp; -struct oextra *d_oextra; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "oextra"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "oextra", 1); - - sfi_char(nhfp, d_oextra->oname, parent, "oname", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_oextra->omonst, parent, "omonst", 1); - sfi_unsigned(nhfp, d_oextra->omid, parent, "omid", 1); - sfi_long(nhfp, d_oextra->olong, parent, "olong", 1); - sfi_char(nhfp, d_oextra->omailcmd, parent, "omailcmd", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "oextra", 1); -} - -void -sfi_polearm_info(nhfp, d_polearm_info, myparent, myname, cnt) -NHFILE *nhfp; -struct polearm_info *d_polearm_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "polearm_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "polearm_info", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_polearm_info->hitmon, parent, "hitmon", 1); - sfi_unsigned(nhfp, &d_polearm_info->m_id, parent, "m_id", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "polearm_info", 1); -} - -void -sfi_prop(nhfp, d_prop, myparent, myname, cnt) -NHFILE *nhfp; -struct prop *d_prop; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "prop"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "prop", 1); - - sfi_long(nhfp, &d_prop->extrinsic, parent, "extrinsic", 1); - sfi_long(nhfp, &d_prop->blocked, parent, "blocked", 1); - sfi_long(nhfp, &d_prop->intrinsic, parent, "intrinsic", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "prop", 1); -} - -void -sfi_q_score(nhfp, d_q_score, myparent, myname, cnt) -NHFILE *nhfp; -struct q_score *d_q_score; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "q_score"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "q_score", 1); - - bitfield = d_q_score->first_start; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "first_start", 1); - d_q_score->first_start = bitfield; - - bitfield = d_q_score->met_leader; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "met_leader", 1); - d_q_score->met_leader = bitfield; - - bitfield = d_q_score->not_ready; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "not_ready", 3); - d_q_score->not_ready = bitfield; - - bitfield = d_q_score->pissed_off; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "pissed_off", 1); - d_q_score->pissed_off = bitfield; - - bitfield = d_q_score->got_quest; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "got_quest", 1); - d_q_score->got_quest = bitfield; - - bitfield = d_q_score->first_locate; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "first_locate", 1); - d_q_score->first_locate = bitfield; - - bitfield = d_q_score->met_intermed; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "met_intermed", 1); - d_q_score->met_intermed = bitfield; - - bitfield = d_q_score->got_final; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "got_final", 1); - d_q_score->got_final = bitfield; - - bitfield = d_q_score->made_goal; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "made_goal", 3); - d_q_score->made_goal = bitfield; - - bitfield = d_q_score->met_nemesis; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "met_nemesis", 1); - d_q_score->met_nemesis = bitfield; - - bitfield = d_q_score->killed_nemesis; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "killed_nemesis", 1); - d_q_score->killed_nemesis = bitfield; - - bitfield = d_q_score->in_battle; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "in_battle", 1); - d_q_score->in_battle = bitfield; - - bitfield = d_q_score->cheater; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "cheater", 1); - d_q_score->cheater = bitfield; - - bitfield = d_q_score->touched_artifact; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "touched_artifact", 1); - d_q_score->touched_artifact = bitfield; - - bitfield = d_q_score->offered_artifact; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "offered_artifact", 1); - d_q_score->offered_artifact = bitfield; - - bitfield = d_q_score->got_thanks; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "got_thanks", 1); - d_q_score->got_thanks = bitfield; - - bitfield = d_q_score->ldrgend; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ldrgend", 2); - d_q_score->ldrgend = bitfield; - - bitfield = d_q_score->nemgend; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "nemgend", 2); - d_q_score->nemgend = bitfield; - - bitfield = d_q_score->godgend; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "godgend", 2); - d_q_score->godgend = bitfield; - - bitfield = d_q_score->leader_is_dead; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "leader_is_dead", 1); - d_q_score->leader_is_dead = bitfield; - - sfi_unsigned(nhfp, &d_q_score->leader_m_id, parent, "leader_m_id", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "q_score", 1); -} - -void -sfi_rm(nhfp, d_rm, myparent, myname, cnt) -NHFILE *nhfp; -struct rm *d_rm; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "rm"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "rm", 1); - - sfi_int(nhfp, &d_rm->glyph, parent, "glyph", 1); - sfi_schar(nhfp, &d_rm->typ, parent, "typ", 1); - sfi_uchar(nhfp, &d_rm->seenv, parent, "seenv", 1); - bitfield = d_rm->flags; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "flags", 5); - d_rm->flags = bitfield; - - bitfield = d_rm->horizontal; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "horizontal", 1); - d_rm->horizontal = bitfield; - - bitfield = d_rm->lit; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "lit", 1); - d_rm->lit = bitfield; - - bitfield = d_rm->waslit; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "waslit", 1); - d_rm->waslit = bitfield; - - bitfield = d_rm->roomno; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "roomno", 6); - d_rm->roomno = bitfield; - - bitfield = d_rm->edge; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "edge", 1); - d_rm->edge = bitfield; - - bitfield = d_rm->candig; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "candig", 1); - d_rm->candig = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "rm", 1); -} - -void -sfi_s_level(nhfp, d_s_level, myparent, myname, cnt) -NHFILE *nhfp; -struct s_level *d_s_level; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "s_level"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "s_level", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_s_level->next, parent, "next", 1); - sfi_d_level(nhfp, &d_s_level->dlevel, parent, "dlevel", 1); - sfi_char(nhfp, d_s_level->proto, parent, "proto", 15); - sfi_char(nhfp, &d_s_level->boneid, parent, "boneid", 1); - sfi_uchar(nhfp, &d_s_level->rndlevs, parent, "rndlevs", 1); - sfi_d_flags(nhfp, &d_s_level->flags, parent, "flags", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "s_level", 1); -} - -void -sfi_savefile_info(nhfp, d_savefile_info, myparent, myname, cnt) -NHFILE *nhfp; -struct savefile_info *d_savefile_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "savefile_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "savefile_info", 1); - - sfi_ulong(nhfp, &d_savefile_info->sfi1, parent, "sfi1", 1); - sfi_ulong(nhfp, &d_savefile_info->sfi2, parent, "sfi2", 1); - sfi_ulong(nhfp, &d_savefile_info->sfi3, parent, "sfi3", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "savefile_info", 1); -} - -void -sfi_skills(nhfp, d_skills, myparent, myname, cnt) -NHFILE *nhfp; -struct skills *d_skills; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "skills"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "skills", 1); - - sfi_xchar(nhfp, &d_skills->skill, parent, "skill", 1); - sfi_xchar(nhfp, &d_skills->max_skill, parent, "max_skill", 1); - sfi_ushort(nhfp, &d_skills->advance, parent, "advance", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "skills", 1); -} - -void -sfi_spell(nhfp, d_spell, myparent, myname, cnt) -NHFILE *nhfp; -struct spell *d_spell; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "spell"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "spell", 1); - - sfi_short(nhfp, &d_spell->sp_id, parent, "sp_id", 1); - sfi_xchar(nhfp, &d_spell->sp_lev, parent, "sp_lev", 1); - sfi_int(nhfp, &d_spell->sp_know, parent, "sp_know", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "spell", 1); -} - -void -sfi_stairway(nhfp, d_stairway, myparent, myname, cnt) -NHFILE *nhfp; -struct stairway *d_stairway; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "stairway"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "stairway", 1); - - sfi_xchar(nhfp, &d_stairway->sx, parent, "sx", 1); - sfi_xchar(nhfp, &d_stairway->sy, parent, "sy", 1); - sfi_d_level(nhfp, &d_stairway->tolev, parent, "tolev", 1); - sfi_char(nhfp, &d_stairway->up, parent, "up", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "stairway", 1); -} - -void -sfi_takeoff_info(nhfp, d_takeoff_info, myparent, myname, cnt) -NHFILE *nhfp; -struct takeoff_info *d_takeoff_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "takeoff_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "takeoff_info", 1); - - sfi_long(nhfp, &d_takeoff_info->mask, parent, "mask", 1); - sfi_long(nhfp, &d_takeoff_info->what, parent, "what", 1); - sfi_int(nhfp, &d_takeoff_info->delay, parent, "delay", 1); - sfi_boolean(nhfp, &d_takeoff_info->cancelled_don, parent, "cancelled_don", 1); - sfi_char(nhfp, d_takeoff_info->disrobing, parent, "disrobing", CONTEXTVERBSZ + 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "takeoff_info", 1); -} - -void -sfi_tin_info(nhfp, d_tin_info, myparent, myname, cnt) -NHFILE *nhfp; -struct tin_info *d_tin_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "tin_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "tin_info", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_tin_info->tin, parent, "tin", 1); - sfi_unsigned(nhfp, &d_tin_info->o_id, parent, "o_id", 1); - sfi_int(nhfp, &d_tin_info->usedtime, parent, "usedtime", 1); - sfi_int(nhfp, &d_tin_info->reqtime, parent, "reqtime", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "tin_info", 1); -} - -void -sfi_trap(nhfp, d_trap, myparent, myname, cnt) -NHFILE *nhfp; -struct trap *d_trap; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "trap"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "trap", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_trap->ntrap, parent, "ntrap", 1); - sfi_xchar(nhfp, &d_trap->tx, parent, "tx", 1); - sfi_xchar(nhfp, &d_trap->ty, parent, "ty", 1); - sfi_d_level(nhfp, &d_trap->dst, parent, "dst", 1); - sfi_nhcoord(nhfp, &d_trap->launch, parent, "launch", 1); - bitfield = d_trap->ttyp; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ttyp", 5); - d_trap->ttyp = bitfield; - - bitfield = d_trap->tseen; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "tseen", 1); - d_trap->tseen = bitfield; - - bitfield = d_trap->once; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "once", 1); - d_trap->once = bitfield; - - bitfield = d_trap->madeby_u; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "madeby_u", 1); - d_trap->madeby_u = bitfield; - - sfi_vlaunchinfo(nhfp, &d_trap->vl, parent, "vl", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "trap", 1); -} - -void -sfi_tribute_info(nhfp, d_tribute_info, myparent, myname, cnt) -NHFILE *nhfp; -struct tribute_info *d_tribute_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "tribute_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "tribute_info", 1); - - sfi_size_t(nhfp, &d_tribute_info->tributesz, parent, "tributesz", 1); - sfi_boolean(nhfp, &d_tribute_info->enabled, parent, "enabled", 1); - bitfield = d_tribute_info->bookstock; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "bookstock", 1); - d_tribute_info->bookstock = bitfield; - - bitfield = d_tribute_info->Deathnotice; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "Deathnotice", 1); - d_tribute_info->Deathnotice = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "tribute_info", 1); -} - -void -sfi_u_achieve(nhfp, d_u_achieve, myparent, myname, cnt) -NHFILE *nhfp; -struct u_achieve *d_u_achieve; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_achieve"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "u_achieve", 1); - - bitfield = d_u_achieve->amulet; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "amulet", 1); - d_u_achieve->amulet = bitfield; - - bitfield = d_u_achieve->bell; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "bell", 1); - d_u_achieve->bell = bitfield; - - bitfield = d_u_achieve->book; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "book", 1); - d_u_achieve->book = bitfield; - - bitfield = d_u_achieve->menorah; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "menorah", 1); - d_u_achieve->menorah = bitfield; - - bitfield = d_u_achieve->enter_gehennom; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "enter_gehennom", 1); - d_u_achieve->enter_gehennom = bitfield; - - bitfield = d_u_achieve->ascended; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ascended", 1); - d_u_achieve->ascended = bitfield; - - bitfield = d_u_achieve->mines_luckstone; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mines_luckstone", 1); - d_u_achieve->mines_luckstone = bitfield; - - bitfield = d_u_achieve->finish_sokoban; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "finish_sokoban", 1); - d_u_achieve->finish_sokoban = bitfield; - - bitfield = d_u_achieve->killed_medusa; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "killed_medusa", 1); - d_u_achieve->killed_medusa = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "u_achieve", 1); -} - -void -sfi_u_conduct(nhfp, d_u_conduct, myparent, myname, cnt) -NHFILE *nhfp; -struct u_conduct *d_u_conduct; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_conduct"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "u_conduct", 1); - - sfi_long(nhfp, &d_u_conduct->unvegetarian, parent, "unvegetarian", 1); - sfi_long(nhfp, &d_u_conduct->unvegan, parent, "unvegan", 1); - sfi_long(nhfp, &d_u_conduct->food, parent, "food", 1); - sfi_long(nhfp, &d_u_conduct->gnostic, parent, "gnostic", 1); - sfi_long(nhfp, &d_u_conduct->weaphit, parent, "weaphit", 1); - sfi_long(nhfp, &d_u_conduct->killer, parent, "killer", 1); - sfi_long(nhfp, &d_u_conduct->literate, parent, "literate", 1); - sfi_long(nhfp, &d_u_conduct->polypiles, parent, "polypiles", 1); - sfi_long(nhfp, &d_u_conduct->polyselfs, parent, "polyselfs", 1); - sfi_long(nhfp, &d_u_conduct->wishes, parent, "wishes", 1); - sfi_long(nhfp, &d_u_conduct->wisharti, parent, "wisharti", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "u_conduct", 1); -} - -void -sfi_u_event(nhfp, d_u_event, myparent, myname, cnt) -NHFILE *nhfp; -struct u_event *d_u_event; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_event"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "u_event", 1); - - bitfield = d_u_event->minor_oracle; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "minor_oracle", 1); - d_u_event->minor_oracle = bitfield; - - bitfield = d_u_event->major_oracle; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "major_oracle", 1); - d_u_event->major_oracle = bitfield; - - bitfield = d_u_event->read_tribute; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "read_tribute", 1); - d_u_event->read_tribute = bitfield; - - bitfield = d_u_event->qcalled; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "qcalled", 1); - d_u_event->qcalled = bitfield; - - bitfield = d_u_event->qexpelled; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "qexpelled", 1); - d_u_event->qexpelled = bitfield; - - bitfield = d_u_event->qcompleted; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "qcompleted", 1); - d_u_event->qcompleted = bitfield; - - bitfield = d_u_event->uheard_tune; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uheard_tune", 2); - d_u_event->uheard_tune = bitfield; - - bitfield = d_u_event->uopened_dbridge; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uopened_dbridge", 1); - d_u_event->uopened_dbridge = bitfield; - - bitfield = d_u_event->invoked; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "invoked", 1); - d_u_event->invoked = bitfield; - - bitfield = d_u_event->gehennom_entered; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "gehennom_entered", 1); - d_u_event->gehennom_entered = bitfield; - - bitfield = d_u_event->uhand_of_elbereth; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uhand_of_elbereth", 2); - d_u_event->uhand_of_elbereth = bitfield; - - bitfield = d_u_event->udemigod; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "udemigod", 1); - d_u_event->udemigod = bitfield; - - bitfield = d_u_event->uvibrated; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uvibrated", 1); - d_u_event->uvibrated = bitfield; - - bitfield = d_u_event->ascended; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "ascended", 1); - d_u_event->ascended = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "u_event", 1); -} - -void -sfi_u_have(nhfp, d_u_have, myparent, myname, cnt) -NHFILE *nhfp; -struct u_have *d_u_have; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_have"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "u_have", 1); - - bitfield = d_u_have->amulet; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "amulet", 1); - d_u_have->amulet = bitfield; - - bitfield = d_u_have->bell; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "bell", 1); - d_u_have->bell = bitfield; - - bitfield = d_u_have->book; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "book", 1); - d_u_have->book = bitfield; - - bitfield = d_u_have->menorah; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "menorah", 1); - d_u_have->menorah = bitfield; - - bitfield = d_u_have->questart; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "questart", 1); - d_u_have->questart = bitfield; - - bitfield = d_u_have->unused; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "unused", 3); - d_u_have->unused = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "u_have", 1); -} - -void -sfi_u_realtime(nhfp, d_u_realtime, myparent, myname, cnt) -NHFILE *nhfp; -struct u_realtime *d_u_realtime; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_realtime"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "u_realtime", 1); - - sfi_long(nhfp, &d_u_realtime->realtime, parent, "realtime", 1); - sfi_time_t(nhfp, &d_u_realtime->start_timing, parent, "start_timing", 1); - sfi_time_t(nhfp, &d_u_realtime->finish_time, parent, "finish_time", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "u_realtime", 1); -} - -void -sfi_u_roleplay(nhfp, d_u_roleplay, myparent, myname, cnt) -NHFILE *nhfp; -struct u_roleplay *d_u_roleplay; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "u_roleplay"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "u_roleplay", 1); - - sfi_boolean(nhfp, &d_u_roleplay->blind, parent, "blind", 1); - sfi_boolean(nhfp, &d_u_roleplay->nudist, parent, "nudist", 1); - sfi_long(nhfp, &d_u_roleplay->numbones, parent, "numbones", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "u_roleplay", 1); -} - -void -sfi_version_info(nhfp, d_version_info, myparent, myname, cnt) -NHFILE *nhfp; -struct version_info *d_version_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "version_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "version_info", 1); - - sfi_ulong(nhfp, &d_version_info->incarnation, parent, "incarnation", 1); - sfi_ulong(nhfp, &d_version_info->feature_set, parent, "feature_set", 1); - sfi_ulong(nhfp, &d_version_info->entity_count, parent, "entity_count", 1); - sfi_ulong(nhfp, &d_version_info->struct_sizes1, parent, "struct_sizes1", 1); - sfi_ulong(nhfp, &d_version_info->struct_sizes2, parent, "struct_sizes2", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "version_info", 1); -} - -void -sfi_victual_info(nhfp, d_victual_info, myparent, myname, cnt) -NHFILE *nhfp; -struct victual_info *d_victual_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "victual_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "victual_info", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_victual_info->piece, parent, "piece", 1); - sfi_unsigned(nhfp, &d_victual_info->o_id, parent, "o_id", 1); - sfi_int(nhfp, &d_victual_info->usedtime, parent, "usedtime", 1); - sfi_int(nhfp, &d_victual_info->reqtime, parent, "reqtime", 1); - sfi_int(nhfp, &d_victual_info->nmod, parent, "nmod", 1); - bitfield = d_victual_info->canchoke; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "canchoke", 1); - d_victual_info->canchoke = bitfield; - - bitfield = d_victual_info->fullwarn; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "fullwarn", 1); - d_victual_info->fullwarn = bitfield; - - bitfield = d_victual_info->eating; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "eating", 1); - d_victual_info->eating = bitfield; - - bitfield = d_victual_info->doreset; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "doreset", 1); - d_victual_info->doreset = bitfield; - - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "victual_info", 1); -} - -void -sfi_vlaunchinfo(nhfp, d_vlaunchinfo, myparent, myname, cnt) -NHFILE *nhfp; -union vlaunchinfo *d_vlaunchinfo; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "vlaunchinfo"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "vlaunchinfo", 1); - - sfi_short(nhfp, &d_vlaunchinfo->v_launch_otyp, parent, "v_launch_otyp", 1); - sfi_nhcoord(nhfp, &d_vlaunchinfo->v_launch2, parent, "v_launch2", 1); - sfi_uchar(nhfp, &d_vlaunchinfo->v_conjoined, parent, "v_conjoined", 1); - sfi_short(nhfp, &d_vlaunchinfo->v_tnote, parent, "v_tnote", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "vlaunchinfo", 1); -} - -void -sfi_vptrs(nhfp, d_vptrs, myparent, myname, cnt) -NHFILE *nhfp; -union vptrs *d_vptrs; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "vptrs"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "vptrs", 1); - - sfi_genericptr(nhfp, (genericptr_t) &d_vptrs->v_nexthere, parent, "v_nexthere", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_vptrs->v_ocontainer, parent, "v_ocontainer", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_vptrs->v_ocarry, parent, "v_ocarry", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "vptrs", 1); -} - -void -sfi_warntype_info(nhfp, d_warntype_info, myparent, myname, cnt) -NHFILE *nhfp; -struct warntype_info *d_warntype_info; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "warntype_info"; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "warntype_info", 1); - - sfi_ulong(nhfp, &d_warntype_info->obj, parent, "obj", 1); - sfi_ulong(nhfp, &d_warntype_info->polyd, parent, "polyd", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_warntype_info->species, parent, "species", 1); - sfi_short(nhfp, &d_warntype_info->speciesidx, parent, "speciesidx", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "warntype_info", 1); -} - -void -sfi_you(nhfp, d_you, myparent, myname, cnt) -NHFILE *nhfp; -struct you *d_you; -const char *myparent; -const char *myname; -int cnt; -{ - const char *parent = "you"; - int i; - - nhUse(myname); - nhUse(cnt); - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "start", "you", 1); - - sfi_xchar(nhfp, &d_you->ux, parent, "ux", 1); - sfi_xchar(nhfp, &d_you->uy, parent, "uy", 1); - sfi_schar(nhfp, &d_you->dx, parent, "dx", 1); - sfi_schar(nhfp, &d_you->dy, parent, "dy", 1); - sfi_schar(nhfp, &d_you->dz, parent, "dz", 1); - sfi_schar(nhfp, &d_you->di, parent, "di", 1); - sfi_xchar(nhfp, &d_you->tx, parent, "tx", 1); - sfi_xchar(nhfp, &d_you->ty, parent, "ty", 1); - sfi_xchar(nhfp, &d_you->ux0, parent, "ux0", 1); - sfi_xchar(nhfp, &d_you->uy0, parent, "uy0", 1); - sfi_d_level(nhfp, &d_you->uz, parent, "uz", 1); - sfi_d_level(nhfp, &d_you->uz0, parent, "uz0", 1); - sfi_d_level(nhfp, &d_you->utolev, parent, "utolev", 1); - sfi_uchar(nhfp, &d_you->utotype, parent, "utotype", 1); - sfi_boolean(nhfp, &d_you->umoved, parent, "umoved", 1); - sfi_int(nhfp, &d_you->last_str_turn, parent, "last_str_turn", 1); - sfi_int(nhfp, &d_you->ulevel, parent, "ulevel", 1); - sfi_int(nhfp, &d_you->ulevelmax, parent, "ulevelmax", 1); - sfi_unsigned(nhfp, &d_you->utrap, parent, "utrap", 1); - sfi_unsigned(nhfp, &d_you->utraptype, parent, "utraptype", 1); - sfi_char(nhfp, d_you->urooms, parent, "urooms", 5); - sfi_char(nhfp, d_you->urooms0, parent, "urooms0", 5); - sfi_char(nhfp, d_you->uentered, parent, "uentered", 5); - sfi_char(nhfp, d_you->ushops, parent, "ushops", 5); - sfi_char(nhfp, d_you->ushops0, parent, "ushops0", 5); - sfi_char(nhfp, d_you->ushops_entered, parent, "ushops_entered", 5); - sfi_char(nhfp, d_you->ushops_left, parent, "ushops_left", 5); - sfi_int(nhfp, &d_you->uhunger, parent, "uhunger", 1); - sfi_unsigned(nhfp, &d_you->uhs, parent, "uhs", 1); - sfi_prop(nhfp, d_you->uprops, parent, "uprops", LAST_PROP + 1); - sfi_unsigned(nhfp, &d_you->umconf, parent, "umconf", 1); - bitfield = d_you->usick_type; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "usick_type", 2); - d_you->usick_type = bitfield; - - sfi_int(nhfp, &d_you->nv_range, parent, "nv_range", 1); - sfi_int(nhfp, &d_you->xray_range, parent, "xray_range", 1); - sfi_int(nhfp, &d_you->bglyph, parent, "bglyph", 1); - sfi_int(nhfp, &d_you->cglyph, parent, "cglyph", 1); - sfi_int(nhfp, &d_you->bc_order, parent, "bc_order", 1); - sfi_int(nhfp, &d_you->bc_felt, parent, "bc_felt", 1); - sfi_int(nhfp, &d_you->umonster, parent, "umonster", 1); - sfi_int(nhfp, &d_you->umonnum, parent, "umonnum", 1); - sfi_int(nhfp, &d_you->mh, parent, "mh", 1); - sfi_int(nhfp, &d_you->mhmax, parent, "mhmax", 1); - sfi_int(nhfp, &d_you->mtimedone, parent, "mtimedone", 1); - sfi_attribs(nhfp, &d_you->macurr, parent, "macurr", 1); - sfi_attribs(nhfp, &d_you->mamax, parent, "mamax", 1); - sfi_int(nhfp, &d_you->ulycn, parent, "ulycn", 1); - sfi_unsigned(nhfp, &d_you->ucreamed, parent, "ucreamed", 1); - sfi_unsigned(nhfp, &d_you->uswldtim, parent, "uswldtim", 1); - bitfield = d_you->uswallow; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uswallow", 1); - d_you->uswallow = bitfield; - - bitfield = d_you->uinwater; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uinwater", 1); - d_you->uinwater = bitfield; - - bitfield = d_you->uundetected; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uundetected", 1); - d_you->uundetected = bitfield; - - bitfield = d_you->mfemale; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "mfemale", 1); - d_you->mfemale = bitfield; - - bitfield = d_you->uinvulnerable; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uinvulnerable", 1); - d_you->uinvulnerable = bitfield; - - bitfield = d_you->uburied; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uburied", 1); - d_you->uburied = bitfield; - - bitfield = d_you->uedibility; /* set it to current value for testing */ - sfi_bitfield(nhfp, &bitfield, parent, "uedibility", 1); - d_you->uedibility = bitfield; - - sfi_unsigned(nhfp, &d_you->udg_cnt, parent, "udg_cnt", 1); - sfi_u_achieve(nhfp, &d_you->uachieve, parent, "uachieve", 1); - sfi_u_event(nhfp, &d_you->uevent, parent, "uevent", 1); - sfi_u_have(nhfp, &d_you->uhave, parent, "uhave", 1); - sfi_u_conduct(nhfp, &d_you->uconduct, parent, "uconduct", 1); - sfi_u_roleplay(nhfp, &d_you->uroleplay, parent, "uroleplay", 1); - sfi_attribs(nhfp, &d_you->acurr, parent, "acurr", 1); - sfi_attribs(nhfp, &d_you->aexe, parent, "aexe", 1); - sfi_attribs(nhfp, &d_you->abon, parent, "abon", 1); - sfi_attribs(nhfp, &d_you->amax, parent, "amax", 1); - sfi_attribs(nhfp, &d_you->atemp, parent, "atemp", 1); - sfi_attribs(nhfp, &d_you->atime, parent, "atime", 1); - sfi_align(nhfp, &d_you->ualign, parent, "ualign", 1); - for (i = 0; i < CONVERT; ++i) - sfi_aligntyp(nhfp, &d_you->ualignbase[i], parent, "ualignbase", 1); - sfi_schar(nhfp, &d_you->uluck, parent, "uluck", 1); - sfi_schar(nhfp, &d_you->moreluck, parent, "moreluck", 1); - sfi_schar(nhfp, &d_you->uhitinc, parent, "uhitinc", 1); - sfi_schar(nhfp, &d_you->udaminc, parent, "udaminc", 1); - sfi_schar(nhfp, &d_you->uac, parent, "uac", 1); - sfi_uchar(nhfp, &d_you->uspellprot, parent, "uspellprot", 1); - sfi_uchar(nhfp, &d_you->usptime, parent, "usptime", 1); - sfi_uchar(nhfp, &d_you->uspmtime, parent, "uspmtime", 1); - sfi_int(nhfp, &d_you->uhp, parent, "uhp", 1); - sfi_int(nhfp, &d_you->uhpmax, parent, "uhpmax", 1); - sfi_int(nhfp, &d_you->uen, parent, "uen", 1); - sfi_int(nhfp, &d_you->uenmax, parent, "uenmax", 1); - sfi_xchar(nhfp, d_you->uhpinc, parent, "uhpinc", MAXULEV); - sfi_xchar(nhfp, d_you->ueninc, parent, "ueninc", MAXULEV); - sfi_int(nhfp, &d_you->ugangr, parent, "ugangr", 1); - sfi_int(nhfp, &d_you->ugifts, parent, "ugifts", 1); - sfi_int(nhfp, &d_you->ublessed, parent, "ublessed", 1); - sfi_int(nhfp, &d_you->ublesscnt, parent, "ublesscnt", 1); - sfi_long(nhfp, &d_you->umoney0, parent, "umoney0", 1); - sfi_long(nhfp, &d_you->uspare1, parent, "uspare1", 1); - sfi_long(nhfp, &d_you->uexp, parent, "uexp", 1); - sfi_long(nhfp, &d_you->urexp, parent, "urexp", 1); - sfi_long(nhfp, &d_you->ucleansed, parent, "ucleansed", 1); - sfi_long(nhfp, &d_you->usleep, parent, "usleep", 1); - sfi_int(nhfp, &d_you->uinvault, parent, "uinvault", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_you->ustuck, parent, "ustuck", 1); - sfi_genericptr(nhfp, (genericptr_t) &d_you->usteed, parent, "usteed", 1); - sfi_long(nhfp, &d_you->ugallop, parent, "ugallop", 1); - sfi_int(nhfp, &d_you->urideturns, parent, "urideturns", 1); - sfi_int(nhfp, &d_you->umortality, parent, "umortality", 1); - sfi_int(nhfp, &d_you->ugrave_arise, parent, "ugrave_arise", 1); - sfi_int(nhfp, &d_you->weapon_slots, parent, "weapon_slots", 1); - sfi_int(nhfp, &d_you->skills_advanced, parent, "skills_advanced", 1); - sfi_xchar(nhfp, d_you->skill_record, parent, "skill_record", P_SKILL_LIMIT); - for (i = 0; i < P_NUM_SKILLS; ++i) - sfi_skills(nhfp, &d_you->weapon_skills[i], parent, "weapon_skills", 1); - sfi_boolean(nhfp, &d_you->twoweap, parent, "twoweap", 1); - sfi_short(nhfp, &d_you->mcham, parent, "mcham", 1); - - if (nhfp->addinfo) - sfi_addinfo(nhfp, myparent, "end", "you", 1); -} -struct nhdatatypes_t nhdatatypes[] = { - {NHTYPE_SIMPLE, (char *) "any", sizeof(anything)}, - {NHTYPE_SIMPLE, (char *) "genericptr_t", sizeof(genericptr_t)}, - {NHTYPE_SIMPLE, (char *) "aligntyp", sizeof(aligntyp)}, - {NHTYPE_SIMPLE, (char *) "Bitfield", sizeof(uint8_t)}, - {NHTYPE_SIMPLE, (char *) "boolean", sizeof(boolean)}, - {NHTYPE_SIMPLE, (char *) "char", sizeof(char)}, - {NHTYPE_SIMPLE, (char *) "int", sizeof(int)}, - {NHTYPE_SIMPLE, (char *) "long", sizeof(long)}, - {NHTYPE_SIMPLE, (char *) "schar", sizeof(schar)}, - {NHTYPE_SIMPLE, (char *) "short", sizeof(short)}, - {NHTYPE_SIMPLE, (char *) "size_t", sizeof(size_t)}, - {NHTYPE_SIMPLE, (char *) "string", sizeof(uchar)}, - {NHTYPE_SIMPLE, (char *) "time_t", sizeof(time_t)}, - {NHTYPE_SIMPLE, (char *) "uchar", sizeof(uchar)}, - {NHTYPE_SIMPLE, (char *) "unsigned char", sizeof(unsigned char)}, - {NHTYPE_SIMPLE, (char *) "unsigned int", sizeof(unsigned int)}, - {NHTYPE_SIMPLE, (char *) "unsigned long", sizeof(unsigned long)}, - {NHTYPE_SIMPLE, (char *) "unsigned short", sizeof(unsigned short)}, - {NHTYPE_SIMPLE, (char *) "unsigned", sizeof(unsigned)}, - {NHTYPE_SIMPLE, (char *) "xchar", sizeof(xchar)}, - {NHTYPE_COMPLEX, (char *) "align", sizeof(struct align)}, - {NHTYPE_COMPLEX, (char *) "attribs", sizeof(struct attribs)}, - {NHTYPE_COMPLEX, (char *) "dig_info", sizeof(struct dig_info)}, - {NHTYPE_COMPLEX, (char *) "tin_info", sizeof(struct tin_info)}, - {NHTYPE_COMPLEX, (char *) "book_info", sizeof(struct book_info)}, - {NHTYPE_COMPLEX, (char *) "takeoff_info", sizeof(struct takeoff_info)}, - {NHTYPE_COMPLEX, (char *) "victual_info", sizeof(struct victual_info)}, - {NHTYPE_COMPLEX, (char *) "warntype_info", sizeof(struct warntype_info)}, - {NHTYPE_COMPLEX, (char *) "polearm_info", sizeof(struct polearm_info)}, - {NHTYPE_COMPLEX, (char *) "obj_split", sizeof(struct obj_split)}, - {NHTYPE_COMPLEX, (char *) "tribute_info", sizeof(struct tribute_info)}, - {NHTYPE_COMPLEX, (char *) "novel_tracking", sizeof(struct novel_tracking)}, - {NHTYPE_COMPLEX, (char *) "context_info", sizeof(struct context_info)}, - {NHTYPE_COMPLEX, (char *) "nhcoord", sizeof(struct nhcoord)}, - {NHTYPE_COMPLEX, (char *) "dgn_topology", sizeof(struct dgn_topology)}, - {NHTYPE_COMPLEX, (char *) "kinfo", sizeof(struct kinfo)}, - {NHTYPE_COMPLEX, (char *) "mvitals", sizeof(struct mvitals)}, - {NHTYPE_COMPLEX, (char *) "ls_t", sizeof(struct ls_t)}, - {NHTYPE_COMPLEX, (char *) "bubble", sizeof(struct bubble)}, - {NHTYPE_COMPLEX, (char *) "d_flags", sizeof(struct d_flags)}, - {NHTYPE_COMPLEX, (char *) "d_level", sizeof(struct d_level)}, - {NHTYPE_COMPLEX, (char *) "s_level", sizeof(struct s_level)}, - {NHTYPE_COMPLEX, (char *) "stairway", sizeof(struct stairway)}, - {NHTYPE_COMPLEX, (char *) "dest_area", sizeof(struct dest_area)}, - {NHTYPE_COMPLEX, (char *) "dungeon", sizeof(struct dungeon)}, - {NHTYPE_COMPLEX, (char *) "branch", sizeof(struct branch)}, - {NHTYPE_COMPLEX, (char *) "linfo", sizeof(struct linfo)}, - {NHTYPE_COMPLEX, (char *) "mapseen", sizeof(struct mapseen)}, - {NHTYPE_COMPLEX, (char *) "mapseen_feat", sizeof(struct mapseen_feat)}, - {NHTYPE_COMPLEX, (char *) "mapseen_flags", sizeof(struct mapseen_flags)}, - {NHTYPE_COMPLEX, (char *) "mapseen_rooms", sizeof(struct mapseen_rooms)}, - {NHTYPE_COMPLEX, (char *) "engr", sizeof(struct engr)}, - {NHTYPE_COMPLEX, (char *) "flag", sizeof(struct flag)}, - {NHTYPE_COMPLEX, (char *) "version_info", sizeof(struct version_info)}, - {NHTYPE_COMPLEX, (char *) "savefile_info", sizeof(struct savefile_info)}, - {NHTYPE_COMPLEX, (char *) "fakecorridor", sizeof(struct fakecorridor)}, - {NHTYPE_COMPLEX, (char *) "egd", sizeof(struct egd)}, - {NHTYPE_COMPLEX, (char *) "epri", sizeof(struct epri)}, - {NHTYPE_COMPLEX, (char *) "bill_x", sizeof(struct bill_x)}, - {NHTYPE_COMPLEX, (char *) "eshk", sizeof(struct eshk)}, - {NHTYPE_COMPLEX, (char *) "emin", sizeof(struct emin)}, - {NHTYPE_COMPLEX, (char *) "edog", sizeof(struct edog)}, - {NHTYPE_COMPLEX, (char *) "mextra", sizeof(struct mextra)}, - {NHTYPE_COMPLEX, (char *) "mkroom", sizeof(struct mkroom)}, - {NHTYPE_COMPLEX, (char *) "monst", sizeof(struct monst)}, - {NHTYPE_COMPLEX, (char *) "vptrs", sizeof(union vptrs)}, - {NHTYPE_COMPLEX, (char *) "oextra", sizeof(struct oextra)}, - {NHTYPE_COMPLEX, (char *) "obj", sizeof(struct obj)}, - {NHTYPE_COMPLEX, (char *) "objclass", sizeof(struct objclass)}, - {NHTYPE_COMPLEX, (char *) "fruit", sizeof(struct fruit)}, - {NHTYPE_COMPLEX, (char *) "prop", sizeof(struct prop)}, - {NHTYPE_COMPLEX, (char *) "q_score", sizeof(struct q_score)}, - {NHTYPE_COMPLEX, (char *) "nhrect", sizeof(struct nhrect)}, - {NHTYPE_COMPLEX, (char *) "rm", sizeof(struct rm)}, - {NHTYPE_COMPLEX, (char *) "damage", sizeof(struct damage)}, - {NHTYPE_COMPLEX, (char *) "cemetery", sizeof(struct cemetery)}, - {NHTYPE_COMPLEX, (char *) "levelflags", sizeof(struct levelflags)}, - {NHTYPE_COMPLEX, (char *) "skills", sizeof(struct skills)}, - {NHTYPE_COMPLEX, (char *) "spell", sizeof(struct spell)}, - {NHTYPE_COMPLEX, (char *) "fe", sizeof(struct fe)}, - {NHTYPE_COMPLEX, (char *) "vlaunchinfo", sizeof(union vlaunchinfo)}, - {NHTYPE_COMPLEX, (char *) "trap", sizeof(struct trap)}, - {NHTYPE_COMPLEX, (char *) "u_have", sizeof(struct u_have)}, - {NHTYPE_COMPLEX, (char *) "u_event", sizeof(struct u_event)}, - {NHTYPE_COMPLEX, (char *) "u_achieve", sizeof(struct u_achieve)}, - {NHTYPE_COMPLEX, (char *) "u_realtime", sizeof(struct u_realtime)}, - {NHTYPE_COMPLEX, (char *) "u_conduct", sizeof(struct u_conduct)}, - {NHTYPE_COMPLEX, (char *) "u_roleplay", sizeof(struct u_roleplay)}, - {NHTYPE_COMPLEX, (char *) "you", sizeof(struct you)} -}; - -int nhdatatypes_size() -{ - return SIZE(nhdatatypes); -} - -const char *critical_members[] = { - "struct align:type:aligntyp", - "struct align:record:int", - "struct attribs:a:schar", - "struct bill_x:bo_id:unsigned", - "struct bill_x:useup:boolean", - "struct bill_x:price:long", - "struct bill_x:bquan:long", - "struct book_info:book:struct obj *", - "struct book_info:o_id:unsigned", - "struct book_info:delay:schar", - "struct branch:next:struct branch *", - "struct branch:id:int", - "struct branch:type:int", - "struct branch:end1:d_level", - "struct branch:end2:d_level", - "struct branch:end1_up:boolean", - "struct bubble:x:xchar", - "struct bubble:y:xchar", - "struct bubble:dx:schar", - "struct bubble:dy:schar", - "struct bubble:bm:uchar", - "struct bubble:prev:struct bubble *", - "struct bubble:next:struct bubble *", - "struct bubble:cons:struct container *", - "struct cemetery:next:struct cemetery *", - "struct cemetery:who:char", - "struct cemetery:how:char", - "struct cemetery:when:char", - "struct cemetery:frpx:schar", - "struct cemetery:frpy:schar", - "struct cemetery:bonesknown:boolean", - "struct context_info:ident:unsigned", - "struct context_info:no_of_wizards:unsigned", - "struct context_info:run:unsigned", - "struct context_info:startingpet_mid:unsigned", - "struct context_info:current_fruit:int", - "struct context_info:warnlevel:int", - "struct context_info:rndencode:int", - "struct context_info:next_attrib_check:long", - "struct context_info:stethoscope_move:long", - "struct context_info:stethoscope_movement:short", - "struct context_info:travel:boolean", - "struct context_info:travel1:boolean", - "struct context_info:forcefight:boolean", - "struct context_info:nopick:boolean", - "struct context_info:made_amulet:boolean", - "struct context_info:mon_moving:boolean", - "struct context_info:move:boolean", - "struct context_info:mv:boolean", - "struct context_info:bypasses:boolean", - "struct context_info:botl:boolean", - "struct context_info:botlx:boolean", - "struct context_info:door_opened:boolean", - "struct context_info:digging:dig_info", - "struct context_info:victual:victual_info", - "struct context_info:tin:tin_info", - "struct context_info:spbook:book_info", - "struct context_info:takeoff:takeoff_info", - "struct context_info:warntype:warntype_info", - "struct context_info:polearm:polearm_info", - "struct context_info:objsplit:obj_split", - "struct context_info:tribute:tribute_info", - "struct context_info:novel:novel_tracking", - "struct d_flags:town:Bitfield(town, 1)", - "struct d_flags:hellish:Bitfield(hellish, 1)", - "struct d_flags:maze_like:Bitfield(maze_like, 1)", - "struct d_flags:rogue_like:Bitfield(rogue_like, 1)", - "struct d_flags:align:Bitfield(align, 3)", - "struct d_flags:unused:Bitfield(unused, 1)", - "struct d_level:dnum:xchar", - "struct d_level:dlevel:xchar", - "struct damage:next:struct damage *", - "struct damage:when:long", - "struct damage:cost:long", - "struct damage:place:nhcoord", - "struct damage:typ:schar", - "struct dest_area:lx:xchar", - "struct dest_area:ly:xchar", - "struct dest_area:hx:xchar", - "struct dest_area:hy:xchar", - "struct dest_area:nlx:xchar", - "struct dest_area:nly:xchar", - "struct dest_area:nhx:xchar", - "struct dest_area:nhy:xchar", - "struct dgn_topology:d_oracle_level:d_level", - "struct dgn_topology:d_bigroom_level:d_level", - "struct dgn_topology:d_rogue_level:d_level", - "struct dgn_topology:d_medusa_level:d_level", - "struct dgn_topology:d_stronghold_level:d_level", - "struct dgn_topology:d_valley_level:d_level", - "struct dgn_topology:d_wiz1_level:d_level", - "struct dgn_topology:d_wiz2_level:d_level", - "struct dgn_topology:d_wiz3_level:d_level", - "struct dgn_topology:d_juiblex_level:d_level", - "struct dgn_topology:d_orcus_level:d_level", - "struct dgn_topology:d_baalzebub_level:d_level", - "struct dgn_topology:d_asmodeus_level:d_level", - "struct dgn_topology:d_portal_level:d_level", - "struct dgn_topology:d_sanctum_level:d_level", - "struct dgn_topology:d_earth_level:d_level", - "struct dgn_topology:d_water_level:d_level", - "struct dgn_topology:d_fire_level:d_level", - "struct dgn_topology:d_air_level:d_level", - "struct dgn_topology:d_astral_level:d_level", - "struct dgn_topology:d_tower_dnum:xchar", - "struct dgn_topology:d_sokoban_dnum:xchar", - "struct dgn_topology:d_mines_dnum:xchar", - "struct dgn_topology:d_quest_dnum:xchar", - "struct dgn_topology:d_qstart_level:d_level", - "struct dgn_topology:d_qlocate_level:d_level", - "struct dgn_topology:d_nemesis_level:d_level", - "struct dgn_topology:d_knox_level:d_level", - "struct dgn_topology:d_mineend_level:d_level", - "struct dgn_topology:d_sokoend_level:d_level", - "struct dig_info:effort:int", - "struct dig_info:level:d_level", - "struct dig_info:pos:nhcoord", - "struct dig_info:lastdigtime:long", - "struct dig_info:down:boolean", - "struct dig_info:chew:boolean", - "struct dig_info:warned:boolean", - "struct dig_info:quiet:boolean", - "struct dungeon:dname:char", - "struct dungeon:proto:char", - "struct dungeon:boneid:char", - "struct dungeon:flags:d_flags", - "struct dungeon:entry_lev:xchar", - "struct dungeon:num_dunlevs:xchar", - "struct dungeon:dunlev_ureached:xchar", - "struct dungeon:ledger_start:int", - "struct dungeon:depth_start:int", - "struct edog:droptime:long", - "struct edog:dropdist:unsigned", - "struct edog:apport:int", - "struct edog:whistletime:long", - "struct edog:hungrytime:long", - "struct edog:ogoal:nhcoord", - "struct edog:abuse:int", - "struct edog:revivals:int", - "struct edog:mhpmax_penalty:int", - "struct edog:killed_by_u:Bitfield(killed_by_u, 1)", - "struct egd:fcbeg:int", - "struct egd:fcend:int", - "struct egd:vroom:int", - "struct egd:gdx:xchar", - "struct egd:gdy:xchar", - "struct egd:ogx:xchar", - "struct egd:ogy:xchar", - "struct egd:gdlevel:d_level", - "struct egd:warncnt:xchar", - "struct egd:gddone:Bitfield(gddone, 1)", - "struct egd:witness:Bitfield(witness, 2)", - "struct egd:unused:Bitfield(unused, 5)", - "struct egd:fakecorr:fakecorridor", - "struct emin:min_align:aligntyp", - "struct emin:renegade:boolean", - "struct engr:nxt_engr:struct engr *", - "struct engr:engr_txt:char *", - "struct engr:engr_x:xchar", - "struct engr:engr_y:xchar", - "struct engr:engr_lth:unsigned", - "struct engr:engr_time:long", - "struct engr:engr_type:xchar", - "struct epri:shralign:aligntyp", - "struct epri:shroom:schar", - "struct epri:shrpos:nhcoord", - "struct epri:shrlevel:d_level", - "struct epri:intone_time:long", - "struct epri:enter_time:long", - "struct epri:hostile_time:long", - "struct epri:peaceful_time:long", - "struct eshk:robbed:long", - "struct eshk:credit:long", - "struct eshk:debit:long", - "struct eshk:loan:long", - "struct eshk:shoptype:int", - "struct eshk:shoproom:schar", - "struct eshk:unused:schar", - "struct eshk:following:boolean", - "struct eshk:surcharge:boolean", - "struct eshk:dismiss_kops:boolean", - "struct eshk:shk:nhcoord", - "struct eshk:shd:nhcoord", - "struct eshk:shoplevel:d_level", - "struct eshk:billct:int", - "struct eshk:bill:bill_x", - "struct eshk:bill_p:struct bill_x *", - "struct eshk:visitct:int", - "struct eshk:customer:char", - "struct eshk:shknam:char", - "struct fakecorridor:fx:xchar", - "struct fakecorridor:fy:xchar", - "struct fakecorridor:ftyp:xchar", - "struct fe:next:struct fe *", - "struct fe:timeout:long", - "struct fe:tid:unsigned long", - "struct fe:kind:short", - "struct fe:func_index:short", - "struct fe:arg:any", - "struct fe:needs_fixup:Bitfield(needs_fixup, 1)", - "struct flag:acoustics:boolean", - "struct flag:autodig:boolean", - "struct flag:autoquiver:boolean", - "struct flag:autoopen:boolean", - "struct flag:beginner:boolean", - "struct flag:biff:boolean", - "struct flag:bones:boolean", - "struct flag:confirm:boolean", - "struct flag:dark_room:boolean", - "struct flag:debug:boolean", - "struct flag:end_own:boolean", - "struct flag:explore:boolean", - "struct flag:female:boolean", - "struct flag:friday13:boolean", - "struct flag:help:boolean", - "struct flag:ignintr:boolean", - "struct flag:ins_chkpt:boolean", - "struct flag:invlet_constant:boolean", - "struct flag:legacy:boolean", - "struct flag:lit_corridor:boolean", - "struct flag:nap:boolean", - "struct flag:null:boolean", - "struct flag:p__obsolete:boolean", - "struct flag:pickup:boolean", - "struct flag:pickup_thrown:boolean", - "struct flag:pushweapon:boolean", - "struct flag:rest_on_space:boolean", - "struct flag:safe_dog:boolean", - "struct flag:showexp:boolean", - "struct flag:showscore:boolean", - "struct flag:silent:boolean", - "struct flag:sortpack:boolean", - "struct flag:sparkle:boolean", - "struct flag:standout:boolean", - "struct flag:time:boolean", - "struct flag:tombstone:boolean", - "struct flag:verbose:boolean", - "struct flag:end_top:int", - "struct flag:end_around:int", - "struct flag:moonphase:unsigned", - "struct flag:suppress_alert:unsigned long", - "struct flag:paranoia_bits:unsigned", - "struct flag:pickup_burden:int", - "struct flag:pile_limit:int", - "struct flag:sortloot:char", - "struct flag:inv_order:char", - "struct flag:pickup_types:char", - "struct flag:end_disclose:char", - "struct flag:menu_style:char", - "struct flag:made_fruit:boolean", - "struct flag:initrole:int", - "struct flag:initrace:int", - "struct flag:initgend:int", - "struct flag:initalign:int", - "struct flag:randomall:int", - "struct flag:pantheon:int", - "struct flag:lootabc:boolean", - "struct flag:showrace:boolean", - "struct flag:travelcmd:boolean", - "struct flag:runmode:int", - "struct fruit:fname:char", - "struct fruit:fid:int", - "struct fruit:nextf:struct fruit *", - "struct kinfo:next:struct kinfo *", - "struct kinfo:id:int", - "struct kinfo:format:int", - "struct kinfo:name:char", - "struct levelflags:nfountains:uchar", - "struct levelflags:nsinks:uchar", - "struct levelflags:has_shop:Bitfield(has_shop, 1)", - "struct levelflags:has_vault:Bitfield(has_vault, 1)", - "struct levelflags:has_zoo:Bitfield(has_zoo, 1)", - "struct levelflags:has_court:Bitfield(has_court, 1)", - "struct levelflags:has_morgue:Bitfield(has_morgue, 1)", - "struct levelflags:has_beehive:Bitfield(has_beehive, 1)", - "struct levelflags:has_barracks:Bitfield(has_barracks, 1)", - "struct levelflags:has_temple:Bitfield(has_temple, 1)", - "struct levelflags:has_swamp:Bitfield(has_swamp, 1)", - "struct levelflags:noteleport:Bitfield(noteleport, 1)", - "struct levelflags:hardfloor:Bitfield(hardfloor, 1)", - "struct levelflags:nommap:Bitfield(nommap, 1)", - "struct levelflags:hero_memory:Bitfield(hero_memory, 1)", - "struct levelflags:shortsighted:Bitfield(shortsighted, 1)", - "struct levelflags:graveyard:Bitfield(graveyard, 1)", - "struct levelflags:sokoban_rules:Bitfield(sokoban_rules, 1)", - "struct levelflags:is_maze_lev:Bitfield(is_maze_lev, 1)", - "struct levelflags:is_cavernous_lev:Bitfield(is_cavernous_lev, 1)", - "struct levelflags:arboreal:Bitfield(arboreal, 1)", - "struct levelflags:wizard_bones:Bitfield(wizard_bones, 1)", - "struct levelflags:corrmaze:Bitfield(corrmaze, 1)", - "struct linfo:flags:unsigned char", -#ifdef MFLOPPY - "struct linfo:where:int", - "struct linfo:time:long", - "struct linfo:size:long", -#endif /*MFLOPPY*/ - "struct ls_t:next:struct ls_t *", - "struct ls_t:x:xchar", - "struct ls_t:y:xchar", - "struct ls_t:range:short", - "struct ls_t:flags:short", - "struct ls_t:type:short", - "struct ls_t:id:any", - "struct mapseen_feat:nfount:Bitfield(nfount, 2)", - "struct mapseen_feat:nsink:Bitfield(nsink, 2)", - "struct mapseen_feat:naltar:Bitfield(naltar, 2)", - "struct mapseen_feat:nthrone:Bitfield(nthrone, 2)", - "struct mapseen_feat:ngrave:Bitfield(ngrave, 2)", - "struct mapseen_feat:ntree:Bitfield(ntree, 2)", - "struct mapseen_feat:water:Bitfield(water, 2)", - "struct mapseen_feat:lava:Bitfield(lava, 2)", - "struct mapseen_feat:ice:Bitfield(ice, 2)", - "struct mapseen_feat:nshop:Bitfield(nshop, 2)", - "struct mapseen_feat:ntemple:Bitfield(ntemple, 2)", - "struct mapseen_feat:msalign:Bitfield(msalign, 2)", - "struct mapseen_feat:shoptype:Bitfield(shoptype, 5)", - "struct mapseen_flags:unreachable:Bitfield(unreachable, 1)", - "struct mapseen_flags:forgot:Bitfield(forgot, 1)", - "struct mapseen_flags:knownbones:Bitfield(knownbones, 1)", - "struct mapseen_flags:oracle:Bitfield(oracle, 1)", - "struct mapseen_flags:sokosolved:Bitfield(sokosolved, 1)", - "struct mapseen_flags:bigroom:Bitfield(bigroom, 1)", - "struct mapseen_flags:castle:Bitfield(castle, 1)", - "struct mapseen_flags:castletune:Bitfield(castletune, 1)", - "struct mapseen_flags:valley:Bitfield(valley, 1)", - "struct mapseen_flags:msanctum:Bitfield(msanctum, 1)", - "struct mapseen_flags:ludios:Bitfield(ludios, 1)", - "struct mapseen_flags:roguelevel:Bitfield(roguelevel, 1)", - "struct mapseen_flags:quest_summons:Bitfield(quest_summons, 1)", - "struct mapseen_flags:questing:Bitfield(questing, 1)", - "struct mapseen_flags:vibrating_square:Bitfield(vibrating_square, 1)", - "struct mapseen_flags:spare1:Bitfield(spare1, 1)", - "struct mapseen_rooms:seen:Bitfield(seen, 1)", - "struct mapseen_rooms:untended:Bitfield(untended, 1)", - "struct mapseen:next:struct mapseen *", - "struct mapseen:br:branch *", - "struct mapseen:lev:d_level", - "struct mapseen:feat:mapseen_feat", - "struct mapseen:flags:mapseen_flags", - "struct mapseen:custom:char *", - "struct mapseen:custom_lth:unsigned", - "struct mapseen:msrooms:mapseen_rooms", - "struct mapseen:final_resting_place:struct cemetery *", - "struct mextra:mname:char *", - "struct mextra:egd:struct egd *", - "struct mextra:epri:struct epri *", - "struct mextra:eshk:struct eshk *", - "struct mextra:emin:struct emin *", - "struct mextra:edog:struct edog *", - "struct mextra:mcorpsenm:int", - "struct mkroom:lx:schar", - "struct mkroom:hx:schar", - "struct mkroom:ly:schar", - "struct mkroom:hy:schar", - "struct mkroom:rtype:schar", - "struct mkroom:orig_rtype:schar", - "struct mkroom:rlit:schar", - "struct mkroom:needfill:schar", - "struct mkroom:needjoining:schar", - "struct mkroom:doorct:schar", - "struct mkroom:fdoor:schar", - "struct mkroom:nsubrooms:schar", - "struct mkroom:irregular:boolean", - "struct mkroom:sbrooms:struct mkroom *", - "struct mkroom:resident:struct monst *", - "struct monst:nmon:struct monst *", - "struct monst:data:struct permonst *", - "struct monst:m_id:unsigned", - "struct monst:mnum:short", - "struct monst:cham:short", - "struct monst:movement:short", - "struct monst:m_lev:uchar", - "struct monst:malign:aligntyp", - "struct monst:mx:xchar", - "struct monst:my:xchar", - "struct monst:mux:xchar", - "struct monst:muy:xchar", - "struct monst:mtrack:nhcoord", - "struct monst:mhp:int", - "struct monst:mhpmax:int", - "struct monst:mappearance:unsigned", - "struct monst:m_ap_type:uchar", - "struct monst:mtame:schar", - "struct monst:mextrinsics:unsigned short", - "struct monst:mspec_used:int", - "struct monst:female:Bitfield(female, 1)", - "struct monst:minvis:Bitfield(minvis, 1)", - "struct monst:invis_blkd:Bitfield(invis_blkd, 1)", - "struct monst:perminvis:Bitfield(perminvis, 1)", - "struct monst:mcan:Bitfield(mcan, 1)", - "struct monst:mburied:Bitfield(mburied, 1)", - "struct monst:mundetected:Bitfield(mundetected, 1)", - "struct monst:mcansee:Bitfield(mcansee, 1)", - "struct monst:mspeed:Bitfield(mspeed, 2)", - "struct monst:permspeed:Bitfield(permspeed, 2)", - "struct monst:mrevived:Bitfield(mrevived, 1)", - "struct monst:mcloned:Bitfield(mcloned, 1)", - "struct monst:mavenge:Bitfield(mavenge, 1)", - "struct monst:mflee:Bitfield(mflee, 1)", - "struct monst:mfleetim:Bitfield(mfleetim, 7)", - "struct monst:msleeping:Bitfield(msleeping, 1)", - "struct monst:mblinded:Bitfield(mblinded, 7)", - "struct monst:mstun:Bitfield(mstun, 1)", - "struct monst:mfrozen:Bitfield(mfrozen, 7)", - "struct monst:mcanmove:Bitfield(mcanmove, 1)", - "struct monst:mconf:Bitfield(mconf, 1)", - "struct monst:mpeaceful:Bitfield(mpeaceful, 1)", - "struct monst:mtrapped:Bitfield(mtrapped, 1)", - "struct monst:mleashed:Bitfield(mleashed, 1)", - "struct monst:isshk:Bitfield(isshk, 1)", - "struct monst:isminion:Bitfield(isminion, 1)", - "struct monst:isgd:Bitfield(isgd, 1)", - "struct monst:ispriest:Bitfield(ispriest, 1)", - "struct monst:iswiz:Bitfield(iswiz, 1)", - "struct monst:wormno:Bitfield(wormno, 5)", - "struct monst:mtemplit:Bitfield(mtemplit, 1)", - "struct monst:mstrategy:unsigned long", - "struct monst:mtrapseen:long", - "struct monst:mlstmv:long", - "struct monst:mspare1:long", - "struct monst:minvent:struct obj *", - "struct monst:mw:struct obj *", - "struct monst:misc_worn_check:long", - "struct monst:weapon_check:xchar", - "struct monst:meating:int", - "struct monst:mextra:struct mextra *", - "struct mvitals:born:uchar", - "struct mvitals:died:uchar", - "struct mvitals:mvflags:uchar", - "struct nhcoord:x:xchar", - "struct nhcoord:y:xchar", - "struct nhrect:lx:xchar", - "struct nhrect:ly:xchar", - "struct nhrect:hx:xchar", - "struct nhrect:hy:xchar", - "struct novel_tracking:id:unsigned", - "struct novel_tracking:count:int", - "struct novel_tracking:pasg:xchar", - "struct obj:nobj:struct obj *", - "struct obj:v:vptrs", - "struct obj:cobj:struct obj *", - "struct obj:o_id:unsigned", - "struct obj:ox:xchar", - "struct obj:oy:xchar", - "struct obj:otyp:short", - "struct obj:owt:unsigned", - "struct obj:quan:long", - "struct obj:spe:schar", - "struct obj:oclass:char", - "struct obj:invlet:char", - "struct obj:oartifact:char", - "struct obj:where:xchar", - "struct obj:timed:xchar", - "struct obj:cursed:Bitfield(cursed, 1)", - "struct obj:blessed:Bitfield(blessed, 1)", - "struct obj:unpaid:Bitfield(unpaid, 1)", - "struct obj:no_charge:Bitfield(no_charge, 1)", - "struct obj:known:Bitfield(known, 1)", - "struct obj:dknown:Bitfield(dknown, 1)", - "struct obj:bknown:Bitfield(bknown, 1)", - "struct obj:rknown:Bitfield(rknown, 1)", - "struct obj:oeroded:Bitfield(oeroded, 2)", - "struct obj:oeroded2:Bitfield(oeroded2, 2)", - "struct obj:oerodeproof:Bitfield(oerodeproof, 1)", - "struct obj:olocked:Bitfield(olocked, 1)", - "struct obj:obroken:Bitfield(obroken, 1)", - "struct obj:otrapped:Bitfield(otrapped, 1)", - "struct obj:recharged:Bitfield(recharged, 3)", - "struct obj:lamplit:Bitfield(lamplit, 1)", - "struct obj:globby:Bitfield(globby, 1)", - "struct obj:greased:Bitfield(greased, 1)", - "struct obj:nomerge:Bitfield(nomerge, 1)", - "struct obj:was_thrown:Bitfield(was_thrown, 1)", - "struct obj:in_use:Bitfield(in_use, 1)", - "struct obj:bypass:Bitfield(bypass, 1)", - "struct obj:cknown:Bitfield(cknown, 1)", - "struct obj:lknown:Bitfield(lknown, 1)", - "struct obj:corpsenm:int", - "struct obj:usecount:int", - "struct obj:oeaten:unsigned", - "struct obj:age:long", - "struct obj:owornmask:long", - "struct obj:oextra:struct oextra *", - "struct objclass:oc_name_idx:short", - "struct objclass:oc_descr_idx:short", - "struct objclass:oc_uname:char *", - "struct objclass:oc_name_known:Bitfield(oc_name_known, 1)", - "struct objclass:oc_merge:Bitfield(oc_merge, 1)", - "struct objclass:oc_uses_known:Bitfield(oc_uses_known, 1)", - "struct objclass:oc_pre_discovered:Bitfield(oc_pre_discovered, 1)", - "struct objclass:oc_magic:Bitfield(oc_magic, 1)", - "struct objclass:oc_charged:Bitfield(oc_charged, 1)", - "struct objclass:oc_unique:Bitfield(oc_unique, 1)", - "struct objclass:oc_nowish:Bitfield(oc_nowish, 1)", - "struct objclass:oc_big:Bitfield(oc_big, 1)", - "struct objclass:oc_tough:Bitfield(oc_tough, 1)", - "struct objclass:oc_dir:Bitfield(oc_dir, 2)", - "struct objclass:oc_material:Bitfield(oc_material, 5)", - "struct objclass:oc_subtyp:schar", - "struct objclass:oc_oprop:uchar", - "struct objclass:oc_class:char", - "struct objclass:oc_delay:schar", - "struct objclass:oc_color:uchar", - "struct objclass:oc_prob:short", - "struct objclass:oc_weight:unsigned short", - "struct objclass:oc_cost:short", - "struct objclass:oc_wsdam:schar", - "struct objclass:oc_wldam:schar", - "struct objclass:oc_oc1:schar", - "struct objclass:oc_oc2:schar", - "struct objclass:oc_nutrition:unsigned short", - "struct obj_split:parent_oid:unsigned", - "struct obj_split:child_oid:unsigned", - "struct oextra:oname:char *", - "struct oextra:omonst:struct monst *", - "struct oextra:omid:unsigned *", - "struct oextra:olong:long *", - "struct oextra:omailcmd:char *", - "struct polearm_info:hitmon:struct monst *", - "struct polearm_info:m_id:unsigned", - "struct prop:extrinsic:long", - "struct prop:blocked:long", - "struct prop:intrinsic:long", - "struct q_score:first_start:Bitfield(first_start, 1)", - "struct q_score:met_leader:Bitfield(met_leader, 1)", - "struct q_score:not_ready:Bitfield(not_ready, 3)", - "struct q_score:pissed_off:Bitfield(pissed_off, 1)", - "struct q_score:got_quest:Bitfield(got_quest, 1)", - "struct q_score:first_locate:Bitfield(first_locate, 1)", - "struct q_score:met_intermed:Bitfield(met_intermed, 1)", - "struct q_score:got_final:Bitfield(got_final, 1)", - "struct q_score:made_goal:Bitfield(made_goal, 3)", - "struct q_score:met_nemesis:Bitfield(met_nemesis, 1)", - "struct q_score:killed_nemesis:Bitfield(killed_nemesis, 1)", - "struct q_score:in_battle:Bitfield(in_battle, 1)", - "struct q_score:cheater:Bitfield(cheater, 1)", - "struct q_score:touched_artifact:Bitfield(touched_artifact, 1)", - "struct q_score:offered_artifact:Bitfield(offered_artifact, 1)", - "struct q_score:got_thanks:Bitfield(got_thanks, 1)", - "struct q_score:ldrgend:Bitfield(ldrgend, 2)", - "struct q_score:nemgend:Bitfield(nemgend, 2)", - "struct q_score:godgend:Bitfield(godgend, 2)", - "struct q_score:leader_is_dead:Bitfield(leader_is_dead, 1)", - "struct q_score:leader_m_id:unsigned", - "struct rm:glyph:int", - "struct rm:typ:schar", - "struct rm:seenv:uchar", - "struct rm:flags:Bitfield(flags, 5)", - "struct rm:horizontal:Bitfield(horizontal, 1)", - "struct rm:lit:Bitfield(lit, 1)", - "struct rm:waslit:Bitfield(waslit, 1)", - "struct rm:roomno:Bitfield(roomno, 6)", - "struct rm:edge:Bitfield(edge, 1)", - "struct rm:candig:Bitfield(candig, 1)", - "struct s_level:next:struct s_level *", - "struct s_level:dlevel:d_level", - "struct s_level:proto:char", - "struct s_level:boneid:char", - "struct s_level:rndlevs:uchar", - "struct s_level:flags:d_flags", - "struct savefile_info:sfi1:unsigned long", - "struct savefile_info:sfi2:unsigned long", - "struct savefile_info:sfi3:unsigned long", - "struct skills:skill:xchar", - "struct skills:max_skill:xchar", - "struct skills:advance:unsigned short", - "struct spell:sp_id:short", - "struct spell:sp_lev:xchar", - "struct spell:sp_know:int", - "struct stairway:sx:xchar", - "struct stairway:sy:xchar", - "struct stairway:tolev:d_level", - "struct stairway:up:char", - "struct takeoff_info:mask:long", - "struct takeoff_info:what:long", - "struct takeoff_info:delay:int", - "struct takeoff_info:cancelled_don:boolean", - "struct takeoff_info:disrobing:char", - "struct tin_info:tin:struct obj *", - "struct tin_info:o_id:unsigned", - "struct tin_info:usedtime:int", - "struct tin_info:reqtime:int", - "struct trap:ntrap:struct trap *", - "struct trap:tx:xchar", - "struct trap:ty:xchar", - "struct trap:dst:d_level", - "struct trap:launch:nhcoord", - "struct trap:ttyp:Bitfield(ttyp, 5)", - "struct trap:tseen:Bitfield(tseen, 1)", - "struct trap:once:Bitfield(once, 1)", - "struct trap:madeby_u:Bitfield(madeby_u, 1)", - "struct trap:vl:vlaunchinfo", - "struct tribute_info:tributesz:size_t", - "struct tribute_info:enabled:boolean", - "struct tribute_info:bookstock:Bitfield(bookstock, 1)", - "struct tribute_info:Deathnotice:Bitfield(Deathnotice,1)", - "struct u_achieve:amulet:Bitfield(amulet, 1)", - "struct u_achieve:bell:Bitfield(bell, 1)", - "struct u_achieve:book:Bitfield(book, 1)", - "struct u_achieve:menorah:Bitfield(menorah, 1)", - "struct u_achieve:enter_gehennom:Bitfield(enter_gehennom,1)", - "struct u_achieve:ascended:Bitfield(ascended, 1)", - "struct u_achieve:mines_luckstone:Bitfield(mines_luckstone, 1)", - "struct u_achieve:finish_sokoban:Bitfield(finish_sokoban, 1)", - "struct u_achieve:killed_medusa:Bitfield(killed_medusa, 1)", - "struct u_conduct:unvegetarian:long", - "struct u_conduct:unvegan:long", - "struct u_conduct:food:long", - "struct u_conduct:gnostic:long", - "struct u_conduct:weaphit:long", - "struct u_conduct:killer:long", - "struct u_conduct:literate:long", - "struct u_conduct:polypiles:long", - "struct u_conduct:polyselfs:long", - "struct u_conduct:wishes:long", - "struct u_conduct:wisharti:long", - "struct u_event:minor_oracle:Bitfield(minor_oracle, 1)", - "struct u_event:major_oracle:Bitfield(major_oracle, 1)", - "struct u_event:read_tribute:Bitfield(read_tribute, 1)", - "struct u_event:qcalled:Bitfield(qcalled, 1)", - "struct u_event:qexpelled:Bitfield(qexpelled, 1)", - "struct u_event:qcompleted:Bitfield(qcompleted, 1)", - "struct u_event:uheard_tune:Bitfield(uheard_tune, 2)", - "struct u_event:uopened_dbridge:Bitfield(uopened_dbridge, 1)", - "struct u_event:invoked:Bitfield(invoked, 1)", - "struct u_event:gehennom_entered:Bitfield(gehennom_entered, 1)", - "struct u_event:uhand_of_elbereth:Bitfield(uhand_of_elbereth, 2)", - "struct u_event:udemigod:Bitfield(udemigod, 1)", - "struct u_event:uvibrated:Bitfield(uvibrated, 1)", - "struct u_event:ascended:Bitfield(ascended, 1)", - "struct u_have:amulet:Bitfield(amulet, 1)", - "struct u_have:bell:Bitfield(bell, 1)", - "struct u_have:book:Bitfield(book, 1)", - "struct u_have:menorah:Bitfield(menorah, 1)", - "struct u_have:questart:Bitfield(questart, 1)", - "struct u_have:unused:Bitfield(unused, 3)", - "struct u_realtime:realtime:long", - "struct u_realtime:start_timing:time_t", - "struct u_realtime:finish_time:time_t", - "struct u_roleplay:blind:boolean", - "struct u_roleplay:nudist:boolean", - "struct u_roleplay:numbones:long", - "struct version_info:incarnation:unsigned long", - "struct version_info:feature_set:unsigned long", - "struct version_info:entity_count:unsigned long", - "struct version_info:struct_sizes1:unsigned long", - "struct version_info:struct_sizes2:unsigned long", - "struct victual_info:piece:struct obj *", - "struct victual_info:o_id:unsigned", - "struct victual_info:usedtime:int", - "struct victual_info:reqtime:int", - "struct victual_info:nmod:int", - "struct victual_info:canchoke:Bitfield(canchoke, 1)", - "struct victual_info:fullwarn:Bitfield(fullwarn, 1)", - "struct victual_info:eating:Bitfield(eating, 1)", - "struct victual_info:doreset:Bitfield(doreset, 1)", - "union vlaunchinfo:v_launch_otyp:short", - "union vlaunchinfo:v_launch2:nhcoord", - "union vlaunchinfo:v_conjoined:uchar", - "union vlaunchinfo:v_tnote:short", - "union vptrs:v_nexthere:struct obj *", - "union vptrs:v_ocontainer:struct obj *", - "union vptrs:v_ocarry:struct monst *", - "struct warntype_info:obj:unsigned long", - "struct warntype_info:polyd:unsigned long", - "struct warntype_info:species:struct permonst *", - "struct warntype_info:speciesidx:short", - "struct you:ux:xchar", - "struct you:uy:xchar", - "struct you:dx:schar", - "struct you:dy:schar", - "struct you:dz:schar", - "struct you:di:schar", - "struct you:tx:xchar", - "struct you:ty:xchar", - "struct you:ux0:xchar", - "struct you:uy0:xchar", - "struct you:uz:d_level", - "struct you:uz0:d_level", - "struct you:utolev:d_level", - "struct you:utotype:uchar", - "struct you:umoved:boolean", - "struct you:last_str_turn:int", - "struct you:ulevel:int", - "struct you:ulevelmax:int", - "struct you:utrap:unsigned", - "struct you:utraptype:unsigned", - "struct you:urooms:char", - "struct you:urooms0:char", - "struct you:uentered:char", - "struct you:ushops:char", - "struct you:ushops0:char", - "struct you:ushops_entered:char", - "struct you:ushops_left:char", - "struct you:uhunger:int", - "struct you:uhs:unsigned", - "struct you:uprops:prop", - "struct you:umconf:unsigned", - "struct you:usick_type:Bitfield(usick_type, 2)", - "struct you:nv_range:int", - "struct you:xray_range:int", - "struct you:bglyph:int", - "struct you:cglyph:int", - "struct you:bc_order:int", - "struct you:bc_felt:int", - "struct you:umonster:int", - "struct you:umonnum:int", - "struct you:mh:int", - "struct you:mhmax:int", - "struct you:mtimedone:int", - "struct you:macurr:attribs", - "struct you:mamax:attribs", - "struct you:ulycn:int", - "struct you:ucreamed:unsigned", - "struct you:uswldtim:unsigned", - "struct you:uswallow:Bitfield(uswallow, 1)", - "struct you:uinwater:Bitfield(uinwater, 1)", - "struct you:uundetected:Bitfield(uundetected, 1)", - "struct you:mfemale:Bitfield(mfemale, 1)", - "struct you:uinvulnerable:Bitfield(uinvulnerable, 1)", - "struct you:uburied:Bitfield(uburied, 1)", - "struct you:uedibility:Bitfield(uedibility, 1)", - "struct you:udg_cnt:unsigned", - "struct you:uachieve:u_achieve", - "struct you:uevent:u_event", - "struct you:uhave:u_have", - "struct you:uconduct:u_conduct", - "struct you:uroleplay:u_roleplay", - "struct you:acurr:attribs", - "struct you:aexe:attribs", - "struct you:abon:attribs", - "struct you:amax:attribs", - "struct you:atemp:attribs", - "struct you:atime:attribs", - "struct you:ualign:align", - "struct you:ualignbase:aligntyp", - "struct you:uluck:schar", - "struct you:moreluck:schar", - "struct you:uhitinc:schar", - "struct you:udaminc:schar", - "struct you:uac:schar", - "struct you:uspellprot:uchar", - "struct you:usptime:uchar", - "struct you:uspmtime:uchar", - "struct you:uhp:int", - "struct you:uhpmax:int", - "struct you:uen:int", - "struct you:uenmax:int", - "struct you:uhpinc:xchar", - "struct you:ueninc:xchar", - "struct you:ugangr:int", - "struct you:ugifts:int", - "struct you:ublessed:int", - "struct you:ublesscnt:int", - "struct you:umoney0:long", - "struct you:uspare1:long", - "struct you:uexp:long", - "struct you:urexp:long", - "struct you:ucleansed:long", - "struct you:usleep:long", - "struct you:uinvault:int", - "struct you:ustuck:struct monst *", - "struct you:usteed:struct monst *", - "struct you:ugallop:long", - "struct you:urideturns:int", - "struct you:umortality:int", - "struct you:ugrave_arise:int", - "struct you:weapon_slots:int", - "struct you:skills_advanced:int", - "struct you:skill_record:xchar", - "struct you:weapon_skills:skills", - "struct you:twoweap:boolean", - "struct you:mcham:short", -}; - -int critical_members_count() -{ - return SIZE(critical_members); -} - -/*sfdata.c*/ diff --git a/src/sflendian.c b/src/sflendian.c deleted file mode 100644 index ca2a69707..000000000 --- a/src/sflendian.c +++ /dev/null @@ -1,1339 +0,0 @@ -/* NetHack 3.6 sflendian.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ -/* Copyright (c) M. Allison, 2019. */ -/* NetHack may be freely redistributed. See license for details. */ - -/* fieldlevel little-endian binary file */ - -#include "hack.h" -#include "integer.h" -#include "sfprocs.h" - -/* -+------------+--------+------+-------+-----------+--------+-----------+ -| Data model | short | int | long | long long | pointer| OS | -+------------+--------+------+-------+-----------+--------+-----------+ -| LLP64 | 16 | 32 | 32 | 64 | 64 | Windows | -+------------+--------+------+-------+-----------+--------+-----------+ -| LP64 | 16 | 32 | 64 | 64 | 64 | Most Unix | -+------------+--------+------+-------+-----------+--------+-----------+ -| ILP64 | 16 | 64 | 64 | 64 | 64 |HAL,SPARC64| -+------------+--------+------+-------+-----------+--------+-----------+ - - We're using this for NetHack's little-endian binary fieldlevel format - because it involves the fewest compromises (sorry SPARC64, - you'll have to use one of the text file formats instead): - - Data model | short | int | long | long long | pointer| OS | - LP64 | 16 | 32 | 64 | 64 | 64 | Most Unix | -*/ - -#if defined(_MSC_VER) -#include -#define bswap16(x) _byteswap_ushort(x) -#define bswap32(x) _byteswap_ulong(x) -#define bswap64(x) _byteswap_uint64(x) -#elif defined(__GNUC__) -#define bswap16(x) __builtin_bswap16(x) -#define bswap32(x) __builtin_bswap32(x) -#define bswap64(x) __builtin_bswap64(x) -#else -/* else use ais523 approach */ -# define bswap16(x) ((((x) & 0x00ffU) << 8) | \ - (((x) & 0xff00U) >> 8)) - -# define bswap32(x) ((((x) & 0x000000ffLU) << 24) | \ - (((x) & 0x0000ff00LU) << 8) | \ - (((x) & 0x00ff0000LU) >> 8) | \ - (((x) & 0xff000000LU) >> 24)) - -# define bswap64(x) ((((x) & 0x00000000000000ffLLU) << 56) | \ - (((x) & 0x000000000000ff00LLU) << 40) | \ - (((x) & 0x0000000000ff0000LLU) << 24) | \ - (((x) & 0x00000000ff000000LLU) << 8) | \ - (((x) & 0x000000ff00000000LLU) << 8) | \ - (((x) & 0x0000ff0000000000LLU) << 24) | \ - (((x) & 0x00ff000000000000LLU) << 40) | \ - (((x) & 0xff00000000000000LLU) << 56)) -#endif - -#ifdef SAVEFILE_DEBUGGING -#if defined(__GNUC__) -#define DEBUGFORMATSTR64 "%s %s %ld %ld %d\n" -#elif defined(_MSC_VER) -#define DEBUGFORMATSTR64 "%s %s %lld %ld %d\n" -#endif -#endif - -struct sf_procs lendian_sfo_procs = { - ".le", - { - lendian_sfo_aligntyp, - lendian_sfo_any, - lendian_sfo_bitfield, - lendian_sfo_boolean, - lendian_sfo_char, - lendian_sfo_genericptr, - lendian_sfo_int, - lendian_sfo_long, - lendian_sfo_schar, - lendian_sfo_short, - lendian_sfo_size_t, - lendian_sfo_time_t, - lendian_sfo_unsigned, - lendian_sfo_uchar, - lendian_sfo_uint, - lendian_sfo_ulong, - lendian_sfo_ushort, - lendian_sfo_xchar, - lendian_sfo_str, - lendian_sfo_addinfo, - } -}; - -struct sf_procs lendian_sfi_procs = -{ - ".le", - { - lendian_sfi_aligntyp, - lendian_sfi_any, - lendian_sfi_bitfield, - lendian_sfi_boolean, - lendian_sfi_char, - lendian_sfi_genericptr, - lendian_sfi_int, - lendian_sfi_long, - lendian_sfi_schar, - lendian_sfi_short, - lendian_sfi_size_t, - lendian_sfi_time_t, - lendian_sfi_unsigned, - lendian_sfi_uchar, - lendian_sfi_uint, - lendian_sfi_ulong, - lendian_sfi_ushort, - lendian_sfi_xchar, - lendian_sfi_str, - lendian_sfi_addinfo, - } -}; - -#ifdef SAVEFILE_DEBUGGING -static long floc = 0L; -#endif - -/* - *---------------------------------------------------------------------------- - * sfo_lendian_ routines - * - * Default output routines. - * - *---------------------------------------------------------------------------- - */ - -void -lendian_sfo_any(nhfp, d_any, myparent, myname, cnt) -NHFILE *nhfp; -union any *d_any; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - const char *parent = "any"; - int i; - uint64_t ui64; - int64_t i64; - uint32_t ui32; - int32_t i32; - int8_t i8; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - ui64 = (uint64_t) d_any->a_void; - fwrite(&ui64, sizeof ui64, 1, nhfp->fpdef); - i64 = (int64_t) d_any->a_ulong; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %ld %ld %d\n", myname, - "any", - d_any->a_ulong, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&i64, sizeof i64, 1, nhfp->fpdef); - ui32 = (uint32_t) d_any->a_uint; - fwrite(&ui32, sizeof ui32, 1, nhfp->fpdef); - i32 = (int32_t) d_any->a_int; - fwrite(&i32, sizeof i32, 1, nhfp->fpdef); - i8 = (int8_t) d_any->a_char; - fwrite(&i8, sizeof i8, 1, nhfp->fpdef); - d_any++; - } -#if 0 - sfo_genericptr(nhfp, d_any->a_void, parent, "a_void", 1); /* (genericptr_t) */ - sfo_genericptr(nhfp, d_any->a_obj, parent, "a_obj", 1); /* (struct obj *) */ - sfo_genericptr(nhfp, d_any->a_monst, parent, "a_monst", 1); /* (struct monst *) */ - sfo_int(nhfp, &d_any->a_int, parent, "a_int", 1); /* (int) */ - sfo_char(nhfp, &d_any->a_char, parent, "a_char", 1); /* (char) */ - sfo_schar(nhfp, &d_any->a_schar, parent, "a_schar", 1); /* (schar) */ - sfo_uchar(nhfp, &d_any->a_uchar, parent, "a_uchar", 1); /* (uchar) */ - sfo_uint(nhfp, &d_any->a_uint, parent, "a_uint", 1); /* (unsigned int) */ - sfo_long(nhfp, &d_any->a_long, parent, "a_long", 1); /* (long) */ - sfo_ulong(nhfp, &d_any->a_ulong, parent, "a_ulong", 1); /* (unsigned long) */ - sfo_genericptr(nhfp, d_any->a_iptr, parent, "a_iptr", 1); /* (int *) */ - sfo_genericptr(nhfp, d_any->a_lptr, parent, "a_lptr", 1); /* (long *) */ - sfo_genericptr(nhfp, d_any->a_ulptr, parent, "a_ulptr", 1); /* (unsigned long *) */ - sfo_genericptr(nhfp, d_any->a_uptr, parent, "a_uptr", 1); /* (unsigned *) */my - sfo_genericptr(nhfp, d_any->a_string, parent, "a_string", 1); /* (const char *) */ - sfo_ulong(nhfp, &d_any->a_mask32, parent, "a_mask32", 1); /* (unsigned long) */ -#endif -} - -void -lendian_sfo_aligntyp(nhfp, d_aligntyp, myparent, myname, cnt) -NHFILE *nhfp; -aligntyp *d_aligntyp; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - const char *parent = "aligntyp"; - int i; - int16_t val; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - val = nhfp->bendian ? bswap16(*d_aligntyp) : *d_aligntyp; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "aligntyp", - val, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val, sizeof val, 1, nhfp->fpdef); - d_aligntyp++; - } -} - -void -lendian_sfo_bitfield(nhfp, d_bitfield, myparent, myname, cnt) -NHFILE *nhfp; -uint8_t *d_bitfield; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - const char *parent = "bitfield"; - - nhUse(parent); - /* for bitfields, cnt is the number of bits, not an array */ -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "bitfield", - (int) *d_bitfield, ftell(nhfp->fpdef), cnt); -#endif - fwrite(d_bitfield, sizeof *d_bitfield, 1, nhfp->fpdef); -} - -void -lendian_sfo_boolean(nhfp, d_boolean, myparent, myname, cnt) -NHFILE *nhfp; -boolean *d_boolean; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - const char *parent = "boolean"; - int i; - int8_t val; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - val = *d_boolean; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "boolean", - (int) val, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val, sizeof val, 1, nhfp->fpdef); - d_boolean++; - } -} - -void -lendian_sfo_char(nhfp, d_char, myparent, myname, cnt) -NHFILE *nhfp; -char *d_char; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "char"; - int8_t val; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - val = *d_char; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "char", - (int) val, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val, sizeof val, 1, nhfp->fpdef); - d_char++; - } -} - -void -lendian_sfo_genericptr(nhfp, d_genericptr, myparent, myname, cnt) -NHFILE *nhfp; -genericptr_t *d_genericptr; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int8_t p; - - /* - * sbrooms is an array of pointers to mkroom. - * That array dimension is MAX_SUBROOMS. - * Even though the pointers themselves won't - * be valid, we need to account for the existence - * of the elements of that array, and whether each - * is zero or non-zero. - * - * We only consume a single byte in the file for that - * and we expand it back to pointer size later when - * we read it back in, again preserving zero or non-zero. - */ - - for (i = 0; i < cnt; ++i) { - p = (*d_genericptr) ? 1 : 0; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "genericptr", - (int) p, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&p, sizeof p, 1, nhfp->fpdef); - d_genericptr++; - } -} - -void -lendian_sfo_int(nhfp, d_int, myparent, myname, cnt) -NHFILE *nhfp; -int *d_int; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "int"; - int32_t i32, val; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - i32 = (int32_t) *d_int; - val = nhfp->bendian ? bswap32(i32) : i32; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "int", - val, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val, sizeof val, 1, nhfp->fpdef); - d_int++; - } -} - -void -lendian_sfo_long(nhfp, d_long, myparent, myname, cnt) -NHFILE *nhfp; -long *d_long; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "long"; - int64_t i64, val64; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - i64 = (int64_t) *d_long; - val64 = nhfp->bendian ? bswap64(i64) : i64; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug, DEBUGFORMATSTR64, myname, - "long", - val64, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val64, sizeof val64, 1, nhfp->fpdef); - d_long++; - } -} - -void -lendian_sfo_schar(nhfp, d_schar, myparent, myname, cnt) -NHFILE *nhfp; -schar *d_schar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int8_t itmp; - const char *parent = "schar"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - itmp = (int8_t) *d_schar; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "schar", - (int) itmp, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&itmp, sizeof itmp, 1, nhfp->fpdef); - d_schar++; - } -} - -void -lendian_sfo_short(nhfp, d_short, myparent, myname, cnt) -NHFILE *nhfp; -short *d_short; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int16_t itmp; - const char *parent = "short"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - itmp = (int16_t) *d_short; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "short", - itmp, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&itmp, sizeof itmp, 1, nhfp->fpdef); - d_short++; - } -} - -void -lendian_sfo_size_t(nhfp, d_size_t, myparent, myname, cnt) -NHFILE *nhfp; -size_t *d_size_t; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - uint64_t ui64, val; - const char *parent = "size_t"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - ui64 = (uint64_t) *d_size_t; - val = nhfp->bendian ? bswap64(ui64) : ui64; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug, DEBUGFORMATSTR64, myname, - "size_t", - val, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val, sizeof val, 1, nhfp->fpdef); - d_size_t++; - } -} - -void -lendian_sfo_time_t(nhfp, d_time_t, myparent, myname, cnt) -NHFILE *nhfp; -time_t *d_time_t; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - char buf[BUFSZ]; - const char *parent = "time_t"; - - nhUse(parent); - Sprintf(buf, "%s", yyyymmddhhmmss(*d_time_t)); -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %s %ld %d\n", myname, - "time", - buf, ftell(nhfp->fpdef), cnt); -#endif - fwrite(buf, sizeof (char), 15, nhfp->fpdef); -} - -void -lendian_sfo_unsigned(nhfp, d_unsigned, myparent, myname, cnt) -NHFILE *nhfp; -unsigned *d_unsigned; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - lendian_sfo_uint(nhfp, d_unsigned, myparent, myname, cnt); -} - -void -lendian_sfo_uchar(nhfp, d_uchar, myparent, myname, cnt) -NHFILE *nhfp; -unsigned char *d_uchar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "uchar"; - uint8_t ui8; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - ui8 = (uint8_t) *d_uchar; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %u %ld %d\n", myname, - "uchar", - (unsigned int) ui8, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&ui8, sizeof ui8, 1, nhfp->fpdef); - d_uchar++; - } -} - -void -lendian_sfo_uint(nhfp, d_uint, myparent, myname, cnt) -NHFILE *nhfp; -unsigned int *d_uint; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "uint"; - uint32_t ui32, val; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - ui32 = (uint32_t) *d_uint; - val = nhfp->bendian ? bswap32(ui32) : ui32; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %u %ld %d\n", myname, - "uint", - val, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val, sizeof val, 1, nhfp->fpdef); - d_uint++; - } -} - -void -lendian_sfo_ulong(nhfp, d_ulong, myparent, myname, cnt) -NHFILE *nhfp; -unsigned long *d_ulong; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "ulong"; - uint64_t ul64, val64; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - ul64 = (uint64_t) *d_ulong; - val64 = nhfp->bendian ? bswap64(ul64) : ul64; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug, DEBUGFORMATSTR64, myname, - "ulong", - val64, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val64, sizeof val64, 1, nhfp->fpdef); - d_ulong++; - } -} - -void -lendian_sfo_ushort(nhfp, d_ushort, myparent, myname, cnt) -NHFILE *nhfp; -unsigned short *d_ushort; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "ushort"; - uint16_t ui16, val16; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - ui16 = (uint16_t) *d_ushort; - val16 = nhfp->bendian ? bswap16(ui16) : ui16; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "ushort", - val16, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val16, sizeof val16, 1, nhfp->fpdef); - d_ushort++; - } -} - -void -lendian_sfo_xchar(nhfp, d_xchar, myparent, myname, cnt) -NHFILE *nhfp; -xchar *d_xchar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "xchar"; - int16_t i16, val16; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - i16 = (int16_t) *d_xchar; - val16 = nhfp->bendian ? bswap16(i16) : i16; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "xchar", - val16, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&val16, sizeof val16, 1, nhfp->fpdef); - d_xchar++; - } -} - -static char strbuf[BUFSZ * 4]; - -void -lendian_sfo_str(nhfp, d_str, myparent, myname, cnt) -NHFILE *nhfp; -char *d_str; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i, j, intval; - int16_t i16, outcount = 0; - const char *parent = "str"; - char sval[QBUFSZ], *src = d_str, *dest = strbuf; - - nhUse(parent); - /* cnt is the number of characters */ - for (i = 0; i < cnt; ++i) { - if ((*src < 32) || (*src == '\\') || (*src > 127)) { - *dest++ = '\\'; - outcount++; - intval = (int) *src++; - Sprintf(sval, "%03d", intval); - for (j = 0; j < 3; ++j) { - *dest++ = sval[j]; - outcount++; - } - } else { - *dest++ = *src++; - outcount++; - } - } - *dest = '\0'; - i16 = nhfp->bendian ? bswap16(outcount) : outcount; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "str-count", - i16, ftell(nhfp->fpdef), cnt); -#endif - fwrite(&i16, sizeof i16, 1, nhfp->fpdef); -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %s %ld %d\n", myname, - "str", - strbuf, ftell(nhfp->fpdef), cnt); -#endif - fwrite(strbuf, sizeof (char), outcount, nhfp->fpdef); -} - -void -lendian_sfo_addinfo(nhfp, parent, action, myname, indx) -NHFILE *nhfp UNUSED; -const char *parent UNUSED, *action UNUSED, *myname UNUSED; -int indx UNUSED; -{ - /* ignored */ -} - - -/* - *---------------------------------------------------------------------------- - * lendian_sfi_ routines called from functions in sfi_base.c - *---------------------------------------------------------------------------- - */ - -void -lendian_sfi_any(nhfp, d_any, myparent, myname, cnt) -NHFILE *nhfp; -union any *d_any; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - const char *parent = "any"; - int i; - uint64_t ui64; - int64_t i64; - uint32_t ui32; - int32_t i32; - int8_t i8; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { - fread(&ui64, sizeof ui64, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&i64, sizeof i64, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug, DEBUGFORMATSTR64, myname, - "any", - ui64, floc, cnt); -#endif - fread(&ui32, sizeof ui32, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - fread(&i32, sizeof i32, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - fread(&i8, sizeof i8, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - d_any->a_void = (genericptr_t) ui64; - d_any->a_ulong = (unsigned long) i64; - d_any->a_uint = (unsigned int) ui32; - d_any->a_int = (int) i32; - d_any->a_char = (char) i8; - d_any++; - } -#if 0 - sfi_genericptr(nhfp, d_any->a_void, parent, "a_void", 1); - sfi_genericptr(nhfp, d_any->a_obj, parent, "a_obj", 1); - sfi_genericptr(nhfp, d_any->a_monst, parent, "a_monst", 1); - sfi_int(nhfp, &d_any->a_int, parent, "a_int", 1); - sfi_char(nhfp, &d_any->a_char, parent, "a_char", 1); - sfi_schar(nhfp, &d_any->a_schar, parent, "a_schar", 1); - sfi_uchar(nhfp, &d_any->a_uchar, parent, "a_uchar", 1); - sfi_uint(nhfp, &d_any->a_uint, parent, "a_uint", 1); - sfi_long(nhfp, &d_any->a_long, parent, "a_long", 1); - sfi_ulong(nhfp, &d_any->a_ulong, parent, "a_ulong", 1); - sfi_genericptr(nhfp, d_any->a_iptr, parent, "a_iptr", 1); - sfi_genericptr(nhfp, d_any->a_lptr, parent, "a_lptr", 1); - sfi_genericptr(nhfp, d_any->a_ulptr, parent, "a_ulptr", 1); - sfi_genericptr(nhfp, d_any->a_uptr, parent, "a_uptr", 1); - sfi_genericptr(nhfp, d_any->a_string, parent, "a_string", 1); - sfi_ulong(nhfp, &d_any->a_mask32, parent, "a_mask32", 1); -#endif -} - -void -lendian_sfi_aligntyp(nhfp, d_aligntyp, myparent, myname, cnt) -NHFILE *nhfp; -aligntyp *d_aligntyp; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - const char *parent = "aligntyp"; - int i; - int16_t val, i16; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val, sizeof val, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - i16 = nhfp->bendian ? bswap16(val) : val; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "aligntyp", - i16, floc, cnt); -#endif - *d_aligntyp = (aligntyp) i16; - d_aligntyp++; - } -} - -void -lendian_sfi_bitfield(nhfp, d_bitfield, myparent, myname, cnt) -NHFILE *nhfp; -uint8_t *d_bitfield; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - const char *parent = "bitfield"; - - nhUse(parent); -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(d_bitfield, sizeof *d_bitfield, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "bitfield", - (int) *d_bitfield, floc, cnt); -#endif -} - -void -lendian_sfi_boolean(nhfp, d_boolean, myparent, myname, cnt) -NHFILE *nhfp; -boolean *d_boolean; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - const char *parent = "boolean"; - int8_t i8; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&i8, sizeof i8, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "boolean", - (int) i8, floc, cnt); -#endif - *d_boolean = (boolean) i8; - d_boolean++; - } -} - -void -lendian_sfi_char(nhfp, d_char, myparent, myname, cnt) -NHFILE *nhfp; -char *d_char; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int8_t i8; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&i8, sizeof i8, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "char", - (int) i8, floc, cnt); -#endif - *d_char = (char) i8; - d_char++; - } -} - -void -lendian_sfi_genericptr(nhfp, d_genericptr, myparent, myname, cnt) -NHFILE *nhfp; -genericptr_t *d_genericptr; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - static const char *glorkum = "glorkum"; - int8_t p; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&p, sizeof p, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "genericptr", - (int) p, floc, cnt); -#endif - *d_genericptr = p ? (genericptr_t) glorkum : (genericptr_t) 0; - d_genericptr++; - } -} - -void -lendian_sfi_int(nhfp, d_int, myparent, myname, cnt) -NHFILE *nhfp; -int *d_int; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int32_t val, i32; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val, sizeof val, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - i32 = nhfp->bendian ? bswap32(val) : val; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "int", - i32, floc, cnt); -#endif - *d_int = (int) i32; - d_int++; - } -} - -void -lendian_sfi_long(nhfp, d_long, myparent, myname, cnt) -NHFILE *nhfp; -long *d_long; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int64_t val64, i64; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val64, sizeof val64, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - i64 = nhfp->bendian ? bswap64(val64) : val64; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug, DEBUGFORMATSTR64, myname, - "long", - i64, floc, cnt); -#endif - *d_long = (long) i64; - d_long++; - } -} - -void -lendian_sfi_schar(nhfp, d_schar, myparent, myname, cnt) -NHFILE *nhfp; -schar *d_schar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int8_t i8; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&i8, sizeof i8, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %d %ld %d\n", myname, - "schar", - (int) i8, floc, cnt); -#endif - *d_schar = (schar) i8; - d_schar++; - } -} - -void -lendian_sfi_short(nhfp, d_short, myparent, myname, cnt) -NHFILE *nhfp; -short *d_short; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int16_t val16, i16; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val16, sizeof val16, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - i16 = nhfp->bendian ? bswap16(val16) : val16; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "short", - i16, floc, cnt); -#endif - *d_short = (short) i16; - d_short++; - } -} - -void -lendian_sfi_size_t(nhfp, d_size_t, myparent, myname, cnt) -NHFILE *nhfp; -size_t *d_size_t; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - uint64_t ui64, val; - const char *parent = "size_t"; - - nhUse(parent); - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val, sizeof val, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - ui64 = nhfp->bendian ? bswap64(val) : val; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug, DEBUGFORMATSTR64, myname, - "size_t", - ui64, floc, cnt); -#endif - *d_size_t = (size_t) ui64; - d_size_t++; - } -} - -void -lendian_sfi_time_t(nhfp, d_time_t, myparent, myname, cnt) -NHFILE *nhfp; -time_t *d_time_t; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt UNUSED; -{ - time_t tmp; - char buf[BUFSZ]; - const char *parent = "time_t"; - - nhUse(parent); -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(buf, 1, 15, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %s %ld %d\n", myname, - "time", - buf, floc, cnt); -#endif - tmp = time_from_yyyymmddhhmmss(buf); - *d_time_t = tmp; -} - -void -lendian_sfi_unsigned(nhfp, d_unsigned, myparent, myname, cnt) -NHFILE *nhfp; -unsigned *d_unsigned; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - /* deferal */ - lendian_sfi_uint(nhfp, d_unsigned, myparent, myname, cnt); -} - -void -lendian_sfi_uchar(nhfp, d_uchar, myparent, myname, cnt) -NHFILE *nhfp; -unsigned char *d_uchar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - uint8_t ui8; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&ui8, sizeof ui8, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hu %ld %d\n", myname, - "uchar", - (unsigned short) ui8, floc, cnt); -#endif - *d_uchar = (uchar) ui8; - d_uchar++; - } -} - -void -lendian_sfi_uint(nhfp, d_uint, myparent, myname, cnt) -NHFILE *nhfp; -unsigned int *d_uint; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - uint32_t val, ui32; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val, sizeof val, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - ui32 = nhfp->bendian ? bswap32(val) : val; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %u %ld %d\n", myname, - "uint", - ui32, floc, cnt); -#endif - *d_uint = (unsigned int) ui32; - d_uint++; - } -} - -void -lendian_sfi_ulong(nhfp, d_ulong, myparent, myname, cnt) -NHFILE *nhfp; -unsigned long *d_ulong; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - uint64_t val64, ui64; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val64, sizeof val64, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - ui64 = nhfp->bendian ? bswap64(val64) : val64; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug, DEBUGFORMATSTR64, myname, - "ulong", - ui64, floc, cnt); -#endif - *d_ulong = (unsigned long) ui64; - d_ulong++; - } -} - -void -lendian_sfi_ushort(nhfp, d_ushort, myparent, myname, cnt) -NHFILE *nhfp; -unsigned short *d_ushort; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - uint16_t val16, ui16; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val16, sizeof val16, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - ui16 = nhfp->bendian ? bswap16(val16) : val16; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hu %ld %d\n", myname, - "ushort", - ui16, floc, cnt); -#endif - *d_ushort = (unsigned short) ui16; - d_ushort++; - } -} - -void -lendian_sfi_xchar(nhfp, d_xchar, myparent, myname, cnt) -NHFILE *nhfp; -xchar *d_xchar; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ - int i; - int16_t val16, i16; - - for (i = 0; i < cnt; ++i) { -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&val16, sizeof val16, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - i16 = nhfp->bendian ? bswap16(val16) : val16; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "xchar", - i16, floc, cnt); -#endif - *d_xchar = (xchar) i16; - d_xchar++; - } -} - -static char strbuf[BUFSZ * 4]; - -void -lendian_sfi_str(nhfp, d_str, myparent, myname, cnt) -NHFILE *nhfp; -char *d_str; -const char *myparent UNUSED; -const char *myname UNUSED; -int cnt; -{ -#ifdef SAVEFILE_DEBUGGING - char testbuf[BUFSZ]; -#endif - int i, j, sval; - const char *parent = "str"; - char n[4]; - char *src, *dest; - int16_t i16, incount = 0; - - nhUse(parent); -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(&i16, sizeof i16, 1, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - incount = nhfp->bendian ? bswap16(i16) : i16; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %hd %ld %d\n", myname, - "str-count", - incount, floc, cnt); -#endif - if (incount >= (BUFSZ * 4) - 1) - panic("overflow on sflendian string read %d %d", - incount, cnt); -#ifdef SAVEFILE_DEBUGGING - floc = ftell(nhfp->fpdef); -#endif - fread(strbuf, sizeof (char), incount, nhfp->fpdef); - if (feof(nhfp->fpdef)) { - nhfp->eof = TRUE; - return; - } - strbuf[incount] = '\0'; -#ifdef SAVEFILE_DEBUGGING - fprintf(nhfp->fpdebug,"%s %s %s %ld %d\n", myname, - "str", - strbuf, floc, cnt); -#endif - src = strbuf; - dest = -#ifdef SAVEFILE_DEBUGGING - testbuf; -#else - d_str; -#endif - - for (i = 0; i < cnt; ++i) { - if (*src == '\\') { - src++; - for (j = 0; j < 4; ++j) { - if (j < 3) - n[j] = *src++; - else - n[j] = '\0'; - } - sval = atoi(n); - *dest++ = (char) sval; - } else - *dest++ = *src++; - } -} - -void -lendian_sfi_addinfo(nhfp, myparent, action, myname, indx) -NHFILE *nhfp UNUSED; -const char *myparent UNUSED, *action UNUSED, *myname UNUSED; -int indx UNUSED; -{ - /* not doing anything here */ -} - - - diff --git a/src/shk.c b/src/shk.c index 33e84fb64..552fe34ff 100644 --- a/src/shk.c +++ b/src/shk.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 shk.c $NHDT-Date: 1558124088 2019/05/17 20:14:48 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.163 $ */ +/* NetHack 3.6 shk.c $NHDT-Date: 1571436007 2019/10/18 22:00:07 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.171 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -54,9 +54,10 @@ static long FDECL(stolen_container, (struct obj *, struct monst *, static long FDECL(getprice, (struct obj *, BOOLEAN_P)); static void FDECL(shk_names_obj, (struct monst *, struct obj *, const char *, long, const char *)); -static struct obj *FDECL(bp_to_obj, (struct bill_x *)); static boolean FDECL(inherits, (struct monst *, int, int, BOOLEAN_P)); static void FDECL(set_repo_loc, (struct monst *)); +static struct obj *FDECL(bp_to_obj, (struct bill_x *)); +static long FDECL(get_pricing_units, (struct obj *)); static boolean NDECL(angry_shk_exists); static void FDECL(rile_shk, (struct monst *)); static void FDECL(rouse_shk, (struct monst *, BOOLEAN_P)); @@ -74,7 +75,6 @@ static void FDECL(deserted_shop, (char *)); static boolean FDECL(special_stock, (struct obj *, struct monst *, BOOLEAN_P)); static const char *FDECL(cad, (BOOLEAN_P)); -static long FDECL(get_pricing_units, (struct obj *obj)); /* invariants: obj->unpaid iff onbill(obj) [unless bp->useup] @@ -2029,11 +2029,11 @@ struct obj *obj; if (obj->globby) { /* globs must be sold by weight not by volume */ - int unit_weight = (int) objects[obj->otyp].oc_weight, - wt = (obj->owt > 0) ? obj->owt : weight(obj); + long unit_weight = (long) objects[obj->otyp].oc_weight, + wt = (obj->owt > 0) ? (long) obj->owt : (long) weight(obj); if (unit_weight) - units = wt / unit_weight; + units = (wt + unit_weight - 1L) / unit_weight; } return units; } @@ -2898,8 +2898,8 @@ boolean peaceful, silent; /* gather information for message(s) prior to manipulating bill */ was_unpaid = obj->unpaid ? TRUE : FALSE; if (Has_contents(obj)) { - c_count = count_contents(obj, TRUE, FALSE, TRUE); - u_count = count_contents(obj, TRUE, FALSE, FALSE); + c_count = count_contents(obj, TRUE, FALSE, TRUE, FALSE); + u_count = count_contents(obj, TRUE, FALSE, FALSE, FALSE); } if (!billable(&shkp, obj, roomno, FALSE)) { @@ -2983,8 +2983,9 @@ boolean peaceful, silent; if (canseemon(shkp)) { Norep("%s booms: \"%s, you are a thief!\"", Shknam(shkp), g.plname); - } else - Norep("You hear a scream, \"Thief!\""); + } else if (!Deaf) { + Norep("You hear a scream, \"Thief!\""); /* Deaf-aware */ + } } hot_pursuit(shkp); (void) angry_guards(FALSE); @@ -3196,9 +3197,9 @@ xchar x, y; if (container) { /* number of items owned by shk */ - shksc = count_contents(obj, TRUE, TRUE, FALSE); + shksc = count_contents(obj, TRUE, TRUE, FALSE, TRUE); /* number of items owned by you (total - shksc) */ - yourc = count_contents(obj, TRUE, TRUE, TRUE) - shksc; + yourc = count_contents(obj, TRUE, TRUE, TRUE, TRUE) - shksc; only_partially_your_contents = shksc && yourc; } /* @@ -3214,14 +3215,27 @@ xchar x, y; (The case where it has contents already entirely owned by the shk is treated the same was if it were empty since the hero isn't selling any of those contents.) - Your container: + Your container and shk is willing to buy it: "... your . Sell it?" "... your and its contents. Sell them?" "... your and item inside. Sell them?" "... your and items inside. Sell them?" + Your container but shk only cares about the contents: + "... your item in your . Sell it?" + "... your items in your . Sell them?" Shk's container: "... your item in the . Sell it?" "... your items in the . Sell them?" + FIXME: + "your items" should sometimes be "some of your items" + (when container has some stuff the shk is willing to buy + and other stuff he or she doesn't care about); likewise, + "your item" should sometimes be "one of your items". + That would make the prompting even more verbose so + living without it might be a good thing. + FIXME too: + when container's contents are unknown, plural "items" + should be used to not give away information. */ Sprintf(qbuf, "%s offers%s %ld gold piece%s for %s%s ", Shknam(shkp), short_funds ? " only" : "", offer, @@ -3230,7 +3244,7 @@ xchar x, y; ? ((yourc == 1L) ? "your item in " : "your items in ") : "", obj->unpaid ? "the" : "your"); - one = obj->unpaid ? (yourc == 1L) : (obj->quan == 1L && !cltmp); + one = !ltmp ? (yourc == 1L) : (obj->quan == 1L && !cltmp); Sprintf(qsfx, "%s. Sell %s?", (cltmp && ltmp) ? (only_partially_your_contents @@ -4369,7 +4383,7 @@ const char *Izchak_speaks[] = { "%s says: 'These shopping malls give me a headache.'", "%s says: 'Slow down. Think clearly.'", "%s says: 'You need to take things one at a time.'", - "%s says: 'I don't like poofy coffee... give me Columbian Supremo.'", + "%s says: 'I don't like poofy coffee... give me Colombian Supremo.'", "%s says that getting the devteam's agreement on anything is difficult.", "%s says that he has noticed those who serve their deity will prosper.", "%s says: 'Don't try to steal from me - I have friends in high places!'", @@ -4853,7 +4867,7 @@ struct obj *obj_absorber, *obj_absorbed; * Scenario 1. Shop-owned glob absorbing into shop-owned glob **************************************************************/ if (bp && (!obj_absorber->no_charge - || billable(&shkp, obj_absorber, eshkp->shoproom, FALSE))) { + || billable(&shkp, obj_absorber, eshkp->shoproom, FALSE))) { /* the glob being absorbed has a billing record */ amount = bp->price; eshkp->billct--; @@ -4926,18 +4940,14 @@ struct obj *obj_absorber, *obj_absorbed; /************************************************************** * Scenario 3. shop_owned glob merging into player_owned glob **************************************************************/ - if (bp && - (obj_absorber->no_charge - || (floor_absorber && !costly_spot(x, y)))) { + if (bp && (obj_absorber->no_charge + || (floor_absorber && !costly_spot(x, y)))) { amount = bp->price; bill_dummy_object(obj_absorbed); - verbalize( - "You owe me %ld %s for my %s that you %s with your%s", - amount, currency(amount), obj_typename(obj_absorbed->otyp), - ANGRY(shkp) ? "had the audacity to mix" : - "just mixed", - ANGRY(shkp) ? " stinking batch!" : - "s."); + verbalize("You owe me %ld %s for my %s that you %s with your%s", + amount, currency(amount), obj_typename(obj_absorbed->otyp), + ANGRY(shkp) ? "had the audacity to mix" : "just mixed", + ANGRY(shkp) ? " stinking batch!" : "s."); return; } /************************************************************** diff --git a/src/sit.c b/src/sit.c index 7fd1b0764..1f0409f09 100644 --- a/src/sit.c +++ b/src/sit.c @@ -67,7 +67,7 @@ dosit() if (OBJ_AT(u.ux, u.uy) /* ensure we're not standing on the precipice */ - && !uteetering_at_seen_pit(trap)) { + && !(uteetering_at_seen_pit(trap) || uescaped_shaft(trap))) { register struct obj *obj; obj = g.level.objects[u.ux][u.uy]; diff --git a/src/sounds.c b/src/sounds.c index 614cba6ca..3c5ac261a 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 sounds.c $NHDT-Date: 1542765362 2018/11/21 01:56:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.81 $ */ +/* NetHack 3.6 sounds.c $NHDT-Date: 1570844005 2019/10/12 01:33:25 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.83 $ */ /* Copyright (c) 1989 Janet Walz, Mike Threepoint */ /* NetHack may be freely redistributed. See license for details. */ @@ -496,7 +496,7 @@ register struct monst *mtmp; *verbl_msg = 0, /* verbalize() */ *verbl_msg_mcan = 0; /* verbalize() if cancelled */ struct permonst *ptr = mtmp->data; - int msound = ptr->msound; + int msound = ptr->msound, gnomeplan = 0; /* presumably nearness and sleep checks have already been made */ if (Deaf) @@ -512,8 +512,9 @@ register struct monst *mtmp; msound = mons[genus(monsndx(ptr), 1)].msound; /* some normally non-speaking types can/will speak if hero is similar */ else if (msound == MS_ORC /* note: MS_ORC is same as MS_GRUNT */ - && (same_race(ptr, g.youmonst.data) /* current form, */ - || same_race(ptr, &mons[Race_switch]))) /* unpoly'd form */ + && ((same_race(ptr, g.youmonst.data) /* current form, */ + || same_race(ptr, &mons[Race_switch])) /* unpoly'd form */ + || Hallucination)) msound = MS_HUMANOID; /* silliness, with slight chance to interfere with shopping */ else if (Hallucination && mon_is_gecko(mtmp)) @@ -588,13 +589,14 @@ register struct monst *mtmp; } else verbl_msg = "I only drink... potions."; } else { - int vampindex; static const char *const vampmsg[] = { /* These first two (0 and 1) are specially handled below */ "I vant to suck your %s!", "I vill come after %s without regret!", /* other famous vampire quotes can follow here if desired */ }; + int vampindex; + if (kindred) verbl_msg = "This is my hunting ground that you dare to prowl!"; @@ -803,6 +805,18 @@ register struct monst *mtmp; pline_msg = "talks about spellcraft."; else if (ptr->mlet == S_CENTAUR) pline_msg = "discusses hunting."; + else if (is_gnome(ptr) && Hallucination && (gnomeplan = rn2(4)) % 2) + /* skipped for rn2(4) result of 0 or 2; + gag from an early episode of South Park called "Gnomes"; + initially, Tweek (introduced in that episode) is the only + one aware of the tiny gnomes after spotting them sneaking + about; they are embarked upon a three-step business plan; + a diagram of the plan shows: + Phase 1 Phase 2 Phase 3 + Collect underpants ? Profit + and they never verbalize step 2 so we don't either */ + verbl_msg = (gnomeplan == 1) ? "Phase one, collect underpants." + : "Phase three, profit!"; else switch (monsndx(ptr)) { case PM_HOBBIT: diff --git a/src/sp_lev.c b/src/sp_lev.c index f3abad22d..68c6f3ac6 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 sp_lev.c $NHDT-Date: 1567805254 2019/09/06 21:27:34 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.117 $ */ +/* NetHack 3.6 sp_lev.c $NHDT-Date: 1574646949 2019/11/25 01:55:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.141 $ */ /* Copyright (c) 1989 by Jean-Christophe Collet */ /* NetHack may be freely redistributed. See license for details. */ @@ -9,8 +9,9 @@ * It contains also the special level loader. */ +#define IN_SP_LEV_C + #include "hack.h" -#include "dlb.h" #include "sp_lev.h" #ifdef _MSC_VER @@ -22,34 +23,12 @@ typedef void FDECL((*select_iter_func), (int, int, genericptr)); extern void FDECL(mkmap, (lev_init *)); +static void NDECL(create_des_coder); static void NDECL(solidify_map); -static void FDECL(splev_stack_init, (struct splevstack *)); -static void FDECL(splev_stack_done, (struct splevstack *)); -static void FDECL(splev_stack_push, (struct splevstack *, - struct opvar *)); -static struct opvar *FDECL(splev_stack_pop, (struct splevstack *)); -static struct splevstack *FDECL(splev_stack_reverse, - (struct splevstack *)); -static struct opvar *FDECL(opvar_new_str, (char *)); -static struct opvar *FDECL(opvar_new_int, (long)); -static struct opvar *FDECL(opvar_new_coord, (int, int)); -#if 0 -static struct opvar * FDECL(opvar_new_region, (int,int, int,int)); -#endif /*0*/ -static struct opvar *FDECL(opvar_clone, (struct opvar *)); -static struct opvar *FDECL(opvar_var_conversion, (struct sp_coder *, - struct opvar *)); -static struct splev_var *FDECL(opvar_var_defined, (struct sp_coder *, - char *)); -static struct opvar *FDECL(splev_stack_getdat, (struct sp_coder *, - XCHAR_P)); -static struct opvar *FDECL(splev_stack_getdat_any, (struct sp_coder *)); -static void FDECL(variable_list_del, (struct splev_var *)); static void FDECL(lvlfill_maze_grid, (int, int, int, int, SCHAR_P)); static void FDECL(lvlfill_solid, (SCHAR_P, SCHAR_P)); static void FDECL(set_wall_property, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, int)); -static void NDECL(shuffle_alignments); static void NDECL(count_features); static void NDECL(remove_boundary_syms); static void FDECL(set_door_orientation, (int, int)); @@ -61,8 +40,6 @@ static int NDECL(rndtrap); static void FDECL(get_location, (schar *, schar *, int, struct mkroom *)); static boolean FDECL(is_ok_location, (SCHAR_P, SCHAR_P, int)); static unpacked_coord FDECL(get_unpacked_coord, (long, int)); -static void FDECL(get_location_coord, (schar *, schar *, int, - struct mkroom *, long)); static void FDECL(get_room_loc, (schar *, schar *, struct mkroom *)); static void FDECL(get_free_room_loc, (schar *, schar *, struct mkroom *, packed_coord)); @@ -86,86 +63,69 @@ static void FDECL(light_region, (region *)); static void FDECL(wallify_map, (int, int, int, int)); static void FDECL(maze1xy, (coord *, int)); static void NDECL(fill_empty_maze); -static boolean FDECL(sp_level_loader, (dlb *, sp_lev *)); -static boolean FDECL(sp_level_free, (sp_lev *)); static void FDECL(splev_initlev, (lev_init *)); -static struct sp_frame *FDECL(frame_new, (long)); -static void FDECL(frame_del, (struct sp_frame *)); -static void FDECL(spo_frame_push, (struct sp_coder *)); -static void FDECL(spo_frame_pop, (struct sp_coder *)); +#if 0 +/* macosx complains that these are unused */ static long FDECL(sp_code_jmpaddr, (long, long)); -static void FDECL(spo_call, (struct sp_coder *)); -static void FDECL(spo_return, (struct sp_coder *)); -static void FDECL(spo_end_moninvent, (struct sp_coder *)); -static void FDECL(spo_pop_container, (struct sp_coder *)); -static void FDECL(spo_message, (struct sp_coder *)); -static void FDECL(spo_monster, (struct sp_coder *)); -static void FDECL(spo_object, (struct sp_coder *)); -static void FDECL(spo_level_flags, (struct sp_coder *)); -static void FDECL(spo_initlevel, (struct sp_coder *)); -static void FDECL(spo_engraving, (struct sp_coder *)); -static void FDECL(spo_mineralize, (struct sp_coder *)); static void FDECL(spo_room, (struct sp_coder *)); -static void FDECL(spo_endroom, (struct sp_coder *)); -static void FDECL(spo_stair, (struct sp_coder *)); -static void FDECL(spo_ladder, (struct sp_coder *)); -static void FDECL(spo_grave, (struct sp_coder *)); -static void FDECL(spo_altar, (struct sp_coder *)); static void FDECL(spo_trap, (struct sp_coder *)); static void FDECL(spo_gold, (struct sp_coder *)); static void FDECL(spo_corridor, (struct sp_coder *)); -static void FDECL(selection_setpoint, (int, int, struct opvar *, XCHAR_P)); -static struct opvar *FDECL(selection_not, (struct opvar *)); -static struct opvar *FDECL(selection_logical_oper, (struct opvar *, - struct opvar *, CHAR_P)); -static struct opvar *FDECL(selection_filter_mapchar, (struct opvar *, - struct opvar *)); -static void FDECL(selection_filter_percent, (struct opvar *, int)); -static int FDECL(selection_rndcoord, (struct opvar *, schar *, schar *, - BOOLEAN_P)); -static void FDECL(selection_do_grow, (struct opvar *, int)); -static int FDECL(floodfillchk_match_under, (int, int)); -static int FDECL(floodfillchk_match_accessible, (int, int)); -static boolean FDECL(sel_flood_havepoint, (int, int, - xchar *, xchar *, int)); -static void FDECL(selection_do_ellipse, (struct opvar *, int, int, - int, int, int)); -static long FDECL(line_dist_coord, (long, long, long, long, long, long)); -static void FDECL(selection_do_gradient, (struct opvar *, long, long, long, - long, long, long, long, long)); -static void FDECL(selection_do_line, (SCHAR_P, SCHAR_P, SCHAR_P, SCHAR_P, - struct opvar *)); -static void FDECL(selection_do_randline, (SCHAR_P, SCHAR_P, SCHAR_P, - SCHAR_P, SCHAR_P, SCHAR_P, - struct opvar *)); -static void FDECL(selection_iterate, (struct opvar *, select_iter_func, - genericptr_t)); -static void FDECL(sel_set_ter, (int, int, genericptr_t)); -static void FDECL(sel_set_feature, (int, int, genericptr_t)); -static void FDECL(sel_set_door, (int, int, genericptr_t)); -static void FDECL(spo_door, (struct sp_coder *)); static void FDECL(spo_feature, (struct sp_coder *)); static void FDECL(spo_terrain, (struct sp_coder *)); static void FDECL(spo_replace_terrain, (struct sp_coder *)); -static boolean FDECL(generate_way_out_method, (int, int, struct opvar *)); -static void NDECL(ensure_way_out); static void FDECL(spo_levregion, (struct sp_coder *)); static void FDECL(spo_region, (struct sp_coder *)); static void FDECL(spo_drawbridge, (struct sp_coder *)); static void FDECL(spo_mazewalk, (struct sp_coder *)); static void FDECL(spo_wall_property, (struct sp_coder *)); static void FDECL(spo_room_door, (struct sp_coder *)); -static void FDECL(sel_set_wallify, (int, int, genericptr_t)); static void FDECL(spo_wallify, (struct sp_coder *)); -static void FDECL(spo_map, (struct sp_coder *)); -static void FDECL(spo_jmp, (struct sp_coder *, sp_lev *)); -static void FDECL(spo_conditional_jump, (struct sp_coder *, sp_lev *)); -static void FDECL(spo_var_init, (struct sp_coder *)); -#if 0 -static long FDECL(opvar_array_length, (struct sp_coder *)); -#endif /*0*/ -static void FDECL(spo_shuffle_array, (struct sp_coder *)); -static boolean FDECL(sp_level_coder, (sp_lev *)); +static void FDECL(sel_set_wallify, (int, int, genericptr_t)); +#endif +static void NDECL(spo_end_moninvent); +static void NDECL(spo_pop_container); +static void FDECL(spo_endroom, (struct sp_coder *)); +static void FDECL(sel_set_ter, (int, int, genericptr_t)); +static void FDECL(sel_set_door, (int, int, genericptr_t)); +static void FDECL(sel_set_feature, (int, int, genericptr_t)); +static int FDECL(get_coord, (lua_State *, int, int *, int *)); +static int FDECL(get_table_region, (lua_State *, const char *, int *, int *, int *, int *, BOOLEAN_P)); + +/* lua_CFunction prototypes */ +int FDECL(lspo_altar, (lua_State *)); +int FDECL(lspo_branch, (lua_State *)); +int FDECL(lspo_corridor, (lua_State *)); +int FDECL(lspo_door, (lua_State *)); +int FDECL(lspo_drawbridge, (lua_State *)); +int FDECL(lspo_engraving, (lua_State *)); +int FDECL(lspo_feature, (lua_State *)); +int FDECL(lspo_gold, (lua_State *)); +int FDECL(lspo_grave, (lua_State *)); +int FDECL(lspo_ladder, (lua_State *)); +int FDECL(lspo_level_flags, (lua_State *)); +int FDECL(lspo_level_init, (lua_State *)); +int FDECL(lspo_levregion, (lua_State *)); +int FDECL(lspo_map, (lua_State *)); +int FDECL(lspo_mazewalk, (lua_State *)); +int FDECL(lspo_message, (lua_State *)); +int FDECL(lspo_mineralize, (lua_State *)); +int FDECL(lspo_monster, (lua_State *)); +int FDECL(lspo_non_diggable, (lua_State *)); +int FDECL(lspo_non_passwall, (lua_State *)); +int FDECL(lspo_object, (lua_State *)); +int FDECL(lspo_portal, (lua_State *)); +int FDECL(lspo_random_corridors, (lua_State *)); +int FDECL(lspo_region, (lua_State *)); +int FDECL(lspo_replace_terrain, (lua_State *)); +int FDECL(lspo_reset_level, (lua_State *)); +int FDECL(lspo_room, (lua_State *)); +int FDECL(lspo_stair, (lua_State *)); +int FDECL(lspo_teleport_region, (lua_State *)); +int FDECL(lspo_terrain, (lua_State *)); +int FDECL(lspo_trap, (lua_State *)); +int FDECL(lspo_wall_property, (lua_State *)); +int FDECL(lspo_wallify, (lua_State *)); #define LEFT 1 #define H_LEFT 2 @@ -181,17 +141,13 @@ static boolean FDECL(sp_level_coder, (sp_lev *)); #define XLIM 4 #define YLIM 3 -#define Fread (void) dlb_fread -#define Fgetc (schar) dlb_fgetc #define New(type) (type *) alloc(sizeof(type)) #define NewTab(type, size) (type **) alloc(sizeof(type *) * (unsigned) size) #define Free(ptr) if (ptr) free((genericptr_t) (ptr)) extern struct engr *head_engr; -#define SPLEV_STACK_RESERVE 128 - -void +static void solidify_map() { xchar x, y; @@ -202,382 +158,7 @@ solidify_map() levl[x][y].wall_info |= (W_NONDIGGABLE | W_NONPASSWALL); } -void -splev_stack_init(st) -struct splevstack *st; -{ - if (st) { - st->depth = 0; - st->depth_alloc = SPLEV_STACK_RESERVE; - st->stackdata = - (struct opvar **) alloc(st->depth_alloc * sizeof (struct opvar *)); - } -} - -void -splev_stack_done(st) -struct splevstack *st; -{ - if (st) { - int i; - - if (st->stackdata && st->depth) { - for (i = 0; i < st->depth; i++) { - switch (st->stackdata[i]->spovartyp) { - default: - case SPOVAR_NULL: - case SPOVAR_COORD: - case SPOVAR_REGION: - case SPOVAR_MAPCHAR: - case SPOVAR_MONST: - case SPOVAR_OBJ: - case SPOVAR_INT: - break; - case SPOVAR_VARIABLE: - case SPOVAR_STRING: - case SPOVAR_SEL: - Free(st->stackdata[i]->vardata.str); - st->stackdata[i]->vardata.str = NULL; - break; - } - Free(st->stackdata[i]); - st->stackdata[i] = NULL; - } - } - Free(st->stackdata); - st->stackdata = NULL; - st->depth = st->depth_alloc = 0; - Free(st); - } -} - -void -splev_stack_push(st, v) -struct splevstack *st; -struct opvar *v; -{ - if (!st || !v) - return; - if (!st->stackdata) - panic("splev_stack_push: no stackdata allocated?"); - - if (st->depth >= st->depth_alloc) { - struct opvar **tmp = (struct opvar **) alloc( - (st->depth_alloc + SPLEV_STACK_RESERVE) * sizeof (struct opvar *)); - - (void) memcpy(tmp, st->stackdata, - st->depth_alloc * sizeof(struct opvar *)); - Free(st->stackdata); - st->stackdata = tmp; - st->depth_alloc += SPLEV_STACK_RESERVE; - } - - st->stackdata[st->depth] = v; - st->depth++; -} - -struct opvar * -splev_stack_pop(st) -struct splevstack *st; -{ - struct opvar *ret = NULL; - - if (!st) - return ret; - if (!st->stackdata) - panic("splev_stack_pop: no stackdata allocated?"); - - if (st->depth) { - st->depth--; - ret = st->stackdata[st->depth]; - st->stackdata[st->depth] = NULL; - return ret; - } else - impossible("splev_stack_pop: empty stack?"); - return ret; -} - -struct splevstack * -splev_stack_reverse(st) -struct splevstack *st; -{ - long i; - struct opvar *tmp; - - if (!st) - return NULL; - if (!st->stackdata) - panic("splev_stack_reverse: no stackdata allocated?"); - for (i = 0; i < (st->depth / 2); i++) { - tmp = st->stackdata[i]; - st->stackdata[i] = st->stackdata[st->depth - i - 1]; - st->stackdata[st->depth - i - 1] = tmp; - } - return st; -} - -#define OV_typ(o) (o->spovartyp) -#define OV_i(o) (o->vardata.l) -#define OV_s(o) (o->vardata.str) - -#define OV_pop_i(x) (x = splev_stack_getdat(coder, SPOVAR_INT)) -#define OV_pop_c(x) (x = splev_stack_getdat(coder, SPOVAR_COORD)) -#define OV_pop_r(x) (x = splev_stack_getdat(coder, SPOVAR_REGION)) -#define OV_pop_s(x) (x = splev_stack_getdat(coder, SPOVAR_STRING)) -#define OV_pop(x) (x = splev_stack_getdat_any(coder)) -#define OV_pop_typ(x, typ) (x = splev_stack_getdat(coder, typ)) - -struct opvar * -opvar_new_str(s) -char *s; -{ - struct opvar *tmpov = (struct opvar *) alloc(sizeof (struct opvar)); - - tmpov->spovartyp = SPOVAR_STRING; - if (s) { - int len = strlen(s); - tmpov->vardata.str = (char *) alloc(len + 1); - (void) memcpy((genericptr_t) tmpov->vardata.str, (genericptr_t) s, - len); - tmpov->vardata.str[len] = '\0'; - } else - tmpov->vardata.str = NULL; - return tmpov; -} - -struct opvar * -opvar_new_int(i) -long i; -{ - struct opvar *tmpov = (struct opvar *) alloc(sizeof (struct opvar)); - - tmpov->spovartyp = SPOVAR_INT; - tmpov->vardata.l = i; - return tmpov; -} - -struct opvar * -opvar_new_coord(x, y) -int x, y; -{ - struct opvar *tmpov = (struct opvar *) alloc(sizeof (struct opvar)); - - tmpov->spovartyp = SPOVAR_COORD; - tmpov->vardata.l = SP_COORD_PACK(x, y); - return tmpov; -} - -#if 0 -struct opvar * -opvar_new_region(x1,y1,x2,y2) - int x1,y1,x2,y2; -{ - struct opvar *tmpov = (struct opvar *) alloc(sizeof (struct opvar)); - - tmpov->spovartyp = SPOVAR_REGION; - tmpov->vardata.l = SP_REGION_PACK(x1,y1,x2,y2); - return tmpov; -} -#endif /*0*/ - -void -opvar_free_x(ov) -struct opvar *ov; -{ - if (!ov) - return; - switch (ov->spovartyp) { - case SPOVAR_COORD: - case SPOVAR_REGION: - case SPOVAR_MAPCHAR: - case SPOVAR_MONST: - case SPOVAR_OBJ: - case SPOVAR_INT: - break; - case SPOVAR_VARIABLE: - case SPOVAR_STRING: - case SPOVAR_SEL: - Free(ov->vardata.str); - break; - default: - impossible("Unknown opvar value type (%i)!", ov->spovartyp); - } - Free(ov); -} - -/* - * Name of current function for use in messages: - * __func__ -- C99 standard; - * __FUNCTION__ -- gcc extension, starting before C99 and continuing after; - * picked up by other compilers (or vice versa?); - * __FUNC__ -- supported by Borland; - * nhFunc -- slightly intrusive but fully portable nethack construct - * for any version of any compiler. - */ -#define opvar_free(ov) \ - do { \ - if (ov) { \ - opvar_free_x(ov); \ - ov = NULL; \ - } else \ - impossible("opvar_free(), %s", nhFunc); \ - } while (0) - -struct opvar * -opvar_clone(ov) -struct opvar *ov; -{ - struct opvar *tmpov; - - if (!ov) - panic("no opvar to clone"); - tmpov = (struct opvar *) alloc(sizeof(struct opvar)); - tmpov->spovartyp = ov->spovartyp; - switch (ov->spovartyp) { - case SPOVAR_COORD: - case SPOVAR_REGION: - case SPOVAR_MAPCHAR: - case SPOVAR_MONST: - case SPOVAR_OBJ: - case SPOVAR_INT: - tmpov->vardata.l = ov->vardata.l; - break; - case SPOVAR_VARIABLE: - case SPOVAR_STRING: - case SPOVAR_SEL: - tmpov->vardata.str = dupstr(ov->vardata.str); - break; - default: - impossible("Unknown push value type (%i)!", ov->spovartyp); - } - return tmpov; -} - -struct opvar * -opvar_var_conversion(coder, ov) -struct sp_coder *coder; -struct opvar *ov; -{ - static const char nhFunc[] = "opvar_var_conversion"; - struct splev_var *tmp; - struct opvar *tmpov; - struct opvar *array_idx = NULL; - - if (!coder || !ov) - return NULL; - if (ov->spovartyp != SPOVAR_VARIABLE) - return ov; - tmp = coder->frame->variables; - while (tmp) { - if (!strcmp(tmp->name, OV_s(ov))) { - if ((tmp->svtyp & SPOVAR_ARRAY)) { - array_idx = opvar_var_conversion(coder, - splev_stack_pop(coder->stack)); - if (!array_idx || OV_typ(array_idx) != SPOVAR_INT) - panic("array idx not an int"); - if (tmp->array_len < 1) - panic("array len < 1"); - OV_i(array_idx) = (OV_i(array_idx) % tmp->array_len); - tmpov = opvar_clone(tmp->data.arrayvalues[OV_i(array_idx)]); - opvar_free(array_idx); - return tmpov; - } else { - tmpov = opvar_clone(tmp->data.value); - return tmpov; - } - } - tmp = tmp->next; - } - return NULL; -} - -struct splev_var * -opvar_var_defined(coder, name) -struct sp_coder *coder; -char *name; -{ - struct splev_var *tmp; - - if (!coder) - return NULL; - tmp = coder->frame->variables; - while (tmp) { - if (!strcmp(tmp->name, name)) - return tmp; - tmp = tmp->next; - } - return NULL; -} - -struct opvar * -splev_stack_getdat(coder, typ) -struct sp_coder *coder; -xchar typ; -{ - static const char nhFunc[] = "splev_stack_getdat"; - if (coder && coder->stack) { - struct opvar *tmp = splev_stack_pop(coder->stack); - struct opvar *ret = NULL; - - if (!tmp) - panic("no value type %i in stack.", typ); - if (tmp->spovartyp == SPOVAR_VARIABLE) { - ret = opvar_var_conversion(coder, tmp); - opvar_free(tmp); - tmp = ret; - } - if (tmp->spovartyp == typ) - return tmp; - else opvar_free(tmp); - } - return NULL; -} - -struct opvar * -splev_stack_getdat_any(coder) -struct sp_coder *coder; -{ - static const char nhFunc[] = "splev_stack_getdat_any"; - if (coder && coder->stack) { - struct opvar *tmp = splev_stack_pop(coder->stack); - if (tmp && tmp->spovartyp == SPOVAR_VARIABLE) { - struct opvar *ret = opvar_var_conversion(coder, tmp); - opvar_free(tmp); - return ret; - } - return tmp; - } - return NULL; -} - -void -variable_list_del(varlist) -struct splev_var *varlist; -{ - static const char nhFunc[] = "variable_list_del"; - struct splev_var *tmp = varlist; - - if (!tmp) - return; - while (tmp) { - Free(tmp->name); - if ((tmp->svtyp & SPOVAR_ARRAY)) { - long idx = tmp->array_len; - - while (idx-- > 0) { - opvar_free(tmp->data.arrayvalues[idx]); - }; - Free(tmp->data.arrayvalues); - } else { - opvar_free(tmp->data.value); - } - tmp = varlist->next; - Free(varlist); - varlist = tmp; - } -} - -void +static void lvlfill_maze_grid(x1, y1, x2, y2, filling) int x1, y1, x2, y2; schar filling; @@ -594,7 +175,7 @@ schar filling; } } -void +static void lvlfill_solid(filling, lit) schar filling; schar lit; @@ -604,9 +185,28 @@ schar lit; for (x = 2; x <= g.x_maze_max; x++) for (y = 0; y <= g.y_maze_max; y++) { SET_TYPLIT(x, y, filling, lit); + /* TODO: consolidate this w lspo_map ? */ + levl[x][y].flags = 0; + levl[x][y].horizontal = 0; + levl[x][y].roomno = 0; + levl[x][y].edge = 0; } } +void +sel_set_wall_property(x, y, arg) +int x, y; +genericptr_t arg; +{ + int prop = *(int *)arg; + + if (IS_STWALL(levl[x][y].typ) || IS_TREE(levl[x][y].typ) + /* 3.6.2: made iron bars eligible to be flagged nondiggable + (checked by chewing(hack.c) and zap_over_floor(zap.c)) */ + || levl[x][y].typ == IRONBARS) + levl[x][y].wall_info |= prop; +} + /* * Make walls of the area (x1, y1, x2, y2) non diggable/non passwall-able */ @@ -616,7 +216,6 @@ xchar x1, y1, x2, y2; int prop; { register xchar x, y; - struct rm *lev; x1 = max(x1, 1); x2 = min(x2, COLNO - 1); @@ -624,33 +223,10 @@ int prop; y2 = min(y2, ROWNO - 1); for (y = y1; y <= y2; y++) for (x = x1; x <= x2; x++) { - lev = &levl[x][y]; - if (IS_STWALL(lev->typ) || IS_TREE(lev->typ) - /* 3.6.2: made iron bars eligible to be flagged nondiggable - (checked by chewing(hack.c) and zap_over_floor(zap.c)) */ - || lev->typ == IRONBARS) - lev->wall_info |= prop; + sel_set_wall_property(x, y, (genericptr_t)&prop); } } -static void -shuffle_alignments() -{ - int i; - aligntyp atmp; - - /* shuffle 3 alignments */ - i = rn2(3); - atmp = g.ralign[2]; - g.ralign[2] = g.ralign[i]; - g.ralign[i] = atmp; - if (rn2(2)) { - atmp = g.ralign[1]; - g.ralign[1] = g.ralign[0]; - g.ralign[0] = atmp; - } -} - /* * Count the different features (sinks, fountains) in the level. */ @@ -670,7 +246,7 @@ count_features() } } -void +static void remove_boundary_syms() { /* @@ -775,7 +351,7 @@ link_doors_rooms() } } -void +static void fill_rooms() { int tmpi, m; @@ -945,7 +521,7 @@ register int humidity; return FALSE; } -unpacked_coord +static unpacked_coord get_unpacked_coord(loc, defhumidity) long loc; int defhumidity; @@ -967,7 +543,7 @@ int defhumidity; return c; } -static void +void get_location_coord(x, y, humidity, croom, crd) schar *x, *y; int humidity; @@ -1375,7 +951,7 @@ struct mkroom *broom; y = broom->ly - 1; x = broom->lx + ((dpos == -1) ? rn2(1 + (broom->hx - broom->lx)) : dpos); - if (IS_ROCK(levl[x][y - 1].typ)) + if (!isok(x,y - 1)) goto redoloop; goto outdirloop; case 1: @@ -1384,7 +960,7 @@ struct mkroom *broom; y = broom->hy + 1; x = broom->lx + ((dpos == -1) ? rn2(1 + (broom->hx - broom->lx)) : dpos); - if (IS_ROCK(levl[x][y + 1].typ)) + if (!isok(x,y + 1)) goto redoloop; goto outdirloop; case 2: @@ -1393,7 +969,7 @@ struct mkroom *broom; x = broom->lx - 1; y = broom->ly + ((dpos == -1) ? rn2(1 + (broom->hy - broom->ly)) : dpos); - if (IS_ROCK(levl[x - 1][y].typ)) + if (!isok(x - 1,y)) goto redoloop; goto outdirloop; case 3: @@ -1402,7 +978,7 @@ struct mkroom *broom; x = broom->hx + 1; y = broom->ly + ((dpos == -1) ? rn2(1 + (broom->hy - broom->ly)) : dpos); - if (IS_ROCK(levl[x + 1][y].typ)) + if (!isok(x + 1,y)) goto redoloop; goto outdirloop; default: @@ -1581,9 +1157,9 @@ struct mkroom *croom; ? Align2amask(u.ualignbase[A_ORIGINAL]) : (m->align == AM_SPLEV_NONCO) ? Align2amask(noncoalignment(u.ualignbase[A_ORIGINAL])) - : (m->align <= -(MAX_REGISTERS + 1)) + : (m->align == AM_SPLEV_RANDOM) ? induced_align(80) - : (m->align < 0 ? g.ralign[-m->align - 1] : m->align); + : m->align; if (!class) pm = (struct permonst *) 0; @@ -1619,7 +1195,7 @@ struct mkroom *croom; if (MON_AT(x, y) && enexto(&cc, x, y, pm)) x = cc.x, y = cc.y; - if (m->align != -(MAX_REGISTERS + 2)) + if (m->align != AM_SPLEV_RANDOM) mtmp = mk_roamer(pm, Amask2align(amask), x, y, m->peaceful); else if (PM_ARCHEOLOGIST <= m->id && m->id <= PM_WIZARD) mtmp = mk_mplayer(pm, x, y, FALSE); @@ -1906,10 +1482,6 @@ struct mkroom *croom; otmp->otrapped = o->trapped; if (o->greased) otmp->greased = 1; -#ifdef INVISIBLE_OBJECTS - if (o->invis) - otmp->oinvis = 1; -#endif if (o->quan > 0 && objects[otmp->otyp].oc_merge) { otmp->quan = o->quan; @@ -1917,7 +1489,7 @@ struct mkroom *croom; } /* contents (of a container or monster's inventory) */ - if (o->containment & SP_OBJ_CONTENT) { + if (o->containment & SP_OBJ_CONTENT || g.invent_carrying_monster) { if (!g.container_idx) { if (!g.invent_carrying_monster) { /*impossible("create_object: no container");*/ @@ -2086,9 +1658,9 @@ struct mkroom *croom; ? Align2amask(u.ualignbase[A_ORIGINAL]) : (a->align == AM_SPLEV_NONCO) ? Align2amask(noncoalignment(u.ualignbase[A_ORIGINAL])) - : (a->align == -(MAX_REGISTERS + 1)) + : (a->align == AM_SPLEV_RANDOM) ? induced_align(80) - : (a->align < 0 ? g.ralign[-a->align - 1] : a->align); + : a->align; levl[x][y].typ = ALTAR; levl[x][y].altarmask = amask; @@ -2106,7 +1678,7 @@ struct mkroom *croom; } } -void +static void replace_terrain(terr, croom) replaceterrain *terr; struct mkroom *croom; @@ -2145,13 +1717,13 @@ int cnt; int xx, yy; switch (wall) { - case W_NORTH: + case W_SOUTH: dy = 0; dx = 1; xx = croom->lx; yy = croom->hy + 1; break; - case W_SOUTH: + case W_NORTH: dy = 0; dx = 1; xx = croom->lx; @@ -2364,7 +1936,6 @@ corridor *c; if (!search_door(&g.rooms[c->src.room], &org.x, &org.y, c->src.wall, c->src.door)) return; - if (c->dest.room != -1) { if (!search_door(&g.rooms[c->dest.room], &dest.x, &dest.y, c->dest.wall, c->dest.door)) @@ -2469,7 +2040,7 @@ boolean prefilled; } } -struct mkroom * +static struct mkroom * build_room(r, mkr) room *r; struct mkroom *mkr; @@ -2646,105 +2217,7 @@ fill_empty_maze() } } -/* - * special level loader - */ -static boolean -sp_level_loader(fd, lvl) -dlb *fd; -sp_lev *lvl; -{ - long n_opcode = 0; - struct opvar *opdat; - int opcode; - - Fread((genericptr_t) & (lvl->n_opcodes), 1, sizeof(lvl->n_opcodes), fd); - lvl->opcodes = (_opcode *) alloc(sizeof(_opcode) * (lvl->n_opcodes)); - - while (n_opcode < lvl->n_opcodes) { - Fread((genericptr_t) &lvl->opcodes[n_opcode].opcode, 1, - sizeof(lvl->opcodes[n_opcode].opcode), fd); - opcode = lvl->opcodes[n_opcode].opcode; - - opdat = NULL; - - if (opcode < SPO_NULL || opcode >= MAX_SP_OPCODES) - panic("sp_level_loader: impossible opcode %i.", opcode); - - if (opcode == SPO_PUSH) { - int nsize; - struct opvar *ov = (struct opvar *) alloc(sizeof(struct opvar)); - - opdat = ov; - ov->spovartyp = SPO_NULL; - ov->vardata.l = 0; - Fread((genericptr_t) & (ov->spovartyp), 1, sizeof(ov->spovartyp), - fd); - - switch (ov->spovartyp) { - case SPOVAR_NULL: - break; - case SPOVAR_COORD: - case SPOVAR_REGION: - case SPOVAR_MAPCHAR: - case SPOVAR_MONST: - case SPOVAR_OBJ: - case SPOVAR_INT: - Fread((genericptr_t) & (ov->vardata.l), 1, - sizeof(ov->vardata.l), fd); - break; - case SPOVAR_VARIABLE: - case SPOVAR_STRING: - case SPOVAR_SEL: { - char *opd; - - Fread((genericptr_t) &nsize, 1, sizeof(nsize), fd); - opd = (char *) alloc(nsize + 1); - - if (nsize) - Fread(opd, 1, nsize, fd); - opd[nsize] = 0; - ov->vardata.str = opd; - break; - } - default: - panic("sp_level_loader: unknown opvar type %i", - ov->spovartyp); - } - } - - lvl->opcodes[n_opcode].opdat = opdat; - n_opcode++; - } /*while*/ - - return TRUE; -} - -/* Frees the memory allocated for special level creation structs */ -static boolean -sp_level_free(lvl) -sp_lev *lvl; -{ - static const char nhFunc[] = "sp_level_free"; - long n_opcode = 0; - - while (n_opcode < lvl->n_opcodes) { - int opcode = lvl->opcodes[n_opcode].opcode; - struct opvar *opdat = lvl->opcodes[n_opcode].opdat; - - if (opcode < SPO_NULL || opcode >= MAX_SP_OPCODES) - panic("sp_level_free: unknown opcode %i", opcode); - - if (opdat) - opvar_free(opdat); - n_opcode++; - } - Free(lvl->opcodes); - lvl->opcodes = NULL; - return TRUE; -} - -void +static void splev_initlev(linit) lev_init *linit; { @@ -2760,7 +2233,7 @@ lev_init *linit; lvlfill_solid(linit->filling, linit->lit); break; case LVLINIT_MAZEGRID: - lvlfill_maze_grid(2, 0, g.x_maze_max, g.y_maze_max, linit->filling); + lvlfill_maze_grid(2, 0, g.x_maze_max, g.y_maze_max, linit->bg); break; case LVLINIT_ROGUE: makeroguerooms(); @@ -2776,132 +2249,19 @@ lev_init *linit; } } -struct sp_frame * -frame_new(execptr) -long execptr; -{ - struct sp_frame *frame = - (struct sp_frame *) alloc(sizeof(struct sp_frame)); - - frame->next = NULL; - frame->variables = NULL; - frame->n_opcode = execptr; - frame->stack = (struct splevstack *) alloc(sizeof(struct splevstack)); - splev_stack_init(frame->stack); - return frame; -} - -void -frame_del(frame) -struct sp_frame *frame; -{ - if (!frame) - return; - if (frame->stack) { - splev_stack_done(frame->stack); - frame->stack = NULL; - } - if (frame->variables) { - variable_list_del(frame->variables); - frame->variables = NULL; - } - Free(frame); -} - -void -spo_frame_push(coder) -struct sp_coder *coder; -{ - struct sp_frame *tmpframe = frame_new(coder->frame->n_opcode); - - tmpframe->next = coder->frame; - coder->frame = tmpframe; -} - -void -spo_frame_pop(coder) -struct sp_coder *coder; -{ - if (coder->frame && coder->frame->next) { - struct sp_frame *tmpframe = coder->frame->next; - - frame_del(coder->frame); - coder->frame = tmpframe; - coder->stack = coder->frame->stack; - } -} - -long +#if 0 +static long sp_code_jmpaddr(curpos, jmpaddr) long curpos, jmpaddr; { return (curpos + jmpaddr); } +#endif -void -spo_call(coder) -struct sp_coder *coder; -{ - static const char nhFunc[] = "spo_call"; - struct opvar *addr; - struct opvar *params; - struct sp_frame *tmpframe; - - if (!OV_pop_i(addr) || !OV_pop_i(params)) - return; - if (OV_i(params) < 0) - return; - - tmpframe = frame_new(sp_code_jmpaddr(coder->frame->n_opcode, - OV_i(addr) - 1)); - - while (OV_i(params)-- > 0) { - splev_stack_push(tmpframe->stack, splev_stack_getdat_any(coder)); - } - splev_stack_reverse(tmpframe->stack); - - /* push a frame */ - tmpframe->next = coder->frame; - coder->frame = tmpframe; - - opvar_free(addr); - opvar_free(params); -} - -void -spo_return(coder) -struct sp_coder *coder; -{ - static const char nhFunc[] = "spo_return"; - struct opvar *params; - - if (!coder->frame || !coder->frame->next) - panic("return: no frame."); - if (!OV_pop_i(params)) - return; - if (OV_i(params) < 0) - return; - - while (OV_i(params)-- > 0) { - splev_stack_push(coder->frame->next->stack, - splev_stack_pop(coder->stack)); - } - - /* pop the frame */ - if (coder->frame->next) { - struct sp_frame *tmpframe = coder->frame->next; - frame_del(coder->frame); - coder->frame = tmpframe; - coder->stack = coder->frame->stack; - } - - opvar_free(params); -} /*ARGUSED*/ -void -spo_end_moninvent(coder) -struct sp_coder *coder UNUSED; +static void +spo_end_moninvent() { if (g.invent_carrying_monster) m_dowear(g.invent_carrying_monster, TRUE); @@ -2909,9 +2269,8 @@ struct sp_coder *coder UNUSED; } /*ARGUSED*/ -void -spo_pop_container(coder) -struct sp_coder *coder UNUSED; +static void +spo_pop_container() { if (g.container_idx > 0) { g.container_idx--; @@ -2919,20 +2278,25 @@ struct sp_coder *coder UNUSED; } } -void -spo_message(coder) -struct sp_coder *coder; +/* message("What a strange feeling!"); */ +int +lspo_message(L) +lua_State *L; { - static const char nhFunc[] = "spo_message"; - struct opvar *op; - char *msg, *levmsg; + char *levmsg; int old_n, n; + const char *msg; - if (!OV_pop_s(op)) - return; - msg = OV_s(op); - if (!msg) - return; + int argc = lua_gettop(L); + + if (argc < 1) { + nhl_error(L, "Wrong parameters"); + return 0; + } + + create_des_coder(); + + msg = luaL_checkstring(L, 1); old_n = g.lev_message ? (strlen(g.lev_message) + 1) : 0; n = strlen(msg); @@ -2947,25 +2311,90 @@ struct sp_coder *coder; levmsg[old_n + n] = '\0'; Free(g.lev_message); g.lev_message = levmsg; - opvar_free(op); + + return 0; /* number of results */ } -void -spo_monster(coder) -struct sp_coder *coder; +int +get_table_align(L) +lua_State *L; { - static const char nhFunc[] = "spo_monster"; - int nparams = 0; - struct opvar *varparam; - struct opvar *id, *mcoord, *has_inv; + const char *const gtaligns[] = { "noalign", "law", "neutral", "chaos", "coaligned", "noncoaligned", "random", NULL }; + const int aligns2i[] = { AM_NONE, AM_LAWFUL, AM_NEUTRAL, AM_CHAOTIC, AM_SPLEV_CO, AM_SPLEV_NONCO, AM_SPLEV_RANDOM, 0 }; + + int a = aligns2i[get_table_option(L, "align", "random", gtaligns)]; + + return a; +} + +int +get_table_monclass(L) +lua_State *L; +{ + char *s = get_table_str_opt(L, "class", NULL); + int ret = -1; + + if (s && strlen(s) == 1) + ret = (int) *s; + Free(s); + + return ret; +} + +int +find_montype(L, s) +lua_State *L; +const char *s; +{ + int i; + + for (i = LOW_PM; i < NUMMONS; i++) + if (!strcmpi(mons[i].mname, s)) + return i; + nhUse(L); + return NON_PM; +} + +int +get_table_montype(L) +lua_State *L; +{ + char *s = get_table_str_opt(L, "id", NULL); + int ret = NON_PM; + + if (s) { + ret = find_montype(L, s); + Free(s); + if (ret == NON_PM) + nhl_error(L, "Unknown monster id"); + } + return ret; +} + +/* monster(); */ +/* monster("wood nymph"); */ +/* monster("D"); */ +/* monster("giant eel",11,06); */ +/* monster("hill giant", {08,06}); */ +/* monster({ id = "giant mimic", appear_as = "obj:boulder" }); */ +/* monster({ class = "H", peaceful = 0 }); */ +int +lspo_monster(L) +lua_State *L; +{ + int argc = lua_gettop(L); monster tmpmons; + int mx = -1, my = -1; + char *mappear = NULL; + + create_des_coder(); tmpmons.peaceful = -1; tmpmons.asleep = -1; - tmpmons.name.str = (char *) 0; + tmpmons.name.str = NULL; tmpmons.appear = 0; tmpmons.appear_as.str = (char *) 0; - tmpmons.align = -MAX_REGISTERS - 2; + tmpmons.align = AM_SPLEV_RANDOM; tmpmons.female = 0; tmpmons.invis = 0; tmpmons.cancelled = 0; @@ -2979,134 +2408,242 @@ struct sp_coder *coder; tmpmons.seentraps = 0; tmpmons.has_invent = 0; - if (!OV_pop_i(has_inv)) - return; + if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) { + const char *paramstr = luaL_checkstring(L, 1); - if (!OV_pop_i(varparam)) - return; - - while ((nparams++ < (SP_M_V_END + 1)) && (OV_typ(varparam) == SPOVAR_INT) - && (OV_i(varparam) >= 0) && (OV_i(varparam) < SP_M_V_END)) { - struct opvar *parm = NULL; - - OV_pop(parm); - switch (OV_i(varparam)) { - case SP_M_V_NAME: - if ((OV_typ(parm) == SPOVAR_STRING) && !tmpmons.name.str) - tmpmons.name.str = dupstr(OV_s(parm)); - break; - case SP_M_V_APPEAR: - if ((OV_typ(parm) == SPOVAR_INT) && !tmpmons.appear_as.str) { - tmpmons.appear = OV_i(parm); - opvar_free(parm); - OV_pop(parm); - tmpmons.appear_as.str = dupstr(OV_s(parm)); - } - break; - case SP_M_V_ASLEEP: - if (OV_typ(parm) == SPOVAR_INT) - tmpmons.asleep = OV_i(parm); - break; - case SP_M_V_ALIGN: - if (OV_typ(parm) == SPOVAR_INT) - tmpmons.align = OV_i(parm); - break; - case SP_M_V_PEACEFUL: - if (OV_typ(parm) == SPOVAR_INT) - tmpmons.peaceful = OV_i(parm); - break; - case SP_M_V_FEMALE: - if (OV_typ(parm) == SPOVAR_INT) - tmpmons.female = OV_i(parm); - break; - case SP_M_V_INVIS: - if (OV_typ(parm) == SPOVAR_INT) - tmpmons.invis = OV_i(parm); - break; - case SP_M_V_CANCELLED: - if (OV_typ(parm) == SPOVAR_INT) - tmpmons.cancelled = OV_i(parm); - break; - case SP_M_V_REVIVED: - if (OV_typ(parm) == SPOVAR_INT) - tmpmons.revived = OV_i(parm); - break; - case SP_M_V_AVENGE: - if (OV_typ(parm) == SPOVAR_INT) - tmpmons.avenge = OV_i(parm); - break; - case SP_M_V_FLEEING: - if (OV_typ(parm) == SPOVAR_INT) - tmpmons.fleeing = OV_i(parm); - break; - case SP_M_V_BLINDED: - if (OV_typ(parm) == SPOVAR_INT) - tmpmons.blinded = OV_i(parm); - break; - case SP_M_V_PARALYZED: - if (OV_typ(parm) == SPOVAR_INT) - tmpmons.paralyzed = OV_i(parm); - break; - case SP_M_V_STUNNED: - if (OV_typ(parm) == SPOVAR_INT) - tmpmons.stunned = OV_i(parm); - break; - case SP_M_V_CONFUSED: - if (OV_typ(parm) == SPOVAR_INT) - tmpmons.confused = OV_i(parm); - break; - case SP_M_V_SEENTRAPS: - if (OV_typ(parm) == SPOVAR_INT) - tmpmons.seentraps = OV_i(parm); - break; - case SP_M_V_END: - nparams = SP_M_V_END + 1; - break; - default: - impossible("MONSTER with unknown variable param type!"); - break; + if (strlen(paramstr) == 1) { + tmpmons.class = *paramstr; + tmpmons.id = NON_PM; + } else { + tmpmons.class = -1; + tmpmons.id = find_montype(L, paramstr); } - opvar_free(parm); - if (OV_i(varparam) != SP_M_V_END) { - opvar_free(varparam); - OV_pop(varparam); + } else if (argc == 2 && lua_type(L, 1) == LUA_TSTRING + && lua_type(L, 2) == LUA_TTABLE) { + const char *paramstr = luaL_checkstring(L, 1); + + get_coord(L, 2, &mx, &my); + + if (strlen(paramstr) == 1) { + tmpmons.class = *paramstr; + tmpmons.id = NON_PM; + } else { + tmpmons.class = -1; + tmpmons.id = find_montype(L, paramstr); + } + + } else if (argc == 3) { + const char *paramstr = luaL_checkstring(L, 1); + + mx = luaL_checkinteger(L, 2); + my = luaL_checkinteger(L, 3); + + if (strlen(paramstr) == 1) { + tmpmons.class = *paramstr; + tmpmons.id = NON_PM; + } else { + tmpmons.class = -1; + tmpmons.id = find_montype(L, paramstr); + } + } else { + lcheck_param_table(L); + + tmpmons.peaceful = get_table_int_opt(L, "peaceful", -1); /* TODO: alias hostile=!peaceful */ + tmpmons.asleep = get_table_int_opt(L, "asleep", -1); + tmpmons.name.str = get_table_str_opt(L, "name", NULL); + tmpmons.appear = 0; + tmpmons.appear_as.str = (char *) 0; + tmpmons.align = get_table_align(L); + tmpmons.female = get_table_int_opt(L, "female", 0); + tmpmons.invis = get_table_int_opt(L, "invisible", 0); + tmpmons.cancelled = get_table_int_opt(L, "cancelled", 0); + tmpmons.revived = get_table_int_opt(L, "revived", 0); + tmpmons.avenge = get_table_int_opt(L, "avenge", 0); + tmpmons.fleeing = get_table_int_opt(L, "fleeing", 0); + tmpmons.blinded = get_table_int_opt(L, "blinded", 0); + tmpmons.paralyzed = get_table_int_opt(L, "paralyzed", 0); + tmpmons.stunned = get_table_int_opt(L, "stunned", 0); + tmpmons.confused = get_table_int_opt(L, "confused", 0); + tmpmons.seentraps = 0; /* TODO: list of trap names to bitfield */ + tmpmons.has_invent = 0; + + mappear = get_table_str_opt(L, "appear_as", NULL); + if (mappear) { + if (!strncmp("obj:", mappear, 4)) { + tmpmons.appear = M_AP_OBJECT; + } else if (!strncmp("mon:", mappear, 4)) { + tmpmons.appear = M_AP_MONSTER; + } else if (!strncmp("ter:", mappear, 4)) { + tmpmons.appear = M_AP_FURNITURE; + } else { + nhl_error(L, "Unknown appear_as type"); + } + tmpmons.appear_as.str = dupstr(&mappear[4]); + Free(mappear); + } + + mx = get_table_int_opt(L, "x", -1); + my = get_table_int_opt(L, "y", -1); + + if (mx == -1 && my == -1) { + lua_getfield(L, 1, "coord"); + get_coord(L, -1, &mx, &my); + lua_pop(L, 1); + } + + tmpmons.id = get_table_montype(L); + tmpmons.class = get_table_monclass(L); + + lua_getfield(L, 1, "inventory"); + if (!lua_isnil(L, -1)) { + tmpmons.has_invent = 1; } } - if (!OV_pop_c(mcoord)) - panic("no monster coord?"); + if (mx == -1 && my == -1) + tmpmons.coord = SP_COORD_PACK_RANDOM(0); + else + tmpmons.coord = SP_COORD_PACK(mx, my); - if (!OV_pop_typ(id, SPOVAR_MONST)) - panic("no mon type"); + if (tmpmons.id != NON_PM && tmpmons.class == -1) + tmpmons.class = def_monsyms[(int) mons[tmpmons.id].mlet].sym; - tmpmons.id = SP_MONST_PM(OV_i(id)); - tmpmons.class = SP_MONST_CLASS(OV_i(id)); - tmpmons.coord = OV_i(mcoord); - tmpmons.has_invent = OV_i(has_inv); + create_monster(&tmpmons, g.coder->croom); - create_monster(&tmpmons, coder->croom); + if (tmpmons.has_invent && lua_type(L, -1) == LUA_TFUNCTION) { + lua_remove(L, -2); + lua_call(L, 0, 0); + spo_end_moninvent(); + } else + lua_pop(L, 1); Free(tmpmons.name.str); Free(tmpmons.appear_as.str); - opvar_free(id); - opvar_free(mcoord); - opvar_free(has_inv); - opvar_free(varparam); + + return 0; } -void -spo_object(coder) -struct sp_coder *coder; +/* the hash key 'name' is an integer or "random", + or if not existent, also return rndval. + */ +int +get_table_int_or_random(L, name, rndval) +lua_State *L; +const char *name; +int rndval; { - static const char nhFunc[] = "spo_object"; + int ret; + char buf[BUFSZ]; + + lua_getfield(L, 1, name); + if (lua_type(L, -1) == LUA_TNIL) { + lua_pop(L, 1); + return rndval; + } + if (!lua_isnumber(L, -1)) { + const char *tmp = lua_tostring(L, -1); + + if (tmp && !strcmpi("random", tmp)) { + lua_pop(L, 1); + return rndval; + } + Sprintf(buf, "Expected integer or \"random\" for \"%s\", got %s", name, tmp); + nhl_error(L, buf); + lua_pop(L, 1); + return 0; + } + ret = luaL_optinteger(L, -1, rndval); + lua_pop(L, 1); + return ret; +} + +int +get_table_buc(L) +lua_State *L; +{ + const char *const bucs[] = { "random", "blessed", "uncursed", "cursed", NULL }; + const int bucs2i[] = { 0, 1, 2, 3, 0 }; + + int curse_state = bucs2i[get_table_option(L, "buc", "random", bucs)]; + return curse_state; +} + +int +get_table_objclass(L) +lua_State *L; +{ + char *s = get_table_str_opt(L, "class", NULL); + int ret = -1; + + if (s && strlen(s) == 1) + ret = (int) *s; + Free(s); + return ret; +} + +int +find_objtype(L, s) +lua_State *L; +const char *s; +{ + if (s) { + int i; + const char *objname; + + /* find by object name */ + for (i = 0; i < NUM_OBJECTS; i++) { + objname = obj_descr[i].oc_name; + if (objname && !strcmpi(s, objname)) + return i; + } + + /* find by object description */ + for (i = 0; i < NUM_OBJECTS; i++) { + objname = obj_descr[i].oc_descr; + if (objname && !strcmpi(s, objname)) + return i; + } + + nhl_error(L, "Unknown object id"); + } + return STRANGE_OBJECT; +} + +int +get_table_objtype(L) +lua_State *L; +{ + char *s = get_table_str_opt(L, "id", NULL); + int ret = find_objtype(L, s); + + Free(s); + return ret; +} + +/* object(); */ +/* object("sack"); */ +/* object("scimitar", 6,7); */ +/* object("scimitar", {6,7}); */ +/* object({ class = "%" }); */ +/* object({ id = "boulder", x = 03, y = 12}); */ +/* object({ id = "boulder", coord = {03,12} }); */ +int +lspo_object(L) +lua_State *L; +{ +#if 0 int nparams = 0; +#endif long quancnt; - struct opvar *varparam; - struct opvar *id, *containment; object tmpobj; + int ox = -1, oy = -1; + int argc = lua_gettop(L); + int maybe_contents = 0; + + create_des_coder(); tmpobj.spe = -127; - tmpobj.curse_state = -1; + tmpobj.curse_state = 0; tmpobj.corpsenm = NON_PM; tmpobj.name.str = (char *) 0; tmpobj.quan = -1; @@ -3116,329 +2653,429 @@ struct sp_coder *coder; tmpobj.locked = 0; tmpobj.trapped = -1; tmpobj.recharged = 0; - tmpobj.invis = 0; tmpobj.greased = 0; tmpobj.broken = 0; - tmpobj.coord = SP_COORD_PACK_RANDOM(0); + tmpobj.containment = 0; - if (!OV_pop_i(containment)) - return; + if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) { + const char *paramstr = luaL_checkstring(L, 1); - if (!OV_pop_i(varparam)) - return; - - while ((nparams++ < (SP_O_V_END + 1)) && (OV_typ(varparam) == SPOVAR_INT) - && (OV_i(varparam) >= 0) && (OV_i(varparam) < SP_O_V_END)) { - struct opvar *parm; - - OV_pop(parm); - switch (OV_i(varparam)) { - case SP_O_V_NAME: - if ((OV_typ(parm) == SPOVAR_STRING) && !tmpobj.name.str) - tmpobj.name.str = dupstr(OV_s(parm)); - break; - case SP_O_V_CORPSENM: - if (OV_typ(parm) == SPOVAR_MONST) { - char monclass = SP_MONST_CLASS(OV_i(parm)); - int monid = SP_MONST_PM(OV_i(parm)); - - if (monid >= LOW_PM && monid < NUMMONS) { - tmpobj.corpsenm = monid; - break; /* we're done! */ - } else { - struct permonst *pm = (struct permonst *) 0; - - if (def_char_to_monclass(monclass) != MAXMCLASSES) { - pm = mkclass(def_char_to_monclass(monclass), G_NOGEN); - } else { - pm = rndmonst(); - } - if (pm) - tmpobj.corpsenm = monsndx(pm); - } - } - break; - case SP_O_V_CURSE: - if (OV_typ(parm) == SPOVAR_INT) - tmpobj.curse_state = OV_i(parm); - break; - case SP_O_V_SPE: - if (OV_typ(parm) == SPOVAR_INT) - tmpobj.spe = OV_i(parm); - break; - case SP_O_V_QUAN: - if (OV_typ(parm) == SPOVAR_INT) - tmpobj.quan = OV_i(parm); - break; - case SP_O_V_BURIED: - if (OV_typ(parm) == SPOVAR_INT) - tmpobj.buried = OV_i(parm); - break; - case SP_O_V_LIT: - if (OV_typ(parm) == SPOVAR_INT) - tmpobj.lit = OV_i(parm); - break; - case SP_O_V_ERODED: - if (OV_typ(parm) == SPOVAR_INT) - tmpobj.eroded = OV_i(parm); - break; - case SP_O_V_LOCKED: - if (OV_typ(parm) == SPOVAR_INT) - tmpobj.locked = OV_i(parm); - break; - case SP_O_V_TRAPPED: - if (OV_typ(parm) == SPOVAR_INT) - tmpobj.trapped = OV_i(parm); - break; - case SP_O_V_RECHARGED: - if (OV_typ(parm) == SPOVAR_INT) - tmpobj.recharged = OV_i(parm); - break; - case SP_O_V_INVIS: - if (OV_typ(parm) == SPOVAR_INT) - tmpobj.invis = OV_i(parm); - break; - case SP_O_V_GREASED: - if (OV_typ(parm) == SPOVAR_INT) - tmpobj.greased = OV_i(parm); - break; - case SP_O_V_BROKEN: - if (OV_typ(parm) == SPOVAR_INT) - tmpobj.broken = OV_i(parm); - break; - case SP_O_V_COORD: - if (OV_typ(parm) != SPOVAR_COORD) - panic("no coord for obj?"); - tmpobj.coord = OV_i(parm); - break; - case SP_O_V_END: - nparams = SP_O_V_END + 1; - break; - default: - impossible("OBJECT with unknown variable param type!"); - break; + if (strlen(paramstr) == 1) { + tmpobj.class = *paramstr; + tmpobj.id = STRANGE_OBJECT; + } else { + tmpobj.class = -1; + tmpobj.id = find_objtype(L, paramstr); } - opvar_free(parm); - if (OV_i(varparam) != SP_O_V_END) { - opvar_free(varparam); - OV_pop(varparam); + } else if (argc == 2 && lua_type(L, 1) == LUA_TSTRING + && lua_type(L, 2) == LUA_TTABLE) { + const char *paramstr = luaL_checkstring(L, 1); + + get_coord(L, 2, &ox, &oy); + + if (strlen(paramstr) == 1) { + tmpobj.class = *paramstr; + tmpobj.id = STRANGE_OBJECT; + } else { + tmpobj.class = -1; + tmpobj.id = find_objtype(L, paramstr); + } + } else if (argc == 3) { + const char *paramstr = luaL_checkstring(L, 1); + + ox = luaL_checkinteger(L, 2); + oy = luaL_checkinteger(L, 3); + + if (strlen(paramstr) == 1) { + tmpobj.class = *paramstr; + tmpobj.id = STRANGE_OBJECT; + } else { + tmpobj.class = -1; + tmpobj.id = find_objtype(L, paramstr); + } + } else { + lcheck_param_table(L); + + tmpobj.spe = get_table_int_or_random(L, "spe", -127); + tmpobj.curse_state = get_table_buc(L); + tmpobj.corpsenm = NON_PM; + tmpobj.name.str = get_table_str_opt(L, "name", (char *) 0); + tmpobj.quan = get_table_int_or_random(L, "quantity", -1); + tmpobj.buried = get_table_boolean_opt(L, "buried", 0); + tmpobj.lit = get_table_boolean_opt(L, "lit", 0); + tmpobj.eroded = get_table_int_opt(L, "eroded", 0); + tmpobj.locked = get_table_boolean_opt(L, "locked", 0); + tmpobj.trapped = get_table_int_opt(L, "trapped", -1); + tmpobj.recharged = get_table_int_opt(L, "recharged", 0); + tmpobj.greased = get_table_boolean_opt(L, "greased", 0); + tmpobj.broken = get_table_boolean_opt(L, "broken", 0); + + ox = get_table_int_opt(L, "x", -1); + oy = get_table_int_opt(L, "y", -1); + + if (ox == -1 && oy == -1) { + lua_getfield(L, 1, "coord"); + get_coord(L, -1, &ox, &oy); + lua_pop(L, 1); + } + + tmpobj.id = get_table_objtype(L); + tmpobj.class = get_table_objclass(L); + maybe_contents = 1; + } + + if (ox == -1 && oy == -1) + tmpobj.coord = SP_COORD_PACK_RANDOM(0); + else + tmpobj.coord = SP_COORD_PACK(ox, oy); + + if (tmpobj.class == -1 && tmpobj.id > STRANGE_OBJECT) + tmpobj.class = objects[tmpobj.id].oc_class; + else if (tmpobj.class > -1 && tmpobj.id == STRANGE_OBJECT) + tmpobj.id = -1; + + if (tmpobj.id == STATUE || tmpobj.id == EGG || tmpobj.id == CORPSE || tmpobj.id == TIN) { + int lflags = 0; + char *montype = get_table_str_opt(L, "montype", NULL); + + if (montype) { + struct permonst *pm = NULL; + if (strlen(montype) == 1 && def_char_to_monclass(*montype) != MAXMCLASSES) { + pm = mkclass(def_char_to_monclass(*montype), G_NOGEN); + } else { + int i; + for (i = LOW_PM; i < NUMMONS; i++) + if (!strcmpi(mons[i].mname, montype)) { + pm = &mons[i]; + break; + } + } + if (pm) + tmpobj.corpsenm = monsndx(pm); + else + nhl_error(L, "Unknown montype"); + free(montype); + } + if (tmpobj.id == STATUE) { + lflags |= (get_table_boolean_opt(L, "historic", 0) ? STATUE_HISTORIC : 0x00); + lflags |= (get_table_boolean_opt(L, "male", 0) ? STATUE_MALE : 0x00); + lflags |= (get_table_boolean_opt(L, "female", 0) ? STATUE_FEMALE : 0x00); + tmpobj.spe = lflags; + } else if (tmpobj.id == EGG) { + tmpobj.spe = get_table_boolean_opt(L, "laid_by_you", 0) ? 1 : 0; } } - if (!OV_pop_typ(id, SPOVAR_OBJ)) - panic("no obj type"); - - tmpobj.id = SP_OBJ_TYP(OV_i(id)); - tmpobj.class = SP_OBJ_CLASS(OV_i(id)); - tmpobj.containment = OV_i(containment); - quancnt = (tmpobj.id > STRANGE_OBJECT) ? tmpobj.quan : 0; + if (g.container_idx) + tmpobj.containment |= SP_OBJ_CONTENT; + + if (maybe_contents) { + lua_getfield(L, 1, "contents"); + if (!lua_isnil(L, -1)) + tmpobj.containment |= SP_OBJ_CONTAINER; + } + do { - create_object(&tmpobj, coder->croom); + create_object(&tmpobj, g.coder->croom); quancnt--; } while ((quancnt > 0) && ((tmpobj.id > STRANGE_OBJECT) && !objects[tmpobj.id].oc_merge)); + if (lua_type(L, -1) == LUA_TFUNCTION) { + lua_remove(L, -2); + lua_call(L, 0, 0); + } else + lua_pop(L, 1); + + if ((tmpobj.containment & SP_OBJ_CONTAINER) != 0) + spo_pop_container(); + Free(tmpobj.name.str); - opvar_free(varparam); - opvar_free(id); - opvar_free(containment); + + return 0; } -void -spo_level_flags(coder) -struct sp_coder *coder; +/* level_flags("noteleport", "mazelevel", ... ); */ +int +lspo_level_flags(L) +lua_State *L; { - static const char nhFunc[] = "spo_level_flags"; - struct opvar *flagdata; - long lflags; + int argc = lua_gettop(L); + int i; - if (!OV_pop_i(flagdata)) - return; - lflags = OV_i(flagdata); + create_des_coder(); - if (lflags & NOTELEPORT) - g.level.flags.noteleport = 1; - if (lflags & HARDFLOOR) - g.level.flags.hardfloor = 1; - if (lflags & NOMMAP) - g.level.flags.nommap = 1; - if (lflags & SHORTSIGHTED) - g.level.flags.shortsighted = 1; - if (lflags & ARBOREAL) - g.level.flags.arboreal = 1; - if (lflags & MAZELEVEL) - g.level.flags.is_maze_lev = 1; - if (lflags & PREMAPPED) - coder->premapped = TRUE; - if (lflags & SHROUD) - g.level.flags.hero_memory = 0; - if (lflags & GRAVEYARD) - g.level.flags.graveyard = 1; - if (lflags & ICEDPOOLS) - g.icedpools = TRUE; - if (lflags & SOLIDIFY) - coder->solidify = TRUE; - if (lflags & CORRMAZE) - g.level.flags.corrmaze = TRUE; - if (lflags & CHECK_INACCESSIBLES) - coder->check_inaccessibles = TRUE; + if (argc < 1) + nhl_error(L, "expected string params"); - opvar_free(flagdata); + for (i = 1; i <= argc; i++) { + const char *s = luaL_checkstring(L, i); + + if (!strcmpi(s, "noteleport")) + g.level.flags.noteleport = 1; + else if (!strcmpi(s, "hardfloor")) + g.level.flags.hardfloor = 1; + else if (!strcmpi(s, "nommap")) + g.level.flags.nommap = 1; + else if (!strcmpi(s, "shortsighted")) + g.level.flags.shortsighted = 1; + else if (!strcmpi(s, "arboreal")) + g.level.flags.arboreal = 1; + else if (!strcmpi(s, "mazelevel")) + g.level.flags.is_maze_lev = 1; + else if (!strcmpi(s, "shroud")) + g.level.flags.hero_memory = 1; + else if (!strcmpi(s, "graveyard")) + g.level.flags.graveyard = 1; + else if (!strcmpi(s, "icedpools")) + g.icedpools = 1; + else if (!strcmpi(s, "corrmaze")) + g.level.flags.corrmaze = 1; + else if (!strcmpi(s, "premapped")) + g.coder->premapped = 1; + else if (!strcmpi(s, "solidify")) + g.coder->solidify = 1; + else if (!strcmpi(s, "inaccessibles")) + g.coder->check_inaccessibles = 1; + else { + char buf[BUFSZ]; + Sprintf(buf, "Unknown level flag %s", s); + nhl_error(L, buf); + } + } + + return 0; } -void -spo_initlevel(coder) -struct sp_coder *coder; +/* level_init({ style = "solidfill", fg = " " }); */ +/* level_init({ style = "mines", fg = ".", bg = "}", smoothed=1, joined=1, lit=0 }) */ +int +lspo_level_init(L) +lua_State *L; { - static const char nhFunc[] = "spo_initlevel"; lev_init init_lev; - struct opvar *init_style, *fg, *bg, *smoothed, *joined, *lit, *walled, - *filling; + const char *const initstyles[] = { "solidfill", "mazegrid", "rogue", "mines", NULL }; + const int initstyles2i[] = { LVLINIT_SOLIDFILL, LVLINIT_MAZEGRID, LVLINIT_ROGUE, LVLINIT_MINES }; - if (!OV_pop_i(fg) || !OV_pop_i(bg) || !OV_pop_i(smoothed) - || !OV_pop_i(joined) || !OV_pop_i(lit) || !OV_pop_i(walled) - || !OV_pop_i(filling) || !OV_pop_i(init_style)) - return; + create_des_coder(); + + lcheck_param_table(L); g.splev_init_present = TRUE; - init_lev.init_style = OV_i(init_style); - init_lev.fg = OV_i(fg); - init_lev.bg = OV_i(bg); - init_lev.smoothed = OV_i(smoothed); - init_lev.joined = OV_i(joined); - init_lev.lit = OV_i(lit); - init_lev.walled = OV_i(walled); - init_lev.filling = OV_i(filling); + init_lev.init_style = initstyles2i[get_table_option(L, "style", "solidfill", initstyles)]; + init_lev.fg = get_table_mapchr_opt(L, "fg", ROOM); + init_lev.bg = get_table_mapchr_opt(L, "bg", STONE); + init_lev.smoothed = get_table_boolean_opt(L, "smoothed", 0); + init_lev.joined = get_table_boolean_opt(L, "joined", 0); + init_lev.lit = get_table_int_or_random(L, "lit", -1); /* TODO: allow lit=BOOL */ + init_lev.walled = get_table_boolean_opt(L, "walled", 0); + init_lev.filling = get_table_mapchr_opt(L, "filling", init_lev.fg); - coder->lvl_is_joined = OV_i(joined); + g.coder->lvl_is_joined = init_lev.joined; splev_initlev(&init_lev); - opvar_free(init_style); - opvar_free(fg); - opvar_free(bg); - opvar_free(smoothed); - opvar_free(joined); - opvar_free(lit); - opvar_free(walled); - opvar_free(filling); + return 0; } -void -spo_engraving(coder) -struct sp_coder *coder; +/* engraving({ x = 1, y = 1, type="burn", text="Foo" }); */ +/* engraving({x,y}, "engrave", "Foo"); */ +int +lspo_engraving(L) +lua_State *L; { - static const char nhFunc[] = "spo_engraving"; - struct opvar *etyp, *txt, *ecoord; - xchar x, y; + int etyp = DUST; + char *txt = (char *) 0; + long ecoord; + const char *const engrtypes[] = { "dust", "engrave", "burn", "mark", "blood", NULL }; + const int engrtypes2i[] = { DUST, ENGRAVE, BURN, MARK, ENGR_BLOOD, 0 }; + xchar x = -1, y = -1; + int argc = lua_gettop(L); - if (!OV_pop_i(etyp) || !OV_pop_s(txt) || !OV_pop_c(ecoord)) - return; + create_des_coder(); - get_location_coord(&x, &y, DRY, coder->croom, OV_i(ecoord)); - make_engr_at(x, y, OV_s(txt), 0L, OV_i(etyp)); + if (argc == 1) { + lcheck_param_table(L); - opvar_free(etyp); - opvar_free(txt); - opvar_free(ecoord); + etyp = engrtypes2i[get_table_option(L, "type", "engrave", engrtypes)]; + x = get_table_int_opt(L, "x", -1); + y = get_table_int_opt(L, "y", -1); + txt = get_table_str(L, "text"); + } else if (argc == 3) { + int ex, ey; + get_coord(L, 1, &ex, &ey); + x = ex; + y = ey; + etyp = engrtypes2i[luaL_checkoption(L, 2, "engrave", engrtypes)]; + txt = dupstr(luaL_checkstring(L, 3)); + } else { + nhl_error(L, "Wrong parameters"); + } + + if (x == -1 && y == -1) + ecoord = SP_COORD_PACK_RANDOM(0); + else + ecoord = SP_COORD_PACK(x, y); + + get_location_coord(&x, &y, DRY, g.coder->croom, ecoord); + make_engr_at(x, y, txt, 0L, etyp); + Free(txt); + return 0; } -void -spo_mineralize(coder) -struct sp_coder *coder; +int +lspo_mineralize(L) +lua_State *L; { - static const char nhFunc[] = "spo_mineralize"; - struct opvar *kelp_pool, *kelp_moat, *gold_prob, *gem_prob; + int gem_prob, gold_prob, kelp_moat, kelp_pool; - if (!OV_pop_i(gem_prob) || !OV_pop_i(gold_prob) || !OV_pop_i(kelp_moat) - || !OV_pop_i(kelp_pool)) - return; + create_des_coder(); - mineralize(OV_i(kelp_pool), OV_i(kelp_moat), OV_i(gold_prob), - OV_i(gem_prob), TRUE); + lcheck_param_table(L); + gem_prob = get_table_int_opt(L, "gem_prob", 0); + gold_prob = get_table_int_opt(L, "gold_prob", 0); + kelp_moat = get_table_int_opt(L, "kelp_moat", 0); + kelp_pool = get_table_int_opt(L, "kelp_pool", 0); - opvar_free(gem_prob); - opvar_free(gold_prob); - opvar_free(kelp_moat); - opvar_free(kelp_pool); + mineralize(kelp_pool, kelp_moat, gold_prob, gem_prob, TRUE); + + return 0; } -void -spo_room(coder) -struct sp_coder *coder; -{ - static const char nhFunc[] = "spo_room"; +const struct { + const char *name; + int type; +} room_types[] = { + /* for historical reasons, room types are not contiguous numbers */ + /* (type 1 is skipped) */ + { "ordinary", OROOM }, + { "throne", COURT }, + { "swamp", SWAMP }, + { "vault", VAULT }, + { "beehive", BEEHIVE }, + { "morgue", MORGUE }, + { "barracks", BARRACKS }, + { "zoo", ZOO }, + { "delphi", DELPHI }, + { "temple", TEMPLE }, + { "anthole", ANTHOLE }, + { "cocknest", COCKNEST }, + { "leprehall", LEPREHALL }, + { "shop", SHOPBASE }, + { "armor shop", ARMORSHOP }, + { "scroll shop", SCROLLSHOP }, + { "potion shop", POTIONSHOP }, + { "weapon shop", WEAPONSHOP }, + { "food shop", FOODSHOP }, + { "ring shop", RINGSHOP }, + { "wand shop", WANDSHOP }, + { "tool shop", TOOLSHOP }, + { "book shop", BOOKSHOP }, + { "health food shop", FODDERSHOP }, + { "candle shop", CANDLESHOP }, + { 0, 0 } +}; - if (coder->n_subroom > MAX_NESTED_ROOMS) { +int +get_table_roomtype_opt(L, name, defval) +lua_State *L; +const char *name; +int defval; +{ + char *roomstr = get_table_str_opt(L, name, emptystr); + if (roomstr && *roomstr) { + int i; + for (i = 0; room_types[i].name; i++) + if (!strcmpi(roomstr, room_types[i].name)) { + Free(roomstr); + return room_types[i].type; + } + } + Free(roomstr); + return defval; +} + +/* room({ type="ordinary", lit=1, x=3,y=3, xalign="center",yalign="center", w=11,h=9 }); */ +int +lspo_room(L) +lua_State *L; +{ + create_des_coder(); + + lcheck_param_table(L); + + if (g.coder->n_subroom > MAX_NESTED_ROOMS) { panic("Too deeply nested rooms?!"); } else { - struct opvar *rflags, *h, *w, *yalign, *xalign, *y, *x, *rlit, - *chance, *rtype; + const char *const left_or_right[] = { "left", "half-left", "center", "half-right", "right", "none", "random", NULL }; + const int l_or_r2i[] = { LEFT, H_LEFT, CENTER, H_RIGHT, RIGHT, -1, -1, -1 }; + const char *const top_or_bot[] = { "top", "center", "bottom", "none", "random", NULL }; + const int t_or_b2i[] = { TOP, CENTER, BOTTOM, -1, -1, -1 }; room tmproom; struct mkroom *tmpcr; - if (!OV_pop_i(h) || !OV_pop_i(w) || !OV_pop_i(y) || !OV_pop_i(x) - || !OV_pop_i(yalign) || !OV_pop_i(xalign) || !OV_pop_i(rflags) - || !OV_pop_i(rlit) || !OV_pop_i(chance) || !OV_pop_i(rtype)) - return; + tmproom.x = get_table_int_opt(L, "x", -1); + tmproom.y = get_table_int_opt(L, "y", -1); + if ((tmproom.x == -1 || tmproom.y == -1) && tmproom.x != tmproom.y) + nhl_error(L, "Room must have both x and y"); - tmproom.x = OV_i(x); - tmproom.y = OV_i(y); - tmproom.w = OV_i(w); - tmproom.h = OV_i(h); - tmproom.xalign = OV_i(xalign); - tmproom.yalign = OV_i(yalign); - tmproom.rtype = OV_i(rtype); - tmproom.chance = OV_i(chance); - tmproom.rlit = OV_i(rlit); - tmproom.filled = (OV_i(rflags) & (1 << 0)); - /*tmproom.irregular = (OV_i(rflags) & (1 << 1));*/ - tmproom.joined = !(OV_i(rflags) & (1 << 2)); + tmproom.w = get_table_int_opt(L, "w", -1); + tmproom.h = get_table_int_opt(L, "h", -1); - opvar_free(x); - opvar_free(y); - opvar_free(w); - opvar_free(h); - opvar_free(xalign); - opvar_free(yalign); - opvar_free(rtype); - opvar_free(chance); - opvar_free(rlit); - opvar_free(rflags); + if ((tmproom.w == -1 || tmproom.h == -1) && tmproom.w != tmproom.h) + nhl_error(L, "Room must have both w and h"); - if (!coder->failed_room[coder->n_subroom - 1]) { - tmpcr = build_room(&tmproom, coder->croom); + tmproom.xalign = l_or_r2i[get_table_option(L, "xalign", "random", left_or_right)]; + tmproom.yalign = t_or_b2i[get_table_option(L, "yalign", "random", top_or_bot)]; + tmproom.rtype = get_table_roomtype_opt(L, "type", OROOM); + tmproom.chance = get_table_int_opt(L, "chance", 100); + tmproom.rlit = get_table_int_opt(L, "lit", -1); + tmproom.filled = get_table_int_opt(L, "filled", 1); + tmproom.joined = get_table_int_opt(L, "joined", 1); + + if (!g.coder->failed_room[g.coder->n_subroom - 1]) { + tmpcr = build_room(&tmproom, g.coder->croom); if (tmpcr) { - coder->tmproomlist[coder->n_subroom] = tmpcr; - coder->failed_room[coder->n_subroom] = FALSE; - coder->n_subroom++; - return; + g.coder->tmproomlist[g.coder->n_subroom] = tmpcr; + g.coder->failed_room[g.coder->n_subroom] = FALSE; + g.coder->n_subroom++; + update_croom(); + lua_getfield(L, 1, "contents"); + if (lua_type(L, -1) == LUA_TFUNCTION) { + lua_remove(L, -2); + lua_call(L, 0, 0); + } else + lua_pop(L, 1); + spo_endroom(g.coder); + return 0; } } /* failed to create parent room, so fail this too */ } - coder->tmproomlist[coder->n_subroom] = (struct mkroom *) 0; - coder->failed_room[coder->n_subroom] = TRUE; - coder->n_subroom++; + g.coder->tmproomlist[g.coder->n_subroom] = (struct mkroom *) 0; + g.coder->failed_room[g.coder->n_subroom] = TRUE; + g.coder->n_subroom++; + update_croom(); + spo_endroom(g.coder); + + return 0; } -void +static void spo_endroom(coder) -struct sp_coder *coder; +struct sp_coder *coder UNUSED; { - if (coder->n_subroom > 1) { - coder->n_subroom--; - coder->tmproomlist[coder->n_subroom] = NULL; - coder->failed_room[coder->n_subroom] = TRUE; + if (g.coder->n_subroom > 1) { + g.coder->n_subroom--; + g.coder->tmproomlist[g.coder->n_subroom] = NULL; + g.coder->failed_room[g.coder->n_subroom] = TRUE; } else { /* no subroom, get out of top-level room */ /* Need to ensure xstart/ystart/xsize/ysize have something sensible, in case there's some stuff to be created outside the outermost - room, - and there's no MAP. - */ + room, and there's no MAP. */ if (g.xsize <= 1 && g.ysize <= 1) { g.xstart = 1; g.ystart = 0; @@ -3446,46 +3083,129 @@ struct sp_coder *coder; g.ysize = ROWNO; } } + update_croom(); } -void -spo_stair(coder) -struct sp_coder *coder; +/* stair("up"); */ +/* stair({ dir = "down" }); */ +/* stair({ dir = "down", x = 4, y = 7 }); */ +/* stair({ dir = "down", coord = {x,y} }); */ +/* stair("down", 4, 7); */ +/* TODO: stair(selection, "down"); */ +/* TODO: stair("up", {x,y}); */ +int +lspo_stair(L) +lua_State *L; { - static const char nhFunc[] = "spo_stair"; - xchar x, y; - struct opvar *up, *scoord; + int argc = lua_gettop(L); + xchar x = -1, y = -1; struct trap *badtrap; - if (!OV_pop_i(up) || !OV_pop_c(scoord)) - return; + const char *const stairdirs[] = { "down", "up", NULL }; + const int stairdirs2i[] = { 0, 1 }; - get_location_coord(&x, &y, DRY, coder->croom, OV_i(scoord)); + long scoord; + int ax = -1, ay = -1; + int up; + int ltype = lua_type(L, 1); + + create_des_coder(); + + if (argc == 1 && ltype == LUA_TSTRING) { + up = stairdirs2i[luaL_checkoption(L, 1, "down", stairdirs)]; + } else if (argc == 3 && ltype == LUA_TSTRING) { + up = stairdirs2i[luaL_checkoption(L, 1, "down", stairdirs)]; + ax = luaL_checkinteger(L, 2); + ay = luaL_checkinteger(L, 3); + } else { + lcheck_param_table(L); + + ax = get_table_int_opt(L, "x", -1); + ay = get_table_int_opt(L, "y", -1); + + if (ax == -1 && ay == -1) { + lua_getfield(L, 1, "coord"); + get_coord(L, -1, &ax, &ay); + lua_pop(L, 1); + } + + up = stairdirs2i[get_table_option(L, "dir", "down", stairdirs)]; + } + + x = ax; + y = ay; + + if (x == -1 && y == -1) + scoord = SP_COORD_PACK_RANDOM(0); + else + scoord = SP_COORD_PACK(x, y); + + get_location_coord(&x, &y, DRY, g.coder->croom, scoord); if ((badtrap = t_at(x, y)) != 0) deltrap(badtrap); - mkstairs(x, y, (char) OV_i(up), coder->croom); + mkstairs(x, y, (char) up, g.coder->croom); g.SpLev_Map[x][y] = 1; - opvar_free(scoord); - opvar_free(up); + return 0; } -void -spo_ladder(coder) -struct sp_coder *coder; +/* ladder("down"); */ +/* ladder("up", 6,10); */ +/* ladder({ x=11, y=05, dir="down" }); */ +int +lspo_ladder(L) +lua_State *L; { - static const char nhFunc[] = "spo_ladder"; - xchar x, y; - struct opvar *up, *lcoord; + int argc = lua_gettop(L); + xchar x = -1, y = -1; + struct trap *badtrap; - if (!OV_pop_i(up) || !OV_pop_c(lcoord)) - return; + const char *const stairdirs[] = { "down", "up", NULL }; + const int stairdirs2i[] = { 0, 1 }; - get_location_coord(&x, &y, DRY, coder->croom, OV_i(lcoord)); + long scoord; + int ax = -1, ay = -1; + int up; + int ltype = lua_type(L, 1); + create_des_coder(); + + if (argc == 1 && ltype == LUA_TSTRING) { + up = stairdirs2i[luaL_checkoption(L, 1, "down", stairdirs)]; + } else if (argc == 3 && ltype == LUA_TSTRING) { + up = stairdirs2i[luaL_checkoption(L, 1, "down", stairdirs)]; + ax = luaL_checkinteger(L, 2); + ay = luaL_checkinteger(L, 3); + } else { + lcheck_param_table(L); + + ax = get_table_int_opt(L, "x", -1); + ay = get_table_int_opt(L, "y", -1); + + if (ax == -1 && ay == -1) { + lua_getfield(L, 1, "coord"); + get_coord(L, -1, &ax, &ay); + lua_pop(L, 1); + } + + up = stairdirs2i[get_table_option(L, "dir", "down", stairdirs)]; + } + + x = ax; + y = ay; + + if (x == -1 && y == -1) + scoord = SP_COORD_PACK_RANDOM(0); + else + scoord = SP_COORD_PACK(ax, ay); + + get_location_coord(&x, &y, DRY, g.coder->croom, scoord); + + if ((badtrap = t_at(x, y)) != 0) + deltrap(badtrap); levl[x][y].typ = LADDER; g.SpLev_Map[x][y] = 1; - if (OV_i(up)) { + if (up) { xupladder = x; yupladder = y; levl[x][y].ladder = LA_UP; @@ -3494,212 +3214,398 @@ struct sp_coder *coder; ydnladder = y; levl[x][y].ladder = LA_DOWN; } - opvar_free(lcoord); - opvar_free(up); + + return 0; } -void -spo_grave(coder) -struct sp_coder *coder; +int +lspo_grave(L) +lua_State *L; { - static const char nhFunc[] = "spo_grave"; - struct opvar *gcoord, *typ, *txt; schar x, y; + long scoord; + int ax,ay; + char *txt; - if (!OV_pop_i(typ) || !OV_pop_s(txt) || !OV_pop_c(gcoord)) - return; + create_des_coder(); - get_location_coord(&x, &y, DRY, coder->croom, OV_i(gcoord)); + lcheck_param_table(L); + + x = ax = get_table_int_opt(L, "x", -1); + y = ay = get_table_int_opt(L, "y", -1); + txt = get_table_str_opt(L, "text", NULL); + + if (x == -1 && y == -1) + scoord = SP_COORD_PACK_RANDOM(0); + else + scoord = SP_COORD_PACK(ax, ay); + + get_location_coord(&x, &y, DRY, g.coder->croom, scoord); if (isok(x, y) && !t_at(x, y)) { levl[x][y].typ = GRAVE; - switch (OV_i(typ)) { - case 2: - make_grave(x, y, OV_s(txt)); - break; - case 1: + if (txt) + make_grave(x, y, txt); + else make_grave(x, y, NULL); - break; - default: - del_engr_at(x, y); - break; + } + + Free(txt); + + return 0; +} + +/* altar({ x=NN, y=NN, align=ALIGNMENT, type=SHRINE }); */ +/* des.altar({ coord = {5, 10}, align="noalign", type="altar" }); */ +int +lspo_altar(L) +lua_State *L; +{ + const char *const shrines[] = { "altar", "shrine", "sanctum", NULL }; + const int shrines2i[] = { 0, 1, 2, 0 }; + + altar tmpaltar; + + int x, y; + long acoord; + int shrine; + int align; + + create_des_coder(); + + lcheck_param_table(L); + + x = get_table_int_opt(L, "x", -1); + y = get_table_int_opt(L, "y", -1); + + if (x == -1 && y == -1) { + lua_getfield(L, 1, "coord"); + get_coord(L, -1, &x, &y); + lua_pop(L, 1); + } + + align = get_table_align(L); + shrine = shrines2i[get_table_option(L, "type", "altar", shrines)]; + + if (x == -1 && y == -1) + acoord = SP_COORD_PACK_RANDOM(0); + else + acoord = SP_COORD_PACK(x, y); + + tmpaltar.coord = acoord; + tmpaltar.align = align; + tmpaltar.shrine = shrine; + + create_altar(&tmpaltar, g.coder->croom); + + return 0; +} + +const struct { + const char *name; + int type; +} trap_types[] = { { "arrow", ARROW_TRAP }, + { "dart", DART_TRAP }, + { "falling rock", ROCKTRAP }, + { "board", SQKY_BOARD }, + { "bear", BEAR_TRAP }, + { "land mine", LANDMINE }, + { "rolling boulder", ROLLING_BOULDER_TRAP }, + { "sleep gas", SLP_GAS_TRAP }, + { "rust", RUST_TRAP }, + { "fire", FIRE_TRAP }, + { "pit", PIT }, + { "spiked pit", SPIKED_PIT }, + { "hole", HOLE }, + { "trap door", TRAPDOOR }, + { "teleport", TELEP_TRAP }, + { "level teleport", LEVEL_TELEP }, + { "magic portal", MAGIC_PORTAL }, + { "web", WEB }, + { "statue", STATUE_TRAP }, + { "magic", MAGIC_TRAP }, + { "anti magic", ANTI_MAGIC }, + { "polymorph", POLY_TRAP }, + { "vibrating square", VIBRATING_SQUARE }, + { "random", -1 }, + { 0, NO_TRAP } }; + +int +get_table_traptype_opt(L, name, defval) +lua_State *L; +const char *name; +int defval; +{ + char *trapstr = get_table_str_opt(L, name, emptystr); + + if (trapstr && *trapstr) { + int i; + + for (i = 0; trap_types[i].name; i++) + if (!strcmpi(trapstr, trap_types[i].name)) { + Free(trapstr); + return trap_types[i].type; + } + } + Free(trapstr); + return defval; +} + +const char * +get_trapname_bytype(ttyp) +int ttyp; +{ + int i; + + for (i = 0; trap_types[i].name; i++) + if (ttyp == trap_types[i].type) + return trap_types[i].name; + + return NULL; +} + +int +get_traptype_byname(trapname) +const char *trapname; +{ + int i; + + for (i = 0; trap_types[i].name; i++) + if (!strcmpi(trapname, trap_types[i].name)) + return trap_types[i].type; + + return NO_TRAP; +} + +/* trap({ type = "hole", x = 1, y = 1 }); */ +/* trap("hole", 3, 4); */ +/* trap("level teleport", {5, 8}); */ +/* trap("rust") */ +/* trap(); */ +int +lspo_trap(L) +lua_State *L; +{ + spltrap tmptrap; + int x, y; + int argc = lua_gettop(L); + + create_des_coder(); + + if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) { + const char *trapstr = luaL_checkstring(L, 1); + + tmptrap.type = get_traptype_byname(trapstr); + x = y = -1; + } else if (argc == 2 && lua_type(L, 1) == LUA_TSTRING + && lua_type(L, 2) == LUA_TTABLE) { + const char *trapstr = luaL_checkstring(L, 1); + + tmptrap.type = get_traptype_byname(trapstr); + get_coord(L, 2, &x, &y); + } else if (argc == 3) { + const char *trapstr = luaL_checkstring(L, 1); + + tmptrap.type = get_traptype_byname(trapstr); + x = luaL_checkinteger(L, 2); + y = luaL_checkinteger(L, 3); + } else { + lcheck_param_table(L); + + x = get_table_int_opt(L, "x", -1); + y = get_table_int_opt(L, "y", -1); + tmptrap.type = get_table_traptype_opt(L, "type", -1); + + if (x == -1 && y == -1) { + lua_getfield(L, 1, "coord"); + get_coord(L, -1, &x, &y); + lua_pop(L, 1); } } - opvar_free(gcoord); - opvar_free(typ); - opvar_free(txt); + if (tmptrap.type == NO_TRAP) + nhl_error(L, "Unknown trap type"); + + if (x == -1 && y == -1) + tmptrap.coord = SP_COORD_PACK_RANDOM(0); + else + tmptrap.coord = SP_COORD_PACK(x, y); + + create_trap(&tmptrap, g.coder->croom); + + return 0; } -void -spo_altar(coder) -struct sp_coder *coder; +/* gold({ amount = 500, x = 2, y = 5 });*/ +int +lspo_gold(L) +lua_State *L; { - static const char nhFunc[] = "spo_altar"; - struct opvar *al, *shrine, *acoord; - altar tmpaltar; - - if (!OV_pop_i(al) || !OV_pop_i(shrine) || !OV_pop_c(acoord)) - return; - - tmpaltar.coord = OV_i(acoord); - tmpaltar.align = OV_i(al); - tmpaltar.shrine = OV_i(shrine); - - create_altar(&tmpaltar, coder->croom); - - opvar_free(acoord); - opvar_free(shrine); - opvar_free(al); -} - -void -spo_trap(coder) -struct sp_coder *coder; -{ - static const char nhFunc[] = "spo_trap"; - struct opvar *type; - struct opvar *tcoord; - spltrap tmptrap; - - if (!OV_pop_i(type) || !OV_pop_c(tcoord)) - return; - - tmptrap.coord = OV_i(tcoord); - tmptrap.type = OV_i(type); - - create_trap(&tmptrap, coder->croom); - opvar_free(tcoord); - opvar_free(type); -} - -void -spo_gold(coder) -struct sp_coder *coder; -{ - static const char nhFunc[] = "spo_gold"; - struct opvar *gcoord, *amt; schar x, y; long amount; + long gcoord; + int gx, gy; - if (!OV_pop_c(gcoord) || !OV_pop_i(amt)) - return; - amount = OV_i(amt); - get_location_coord(&x, &y, DRY, coder->croom, OV_i(gcoord)); - if (amount == -1) + create_des_coder(); + + lcheck_param_table(L); + + x = gx = get_table_int_opt(L, "x", -1); + y = gy = get_table_int_opt(L, "y", -1); + + if (x == -1 && y == -1) + gcoord = SP_COORD_PACK_RANDOM(0); + else + gcoord = SP_COORD_PACK(gx, gy); + amount = get_table_int_opt(L, "amount", -1); + get_location_coord(&x, &y, DRY, g.coder->croom, gcoord); + if (amount < 0) amount = rnd(200); mkgold(amount, x, y); - opvar_free(gcoord); - opvar_free(amt); + + return 0; } -void -spo_corridor(coder) -struct sp_coder *coder; +/* corridor({ srcroom=1, srcdoor=2, srcwall="north", destroom=2, destdoor=1, destwall="west" });*/ +int +lspo_corridor(L) +lua_State *L; { - static const char nhFunc[] = "spo_corridor"; - struct opvar *deswall, *desdoor, *desroom, *srcwall, *srcdoor, *srcroom; + const char *const walldirs[] = { "all", "random", "north", "west", "east", "south", NULL }; + const int walldirs2i[] = { W_ANY, -1, W_NORTH, W_WEST, W_EAST, W_SOUTH, 0 }; corridor tc; - if (!OV_pop_i(deswall) || !OV_pop_i(desdoor) || !OV_pop_i(desroom) - || !OV_pop_i(srcwall) || !OV_pop_i(srcdoor) || !OV_pop_i(srcroom)) - return; + create_des_coder(); - tc.src.room = OV_i(srcroom); - tc.src.door = OV_i(srcdoor); - tc.src.wall = OV_i(srcwall); - tc.dest.room = OV_i(desroom); - tc.dest.door = OV_i(desdoor); - tc.dest.wall = OV_i(deswall); + lcheck_param_table(L); + + tc.src.room = get_table_int(L, "srcroom"); + tc.src.door = get_table_int(L, "srcdoor"); + tc.src.wall = walldirs2i[get_table_option(L, "srcwall", "all", walldirs)]; + tc.dest.room = get_table_int(L, "destroom"); + tc.dest.door = get_table_int(L, "destdoor"); + tc.dest.wall = walldirs2i[get_table_option(L, "destwall", "all", walldirs)]; create_corridor(&tc); - opvar_free(deswall); - opvar_free(desdoor); - opvar_free(desroom); - opvar_free(srcwall); - opvar_free(srcdoor); - opvar_free(srcroom); + return 0; } -struct opvar * -selection_opvar(nbuf) -char *nbuf; +/* random_corridors(); */ +int +lspo_random_corridors(L) +lua_State *L UNUSED; { - struct opvar *ov; - char buf[(COLNO * ROWNO) + 1]; + corridor tc; - if (!nbuf) { - (void) memset(buf, 1, sizeof(buf)); - buf[(COLNO * ROWNO)] = '\0'; - ov = opvar_new_str(buf); - } else { - ov = opvar_new_str(nbuf); - } - ov->spovartyp = SPOVAR_SEL; - return ov; + create_des_coder(); + + tc.src.room = -1; + tc.src.door = -1; + tc.src.wall = -1; + tc.dest.room = -1; + tc.dest.door = -1; + tc.dest.wall = -1; + + create_corridor(&tc); + + return 0; } -xchar -selection_getpoint(x, y, ov) -int x, y; -struct opvar *ov; +/* selection */ +struct selectionvar * +selection_new() { - if (!ov || ov->spovartyp != SPOVAR_SEL) - return 0; - if (x < 0 || y < 0 || x >= COLNO || y >= ROWNO) - return 0; + struct selectionvar *tmps = (struct selectionvar *) alloc(sizeof (struct selectionvar)); - return (ov->vardata.str[COLNO * y + x] - 1); + tmps->wid = COLNO; + tmps->hei = ROWNO; + tmps->map = (char *)alloc((COLNO * ROWNO) + 1); + (void) memset(tmps->map, 1, (COLNO * ROWNO)); + tmps->map[(COLNO * ROWNO)] = '\0'; + + return tmps; } void -selection_setpoint(x, y, ov, c) +selection_free(sel) +struct selectionvar *sel; +{ + if (!sel) + return; + Free(sel->map); + sel->map = NULL; + sel->wid = sel->hei = 0; +} + +struct selectionvar * +selection_clone(sel) +struct selectionvar *sel; +{ + struct selectionvar *tmps = (struct selectionvar *) alloc(sizeof (struct selectionvar)); + + tmps->wid = sel->wid; + tmps->hei = sel->hei; + tmps->map = dupstr(sel->map); + + return tmps; +} + +xchar +selection_getpoint(x, y, sel) int x, y; -struct opvar *ov; +struct selectionvar *sel; +{ + if (!sel || !sel->map) + return 0; + if (x < 0 || y < 0 || x >= sel->wid || y >= sel->hei) + return 0; + + return (sel->map[sel->wid * y + x] - 1); +} + +void +selection_setpoint(x, y, sel, c) +int x, y; +struct selectionvar *sel; xchar c; { - if (!ov || ov->spovartyp != SPOVAR_SEL) + if (!sel || !sel->map) return; - if (x < 0 || y < 0 || x >= COLNO || y >= ROWNO) + if (x < 0 || y < 0 || x >= sel->wid || y >= sel->hei) return; - ov->vardata.str[COLNO * y + x] = (char) (c + 1); + sel->map[sel->wid * y + x] = (char) (c + 1); } -struct opvar * +struct selectionvar * selection_not(s) -struct opvar *s; +struct selectionvar *s; { - struct opvar *ov; int x, y; - ov = selection_opvar((char *) 0); - if (!ov) - return NULL; - for (x = 0; x < COLNO; x++) - for (y = 0; y < ROWNO; y++) - if (!selection_getpoint(x, y, s)) - selection_setpoint(x, y, ov, 1); + for (x = 0; x < s->wid; x++) + for (y = 0; y < s->hei; y++) + selection_setpoint(x, y, s, selection_getpoint(x, y, s) ? 0 : 1); - return ov; + return s; } -struct opvar * +struct selectionvar * selection_logical_oper(s1, s2, oper) -struct opvar *s1, *s2; +struct selectionvar *s1, *s2; char oper; { - struct opvar *ov; + struct selectionvar *ov; int x, y; - ov = selection_opvar((char *) 0); + ov = selection_new(); if (!ov) return NULL; - for (x = 0; x < COLNO; x++) - for (y = 0; y < ROWNO; y++) { + for (x = 0; x < ov->wid; x++) + for (y = 0; y < ov->hei; y++) { switch (oper) { default: case '|': @@ -3718,23 +3624,21 @@ char oper; return ov; } -struct opvar * -selection_filter_mapchar(ov, mc) -struct opvar *ov; -struct opvar *mc; +struct selectionvar * +selection_filter_mapchar(ov, typ, lit) +struct selectionvar *ov; +xchar typ; +int lit; { int x, y; - schar mapc; - xchar lit; - struct opvar *ret = selection_opvar((char *) 0); + struct selectionvar *ret = selection_new(); - if (!ov || !mc || !ret) + if (!ov || !ret) return NULL; - mapc = SP_MAPCHAR_TYP(OV_i(mc)); - lit = SP_MAPCHAR_LIT(OV_i(mc)); - for (x = 0; x < COLNO; x++) - for (y = 0; y < ROWNO; y++) - if (selection_getpoint(x, y, ov) && (levl[x][y].typ == mapc)) { + + for (x = 0; x < ret->wid; x++) + for (y = 0; y < ret->hei; y++) + if (selection_getpoint(x, y, ov) && (levl[x][y].typ == typ)) { switch (lit) { default: case -2: @@ -3755,22 +3659,22 @@ struct opvar *mc; void selection_filter_percent(ov, percent) -struct opvar *ov; +struct selectionvar *ov; int percent; { int x, y; if (!ov) return; - for (x = 0; x < COLNO; x++) - for (y = 0; y < ROWNO; y++) + for (x = 0; x < ov->wid; x++) + for (y = 0; y < ov->hei; y++) if (selection_getpoint(x, y, ov) && (rn2(100) >= percent)) selection_setpoint(x, y, ov, 0); } -static int +int selection_rndcoord(ov, x, y, removeit) -struct opvar *ov; +struct selectionvar *ov; schar *x, *y; boolean removeit; { @@ -3778,20 +3682,21 @@ boolean removeit; int c; int dx, dy; - for (dx = 0; dx < COLNO; dx++) - for (dy = 0; dy < ROWNO; dy++) - if (isok(dx, dy) && selection_getpoint(dx, dy, ov)) + for (dx = 0; dx < ov->wid; dx++) + for (dy = 0; dy < ov->hei; dy++) + if (selection_getpoint(dx, dy, ov)) idx++; if (idx) { c = rn2(idx); - for (dx = 0; dx < COLNO; dx++) - for (dy = 0; dy < ROWNO; dy++) - if (isok(dx, dy) && selection_getpoint(dx, dy, ov)) { + for (dx = 0; dx < ov->wid; dx++) + for (dy = 0; dy < ov->hei; dy++) + if (selection_getpoint(dx, dy, ov)) { if (!c) { *x = dx; *y = dy; - if (removeit) selection_setpoint(dx, dy, ov, 0); + if (removeit) + selection_setpoint(dx, dy, ov, 0); return 1; } c--; @@ -3803,21 +3708,17 @@ boolean removeit; void selection_do_grow(ov, dir) -struct opvar *ov; +struct selectionvar *ov; int dir; { int x, y; - char tmp[COLNO][ROWNO]; + struct selectionvar *tmp = selection_new(); - if (ov->spovartyp != SPOVAR_SEL) - return; - if (!ov) + if (!ov || !tmp) return; - (void) memset(tmp, 0, sizeof tmp); - - for (x = 1; x < COLNO; x++) - for (y = 0; y < ROWNO; y++) { + for (x = 1; x < ov->wid; x++) + for (y = 0; y < ov->hei; y++) { /* note: dir is a mask of multiple directions, but the only way to specify diagonals is by including the two adjacent orthogonal directions, which effectively specifies three- @@ -3834,14 +3735,17 @@ int dir; || ((dir & W_SOUTH) && selection_getpoint(x, y - 1, ov)) || (((dir & (W_SOUTH | W_WEST)) == (W_SOUTH | W_WEST)) && selection_getpoint(x + 1, y - 1, ov))) { - tmp[x][y] = 1; + selection_setpoint(x, y, tmp, 1); } } - for (x = 1; x < COLNO; x++) - for (y = 0; y < ROWNO; y++) - if (tmp[x][y]) + for (x = 1; x < ov->wid; x++) + for (y = 0; y < ov->hei; y++) + if (selection_getpoint(x, y, tmp)) selection_setpoint(x, y, ov, 1); + + selection_free(tmp); + free(tmp); } static int FDECL((*selection_flood_check_func), (int, int)); @@ -3861,6 +3765,14 @@ int x,y; return (floodfillchk_match_under_typ == levl[x][y].typ); } +void +set_floodfillchk_match_under(typ) +xchar typ; +{ + floodfillchk_match_under_typ = typ; + set_selection_floodfillchk(floodfillchk_match_under); +} + static int floodfillchk_match_accessible(x, y) int x, y; @@ -3889,12 +3801,11 @@ int n; void selection_floodfill(ov, x, y, diagonals) -struct opvar *ov; +struct selectionvar *ov; int x, y; boolean diagonals; { - static const char nhFunc[] = "selection_floodfill"; - struct opvar *tmp = selection_opvar((char *) 0); + struct selectionvar *tmp = selection_new(); #define SEL_FLOOD_STACK (COLNO * ROWNO) #define SEL_FLOOD(nx, ny) \ do { \ @@ -3919,7 +3830,7 @@ boolean diagonals; xchar dy[SEL_FLOOD_STACK]; if (selection_flood_check_func == (int FDECL((*), (int, int))) 0) { - opvar_free(tmp); + selection_free(tmp); return; } SEL_FLOOD(x, y); @@ -3945,13 +3856,14 @@ boolean diagonals; #undef SEL_FLOOD #undef SEL_FLOOD_STACK #undef SEL_FLOOD_CHKDIR - opvar_free(tmp); + selection_free(tmp); + free(tmp); } /* McIlroy's Ellipse Algorithm */ void selection_do_ellipse(ov, xc, yc, a, b, filled) -struct opvar *ov; +struct selectionvar *ov; int xc, yc, a, b, filled; { /* e(x,y) = b^2*x^2 + a^2*y^2 - a^2*b^2 */ int x = 0, y = b; @@ -4063,7 +3975,7 @@ long x1, y1, x2, y2, x3, y3; void selection_do_gradient(ov, x, y, x2, y2, gtyp, mind, maxd, limit) -struct opvar *ov; +struct selectionvar *ov; long x, y, x2, y2, gtyp, mind, maxd, limit; { long dx, dy, dofs; @@ -4115,7 +4027,7 @@ long x, y, x2, y2, gtyp, mind, maxd, limit; void selection_do_line(x1, y1, x2, y2, ov) schar x1, y1, x2, y2; -struct opvar *ov; +struct selectionvar *ov; { int d0, dx, dy, ai, bi, xi, yi; @@ -4169,7 +4081,7 @@ struct opvar *ov; void selection_do_randline(x1, y1, x2, y2, rough, rec, ov) schar x1, y1, x2, y2, rough, rec; -struct opvar *ov; +struct selectionvar *ov; { int mx, my; int dx, dy; @@ -4210,20 +4122,49 @@ struct opvar *ov; void selection_iterate(ov, func, arg) -struct opvar *ov; +struct selectionvar *ov; select_iter_func func; genericptr_t arg; { int x, y; + if (!ov) + return; + /* yes, this is very naive, but it's not _that_ expensive. */ - for (x = 0; x < COLNO; x++) - for (y = 0; y < ROWNO; y++) + for (x = 0; x < ov->wid; x++) + for (y = 0; y < ov->hei; y++) if (selection_getpoint(x, y, ov)) (*func)(x, y, arg); } + void +stackDump(L) +lua_State *L; +{ + int i; + int top = lua_gettop(L); + for (i = 1; i <= top; i++) { /* repeat for each level */ + int t = lua_type(L, i); + switch (t) { + case LUA_TSTRING: /* strings */ + pline("%i:\"%s\"", i, lua_tostring(L, i)); + break; + case LUA_TBOOLEAN: /* booleans */ + pline("%i:%s", i, lua_toboolean(L, i) ? "true" : "false"); + break; + case LUA_TNUMBER: /* numbers */ + pline("%i:%g", i, lua_tonumber(L, i)); + break; + default: /* other values */ + pline("%i:%s", i, lua_typename(L, t)); + break; + } + } +} + +static void sel_set_ter(x, y, arg) int x, y; genericptr_t arg; @@ -4241,7 +4182,7 @@ genericptr_t arg; } } -void +static void sel_set_feature(x, y, arg) int x, y; genericptr_t arg; @@ -4251,7 +4192,7 @@ genericptr_t arg; levl[x][y].typ = (*(int *) arg); } -void +static void sel_set_door(dx, dy, arg) int dx, dy; genericptr_t arg; @@ -4271,121 +4212,237 @@ genericptr_t arg; g.SpLev_Map[x][y] = 1; } -void -spo_door(coder) -struct sp_coder *coder; +/* door({ x = 1, y = 1, state = "nodoor" }); */ +/* door({ wall = "north", pos = 3, state="secret" }); */ +/* door("nodoor", 1, 2); */ +int +lspo_door(L) +lua_State *L; { - static const char nhFunc[] = "spo_door"; - struct opvar *msk, *sel; + int msk; + schar x,y; xchar typ; + const char *const doorstates[] = { "random", "open", "closed", "locked", "nodoor", "broken", "secret", NULL }; + const int doorstates2i[] = { -1, D_ISOPEN, D_CLOSED, D_LOCKED, D_NODOOR, D_BROKEN, D_SECRET }; + int argc = lua_gettop(L); - if (!OV_pop_i(msk) || !OV_pop_typ(sel, SPOVAR_SEL)) - return; + create_des_coder(); - typ = OV_i(msk) == -1 ? rnddoor() : (xchar) OV_i(msk); + if (argc == 3) { + msk = doorstates2i[luaL_checkoption(L, 1, "random", doorstates)]; + x = luaL_checkinteger(L, 2); + y = luaL_checkinteger(L, 3); - selection_iterate(sel, sel_set_door, (genericptr_t) &typ); + } else { + lcheck_param_table(L); - opvar_free(sel); - opvar_free(msk); + x = get_table_int_opt(L, "x", -1); + y = get_table_int_opt(L, "y", -1); + msk = doorstates2i[get_table_option(L, "state", "random", doorstates)]; + } + + typ = (msk == -1) ? rnddoor() : (xchar) msk; + + if (x == -1 && y == -1) { + const char *const walldirs[] = { "all", "random", "north", "west", "east", "south", NULL }; + const int walldirs2i[] = { W_ANY, W_ANY, W_NORTH, W_WEST, W_EAST, W_SOUTH, 0 }; + room_door tmpd; + + tmpd.secret = (typ == D_SECRET) ? 1 : 0; + tmpd.mask = msk; + tmpd.pos = get_table_int_opt(L, "pos", -1); + tmpd.wall = walldirs2i[get_table_option(L, "wall", "all", walldirs)]; + + create_door(&tmpd, g.coder->croom); + link_doors_rooms(); + } else { + /*selection_iterate(sel, sel_set_door, (genericptr_t) &typ);*/ + get_location_coord(&x, &y, ANY_LOC, g.coder->croom, SP_COORD_PACK(x,y)); + if (!isok(x,y)) + nhl_error(L, "door coord not ok"); + sel_set_door(x, y, (genericptr_t) &typ); + } + + return 0; } -void -spo_feature(coder) -struct sp_coder *coder; +/* feature("fountain", x, y); */ +/* feature("fountain", {x,y}); */ +/* feature({ type="fountain", x=NN, y=NN }); */ +int +lspo_feature(L) +lua_State *L; { - static const char nhFunc[] = "spo_feature"; - struct opvar *sel; + const char *const features[] = { "fountain", "sink", "pool", NULL }; + const int features2i[] = { FOUNTAIN, SINK, POOL, STONE }; + schar x,y; int typ; + int argc = lua_gettop(L); - if (!OV_pop_typ(sel, SPOVAR_SEL)) - return; + create_des_coder(); - switch (coder->opcode) { + if (argc == 2 && lua_type(L, 1) == LUA_TSTRING + && lua_type(L, 2) == LUA_TTABLE) { + int fx, fy; + typ = features2i[luaL_checkoption(L, 1, NULL, features)]; + get_coord(L, 2, &fx, &fy); + x = fx; + y = fy; + } else if (argc == 3) { + typ = features2i[luaL_checkoption(L, 1, NULL, features)]; + x = luaL_checkinteger(L, 2); + y = luaL_checkinteger(L, 3); + } else { + lcheck_param_table(L); + + x = get_table_int(L, "x"); + y = get_table_int(L, "y"); + typ = features2i[get_table_option(L, "type", NULL, features)]; + } + + get_location_coord(&x, &y, ANY_LOC, g.coder->croom, SP_COORD_PACK(x,y)); + + switch (typ) { default: - impossible("spo_feature called with wrong opcode %i.", coder->opcode); break; - case SPO_FOUNTAIN: + case FOUNTAIN: typ = FOUNTAIN; break; - case SPO_SINK: + case SINK: typ = SINK; break; - case SPO_POOL: + case POOL: typ = POOL; break; } - selection_iterate(sel, sel_set_feature, (genericptr_t) &typ); - opvar_free(sel); + if (typ == STONE) + impossible("feature has unknown type param."); + else + sel_set_feature(x, y, (genericptr_t) &typ); + + return 0; } -void -spo_terrain(coder) -struct sp_coder *coder; +/* terrain({ x=NN, y=NN, typ=MAPCHAR, lit=BOOL }); */ +/* terrain({ selection=SELECTION, typ=MAPCHAR, lit=BOOL }); */ +/* terrain( SELECTION, MAPCHAR [, BOOL ] ); */ +/* terrain({x,y}, MAPCHAR); */ +/* terrain(x,y, MAPCHAR); */ +int +lspo_terrain(L) +lua_State *L; { - static const char nhFunc[] = "spo_terrain"; terrain tmpterrain; - struct opvar *ter, *sel; + xchar x, y; + struct selectionvar *sel = NULL; + int argc = lua_gettop(L); - if (!OV_pop_typ(ter, SPOVAR_MAPCHAR) || !OV_pop_typ(sel, SPOVAR_SEL)) - return; + create_des_coder(); + tmpterrain.tlit = 0; + tmpterrain.ter = INVALID_TYPE; - tmpterrain.ter = SP_MAPCHAR_TYP(OV_i(ter)); - tmpterrain.tlit = SP_MAPCHAR_LIT(OV_i(ter)); - selection_iterate(sel, sel_set_ter, (genericptr_t) &tmpterrain); + if (argc == 1) { + lcheck_param_table(L); - opvar_free(ter); - opvar_free(sel); + x = get_table_int_opt(L, "x", -1); + y = get_table_int_opt(L, "y", -1); + if (x == -1 && y == -1) { + lua_getfield(L, 1, "selection"); + sel = l_selection_check(L, -1); + lua_pop(L, 1); + } + tmpterrain.ter = get_table_mapchr(L, "typ"); + tmpterrain.tlit = get_table_int_opt(L, "lit", 0); + } else if (argc == 2 && lua_type(L, 1) == LUA_TTABLE + && lua_type(L, 2) == LUA_TSTRING) { + int tx, ty; + tmpterrain.ter = check_mapchr(luaL_checkstring(L, 2)); + lua_pop(L, 1); + get_coord(L, 1, &tx, &ty); + x = tx; + y = ty; + } else if (argc == 2) { + sel = l_selection_check(L, 1); + tmpterrain.ter = check_mapchr(luaL_checkstring(L, 2)); + } else if (argc == 3) { + x = luaL_checkinteger(L, 1); + y = luaL_checkinteger(L, 2); + tmpterrain.ter = check_mapchr(luaL_checkstring(L, 3)); + } else { + nhl_error(L, "wrong parameters"); + } + + if (tmpterrain.ter == INVALID_TYPE) + nhl_error(L, "Erroneous map char"); + + if (sel) { + selection_iterate(sel, sel_set_ter, (genericptr_t) &tmpterrain); + } else { + get_location_coord(&x, &y, ANY_LOC, g.coder->croom, SP_COORD_PACK(x,y)); + sel_set_ter(x,y, (genericptr_t) &tmpterrain); + } + + return 0; } -void -spo_replace_terrain(coder) -struct sp_coder *coder; +/* TODO: better parameters, allow selection instead of x1,y1,x2,y2 nonsense. + TODO: or remove, if terrain + selection can do this better? +*/ +/* replace_terrain({ x1=NN,y1=NN, x2=NN,y2=NN, fromterrain=MAPCHAR, toterrain=MAPCHAR, lit=N, chance=NN }); */ +/* replace_terrain({ region={x1,y1, x2,y2}, fromterrain=MAPCHAR, toterrain=MAPCHAR, lit=N, chance=NN }); */ +int +lspo_replace_terrain(L) +lua_State *L; { - static const char nhFunc[] = "spo_replace_terrain"; replaceterrain rt; - struct opvar *reg, *from_ter, *to_ter, *chance; + xchar totyp, fromtyp; - if (!OV_pop_i(chance) || !OV_pop_typ(to_ter, SPOVAR_MAPCHAR) - || !OV_pop_typ(from_ter, SPOVAR_MAPCHAR) || !OV_pop_r(reg)) - return; + create_des_coder(); - rt.chance = OV_i(chance); - rt.tolit = SP_MAPCHAR_LIT(OV_i(to_ter)); - rt.toter = SP_MAPCHAR_TYP(OV_i(to_ter)); - rt.fromter = SP_MAPCHAR_TYP(OV_i(from_ter)); - /* TODO: use SP_MAPCHAR_LIT(OV_i(from_ter)) too */ - rt.x1 = SP_REGION_X1(OV_i(reg)); - rt.y1 = SP_REGION_Y1(OV_i(reg)); - rt.x2 = SP_REGION_X2(OV_i(reg)); - rt.y2 = SP_REGION_Y2(OV_i(reg)); + lcheck_param_table(L); - replace_terrain(&rt, coder->croom); + totyp = get_table_mapchr(L, "toterrain"); - opvar_free(reg); - opvar_free(from_ter); - opvar_free(to_ter); - opvar_free(chance); + fromtyp = get_table_mapchr(L, "fromterrain"); + + rt.chance = get_table_int_opt(L, "chance", 100); + rt.tolit = get_table_int_opt(L, "lit", 1); + rt.toter = totyp; + rt.fromter = fromtyp; + rt.x1 = get_table_int_opt(L, "x1", -1); + rt.y1 = get_table_int_opt(L, "y1", -1); + rt.x2 = get_table_int_opt(L, "x2", -1); + rt.y2 = get_table_int_opt(L, "y2", -1); + + if (rt.x1 == -1 && rt.y1 == -1 && rt.x2 == -1 && rt.y2 == -1) { + int rx1, ry1, rx2, ry2; + get_table_region(L, "region", &rx1, &ry1, &rx2, &ry2, FALSE); + rt.x1 = rx1; rt.y1 = ry1; + rt.x2 = rx2; rt.y2 = ry2; + } + + replace_terrain(&rt, g.coder->croom); + + return 0; } static boolean generate_way_out_method(nx,ny, ov) int nx,ny; -struct opvar *ov; +struct selectionvar *ov; { - static const char nhFunc[] = "generate_way_out_method"; const int escapeitems[] = { PICK_AXE, DWARVISH_MATTOCK, WAN_DIGGING, WAN_TELEPORTATION, SCR_TELEPORTATION, RIN_TELEPORTATION }; - struct opvar *ov2 = selection_opvar((char *) 0), *ov3; + struct selectionvar *ov2 = selection_new(), *ov3; schar x, y; boolean res = TRUE; selection_floodfill(ov2, nx, ny, TRUE); - ov3 = opvar_clone(ov2); + ov3 = selection_clone(ov2); /* try to make a secret door */ while (selection_rndcoord(ov3, &x, &y, TRUE)) { @@ -4421,8 +4478,8 @@ struct opvar *ov; /* try to make a hole or a trapdoor */ if (Can_fall_thru(&u.uz)) { - opvar_free(ov3); - ov3 = opvar_clone(ov2); + selection_free(ov3); + ov3 = selection_clone(ov2); while (selection_rndcoord(ov3, &x, &y, TRUE)) { if (maketrap(x,y, rn2(2) ? HOLE : TRAPDOOR)) goto gotitdone; @@ -4437,16 +4494,17 @@ struct opvar *ov; res = FALSE; gotitdone: - opvar_free(ov2); - opvar_free(ov3); + selection_free(ov2); + free(ov2); + selection_free(ov3); + free(ov3); return res; } static void ensure_way_out() { - static const char nhFunc[] = "ensure_way_out"; - struct opvar *ov = selection_opvar((char *) 0); + struct selectionvar *ov = selection_new(); struct trap *ttmp = g.ftrap; int x,y; boolean ret = TRUE; @@ -4483,55 +4541,108 @@ ensure_way_out() } outhere: ; } while (!ret); - opvar_free(ov); + selection_free(ov); + free(ov); +} + +int +get_table_intarray_entry(L, tableidx, entrynum) +lua_State *L; +int tableidx, entrynum; +{ + int ret = 0; + if (tableidx < 0) + tableidx--; + + lua_pushinteger(L, entrynum); + lua_gettable(L, tableidx); + if (lua_isnumber(L, -1)) { + ret = lua_tointeger(L, -1); + } else { + char buf[BUFSZ]; + Sprintf(buf, "Array entry #%i is %s, expected number", + 1, luaL_typename(L, -1)); + nhl_error(L, buf); + } + lua_pop(L, 1); + return ret; +} + +static int +get_table_region(L, name, x1,y1, x2,y2, optional) +lua_State *L; +const char *name; +int *x1, *y1, *x2, *y2; +boolean optional; +{ + int arrlen; + + lua_getfield(L, 1, name); + if (optional && lua_type(L, -1) == LUA_TNIL) { + lua_pop(L, 1); + return 1; + } + + luaL_checktype(L, -1, LUA_TTABLE); + + lua_len(L, -1); + arrlen = lua_tointeger(L, -1); + lua_pop(L, 1); + if (arrlen != 4) { + nhl_error(L, "Not a region"); + lua_pop(L, 1); + return 0; + } + + *x1 = get_table_intarray_entry(L, -1, 1); + *y1 = get_table_intarray_entry(L, -1, 2); + *x2 = get_table_intarray_entry(L, -1, 3); + *y2 = get_table_intarray_entry(L, -1, 4); + + lua_pop(L, 1); + return 1; +} + +static int +get_coord(L, index, x, y) +lua_State *L; +int index; +int *x, *y; +{ + if (lua_type(L, index) == LUA_TTABLE) { + int arrlen; + + lua_len(L, index); + arrlen = lua_tointeger(L, -1); + lua_pop(L, 1); + if (arrlen != 2) { + nhl_error(L, "Not a coordinate"); + return 0; + } + + *x = get_table_intarray_entry(L, index, 1); + *y = get_table_intarray_entry(L, index, 2); + + return 1; + } + return 0; } void -spo_levregion(coder) -struct sp_coder *coder; +levregion_add(lregion) +lev_region *lregion; { - static const char nhFunc[] = "spo_levregion"; - struct opvar *rname, *padding, *rtype, *del_islev, *dy2, *dx2, *dy1, *dx1, - *in_islev, *iy2, *ix2, *iy1, *ix1; - - lev_region *tmplregion; - - if (!OV_pop_s(rname) || !OV_pop_i(padding) || !OV_pop_i(rtype) - || !OV_pop_i(del_islev) || !OV_pop_i(dy2) || !OV_pop_i(dx2) - || !OV_pop_i(dy1) || !OV_pop_i(dx1) || !OV_pop_i(in_islev) - || !OV_pop_i(iy2) || !OV_pop_i(ix2) || !OV_pop_i(iy1) - || !OV_pop_i(ix1)) - return; - - tmplregion = (lev_region *) alloc(sizeof(lev_region)); - - tmplregion->inarea.x1 = OV_i(ix1); - tmplregion->inarea.y1 = OV_i(iy1); - tmplregion->inarea.x2 = OV_i(ix2); - tmplregion->inarea.y2 = OV_i(iy2); - - tmplregion->delarea.x1 = OV_i(dx1); - tmplregion->delarea.y1 = OV_i(dy1); - tmplregion->delarea.x2 = OV_i(dx2); - tmplregion->delarea.y2 = OV_i(dy2); - - tmplregion->in_islev = OV_i(in_islev); - tmplregion->del_islev = OV_i(del_islev); - tmplregion->rtype = OV_i(rtype); - tmplregion->padding = OV_i(padding); - tmplregion->rname.str = dupstr(OV_s(rname)); - - if (!tmplregion->in_islev) { - get_location(&tmplregion->inarea.x1, &tmplregion->inarea.y1, ANY_LOC, + if (!lregion->in_islev) { + get_location(&lregion->inarea.x1, &lregion->inarea.y1, ANY_LOC, (struct mkroom *) 0); - get_location(&tmplregion->inarea.x2, &tmplregion->inarea.y2, ANY_LOC, + get_location(&lregion->inarea.x2, &lregion->inarea.y2, ANY_LOC, (struct mkroom *) 0); } - if (!tmplregion->del_islev) { - get_location(&tmplregion->delarea.x1, &tmplregion->delarea.y1, + if (!lregion->del_islev) { + get_location(&lregion->delarea.x1, &lregion->delarea.y1, ANY_LOC, (struct mkroom *) 0); - get_location(&tmplregion->delarea.x2, &tmplregion->delarea.y2, + get_location(&lregion->delarea.x2, &lregion->delarea.y2, ANY_LOC, (struct mkroom *) 0); } if (g.num_lregions) { @@ -4548,59 +4659,176 @@ struct sp_coder *coder; g.num_lregions = 1; g.lregions = (lev_region *) alloc(sizeof(lev_region)); } - (void) memcpy(&g.lregions[g.num_lregions - 1], tmplregion, + (void) memcpy(&g.lregions[g.num_lregions - 1], lregion, sizeof(lev_region)); - free(tmplregion); - - opvar_free(dx1); - opvar_free(dy1); - opvar_free(dx2); - opvar_free(dy2); - - opvar_free(ix1); - opvar_free(iy1); - opvar_free(ix2); - opvar_free(iy2); - - opvar_free(del_islev); - opvar_free(in_islev); - opvar_free(rname); - opvar_free(rtype); - opvar_free(padding); } -void -spo_region(coder) -struct sp_coder *coder; +/* teleport_region({ region = { x1,y1, x2,y2} }); */ +/* teleport_region({ region = { x1,y1, x2,y2}, [ region_islev = 1, ] exclude = { x1,y1, x2,y2}, [ exclude_islen = 1, ] [ dir = "up" ] }); */ +/* TODO: maybe allow using selection, with a new selection method "getextents()"? */ +int +lspo_teleport_region(L) +lua_State *L; +{ + const char *const teledirs[] = { "both", "down", "up", NULL }; + const int teledirs2i[] = { LR_TELE, LR_DOWNTELE, LR_UPTELE, -1 }; + lev_region tmplregion; + int x1,y1,x2,y2; + + create_des_coder(); + + lcheck_param_table(L); + + get_table_region(L, "region", &x1, &y1, &x2, &y2, FALSE); + tmplregion.inarea.x1 = x1; + tmplregion.inarea.y1 = y1; + tmplregion.inarea.x2 = x2; + tmplregion.inarea.y2 = y2; + + x1 = y1 = x2 = y2 = 0; + get_table_region(L, "exclude", &x1, &y1, &x2, &y2, TRUE); + tmplregion.delarea.x1 = x1; + tmplregion.delarea.y1 = y1; + tmplregion.delarea.x2 = x2; + tmplregion.delarea.y2 = y2; + + tmplregion.in_islev = get_table_boolean_opt(L, "region_islev", 0); + tmplregion.del_islev = get_table_boolean_opt(L, "exclude_islev", 0); + + tmplregion.rtype = teledirs2i[get_table_option(L, "dir", "both", teledirs)]; + tmplregion.padding = 0; + tmplregion.rname.str = NULL; + + levregion_add(&tmplregion); + + return 0; +} + +/* TODO: FIXME + from lev_comp SPO_LEVREGION was called as: + - STAIR:(x1,y1,x2,y2),(x1,y1,x2,y2),dir + - PORTAL:(x1,y1,x2,y2),(x1,y1,x2,y2),string + - BRANCH:(x1,y1,x2,y2),(x1,y1,x2,y2),dir + +*/ +/* levregion({ region = { x1,y1, x2,y2 }, exclude = { x1,y1, x2,y2 }, type = "portal", name="air" }); */ +/* TODO: allow region to be optional, defaulting to whole level */ +int +lspo_levregion(L) +lua_State *L; +{ + const char *const regiontypes[] = { "stair-down", "stair-up", "portal", "branch", "teleport", "teleport-up", "teleport-down", NULL }; + const int regiontypes2i[] = { LR_DOWNSTAIR, LR_UPSTAIR, LR_PORTAL, LR_BRANCH, LR_TELE, LR_UPTELE, LR_DOWNTELE, 0 }; + lev_region tmplregion; + int x1,y1,x2,y2; + + create_des_coder(); + + lcheck_param_table(L); + + get_table_region(L, "region", &x1, &y1, &x2, &y2, FALSE); + + tmplregion.inarea.x1 = x1; + tmplregion.inarea.y1 = y1; + tmplregion.inarea.x2 = x2; + tmplregion.inarea.y2 = y2; + + x1 = y1 = x2 = y2 = 0; + get_table_region(L, "exclude", &x1, &y1, &x2, &y2, TRUE); + + tmplregion.delarea.x1 = x1; + tmplregion.delarea.y1 = y1; + tmplregion.delarea.x2 = x2; + tmplregion.delarea.y2 = y2; + + tmplregion.in_islev = get_table_boolean_opt(L, "region_islev", 0); + tmplregion.del_islev = get_table_boolean_opt(L, "exclude_islev", 0); + tmplregion.rtype = regiontypes2i[get_table_option(L, "type", "stair-down", regiontypes)]; + tmplregion.padding = get_table_int_opt(L, "padding", 0); + tmplregion.rname.str = get_table_str_opt(L, "name", NULL); + + levregion_add(&tmplregion); + + return 0; +} + + +void +sel_set_lit(x, y, arg) +int x, y; +genericptr_t arg; +{ + int lit = *(int *)arg; + + levl[x][y].lit = (levl[x][y].typ == LAVAPOOL) ? 1 : lit; +} + +/* region(selection, lit); */ +/* region({ x1=NN, y1=NN, x2=NN, y2=NN, lit=BOOL, type=ROOMTYPE, joined=BOOL, irregular=BOOL, prefilled=BOOL [ , contents = FUNCTION ] }); */ +/* region({ region={x1,y1, x2,y2}, type="ordinary" }); */ +int +lspo_region(L) +lua_State *L; { - static const char nhFunc[] = "spo_region"; - struct opvar *rtype, *rlit, *rflags, *area; xchar dx1, dy1, dx2, dy2; register struct mkroom *troom; - boolean prefilled, room_not_needed, irregular, joined; + boolean prefilled = FALSE, room_not_needed, irregular = FALSE, joined = TRUE; + int rtype = OROOM, rlit = 1; + int argc = lua_gettop(L); - if (!OV_pop_i(rflags) || !OV_pop_i(rtype) || !OV_pop_i(rlit) - || !OV_pop_r(area)) - return; + create_des_coder(); - prefilled = !(OV_i(rflags) & (1 << 0)); - irregular = (OV_i(rflags) & (1 << 1)); - joined = !(OV_i(rflags) & (1 << 2)); + if (argc <= 1) { + lcheck_param_table(L); - if (OV_i(rtype) > MAXRTYPE) { - OV_i(rtype) -= MAXRTYPE + 1; - prefilled = TRUE; - } else - prefilled = FALSE; + /* TODO: check the prefilled, what was the default in lev_comp? */ + /* "unfilled" == 0, "filled" == 1, missing = "filled" */ - if (OV_i(rlit) < 0) - OV_i(rlit) = - (rnd(1 + abs(depth(&u.uz))) < 11 && rn2(77)) ? TRUE : FALSE; + /* TODO: "unfilled" ==> prefilled=1 */ + prefilled = get_table_boolean_opt(L, "prefilled", 0); + irregular = get_table_boolean_opt(L, "irregular", 0); + joined = get_table_boolean_opt(L, "joined", 1); + rtype = get_table_roomtype_opt(L, "type", OROOM); + rlit = get_table_int_opt(L, "lit", -1); + dx1 = get_table_int_opt(L, "x1", -1); /* TODO: area */ + dy1 = get_table_int_opt(L, "y1", -1); + dx2 = get_table_int_opt(L, "x2", -1); + dy2 = get_table_int_opt(L, "y2", -1); - dx1 = SP_REGION_X1(OV_i(area)); - dy1 = SP_REGION_Y1(OV_i(area)); - dx2 = SP_REGION_X2(OV_i(area)); - dy2 = SP_REGION_Y2(OV_i(area)); + if (dx1 == -1 && dy1 == -1 && dx2 == -1 && dy2 == -1) { + int rx1, ry1, rx2, ry2; + get_table_region(L, "region", &rx1, &ry1, &rx2, &ry2, FALSE); + dx1 = rx1; dy1 = ry1; + dx2 = rx2; dy2 = ry2; + } + if (dx1 == -1 && dy1 == -1 && dx2 == -1 && dy2 == -1) { + nhl_error(L, "region needs region"); + } + + } else if (argc == 2) { + /* region(selection, "lit"); */ + const char *const lits[] = { "unlit", "lit", NULL }; + struct selectionvar *sel = l_selection_check(L, 1); + + rlit = luaL_checkoption(L, 2, "lit", lits); + + /* + TODO: adjust region size for wall, but only if lit + TODO: lit=random + */ + if (rlit) + selection_do_grow(sel, W_ANY); + selection_iterate(sel, sel_set_lit, (genericptr_t) &rlit); + + /* TODO: skip the rest of this function? */ + return 0; + } else { + nhl_error(L, "Wrong parameters"); + return 0; + } + + if (rlit < 0) + rlit = (rnd(1 + abs(depth(&u.uz))) < 11 && rn2(77)) ? TRUE : FALSE; get_location(&dx1, &dy1, ANY_LOC, (struct mkroom *) 0); get_location(&dx2, &dy2, ANY_LOC, (struct mkroom *) 0); @@ -4608,30 +4836,25 @@ struct sp_coder *coder; /* for an ordinary room, `prefilled' is a flag to force an actual room to be created (such rooms are used to control placement of migrating monster arrivals) */ - room_not_needed = (OV_i(rtype) == OROOM && !irregular && !prefilled); + room_not_needed = (rtype == OROOM && !irregular && !prefilled); if (room_not_needed || g.nroom >= MAXNROFROOMS) { region tmpregion; if (!room_not_needed) impossible("Too many rooms on new level!"); - tmpregion.rlit = OV_i(rlit); + tmpregion.rlit = rlit; tmpregion.x1 = dx1; tmpregion.y1 = dy1; tmpregion.x2 = dx2; tmpregion.y2 = dy2; light_region(&tmpregion); - opvar_free(area); - opvar_free(rflags); - opvar_free(rlit); - opvar_free(rtype); - - return; + return 0; } troom = &g.rooms[g.nroom]; /* mark rooms that must be filled, but do it later */ - if (OV_i(rtype) != OROOM) + if (rtype != OROOM) troom->needfill = (prefilled ? 2 : 1); troom->needjoining = joined; @@ -4640,13 +4863,12 @@ struct sp_coder *coder; g.min_rx = g.max_rx = dx1; g.min_ry = g.max_ry = dy1; g.smeq[g.nroom] = g.nroom; - flood_fill_rm(dx1, dy1, g.nroom + ROOMOFFSET, OV_i(rlit), TRUE); - add_room(g.min_rx, g.min_ry, g.max_rx, g.max_ry, FALSE, OV_i(rtype), - TRUE); - troom->rlit = OV_i(rlit); + flood_fill_rm(dx1, dy1, g.nroom + ROOMOFFSET, rlit, TRUE); + add_room(g.min_rx, g.min_ry, g.max_rx, g.max_ry, FALSE, rtype, TRUE); + troom->rlit = rlit; troom->irregular = TRUE; } else { - add_room(dx1, dy1, dx2, dy2, OV_i(rlit), OV_i(rtype), TRUE); + add_room(dx1, dy1, dx2, dy2, rlit, rtype, TRUE); #ifdef SPECIALIZATION topologize(troom, FALSE); /* set roomno */ #else @@ -4655,68 +4877,109 @@ struct sp_coder *coder; } if (!room_not_needed) { - if (coder->n_subroom > 1) + if (g.coder->n_subroom > 1) impossible("region as subroom"); else { - coder->tmproomlist[coder->n_subroom] = troom; - coder->failed_room[coder->n_subroom] = FALSE; - coder->n_subroom++; + g.coder->tmproomlist[g.coder->n_subroom] = troom; + g.coder->failed_room[g.coder->n_subroom] = FALSE; + g.coder->n_subroom++; + update_croom(); + lua_getfield(L, 1, "contents"); + if (lua_type(L, -1) == LUA_TFUNCTION) { + lua_remove(L, -2); + lua_call(L, 0, 0); + } else + lua_pop(L, 1); + spo_endroom(g.coder); } } - opvar_free(area); - opvar_free(rflags); - opvar_free(rlit); - opvar_free(rtype); + return 0; } -void -spo_drawbridge(coder) -struct sp_coder *coder; +/* drawbridge({ dir="east", state="closed", x=05,y=08}); */ +int +lspo_drawbridge(L) +lua_State *L; { - static const char nhFunc[] = "spo_drawbridge"; + const char *const mwdirs[] = { "north", "south", "west", "east", "random", NULL }; + const int mwdirs2i[] = { DB_NORTH, DB_SOUTH, DB_WEST, DB_EAST, -1, -2 }; + const char *const dbopens[] = { "open", "closed", "random", NULL }; + const int dbopens2i[] = { 1, 0, -1, -2 }; xchar x, y; - int dopen; - struct opvar *dir, *db_open, *dcoord; + int mx, my, dir; + int db_open; + long dcoord; - if (!OV_pop_i(dir) || !OV_pop_i(db_open) || !OV_pop_c(dcoord)) - return; + create_des_coder(); - get_location_coord(&x, &y, DRY | WET | HOT, coder->croom, OV_i(dcoord)); - if ((dopen = OV_i(db_open)) == -1) - dopen = !rn2(2); - if (!create_drawbridge(x, y, OV_i(dir), dopen ? TRUE : FALSE)) + lcheck_param_table(L); + + mx = get_table_int(L, "x"); + my = get_table_int(L, "y"); + dir = mwdirs2i[get_table_option(L, "dir", "random", mwdirs)]; + dcoord = SP_COORD_PACK(mx, my); + db_open = dbopens2i[get_table_option(L, "state", "random", dbopens)]; + x = mx; + y = my; + + get_location_coord(&x, &y, DRY | WET | HOT, g.coder->croom, dcoord); + if (db_open == -1) + db_open = !rn2(2); + if (!create_drawbridge(x, y, dir, db_open ? TRUE : FALSE)) impossible("Cannot create drawbridge."); g.SpLev_Map[x][y] = 1; - opvar_free(dcoord); - opvar_free(db_open); - opvar_free(dir); + return 0; } -void -spo_mazewalk(coder) -struct sp_coder *coder; +/* mazewalk({ x = NN, y = NN, typ = ".", dir = "north", stocked = 0 }); */ +/* mazewalk(x,y,dir); */ +int +lspo_mazewalk(L) +lua_State *L; { - static const char nhFunc[] = "spo_mazewalk"; + const char *const mwdirs[] = { "north", "south", "east", "west", "random", NULL }; + const int mwdirs2i[] = { W_NORTH, W_SOUTH, W_EAST, W_WEST, -1, -2 }; xchar x, y; - struct opvar *ftyp, *fstocked, *fdir, *mcoord; - int dir; + int mx, my; + xchar ftyp = ROOM; + int fstocked = 1, dir = -1; + long mcoord; + int argc = lua_gettop(L); - if (!OV_pop_i(ftyp) || !OV_pop_i(fstocked) || !OV_pop_i(fdir) - || !OV_pop_c(mcoord)) - return; + create_des_coder(); - dir = OV_i(fdir); + if (argc == 3) { + mx = luaL_checkinteger(L, 1); + my = luaL_checkinteger(L, 2); + dir = mwdirs2i[luaL_checkoption(L, 3, "random", mwdirs)]; + } else { + lcheck_param_table(L); - get_location_coord(&x, &y, ANY_LOC, coder->croom, OV_i(mcoord)); - if (!isok(x, y)) - return; - - if (OV_i(ftyp) < 1) { - OV_i(ftyp) = g.level.flags.corrmaze ? CORR : ROOM; + mx = get_table_int(L, "x"); + my = get_table_int(L, "y"); + ftyp = get_table_mapchr_opt(L, "typ", ROOM); + fstocked = get_table_boolean_opt(L, "stocked", 1); + dir = mwdirs2i[get_table_option(L, "dir", "random", mwdirs)]; } + mcoord = SP_COORD_PACK(mx, my); + x = mx; + y = my; + + get_location_coord(&x, &y, ANY_LOC, g.coder->croom, mcoord); + + if (!isok(x, y)) + return 0; + + if (ftyp < 1) { + ftyp = g.level.flags.corrmaze ? CORR : ROOM; + } + + if (dir == -1) + dir = mwdirs2i[rn2(4)]; + /* don't use move() - it doesn't use W_NORTH, etc. */ switch (dir) { case W_NORTH: @@ -4732,11 +4995,11 @@ struct sp_coder *coder; --x; break; default: - impossible("spo_mazewalk: Bad MAZEWALK direction"); + impossible("mazewalk: Bad direction"); } if (!IS_DOOR(levl[x][y].typ)) { - levl[x][y].typ = OV_i(ftyp); + levl[x][y].typ = ftyp; levl[x][y].flags = 0; } @@ -4752,7 +5015,7 @@ struct sp_coder *coder; x--; /* no need for IS_DOOR check; out of map bounds */ - levl[x][y].typ = OV_i(ftyp); + levl[x][y].typ = ftyp; levl[x][y].flags = 0; } @@ -4763,149 +5026,266 @@ struct sp_coder *coder; y--; } - walkfrom(x, y, OV_i(ftyp)); - if (OV_i(fstocked)) + walkfrom(x, y, ftyp); + if (fstocked) fill_empty_maze(); - opvar_free(mcoord); - opvar_free(fdir); - opvar_free(fstocked); - opvar_free(ftyp); + return 0; } -void -spo_wall_property(coder) -struct sp_coder *coder; +/* wall_property({ x1=0, y1=0, x2=78, y2=20, property="nondiggable" }); */ +/* wall_property({ region = {1,0, 78,20}, property="nonpasswall" }); */ +int +lspo_wall_property(L) +lua_State *L; { - static const char nhFunc[] = "spo_wall_property"; - struct opvar *r; - xchar dx1, dy1, dx2, dy2; - int wprop = (coder->opcode == SPO_NON_DIGGABLE) - ? W_NONDIGGABLE - : W_NONPASSWALL; + const char *const wprops[] = { "nondiggable", "nonpasswall", NULL }; + const int wprop2i[] = { W_NONDIGGABLE, W_NONPASSWALL, -1 }; + schar dx1 = -1, dy1 = -1, dx2 = -1, dy2 = -1; + int wprop; - if (!OV_pop_r(r)) - return; + create_des_coder(); - dx1 = SP_REGION_X1(OV_i(r)); - dy1 = SP_REGION_Y1(OV_i(r)); - dx2 = SP_REGION_X2(OV_i(r)); - dy2 = SP_REGION_Y2(OV_i(r)); + lcheck_param_table(L); + + dx1 = get_table_int_opt(L, "x1", -1); + dy1 = get_table_int_opt(L, "y1", -1); + dx2 = get_table_int_opt(L, "x2", -1); + dy2 = get_table_int_opt(L, "y2", -1); + + if (dx1 == -1 && dy1 == -1 && dx2 == -1 && dy2 == -1) { + int rx1, ry1, rx2, ry2; + get_table_region(L, "region", &rx1, &ry1, &rx2, &ry2, FALSE); + dx1 = rx1; dy1 = ry1; + dx2 = rx2; dy2 = ry2; + } + + wprop = wprop2i[get_table_option(L, "property", "nondiggable", wprops)]; + + if (dx1 == -1) + dx1 = g.xstart - 1; + if (dy1 == -1) + dy1 = g.ystart - 1; + if (dx2 == -1) + dx2 = g.xstart + g.xsize + 1; + if (dy2 == -1) + dy2 = g.ystart + g.ysize + 1; get_location(&dx1, &dy1, ANY_LOC, (struct mkroom *) 0); get_location(&dx2, &dy2, ANY_LOC, (struct mkroom *) 0); set_wall_property(dx1, dy1, dx2, dy2, wprop); - opvar_free(r); + return 0; } -void -spo_room_door(coder) -struct sp_coder *coder; +/* non_diggable(selection); */ +/* non_diggable(); */ +int +lspo_non_diggable(L) +lua_State *L; { - static const char nhFunc[] = "spo_room_door"; - struct opvar *wall, *secret, *mask, *pos; - room_door tmpd; + int prop = W_NONDIGGABLE; + int argc = lua_gettop(L); + boolean freesel = FALSE; + struct selectionvar *sel = (struct selectionvar *) 0; - if (!OV_pop_i(wall) || !OV_pop_i(secret) || !OV_pop_i(mask) - || !OV_pop_i(pos) || !coder->croom) - return; + create_des_coder(); - tmpd.secret = OV_i(secret); - tmpd.mask = OV_i(mask); - tmpd.pos = OV_i(pos); - tmpd.wall = OV_i(wall); + if (argc == 1) + sel = l_selection_check(L, -1); + else if (argc == 0) { + freesel = TRUE; + sel = selection_new(); + selection_not(sel); + } - create_door(&tmpd, coder->croom); + if (sel) { + selection_iterate(sel, sel_set_wall_property, (genericptr_t) &prop); + if (freesel) { + selection_free(sel); + free(sel); + } + } - opvar_free(wall); - opvar_free(secret); - opvar_free(mask); - opvar_free(pos); + return 0; } +/* non_passwall(selection); */ +/* non_passwall(); */ +int +lspo_non_passwall(L) +lua_State *L; +{ + int prop = W_NONPASSWALL; + int argc = lua_gettop(L); + boolean freesel = FALSE; + struct selectionvar *sel = (struct selectionvar *) 0; + + create_des_coder(); + + if (argc == 1) + sel = l_selection_check(L, -1); + else if (argc == 0) { + freesel = TRUE; + sel = selection_new(); + selection_not(sel); + } + + if (sel) { + selection_iterate(sel, sel_set_wall_property, (genericptr_t) &prop); + if (freesel) { + selection_free(sel); + free(sel); + } + } + + return 0; +} + +#if 0 /*ARGSUSED*/ -void +static void sel_set_wallify(x, y, arg) int x, y; genericptr_t arg UNUSED; { wallify_map(x, y, x, y); } +#endif -void -spo_wallify(coder) -struct sp_coder *coder; +/* TODO: wallify(selection) */ +/* wallify({ x1=NN,y1=NN, x2=NN,y2=NN }); */ +/* wallify(); */ +int +lspo_wallify(L) +lua_State *L; { - static const char nhFunc[] = "spo_wallify"; - struct opvar *typ, *r; - int dx1, dy1, dx2, dy2; + int dx1 = -1, dy1 = -1, dx2 = -1, dy2 = -1; - if (!OV_pop_i(typ)) - return; - switch (OV_i(typ)) { - default: - case 0: - if (!OV_pop_r(r)) - return; - dx1 = (xchar) SP_REGION_X1(OV_i(r)); - dy1 = (xchar) SP_REGION_Y1(OV_i(r)); - dx2 = (xchar) SP_REGION_X2(OV_i(r)); - dy2 = (xchar) SP_REGION_Y2(OV_i(r)); - wallify_map(dx1 < 0 ? (g.xstart - 1) : dx1, - dy1 < 0 ? (g.ystart - 1) : dy1, - dx2 < 0 ? (g.xstart + g.xsize + 1) : dx2, - dy2 < 0 ? (g.ystart + g.ysize + 1) : dy2); - break; - case 1: - if (!OV_pop_typ(r, SPOVAR_SEL)) - return; - selection_iterate(r, sel_set_wallify, NULL); - break; + /* TODO: clamp coord values */ + /* TODO: maybe allow wallify({x1,y1}, {x2,y2}) */ + /* TODO: is_table_coord(), is_table_area(), get_table_coord(), get_table_area() */ + + create_des_coder(); + + if (lua_gettop(L) == 1) { + dx1 = get_table_int(L, "x1"); + dy1 = get_table_int(L, "y1"); + dx2 = get_table_int(L, "x2"); + dy2 = get_table_int(L, "y2"); } - opvar_free(r); - opvar_free(typ); + + wallify_map(dx1 < 0 ? (g.xstart - 1) : dx1, + dy1 < 0 ? (g.ystart - 1) : dy1, + dx2 < 0 ? (g.xstart + g.xsize + 1) : dx2, + dy2 < 0 ? (g.ystart + g.ysize + 1) : dy2); + + return 0; } -void -spo_map(coder) -struct sp_coder *coder; +/* reset_level is only needed for testing purposes */ +int +lspo_reset_level(L) +lua_State *L UNUSED; +{ + boolean wtower = In_W_tower(u.ux, u.uy, &u.uz); + + create_des_coder(); + makemap_prepost(TRUE, wtower); + clear_level_structures(); + return 0; +} + +/* map({ x = 10, y = 10, map = [[...]] }); */ +/* map({ halign = "center", valign = "center", map = [[...]] }); */ +/* map([[...]]) */ +int +lspo_map(L) +lua_State *L; { - static const char nhFunc[] = "spo_map"; mazepart tmpmazepart; - struct opvar *mpxs, *mpys, *mpmap, *mpa, *mpkeepr, *mpzalign; - xchar halign, valign; xchar tmpxstart, tmpystart, tmpxsize, tmpysize; - unpacked_coord upc; - if (!OV_pop_i(mpxs) || !OV_pop_i(mpys) || !OV_pop_s(mpmap) - || !OV_pop_i(mpkeepr) || !OV_pop_i(mpzalign) || !OV_pop_c(mpa)) - return; + /* +TODO: allow passing an array of strings as map data +TODO: handle if map lines aren't same length +TODO: g.coder->croom needs to be updated + */ - tmpmazepart.xsize = OV_i(mpxs); - tmpmazepart.ysize = OV_i(mpys); - tmpmazepart.zaligntyp = OV_i(mpzalign); + const char *const left_or_right[] = { "left", "half-left", "center", "half-right", "right", "none", NULL }; + const int l_or_r2i[] = { LEFT, H_LEFT, CENTER, H_RIGHT, RIGHT, -1, -1 }; + const char *const top_or_bot[] = { "top", "center", "bottom", "none", NULL }; + const int t_or_b2i[] = { TOP, CENTER, BOTTOM, -1, -1 }; + int lr, tb, keepregion = 1, x = -1, y = -1; + char *tmps, *mapdata; + int mapwid, maphei = 0; + int argc = lua_gettop(L); - upc = get_unpacked_coord(OV_i(mpa), ANY_LOC); - tmpmazepart.halign = upc.x; - tmpmazepart.valign = upc.y; + create_des_coder(); + if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) { + lr = tb = CENTER; + mapdata = dupstr(luaL_checkstring(L, 1)); + } else { + lcheck_param_table(L); + lr = l_or_r2i[get_table_option(L, "halign", "none", left_or_right)]; + tb = t_or_b2i[get_table_option(L, "valign", "none", top_or_bot)]; + keepregion = get_table_boolean_opt(L, "keepregion", 1); /* TODO: maybe rename? */ + x = get_table_int_opt(L, "x", -1); + y = get_table_int_opt(L, "y", -1); + mapdata = get_table_str(L, "map"); + } + + (void) stripdigits(mapdata); + mapwid = str_lines_maxlen(mapdata); + tmps = mapdata; + while (tmps && *tmps) { + char *s1 = index(tmps, '\n'); + if (maphei > MAP_Y_LIM) + break; + if (s1) + s1++; + tmps = s1; + maphei++; + } + + /* keepregion restricts the coordinates of the commands coming after the map + into the map region */ + /* for keepregion */ tmpxsize = g.xsize; tmpysize = g.ysize; tmpxstart = g.xstart; tmpystart = g.ystart; - halign = tmpmazepart.halign; - valign = tmpmazepart.valign; - g.xsize = tmpmazepart.xsize; - g.ysize = tmpmazepart.ysize; - switch (tmpmazepart.zaligntyp) { - default: - case 0: - break; - case 1: - switch ((int) halign) { + + g.xsize = tmpmazepart.xsize = mapwid; + g.ysize = tmpmazepart.ysize = maphei; + tmpmazepart.halign = lr; + tmpmazepart.valign = tb; + + if (lr == -1 && tb == -1) { + if (isok(x,y)) { + /* x,y is given, place map starting at x,y */ + if (g.coder->croom) { + /* in a room? adjust to room relative coords */ + g.xstart = x + g.coder->croom->lx; + g.ystart = y + g.coder->croom->ly; + g.xsize = min(tmpmazepart.xsize, (g.coder->croom->hx - g.coder->croom->lx)); + g.ysize = min(tmpmazepart.ysize, (g.coder->croom->hy - g.coder->croom->ly)); + } else { + g.xsize = tmpmazepart.xsize; + g.ysize = tmpmazepart.ysize; + g.xstart = x; + g.ystart = y; + } + } else { + nhl_error(L, "Map requires either x,y or halign,valign params"); + return 0; + } + } else { + /* place map starting at halign,valign */ + switch (lr) { case LEFT: g.xstart = g.splev_init_present ? 1 : 3; break; @@ -4922,7 +5302,7 @@ struct sp_coder *coder; g.xstart = g.x_maze_max - g.xsize - 1; break; } - switch ((int) valign) { + switch (tb) { case TOP: g.ystart = 3; break; @@ -4937,29 +5317,15 @@ struct sp_coder *coder; g.xstart++; if (!(g.ystart % 2)) g.ystart++; - break; - case 2: - if (!coder->croom) { - g.xstart = 1; - g.ystart = 0; - g.xsize = COLNO - 1 - tmpmazepart.xsize; - g.ysize = ROWNO - tmpmazepart.ysize; - } - get_location_coord(&halign, &valign, ANY_LOC, coder->croom, - OV_i(mpa)); - g.xsize = tmpmazepart.xsize; - g.ysize = tmpmazepart.ysize; - g.xstart = halign; - g.ystart = valign; - break; } + if (g.ystart < 0 || g.ystart + g.ysize > ROWNO) { /* try to move the start a bit */ g.ystart += (g.ystart > 0) ? -2 : 2; if (g.ysize == ROWNO) g.ystart = 0; if (g.ystart < 0 || g.ystart + g.ysize > ROWNO) - panic("reading special level with g.ysize too large"); + g.ystart = 0; } if (g.xsize <= 1 && g.ysize <= 1) { g.xstart = 1; @@ -4967,13 +5333,18 @@ struct sp_coder *coder; g.xsize = COLNO - 1; g.ysize = ROWNO; } else { - xchar x, y, mptyp; + char mpchr; + xchar mptyp; /* Load the map */ - for (y = g.ystart; y < g.ystart + g.ysize; y++) - for (x = g.xstart; x < g.xstart + g.xsize; x++) { - mptyp = (mpmap->vardata.str[(y - g.ystart) * g.xsize - + (x - g.xstart)] - 1); + for (y = g.ystart; y < min(ROWNO, g.ystart + g.ysize); y++) + for (x = g.xstart; x < min(COLNO, g.xstart + g.xsize); x++) { + mpchr = (mapdata[(y - g.ystart) * (mapwid+1) + (x - g.xstart)]); + mptyp = splev_chr2typ(mpchr); + if (mptyp == INVALID_TYPE) { + /* TODO: warn about illegal map char */ + continue; + } if (mptyp >= MAX_TYPE) continue; levl[x][y].typ = mptyp; @@ -5007,291 +5378,47 @@ struct sp_coder *coder; else if (g.splev_init_present && levl[x][y].typ == ICE) levl[x][y].icedpool = g.icedpools ? ICED_POOL : ICED_MOAT; } - if (coder->lvl_is_joined) + if (g.coder->lvl_is_joined) remove_rooms(g.xstart, g.ystart, g.xstart + g.xsize, g.ystart + g.ysize); } - if (!OV_i(mpkeepr)) { + if (!keepregion) { g.xstart = tmpxstart; g.ystart = tmpystart; g.xsize = tmpxsize; g.ysize = tmpysize; } - opvar_free(mpxs); - opvar_free(mpys); - opvar_free(mpmap); - opvar_free(mpa); - opvar_free(mpkeepr); - opvar_free(mpzalign); + Free(mapdata); + + return 0; } void -spo_jmp(coder, lvl) -struct sp_coder *coder; -sp_lev *lvl; +update_croom() { - static const char nhFunc[] = "spo_jmp"; - struct opvar *tmpa; - long a; - - if (!OV_pop_i(tmpa)) - return; - a = sp_code_jmpaddr(coder->frame->n_opcode, (OV_i(tmpa) - 1)); - if ((a >= 0) && (a < lvl->n_opcodes) && (a != coder->frame->n_opcode)) - coder->frame->n_opcode = a; - opvar_free(tmpa); -} - -void -spo_conditional_jump(coder, lvl) -struct sp_coder *coder; -sp_lev *lvl; -{ - static const char nhFunc[] = "spo_conditional_jump"; - struct opvar *oa, *oc; - long a, c; - int test = 0; - - if (!OV_pop_i(oa) || !OV_pop_i(oc)) + if (!g.coder) return; - a = sp_code_jmpaddr(coder->frame->n_opcode, (OV_i(oa) - 1)); - c = OV_i(oc); - - switch (coder->opcode) { - default: - impossible("spo_conditional_jump: illegal opcode"); - break; - case SPO_JL: - test = (c & SP_CPUFLAG_LT); - break; - case SPO_JLE: - test = (c & (SP_CPUFLAG_LT | SP_CPUFLAG_EQ)); - break; - case SPO_JG: - test = (c & SP_CPUFLAG_GT); - break; - case SPO_JGE: - test = (c & (SP_CPUFLAG_GT | SP_CPUFLAG_EQ)); - break; - case SPO_JE: - test = (c & SP_CPUFLAG_EQ); - break; - case SPO_JNE: - test = (c & ~SP_CPUFLAG_EQ); - break; - } - - if ((test) && (a >= 0) && (a < lvl->n_opcodes) - && (a != coder->frame->n_opcode)) - coder->frame->n_opcode = a; - - opvar_free(oa); - opvar_free(oc); + if (g.coder->n_subroom) + g.coder->croom = g.coder->tmproomlist[g.coder->n_subroom - 1]; + else + g.coder->croom = NULL; } -void -spo_var_init(coder) -struct sp_coder *coder; +struct sp_coder * +sp_level_coder_init() { - static const char nhFunc[] = "spo_var_init"; - struct opvar *vname; - struct opvar *arraylen; - struct opvar *vvalue; - struct splev_var *tmpvar; - struct splev_var *tmp2; - long idx; - - OV_pop_s(vname); - OV_pop_i(arraylen); - - if (!vname || !arraylen) - panic("no values for SPO_VAR_INIT"); - - tmpvar = opvar_var_defined(coder, OV_s(vname)); - - if (tmpvar) { - /* variable redefinition */ - if (OV_i(arraylen) < 0) { - /* copy variable */ - if (tmpvar->array_len) { - idx = tmpvar->array_len; - while (idx-- > 0) { - opvar_free(tmpvar->data.arrayvalues[idx]); - } - Free(tmpvar->data.arrayvalues); - } else { - opvar_free(tmpvar->data.value); - } - tmpvar->data.arrayvalues = NULL; - goto copy_variable; - } else if (OV_i(arraylen)) { - /* redefined array */ - idx = tmpvar->array_len; - while (idx-- > 0) { - opvar_free(tmpvar->data.arrayvalues[idx]); - } - Free(tmpvar->data.arrayvalues); - tmpvar->data.arrayvalues = NULL; - goto create_new_array; - } else { - /* redefined single value */ - OV_pop(vvalue); - if (tmpvar->svtyp != vvalue->spovartyp) - panic("redefining variable as different type"); - opvar_free(tmpvar->data.value); - tmpvar->data.value = vvalue; - tmpvar->array_len = 0; - } - } else { - /* new variable definition */ - tmpvar = (struct splev_var *) alloc(sizeof(struct splev_var)); - tmpvar->next = coder->frame->variables; - tmpvar->name = dupstr(OV_s(vname)); - coder->frame->variables = tmpvar; - - if (OV_i(arraylen) < 0) { - /* copy variable */ - copy_variable: - OV_pop(vvalue); - tmp2 = opvar_var_defined(coder, OV_s(vvalue)); - if (!tmp2) - panic("no copyable var"); - tmpvar->svtyp = tmp2->svtyp; - tmpvar->array_len = tmp2->array_len; - if (tmpvar->array_len) { - idx = tmpvar->array_len; - tmpvar->data.arrayvalues = - (struct opvar **) alloc(sizeof(struct opvar *) * idx); - while (idx-- > 0) { - tmpvar->data.arrayvalues[idx] = - opvar_clone(tmp2->data.arrayvalues[idx]); - } - } else { - tmpvar->data.value = opvar_clone(tmp2->data.value); - } - opvar_free(vvalue); - } else if (OV_i(arraylen)) { - /* new array */ - create_new_array: - idx = OV_i(arraylen); - tmpvar->array_len = idx; - tmpvar->data.arrayvalues = - (struct opvar **) alloc(sizeof(struct opvar *) * idx); - while (idx-- > 0) { - OV_pop(vvalue); - if (!vvalue) - panic("no value for arrayvariable"); - tmpvar->data.arrayvalues[idx] = vvalue; - } - tmpvar->svtyp = SPOVAR_ARRAY; - } else { - /* new single value */ - OV_pop(vvalue); - if (!vvalue) - panic("no value for variable"); - tmpvar->svtyp = OV_typ(vvalue); - tmpvar->data.value = vvalue; - tmpvar->array_len = 0; - } - } - - opvar_free(vname); - opvar_free(arraylen); - -} - -#if 0 -static long -opvar_array_length(coder) -struct sp_coder *coder; -{ - static const char nhFunc[] = "opvar_array_length"; - struct opvar *vname; - struct splev_var *tmp; - long len = 0; - - if (!coder) - return 0; - - vname = splev_stack_pop(coder->stack); - if (!vname) - return 0; - if (vname->spovartyp != SPOVAR_VARIABLE) - goto pass; - - tmp = coder->frame->variables; - while (tmp) { - if (!strcmp(tmp->name, OV_s(vname))) { - if ((tmp->svtyp & SPOVAR_ARRAY)) { - len = tmp->array_len; - if (len < 1) - len = 0; - } - goto pass; - } - tmp = tmp->next; - } - -pass: - opvar_free(vname); - return len; -} -#endif /*0*/ - -void -spo_shuffle_array(coder) -struct sp_coder *coder; -{ - static const char nhFunc[] = "spo_shuffle_array"; - struct opvar *vname; - struct splev_var *tmp; - struct opvar *tmp2; - long i, j; - - if (!OV_pop_s(vname)) - return; - - tmp = opvar_var_defined(coder, OV_s(vname)); - if (!tmp || (tmp->array_len < 1)) { - opvar_free(vname); - return; - } - for (i = tmp->array_len - 1; i > 0; i--) { - if ((j = rn2(i + 1)) == i) - continue; - tmp2 = tmp->data.arrayvalues[j]; - tmp->data.arrayvalues[j] = tmp->data.arrayvalues[i]; - tmp->data.arrayvalues[i] = tmp2; - } - - opvar_free(vname); -} - -/* Special level coder, creates the special level from the sp_lev codes. - * Does not free the allocated memory. - */ -static boolean -sp_level_coder(lvl) -sp_lev *lvl; -{ - static const char nhFunc[] = "sp_level_coder"; - unsigned long exec_opcodes = 0; int tmpi; - long room_stack = 0; - unsigned long max_execution = SPCODER_MAX_RUNTIME; struct sp_coder *coder = (struct sp_coder *) alloc(sizeof (struct sp_coder)); - coder->frame = frame_new(0); - coder->stack = NULL; coder->premapped = FALSE; coder->solidify = FALSE; coder->check_inaccessibles = FALSE; coder->croom = NULL; coder->n_subroom = 1; - coder->exit_script = FALSE; coder->lvl_is_joined = 0; + coder->room_stack = 0; g.splev_init_present = FALSE; g.icedpools = FALSE; @@ -5300,19 +5427,12 @@ sp_lev *lvl; once either level is created, these values can be forgotten */ g.mines_prize_count = g.soko_prize_count = 0; - if (wizard) { - char *met = nh_getenv("SPCODER_MAX_RUNTIME"); - - if (met && met[0] == '1') - max_execution = (1 << 30) - 1; - } - for (tmpi = 0; tmpi <= MAX_NESTED_ROOMS; tmpi++) { coder->tmproomlist[tmpi] = (struct mkroom *) 0; coder->failed_room[tmpi] = FALSE; } - shuffle_alignments(); + update_croom(); for (tmpi = 0; tmpi < MAX_CONTAINMENT; tmpi++) g.container_obj[tmpi] = NULL; @@ -5329,642 +5449,99 @@ sp_lev *lvl; g.xsize = COLNO - 1; g.ysize = ROWNO; - while (coder->frame->n_opcode < lvl->n_opcodes && !coder->exit_script) { - coder->opcode = lvl->opcodes[coder->frame->n_opcode].opcode; - coder->opdat = lvl->opcodes[coder->frame->n_opcode].opdat; + return coder; +} - coder->stack = coder->frame->stack; - if (exec_opcodes++ > max_execution) { - impossible("Level script is taking too much time, stopping."); - coder->exit_script = TRUE; - } +static const struct luaL_Reg nhl_functions[] = { + { "message", lspo_message }, + { "monster", lspo_monster }, + { "object", lspo_object }, + { "level_flags", lspo_level_flags }, + { "level_init", lspo_level_init }, + { "engraving", lspo_engraving }, + { "mineralize", lspo_mineralize }, + { "door", lspo_door }, + { "stair", lspo_stair }, + { "ladder", lspo_ladder }, + { "grave", lspo_grave }, + { "altar", lspo_altar }, + { "map", lspo_map }, + { "feature", lspo_feature }, + { "terrain", lspo_terrain }, + { "replace_terrain", lspo_replace_terrain }, + { "room", lspo_room }, + { "corridor", lspo_corridor }, + { "random_corridors", lspo_random_corridors }, + { "gold", lspo_gold }, + { "trap", lspo_trap }, + { "mazewalk", lspo_mazewalk }, + { "drawbridge", lspo_drawbridge }, + { "region", lspo_region }, + { "levregion", lspo_levregion }, + { "wallify", lspo_wallify }, + { "wall_property", lspo_wall_property }, + { "non_diggable", lspo_non_diggable }, + { "non_passwall", lspo_non_passwall }, + { "teleport_region", lspo_teleport_region }, + { "reset_level", lspo_reset_level }, + /* TODO: { "branch", lspo_branch }, */ + /* TODO: { "portal", lspo_portal }, */ + { NULL, NULL } +}; - if (coder->failed_room[coder->n_subroom - 1] - && coder->opcode != SPO_ENDROOM && coder->opcode != SPO_ROOM - && coder->opcode != SPO_SUBROOM) - goto next_opcode; +/* TODO: - coder->croom = coder->tmproomlist[coder->n_subroom - 1]; + - if des-file used MAZE_ID to start a level, the level needs des.level_flags("mazelevel") + - expose g.coder->croom or g.[xy]start and g.xy[size] to lua. + - detect a "subroom" automatically. + - new function get_mapchar(x,y) to return the mapchar on map + - many params should accept their normal type (eg, int or bool), AND "random" + - automatically add shuffle(array) + - automatically add align = { "law", "neutral", "chaos" } and shuffle it. (remove from lua files) + - grab the header comments from des-files and add add them to the lua files - switch (coder->opcode) { - case SPO_NULL: - break; - case SPO_EXIT: - coder->exit_script = TRUE; - break; - case SPO_FRAME_PUSH: - spo_frame_push(coder); - break; - case SPO_FRAME_POP: - spo_frame_pop(coder); - break; - case SPO_CALL: - spo_call(coder); - break; - case SPO_RETURN: - spo_return(coder); - break; - case SPO_END_MONINVENT: - spo_end_moninvent(coder); - break; - case SPO_POP_CONTAINER: - spo_pop_container(coder); - break; - case SPO_POP: { - struct opvar *ov = splev_stack_pop(coder->stack); +*/ - opvar_free(ov); - break; - } - case SPO_PUSH: - splev_stack_push(coder->stack, opvar_clone(coder->opdat)); - break; - case SPO_MESSAGE: - spo_message(coder); - break; - case SPO_MONSTER: - spo_monster(coder); - break; - case SPO_OBJECT: - spo_object(coder); - break; - case SPO_LEVEL_FLAGS: - spo_level_flags(coder); - break; - case SPO_INITLEVEL: - spo_initlevel(coder); - break; - case SPO_ENGRAVING: - spo_engraving(coder); - break; - case SPO_MINERALIZE: - spo_mineralize(coder); - break; - case SPO_SUBROOM: - case SPO_ROOM: - if (!coder->failed_room[coder->n_subroom - 1]) { - spo_room(coder); - } else - room_stack++; - break; - case SPO_ENDROOM: - if (coder->failed_room[coder->n_subroom - 1]) { - if (!room_stack) - spo_endroom(coder); - else - room_stack--; - } else { - spo_endroom(coder); - } - break; - case SPO_DOOR: - spo_door(coder); - break; - case SPO_STAIR: - spo_stair(coder); - break; - case SPO_LADDER: - spo_ladder(coder); - break; - case SPO_GRAVE: - spo_grave(coder); - break; - case SPO_ALTAR: - spo_altar(coder); - break; - case SPO_SINK: - case SPO_POOL: - case SPO_FOUNTAIN: - spo_feature(coder); - break; - case SPO_TRAP: - spo_trap(coder); - break; - case SPO_GOLD: - spo_gold(coder); - break; - case SPO_CORRIDOR: - spo_corridor(coder); - break; - case SPO_TERRAIN: - spo_terrain(coder); - break; - case SPO_REPLACETERRAIN: - spo_replace_terrain(coder); - break; - case SPO_LEVREGION: - spo_levregion(coder); - break; - case SPO_REGION: - spo_region(coder); - break; - case SPO_DRAWBRIDGE: - spo_drawbridge(coder); - break; - case SPO_MAZEWALK: - spo_mazewalk(coder); - break; - case SPO_NON_PASSWALL: - case SPO_NON_DIGGABLE: - spo_wall_property(coder); - break; - case SPO_ROOM_DOOR: - spo_room_door(coder); - break; - case SPO_WALLIFY: - spo_wallify(coder); - break; - case SPO_COPY: { - struct opvar *a = splev_stack_pop(coder->stack); +void +l_register_des(L) +lua_State *L; +{ + /* register des -table, and functions for it */ + lua_newtable(L); + luaL_setfuncs(L, nhl_functions, 0); + lua_setglobal(L, "des"); +} - splev_stack_push(coder->stack, opvar_clone(a)); - splev_stack_push(coder->stack, opvar_clone(a)); - opvar_free(a); - break; - } - case SPO_DEC: { - struct opvar *a; +static void +create_des_coder() +{ + if (!g.coder) + g.coder = sp_level_coder_init(); +} - if (!OV_pop_i(a)) - break; - OV_i(a)--; - splev_stack_push(coder->stack, a); - break; - } - case SPO_INC: { - struct opvar *a; +/* + * General loader + */ +boolean +load_special(name) +const char *name; +{ + boolean result = FALSE; - if (!OV_pop_i(a)) - break; - OV_i(a)++; - splev_stack_push(coder->stack, a); - break; - } - case SPO_MATH_SIGN: { - struct opvar *a; + create_des_coder(); - if (!OV_pop_i(a)) - break; - OV_i(a) = ((OV_i(a) < 0) ? -1 : ((OV_i(a) > 0) ? 1 : 0)); - splev_stack_push(coder->stack, a); - break; - } - case SPO_MATH_ADD: { - struct opvar *a, *b; - - if (!OV_pop(b) || !OV_pop(a)) - break; - if (OV_typ(b) == OV_typ(a)) { - if (OV_typ(a) == SPOVAR_INT) { - OV_i(a) = OV_i(a) + OV_i(b); - splev_stack_push(coder->stack, a); - opvar_free(b); - } else if (OV_typ(a) == SPOVAR_STRING) { - struct opvar *c; - char *tmpbuf = (char *) alloc(strlen(OV_s(a)) - + strlen(OV_s(b)) + 1); - - (void) sprintf(tmpbuf, "%s%s", OV_s(a), OV_s(b)); - c = opvar_new_str(tmpbuf); - splev_stack_push(coder->stack, c); - opvar_free(a); - opvar_free(b); - Free(tmpbuf); - } else { - splev_stack_push(coder->stack, a); - opvar_free(b); - impossible("adding weird types"); - } - } else { - splev_stack_push(coder->stack, a); - opvar_free(b); - impossible("adding different types"); - } - break; - } - case SPO_MATH_SUB: { - struct opvar *a, *b; - - if (!OV_pop_i(b) || !OV_pop_i(a)) - break; - OV_i(a) = OV_i(a) - OV_i(b); - splev_stack_push(coder->stack, a); - opvar_free(b); - break; - } - case SPO_MATH_MUL: { - struct opvar *a, *b; - - if (!OV_pop_i(b) || !OV_pop_i(a)) - break; - OV_i(a) = OV_i(a) * OV_i(b); - splev_stack_push(coder->stack, a); - opvar_free(b); - break; - } - case SPO_MATH_DIV: { - struct opvar *a, *b; - - if (!OV_pop_i(b) || !OV_pop_i(a)) - break; - if (OV_i(b) >= 1) { - OV_i(a) = OV_i(a) / OV_i(b); - } else { - OV_i(a) = 0; - } - splev_stack_push(coder->stack, a); - opvar_free(b); - break; - } - case SPO_MATH_MOD: { - struct opvar *a, *b; - - if (!OV_pop_i(b) || !OV_pop_i(a)) - break; - if (OV_i(b) > 0) { - OV_i(a) = OV_i(a) % OV_i(b); - } else { - OV_i(a) = 0; - } - splev_stack_push(coder->stack, a); - opvar_free(b); - break; - } - case SPO_CMP: { - struct opvar *a; - struct opvar *b; - struct opvar *c; - long val = 0; - - OV_pop(b); - OV_pop(a); - if (!a || !b) { - impossible("spo_cmp: no values in stack"); - break; - } - if (OV_typ(a) != OV_typ(b)) { - impossible("spo_cmp: trying to compare differing datatypes"); - break; - } - switch (OV_typ(a)) { - case SPOVAR_COORD: - case SPOVAR_REGION: - case SPOVAR_MAPCHAR: - case SPOVAR_MONST: - case SPOVAR_OBJ: - case SPOVAR_INT: - if (OV_i(b) > OV_i(a)) - val |= SP_CPUFLAG_LT; - if (OV_i(b) < OV_i(a)) - val |= SP_CPUFLAG_GT; - if (OV_i(b) == OV_i(a)) - val |= SP_CPUFLAG_EQ; - c = opvar_new_int(val); - break; - case SPOVAR_STRING: - c = opvar_new_int(!strcmp(OV_s(b), OV_s(a)) - ? SP_CPUFLAG_EQ - : 0); - break; - default: - c = opvar_new_int(0); - break; - } - splev_stack_push(coder->stack, c); - opvar_free(a); - opvar_free(b); - break; - } - case SPO_JMP: - spo_jmp(coder, lvl); - break; - case SPO_JL: - case SPO_JLE: - case SPO_JG: - case SPO_JGE: - case SPO_JE: - case SPO_JNE: - spo_conditional_jump(coder, lvl); - break; - case SPO_RN2: { - struct opvar *tmpv; - struct opvar *t; - - if (!OV_pop_i(tmpv)) - break; - t = opvar_new_int((OV_i(tmpv) > 1) ? rn2(OV_i(tmpv)) : 0); - splev_stack_push(coder->stack, t); - opvar_free(tmpv); - break; - } - case SPO_DICE: { - struct opvar *a, *b, *t; - - if (!OV_pop_i(b) || !OV_pop_i(a)) - break; - if (OV_i(b) < 1) - OV_i(b) = 1; - if (OV_i(a) < 1) - OV_i(a) = 1; - t = opvar_new_int(d(OV_i(a), OV_i(b))); - splev_stack_push(coder->stack, t); - opvar_free(a); - opvar_free(b); - break; - } - case SPO_MAP: - spo_map(coder); - break; - case SPO_VAR_INIT: - spo_var_init(coder); - break; - case SPO_SHUFFLE_ARRAY: - spo_shuffle_array(coder); - break; - case SPO_SEL_ADD: /* actually, logical or */ - { - struct opvar *sel1, *sel2, *pt; - - if (!OV_pop_typ(sel1, SPOVAR_SEL)) - panic("no sel1 for add"); - if (!OV_pop_typ(sel2, SPOVAR_SEL)) - panic("no sel2 for add"); - pt = selection_logical_oper(sel1, sel2, '|'); - opvar_free(sel1); - opvar_free(sel2); - splev_stack_push(coder->stack, pt); - break; - } - case SPO_SEL_COMPLEMENT: { - struct opvar *sel, *pt; - - if (!OV_pop_typ(sel, SPOVAR_SEL)) - panic("no sel for not"); - pt = selection_not(sel); - opvar_free(sel); - splev_stack_push(coder->stack, pt); - break; - } - case SPO_SEL_FILTER: /* sorta like logical and */ - { - struct opvar *filtertype; - - if (!OV_pop_i(filtertype)) - panic("no sel filter type"); - switch (OV_i(filtertype)) { - case SPOFILTER_PERCENT: { - struct opvar *tmp1, *sel; - - if (!OV_pop_i(tmp1)) - panic("no sel filter percent"); - if (!OV_pop_typ(sel, SPOVAR_SEL)) - panic("no sel filter"); - selection_filter_percent(sel, OV_i(tmp1)); - splev_stack_push(coder->stack, sel); - opvar_free(tmp1); - break; - } - case SPOFILTER_SELECTION: /* logical and */ - { - struct opvar *pt, *sel1, *sel2; - - if (!OV_pop_typ(sel1, SPOVAR_SEL)) - panic("no sel filter sel1"); - if (!OV_pop_typ(sel2, SPOVAR_SEL)) - panic("no sel filter sel2"); - pt = selection_logical_oper(sel1, sel2, '&'); - splev_stack_push(coder->stack, pt); - opvar_free(sel1); - opvar_free(sel2); - break; - } - case SPOFILTER_MAPCHAR: { - struct opvar *pt, *tmp1, *sel; - - if (!OV_pop_typ(sel, SPOVAR_SEL)) - panic("no sel filter"); - if (!OV_pop_typ(tmp1, SPOVAR_MAPCHAR)) - panic("no sel filter mapchar"); - pt = selection_filter_mapchar(sel, tmp1); - splev_stack_push(coder->stack, pt); - opvar_free(tmp1); - opvar_free(sel); - break; - } - default: - panic("unknown sel filter type"); - } - opvar_free(filtertype); - break; - } - case SPO_SEL_POINT: { - struct opvar *tmp; - struct opvar *pt = selection_opvar((char *) 0); - schar x, y; - - if (!OV_pop_c(tmp)) - panic("no ter sel coord"); - get_location_coord(&x, &y, ANY_LOC, coder->croom, OV_i(tmp)); - selection_setpoint(x, y, pt, 1); - splev_stack_push(coder->stack, pt); - opvar_free(tmp); - break; - } - case SPO_SEL_RECT: - case SPO_SEL_FILLRECT: { - struct opvar *tmp, *pt = selection_opvar((char *) 0); - schar x, y, x1, y1, x2, y2; - - if (!OV_pop_r(tmp)) - panic("no ter sel region"); - x1 = min(SP_REGION_X1(OV_i(tmp)), SP_REGION_X2(OV_i(tmp))); - y1 = min(SP_REGION_Y1(OV_i(tmp)), SP_REGION_Y2(OV_i(tmp))); - x2 = max(SP_REGION_X1(OV_i(tmp)), SP_REGION_X2(OV_i(tmp))); - y2 = max(SP_REGION_Y1(OV_i(tmp)), SP_REGION_Y2(OV_i(tmp))); - get_location(&x1, &y1, ANY_LOC, coder->croom); - get_location(&x2, &y2, ANY_LOC, coder->croom); - x1 = (x1 < 0) ? 0 : x1; - y1 = (y1 < 0) ? 0 : y1; - x2 = (x2 >= COLNO) ? COLNO - 1 : x2; - y2 = (y2 >= ROWNO) ? ROWNO - 1 : y2; - if (coder->opcode == SPO_SEL_RECT) { - for (x = x1; x <= x2; x++) { - selection_setpoint(x, y1, pt, 1); - selection_setpoint(x, y2, pt, 1); - } - for (y = y1; y <= y2; y++) { - selection_setpoint(x1, y, pt, 1); - selection_setpoint(x2, y, pt, 1); - } - } else { - for (x = x1; x <= x2; x++) - for (y = y1; y <= y2; y++) - selection_setpoint(x, y, pt, 1); - } - splev_stack_push(coder->stack, pt); - opvar_free(tmp); - break; - } - case SPO_SEL_LINE: { - struct opvar *tmp = NULL, *tmp2 = NULL, - *pt = selection_opvar((char *) 0); - schar x1, y1, x2, y2; - - if (!OV_pop_c(tmp)) - panic("no ter sel linecoord1"); - if (!OV_pop_c(tmp2)) - panic("no ter sel linecoord2"); - get_location_coord(&x1, &y1, ANY_LOC, coder->croom, OV_i(tmp)); - get_location_coord(&x2, &y2, ANY_LOC, coder->croom, OV_i(tmp2)); - x1 = (x1 < 0) ? 0 : x1; - y1 = (y1 < 0) ? 0 : y1; - x2 = (x2 >= COLNO) ? COLNO - 1 : x2; - y2 = (y2 >= ROWNO) ? ROWNO - 1 : y2; - selection_do_line(x1, y1, x2, y2, pt); - splev_stack_push(coder->stack, pt); - opvar_free(tmp); - opvar_free(tmp2); - break; - } - case SPO_SEL_RNDLINE: { - struct opvar *tmp = NULL, *tmp2 = NULL, *tmp3, - *pt = selection_opvar((char *) 0); - schar x1, y1, x2, y2; - - if (!OV_pop_i(tmp3)) - panic("no ter sel randline1"); - if (!OV_pop_c(tmp)) - panic("no ter sel randline2"); - if (!OV_pop_c(tmp2)) - panic("no ter sel randline3"); - get_location_coord(&x1, &y1, ANY_LOC, coder->croom, OV_i(tmp)); - get_location_coord(&x2, &y2, ANY_LOC, coder->croom, OV_i(tmp2)); - x1 = (x1 < 0) ? 0 : x1; - y1 = (y1 < 0) ? 0 : y1; - x2 = (x2 >= COLNO) ? COLNO - 1 : x2; - y2 = (y2 >= ROWNO) ? ROWNO - 1 : y2; - selection_do_randline(x1, y1, x2, y2, OV_i(tmp3), 12, pt); - splev_stack_push(coder->stack, pt); - opvar_free(tmp); - opvar_free(tmp2); - opvar_free(tmp3); - break; - } - case SPO_SEL_GROW: { - struct opvar *dirs, *pt; - - if (!OV_pop_i(dirs)) - panic("no dirs for grow"); - if (!OV_pop_typ(pt, SPOVAR_SEL)) - panic("no selection for grow"); - selection_do_grow(pt, OV_i(dirs)); - splev_stack_push(coder->stack, pt); - opvar_free(dirs); - break; - } - case SPO_SEL_FLOOD: { - struct opvar *tmp; - schar x, y; - - if (!OV_pop_c(tmp)) - panic("no ter sel flood coord"); - get_location_coord(&x, &y, ANY_LOC, coder->croom, OV_i(tmp)); - if (isok(x, y)) { - struct opvar *pt = selection_opvar((char *) 0); - - set_selection_floodfillchk(floodfillchk_match_under); - floodfillchk_match_under_typ = levl[x][y].typ; - selection_floodfill(pt, x, y, FALSE); - splev_stack_push(coder->stack, pt); - } - opvar_free(tmp); - break; - } - case SPO_SEL_RNDCOORD: { - struct opvar *pt; - schar x, y; - - if (!OV_pop_typ(pt, SPOVAR_SEL)) - panic("no selection for rndcoord"); - if (selection_rndcoord(pt, &x, &y, FALSE)) { - x -= g.xstart; - y -= g.ystart; - } - splev_stack_push(coder->stack, opvar_new_coord(x, y)); - opvar_free(pt); - break; - } - case SPO_SEL_ELLIPSE: { - struct opvar *filled, *xaxis, *yaxis, *pt; - struct opvar *sel = selection_opvar((char *) 0); - schar x, y; - - if (!OV_pop_i(filled)) - panic("no filled for ellipse"); - if (!OV_pop_i(yaxis)) - panic("no yaxis for ellipse"); - if (!OV_pop_i(xaxis)) - panic("no xaxis for ellipse"); - if (!OV_pop_c(pt)) - panic("no pt for ellipse"); - get_location_coord(&x, &y, ANY_LOC, coder->croom, OV_i(pt)); - selection_do_ellipse(sel, x, y, OV_i(xaxis), OV_i(yaxis), - OV_i(filled)); - splev_stack_push(coder->stack, sel); - opvar_free(filled); - opvar_free(yaxis); - opvar_free(xaxis); - opvar_free(pt); - break; - } - case SPO_SEL_GRADIENT: { - struct opvar *gtyp, *glim, *mind, *maxd, *gcoord, *coord2; - struct opvar *sel; - schar x, y, x2, y2; - - if (!OV_pop_i(gtyp)) - panic("no gtyp for grad"); - if (!OV_pop_i(glim)) - panic("no glim for grad"); - if (!OV_pop_c(coord2)) - panic("no coord2 for grad"); - if (!OV_pop_c(gcoord)) - panic("no coord for grad"); - if (!OV_pop_i(maxd)) - panic("no maxd for grad"); - if (!OV_pop_i(mind)) - panic("no mind for grad"); - get_location_coord(&x, &y, ANY_LOC, coder->croom, OV_i(gcoord)); - get_location_coord(&x2, &y2, ANY_LOC, coder->croom, OV_i(coord2)); - - sel = selection_opvar((char *) 0); - selection_do_gradient(sel, x, y, x2, y2, OV_i(gtyp), OV_i(mind), - OV_i(maxd), OV_i(glim)); - splev_stack_push(coder->stack, sel); - - opvar_free(gtyp); - opvar_free(glim); - opvar_free(gcoord); - opvar_free(coord2); - opvar_free(maxd); - opvar_free(mind); - break; - } - default: - panic("sp_level_coder: Unknown opcode %i", coder->opcode); - } - - next_opcode: - coder->frame->n_opcode++; - } /*while*/ + if (!load_lua(name)) + goto give_up; link_doors_rooms(); fill_rooms(); remove_boundary_syms(); - if (coder->check_inaccessibles) + /* TODO: ensure_way_out() needs rewrite */ + if (g.coder->check_inaccessibles) ensure_way_out(); + /* FIXME: Ideally, we want this call to only cover areas of the map * which were not inserted directly by the special level file (see * the insect legs on Baalzebub's level, for instance). Since that @@ -5976,59 +5553,21 @@ sp_lev *lvl; count_features(); - if (coder->solidify) + if (g.coder->solidify) solidify_map(); /* This must be done before sokoban_detect(), * otherwise branch stairs won't be premapped. */ fixup_special(); - if (coder->premapped) + if (g.coder->premapped) sokoban_detect(); - if (coder->frame) { - struct sp_frame *tmpframe; - do { - tmpframe = coder->frame->next; - frame_del(coder->frame); - coder->frame = tmpframe; - } while (coder->frame); - } - Free(coder); - - return TRUE; -} - -/* - * General loader - */ -boolean -load_special(name) -const char *name; -{ - dlb *fd; - sp_lev *lvl = NULL; - boolean result = FALSE; - struct version_info vers_info; - - fd = dlb_fopen(name, RDBMODE); - if (!fd) - return FALSE; - Fread((genericptr_t) &vers_info, sizeof vers_info, 1, fd); - if (!check_version(&vers_info, name, TRUE, UTD_CHECKSIZES)) { - (void) dlb_fclose(fd); - goto give_up; - } - - lvl = (sp_lev *) alloc(sizeof (sp_lev)); - result = sp_level_loader(fd, lvl); - (void) dlb_fclose(fd); - if (result) - result = sp_level_coder(lvl); - sp_level_free(lvl); - Free(lvl); - + result = TRUE; give_up: + Free(g.coder); + g.coder = NULL; + return result; } diff --git a/src/steal.c b/src/steal.c index 7988b0316..e170cc50d 100644 --- a/src/steal.c +++ b/src/steal.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 steal.c $NHDT-Date: 1562806584 2019/07/11 00:56:24 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.74 $ */ +/* NetHack 3.6 steal.c $NHDT-Date: 1570566382 2019/10/08 20:26:22 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.75 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -218,7 +218,7 @@ boolean unchain_ball; /* whether to unpunish or just unwield */ Ring_gone(obj); } else if (obj->owornmask & W_TOOL) { Blindf_off(obj); - } else if (obj->owornmask & W_WEAPON) { + } else if (obj->owornmask & W_WEAPONS) { if (obj == uwep) uwepgone(); if (obj == uswapwep) diff --git a/src/steed.c b/src/steed.c index c303df2dd..5e92adf67 100644 --- a/src/steed.c +++ b/src/steed.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 steed.c $NHDT-Date: 1559670610 2019/06/04 17:50:10 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.66 $ */ +/* NetHack 3.7 steed.c $NHDT-Date: 1575245090 2019/12/02 00:04:50 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.68 $ */ /* Copyright (c) Kevin Hugo, 1998-1999. */ /* NetHack may be freely redistributed. See license for details. */ @@ -245,7 +245,7 @@ boolean force; /* Quietly force this animal */ } if (mtmp->data == &mons[PM_LONG_WORM] && (u.ux + u.dx != mtmp->mx || u.uy + u.dy != mtmp->my)) { - /* 3.6.2: test_move(below) is used to check for trying to mount + /* As of 3.6.2: test_move(below) is used to check for trying to mount diagonally into or out of a doorway or through a tight squeeze; attempting to mount a tail segment when hero was not adjacent to worm's head could trigger an impossible() in worm_cross() @@ -377,7 +377,7 @@ exercise_steed() void kick_steed() { - char He[4]; + char He[BUFSZ]; /* monverbself() appends to the "He"/"She"/"It" value */ if (!u.usteed) return; @@ -400,7 +400,9 @@ kick_steed() if (u.usteed->msleeping || !u.usteed->mcanmove) pline("%s stirs.", He); else - pline("%s rouses %sself!", He, mhim(u.usteed)); + /* if hallucinating, might yield "He rouses herself" or + "She rouses himself" */ + pline("%s!", monverbself(u.usteed, He, "rouse", (char *) 0)); } else pline("%s does not respond.", He); return; @@ -742,6 +744,8 @@ place_monster(mon, x, y) struct monst *mon; int x, y; { + struct monst *othermon; + const char *monnm, *othnm; char buf[QBUFSZ]; buf[0] = '\0'; @@ -749,8 +753,8 @@ int x, y; vault guards (either living or dead) are parked at <0,0> */ if (!isok(x, y) && (x != 0 || y != 0 || !mon->isgd)) { describe_level(buf); - impossible("trying to place monster at <%d,%d> mstate:%lx on %s", - x, y, mon->mstate, buf); + impossible("trying to place %s at <%d,%d> mstate:%lx on %s", + minimal_monnam(mon, TRUE), x, y, mon->mstate, buf); x = y = 0; } if (mon == u.usteed @@ -762,10 +766,12 @@ int x, y; mon->mstate, buf); return; } - if (g.level.monsters[x][y]) { + if ((othermon = g.level.monsters[x][y]) != 0) { describe_level(buf); - impossible("placing monster over another at <%d,%d>, mstates:%lx %lx on %s?", - x, y, g.level.monsters[x][y]->mstate, mon->mstate, buf); + monnm = minimal_monnam(mon, FALSE); + othnm = (mon != othermon) ? minimal_monnam(othermon, TRUE) : "itself"; + impossible("placing %s over %s at <%d,%d>, mstates:%lx %lx on %s?", + monnm, othnm, x, y, othermon->mstate, mon->mstate, buf); } mon->mx = x, mon->my = y; g.level.monsters[x][y] = mon; diff --git a/src/sys.c b/src/sys.c index 520f4c758..63a48ab7d 100644 --- a/src/sys.c +++ b/src/sys.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 sys.c $NHDT-Date: 1547118632 2019/01/10 11:10:32 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.43 $ */ +/* NetHack 3.6 sys.c $NHDT-Date: 1575665952 2019/12/06 20:59:12 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.46 $ */ /* Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008. */ /* NetHack may be freely redistributed. See license for details. */ @@ -80,6 +80,12 @@ sys_early_init() sysopt.check_plname = 0; sysopt.seduce = 1; /* if it's compiled in, default to on */ sysopt_seduce_set(sysopt.seduce); + /* default to little-endian in 3.7 */ + sysopt.saveformat[0] = sysopt.bonesformat[0] = lendian; + sysopt.accessibility = 0; +#ifdef WIN32 + sysopt.portable_device_paths = 0; +#endif return; } @@ -106,12 +112,11 @@ sysopt_release() if (sysopt.genericusers) free((genericptr_t) sysopt.genericusers), sysopt.genericusers = (char *) 0; -#ifdef PANICTRACE if (sysopt.gdbpath) free((genericptr_t) sysopt.gdbpath), sysopt.gdbpath = (char *) 0; if (sysopt.greppath) free((genericptr_t) sysopt.greppath), sysopt.greppath = (char *) 0; -#endif + /* this one's last because it might be used in panic feedback, although none of the preceding ones are likely to trigger a controlled panic */ if (sysopt.fmtd_wizard_list) diff --git a/src/teleport.c b/src/teleport.c index febb6221b..8c6af94b6 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 teleport.c $NHDT-Date: 1564771880 2019/08/02 18:51:20 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.92 $ */ +/* NetHack 3.6 teleport.c $NHDT-Date: 1576288434 2019/12/14 01:53:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.106 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -260,8 +260,13 @@ teleok(x, y, trapok) register int x, y; boolean trapok; { - if (!trapok && t_at(x, y)) - return FALSE; + if (!trapok) { + /* allow teleportation onto vibrating square, it's not a real trap */ + struct trap *trap = t_at(x, y); + + if (trap && trap->ttyp != VIBRATING_SQUARE) + return FALSE; + } if (!goodpos(x, y, &g.youmonst, 0)) return FALSE; if (!tele_jump_ok(u.ux, u.uy, x, y)) @@ -302,9 +307,9 @@ boolean allow_drag; * rock in the way), in which case it teleports the ball on its own. */ if (ball_active) { - if (!carried(uball) && distmin(nux, nuy, uball->ox, uball->oy) <= 2) + if (!carried(uball) && distmin(nux, nuy, uball->ox, uball->oy) <= 2) { ball_still_in_range = TRUE; /* don't have to move the ball */ - else { + } else { /* have to move the ball */ if (!allow_drag || distmin(u.ux, u.uy, nux, nuy) > 1) { /* we should not have dist > 1 and allow_drag at the same @@ -341,8 +346,13 @@ boolean allow_drag; boolean cause_delay; if (drag_ball(nux, nuy, &bc_control, &ballx, &bally, &chainx, - &chainy, &cause_delay, allow_drag)) + &chainy, &cause_delay, allow_drag)) { move_bc(0, bc_control, ballx, bally, chainx, chainy); + } else { + /* dragging fails if hero is encumbered beyond 'burdened' */ + allow_drag = FALSE; /* teleport b&c to hero's new spot */ + unplacebc(); /* to match placebc() below */ + } } } /* must set u.ux, u.uy after drag_ball(), which may need to know @@ -682,7 +692,7 @@ boolean break_the_rules; /* True: wizard mode ^T */ if (!Teleportation || (u.ulevel < (Role_if(PM_WIZARD) ? 8 : 12) && !can_teleport(g.youmonst.data))) { /* Try to use teleport away spell. - 3.6.2: this used to require that you know the spellbook + Prior to 3.6.2 this used to require that you know the spellbook (probably just intended as an optimization to skip the lookup loop) but it is possible to know and cast a spell after forgetting its book due to amnesia. */ diff --git a/src/timeout.c b/src/timeout.c index d34955c5b..5ded81904 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -1,12 +1,9 @@ -/* NetHack 3.6 timeout.c $NHDT-Date: 1565574996 2019/08/12 01:56:36 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.92 $ */ +/* NetHack 3.6 timeout.c $NHDT-Date: 1573290422 2019/11/09 09:07:02 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.93 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" -#include "lev.h" /* for checking save modes */ -#include "sfproto.h" - static void NDECL(stoned_dialogue); static void NDECL(vomiting_dialogue); @@ -95,7 +92,7 @@ const struct propname { { UNCHANGING, "unchanging" }, { REFLECTING, "reflecting" }, { FREE_ACTION, "free action" }, - { FIXED_ABIL, "fixed abilites" }, + { FIXED_ABIL, "fixed abilities" }, { LIFESAVED, "life will be saved" }, { 0, 0 }, }; @@ -727,6 +724,9 @@ nh_timeout() case DETECT_MONSTERS: see_monsters(); break; + case GLIB: + make_glib(0); /* might update persistent inventory */ + break; } } @@ -1397,7 +1397,7 @@ long timeout; break; /* case [otyp ==] candelabrum|tallow_candle|wax_candle */ default: - impossible("burn_object: unexpeced obj %s", xname(obj)); + impossible("burn_object: unexpected obj %s", xname(obj)); break; } if (need_newsym) @@ -2162,16 +2162,12 @@ timer_element *timer; /* assume no pointers in arg */ if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) timer, sizeof(timer_element)); - if (nhfp->fieldlevel) - sfo_fe(nhfp, timer, "timers", "timer", 1); break; case TIMER_OBJECT: if (timer->needs_fixup) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t)timer, sizeof(timer_element)); - if (nhfp->fieldlevel) - sfo_fe(nhfp, timer, "timers", "timer", 1); } else { /* replace object pointer with id */ arg_save.a_obj = timer->arg.a_obj; @@ -2180,8 +2176,6 @@ timer_element *timer; timer->needs_fixup = 1; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t)timer, sizeof(timer_element)); - if (nhfp->fieldlevel) - sfo_fe(nhfp, timer, "timers", "timer", 1); timer->arg.a_obj = arg_save.a_obj; timer->needs_fixup = 0; } @@ -2191,8 +2185,6 @@ timer_element *timer; if (timer->needs_fixup) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t)timer, sizeof(timer_element)); - if (nhfp->fieldlevel) - sfo_fe(nhfp, timer, "timers", "timer", 1); } else { /* replace monster pointer with id */ arg_save.a_monst = timer->arg.a_monst; @@ -2201,8 +2193,6 @@ timer_element *timer; timer->needs_fixup = 1; if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t)timer, sizeof(timer_element)); - if (nhfp->fieldlevel) - sfo_fe(nhfp, timer, "timers", "timer", 1); timer->arg.a_monst = arg_save.a_monst; timer->needs_fixup = 0; } @@ -2340,14 +2330,10 @@ int range; if (range == RANGE_GLOBAL) { if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &g.timer_id, sizeof(g.timer_id)); - if (nhfp->fieldlevel) - sfo_ulong(nhfp, &g.timer_id, "timers", "g.timer_id", 1); } count = maybe_write_timer(nhfp, range, FALSE); if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &count, sizeof count); - if (nhfp->fieldlevel) - sfo_int(nhfp, &count, "timers", "timer_count", 1); (void) maybe_write_timer(nhfp, range, TRUE); } @@ -2380,28 +2366,22 @@ int range; boolean ghostly; /* restoring from a ghost level */ long adjust; /* how much to adjust timeout */ { - int count; + int count = 0; timer_element *curr; if (range == RANGE_GLOBAL) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &g.timer_id, sizeof g.timer_id); - if (nhfp->fieldlevel) - sfi_ulong(nhfp, &g.timer_id, "timers", "g.timer_id", 1); } /* restore elements */ if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &count, sizeof count); - if (nhfp->fieldlevel) - sfi_int(nhfp, &count, "timers", "timer_count", 1); while (count-- > 0) { curr = (timer_element *) alloc(sizeof(timer_element)); if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) curr, sizeof(timer_element)); - if (nhfp->fieldlevel) - sfi_fe(nhfp, curr, "timers", "timer", 1); if (ghostly) curr->timeout += adjust; insert_timer(curr); diff --git a/src/topten.c b/src/topten.c index 22347595d..34c43e536 100644 --- a/src/topten.c +++ b/src/topten.c @@ -11,11 +11,13 @@ #include "patchlevel.h" #endif -#ifdef VMS -/* We don't want to rewrite the whole file, because that entails - creating a new version which requires that the old one be deletable. */ -#define UPDATE_RECORD_IN_PLACE -#endif +/* If UPDATE_RECORD_IN_PLACE is defined, we don't want to rewrite the + * whole file, because that entails creating a new version which + * requires that the old one be deletable. UPDATE_RECORD_IN_PLACE + * had to be defined more centrally in 3.7 to ensure that the + * final_fpos field gets included in struct instance_globals aka 'g'. +*/ + /* * Updating in place can leave junk at the end of the file in some diff --git a/src/trap.c b/src/trap.c index 59eee97bb..2b6633e94 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 trap.c $NHDT-Date: 1569189770 2019/09/22 22:02:50 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.317 $ */ +/* NetHack 3.6 trap.c $NHDT-Date: 1576638501 2019/12/18 03:08:21 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.329 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -440,13 +440,15 @@ int x, y, typ; } void -fall_through(td) +fall_through(td, ftflags) boolean td; /* td == TRUE : trap door or hole */ +unsigned ftflags; { d_level dtmp; char msgbuf[BUFSZ]; const char *dont_fall = 0; int newlevel, bottom; + struct trap *t = (struct trap *) 0; /* we'll fall even while levitating in Sokoban; otherwise, if we won't fall and won't be told that we aren't falling, give up now */ @@ -469,10 +471,9 @@ boolean td; /* td == TRUE : trap door or hole */ } while (!rn2(4) && newlevel < bottom); if (td) { - struct trap *t = t_at(u.ux, u.uy); - + t = t_at(u.ux, u.uy); feeltrap(t); - if (!Sokoban) { + if (!Sokoban && !(ftflags & TOOKPLUNGE)) { if (t->ttyp == TRAPDOOR) pline("A trap door opens up under you!"); else @@ -484,8 +485,10 @@ boolean td; /* td == TRUE : trap door or hole */ if (Sokoban && Can_fall_thru(&u.uz)) ; /* KMH -- You can't escape the Sokoban level traps */ else if (Levitation || u.ustuck - || (!Can_fall_thru(&u.uz) && !levl[u.ux][u.uy].candig) || Flying - || is_clinger(g.youmonst.data) + || (!Can_fall_thru(&u.uz) && !levl[u.ux][u.uy].candig) + || ((Flying || is_clinger(g.youmonst.data) + || (ceiling_hider(g.youmonst.data) && u.uundetected)) + && !(ftflags & TOOKPLUNGE)) || (Inhell && !u.uevent.invoked && newlevel == bottom)) { dont_fall = "don't fall in."; } else if (g.youmonst.data->msize >= MZ_HUGE) { @@ -503,6 +506,13 @@ boolean td; /* td == TRUE : trap door or hole */ } return; } + if ((Flying || is_clinger(g.youmonst.data)) + && (ftflags & TOOKPLUNGE) && td && t) + You("%s down %s!", + Flying ? "swoop" : "deliberately drop", + (t->ttyp == TRAPDOOR) + ? "through the trap door" + : "into the gaping hole"); if (*u.ushops) shopdig(1); @@ -1283,7 +1293,7 @@ unsigned trflags; trapname(ttype, TRUE)); break; /* don't activate it after all */ } - fall_through(TRUE); + fall_through(TRUE, (trflags & TOOKPLUNGE)); break; case TELEP_TRAP: @@ -1588,7 +1598,7 @@ struct obj *otmp; switch (tt) { case ARROW_TRAP: if (!otmp) { - impossible("steed hit by non-existant arrow?"); + impossible("steed hit by non-existent arrow?"); return 0; } trapkilled = thitm(8, steed, otmp, 0, FALSE); @@ -1596,7 +1606,7 @@ struct obj *otmp; break; case DART_TRAP: if (!otmp) { - impossible("steed hit by non-existant dart?"); + impossible("steed hit by non-existent dart?"); return 0; } trapkilled = thitm(7, steed, otmp, 0, FALSE); @@ -1624,13 +1634,20 @@ struct obj *otmp; break; case POLY_TRAP: if (!resists_magm(steed) && !resist(steed, WAND_CLASS, 0, NOTELL)) { + struct permonst *mdat = steed->data; + (void) newcham(steed, (struct permonst *) 0, FALSE, FALSE); - if (!can_saddle(steed) || !can_ride(steed)) + if (!can_saddle(steed) || !can_ride(steed)) { dismount_steed(DISMOUNT_POLY); - else - You("have to adjust yourself in the saddle on %s.", - x_monnam(steed, ARTICLE_A, (char *) 0, SUPPRESS_SADDLE, - FALSE)); + } else { + char buf[BUFSZ]; + + Strcpy(buf, x_monnam(steed, ARTICLE_YOUR, (char *) 0, + SUPPRESS_SADDLE, FALSE)); + if (mdat != steed->data) + (void) strsubst(buf, "your ", "your new "); + You("adjust yourself in the saddle on %s.", buf); + } } steedhit = TRUE; break; @@ -1827,7 +1844,6 @@ int style; g.bhitpos.x += dx; g.bhitpos.y += dy; - t = t_at(g.bhitpos.x, g.bhitpos.y); if ((mtmp = m_at(g.bhitpos.x, g.bhitpos.y)) != 0) { if (otyp == BOULDER && throws_rocks(mtmp->data)) { @@ -1862,7 +1878,7 @@ int style; break; } } - if (t && otyp == BOULDER) { + if ((t = t_at(g.bhitpos.x, g.bhitpos.y)) != 0 && otyp == BOULDER) { switch (t->ttyp) { case LANDMINE: if (rn2(10) > 2) { @@ -2155,6 +2171,7 @@ register struct monst *mtmp; inescapable = g.force_mintrap || ((tt == HOLE || tt == PIT) && Sokoban && !trap->madeby_u); const char *fallverb; + xchar tx = trap->tx, ty = trap->ty; /* true when called from dotrap, inescapable is not an option */ if (mtmp == u.usteed) @@ -2624,7 +2641,8 @@ register struct monst *mtmp; a_your[trap->madeby_u]); } if (!in_sight && !Deaf) - pline("Kaablamm! You hear an explosion in the distance!"); + pline("Kaablamm! %s an explosion in the distance!", + "You hear"); /* Deaf-aware */ blow_up_landmine(trap); /* explosion might have destroyed a drawbridge; don't dish out more damage if monster is already dead */ @@ -2637,7 +2655,7 @@ register struct monst *mtmp; trapkilled = TRUE; } /* a boulder may fill the new pit, crushing monster */ - fill_pit(trap->tx, trap->ty); + fill_pit(tx, ty); /* thitm may have already destroyed the trap */ if (DEADMONSTER(mtmp)) trapkilled = TRUE; if (unconscious()) { @@ -3454,7 +3472,7 @@ struct obj *obj; grease_protect(obj, (char *) 0, victim); } else if (obj->oclass == SCROLL_CLASS && obj->otyp != SCR_BLANK_PAPER) { if (obj->otyp != SCR_BLANK_PAPER -#ifdef MAIL +#ifdef MAIL_STRUCTURES && obj->otyp != SCR_MAIL #endif ) { @@ -3530,7 +3548,7 @@ boolean force; return ER_NOTHING; } else if (obj->oclass == SCROLL_CLASS) { if (obj->otyp == SCR_BLANK_PAPER -#ifdef MAIL +#ifdef MAIL_STRUCTURES || obj->otyp == SCR_MAIL #endif ) return 0; @@ -3708,6 +3726,7 @@ drown() boolean inpool_ok = FALSE, crawl_ok; int i, x, y; + feel_newsym(u.ux, u.uy); /* in case Blind, map the water here */ /* happily wading in the same contiguous pool */ if (u.uinwater && is_pool(u.ux - u.dx, u.uy - u.dy) && (Swimming || Amphibious)) { @@ -4323,8 +4342,8 @@ struct trap *ttmp; You("pull %s out of the pit.", mon_nam(mtmp)); mtmp->mtrapped = 0; - fill_pit(mtmp->mx, mtmp->my); reward_untrap(ttmp, mtmp); + fill_pit(mtmp->mx, mtmp->my); return 1; } @@ -5080,11 +5099,21 @@ boolean uteetering_at_seen_pit(trap) struct trap *trap; { - if (trap && trap->tseen && (!u.utrap || u.utraptype != TT_PIT) - && is_pit(trap->ttyp)) - return TRUE; - else - return FALSE; + return (trap && is_pit(trap->ttyp) && trap->tseen + && trap->tx == u.ux && trap->ty == u.uy + && !(u.utrap && u.utraptype == TT_PIT)); +} + +/* + * Returns TRUE if you didn't fall through a hole or didn't + * release a trap door + */ +boolean +uescaped_shaft(trap) +struct trap *trap; +{ + return (trap && is_hole(trap->ttyp) && trap->tseen + && trap->tx == u.ux && trap->ty == u.uy); } /* Destroy a trap that emanates from the floor. */ @@ -5212,6 +5241,7 @@ lava_effects() int dmg = d(6, 6); /* only applicable for water walking */ boolean usurvive, boil_away; + feel_newsym(u.ux, u.uy); /* in case Blind, map the lava here */ burn_away_slime(); if (likes_lava(g.youmonst.data)) return FALSE; @@ -5336,7 +5366,10 @@ sink_into_lava() static const char sink_deeper[] = "You sink deeper into the lava."; if (!u.utrap || u.utraptype != TT_LAVA) { - ; /* do nothing; this shouldn't happen */ + ; /* do nothing; this usually won't happen but could after + * polymorphing from a flier into a ceiling hider and then hiding; + * allmain() only checks whether the hero is at a lava location, + * not whether he or she is currently sinking */ } else if (!is_lava(u.ux, u.uy)) { reset_utrap(FALSE); /* this shouldn't happen either */ } else if (!u.uinvulnerable) { diff --git a/src/u_init.c b/src/u_init.c index 5ecbf7562..707117dca 100644 --- a/src/u_init.c +++ b/src/u_init.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 u_init.c $NHDT-Date: 1539510426 2018/10/14 09:47:06 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.43 $ */ +/* NetHack 3.6 u_init.c $NHDT-Date: 1575245094 2019/12/02 00:04:54 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.60 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2017. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1110,7 +1110,7 @@ register struct trobj *trop; if (obj->oclass == ARMOR_CLASS) { if (is_shield(obj) && !uarms && !(uwep && bimanual(uwep))) { setworn(obj, W_ARMS); - /* 3.6.2: this used to unset uswapwep if it was set, but + /* Prior to 3.6.2 this used to unset uswapwep if it was set, but wearing a shield doesn't prevent having an alternate weapon ready to swap with the primary; just make sure we aren't two-weaponing (academic; no one starts that way) */ diff --git a/src/uhitm.c b/src/uhitm.c index 0848d9513..9f2b1236a 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 uhitm.c $NHDT-Date: 1567805813 2019/09/06 21:36:53 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.212 $ */ +/* NetHack 3.6 uhitm.c $NHDT-Date: 1573764936 2019/11/14 20:55:36 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.215 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -691,10 +691,8 @@ int dieroll; long silverhit = 0L; int wtype; struct obj *monwep; - char unconventional[BUFSZ]; /* substituted for word "attack" in msg */ char saved_oname[BUFSZ]; - unconventional[0] = '\0'; saved_oname[0] = '\0'; wakeup(mon, TRUE); @@ -867,7 +865,6 @@ int dieroll; } else { if (mdat == &mons[PM_SHADE] && !shade_aware(obj)) { tmp = 0; - Strcpy(unconventional, cxname(obj)); } else { switch (obj->otyp) { case BOULDER: /* 1d20 */ @@ -1138,21 +1135,14 @@ int dieroll; poiskilled = TRUE; } if (tmp < 1) { + boolean mon_is_shade = (mon->data == &mons[PM_SHADE]); + /* make sure that negative damage adjustment can't result in inadvertently boosting the victim's hit points */ - tmp = 0; - if (mdat == &mons[PM_SHADE]) { - if (!hittxt) { - const char *what = *unconventional ? unconventional : "attack"; - - Your("%s %s harmlessly through %s.", what, - vtense(what, "pass"), mon_nam(mon)); - hittxt = TRUE; - } - } else { - if (get_dmg_bonus) - tmp = 1; - } + tmp = (get_dmg_bonus && !mon_is_shade) ? 1 : 0; + if (mon_is_shade && !hittxt + && thrown != HMON_THROWN && thrown != HMON_KICKED) + hittxt = shade_miss(&g.youmonst, mon, obj, FALSE, TRUE); } if (jousting) { @@ -1362,6 +1352,44 @@ struct obj *obj; return FALSE; } +/* used for hero vs monster and monster vs monster; also handles + monster vs hero but that won't happen because hero can't be a shade */ +boolean +shade_miss(magr, mdef, obj, thrown, verbose) +struct monst *magr, *mdef; +struct obj *obj; +boolean thrown, verbose; +{ + const char *what, *whose, *target; + boolean youagr = (magr == &g.youmonst), youdef = (mdef == &g.youmonst); + + /* we're using dmgval() for zero/not-zero, not for actual damage amount */ + if (mdef->data != &mons[PM_SHADE] || (obj && dmgval(obj, mdef))) + return FALSE; + + if (verbose + && ((youdef || cansee(mdef->mx, mdef->my) || sensemon(mdef)) + || (magr == &g.youmonst && distu(mdef->mx, mdef->my) <= 2))) { + static const char harmlessly_thru[] = " harmlessly through "; + + what = (!obj || shade_aware(obj)) ? "attack" : cxname(obj); + target = youdef ? "you" : mon_nam(mdef); + if (!thrown) { + whose = youagr ? "Your" : s_suffix(Monnam(magr)); + pline("%s %s %s%s%s.", whose, what, + vtense(what, "pass"), harmlessly_thru, target); + } else { + pline("%s %s%s%s.", The(what), /* note: not pline_The() */ + vtense(what, "pass"), harmlessly_thru, target); + } + if (!youdef && !canspotmon(mdef)) + map_invisible(mdef->mx, mdef->my); + } + if (!youdef) + mdef->msleeping = 0; + return TRUE; +} + /* check whether slippery clothing protects from hug or wrap attack */ /* [currently assumes that you are the attacker] */ static boolean diff --git a/src/vault.c b/src/vault.c index 1982a6271..06da2bbce 100644 --- a/src/vault.c +++ b/src/vault.c @@ -775,9 +775,10 @@ register struct monst *grd; if (!u_in_vault && (grd_in_vault || (in_fcorridor(grd, grd->mx, grd->my) && !in_fcorridor(grd, u.ux, u.uy)))) { - (void) rloc(grd, FALSE); + (void) rloc(grd, TRUE); wallify_vault(grd); - (void) clear_fcorr(grd, TRUE); + if (!in_fcorridor(grd, grd->mx, grd->my)) + (void) clear_fcorr(grd, TRUE); goto letknow; } if (!in_fcorridor(grd, grd->mx, grd->my)) diff --git a/src/version.c b/src/version.c index 3eedd3ac9..c2b5ab416 100644 --- a/src/version.c +++ b/src/version.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 version.c $NHDT-Date: 1552353060 2019/03/12 01:11:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.52 $ */ +/* NetHack 3.6 version.c $NHDT-Date: 1575161965 2019/12/01 00:59:25 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.69 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -6,8 +6,6 @@ #include "hack.h" #include "dlb.h" #include "date.h" -#include "lev.h" -#include "sfproto.h" /* * All the references to the contents of patchlevel.h have been moved @@ -19,11 +17,48 @@ #include "patchlevel.h" #endif +#if defined(CROSSCOMPILE) +struct cross_target_s cross_target = { + /* https://groups.google.com/forum/#!original/ + comp.sources.games/91SfKYg_xzI/dGnR3JnspFkJ */ + "Tue, 28-Jul-87 13:18:57 EDT", + "Version 1.0, built Jul 28 13:18:57 1987.", + "0000000000000000000000000000000000000000", + "master", + "1.0.0-0", + "NetHack Version 1.0.0-0 - last build Tue Jul 28 13:18:57 1987.", + 0x01010000UL, + 0x00000000UL, + 0x00000000UL, + 0x00000000UL, + 0x00000000UL, + 0x00000000UL, + 554476737UL, +}; +#endif /* CROSSCOMPILE */ + #if defined(NETHACK_GIT_SHA) -const char *NetHack_git_sha = NETHACK_GIT_SHA; +const char *NetHack_git_sha +#if !defined(CROSSCOMPILE) || (defined(CROSSCOMPILE) && defined(CROSSCOMPILE_HOST)) + = NETHACK_GIT_SHA +#else +#ifdef NETHACK_HOST_GIT_SHA + = NETHACK_HOST_GIT_SHA #endif +#endif +; +#endif + #if defined(NETHACK_GIT_BRANCH) -const char *NetHack_git_branch = NETHACK_GIT_BRANCH; +const char *NetHack_git_branch +#if !defined(CROSSCOMPILE) || (defined(CROSSCOMPILE) && defined(CROSSCOMPILE_HOST)) + = NETHACK_GIT_BRANCH +#else +#ifdef NETHACK_HOST_GIT_BRANCH + = NETHACK_HOST_GIT_BRANCH +#endif +#endif +; #endif static void FDECL(insert_rtoption, (char *)); @@ -98,9 +133,38 @@ doversion() int doextversion() { - dlb *f; + int rtcontext = 0; + const char *rtbuf; + dlb *f = (dlb *) 0; char buf[BUFSZ], *p = 0; winid win = create_nhwindow(NHW_TEXT); + boolean use_dlb = TRUE, + done_rt = FALSE, + done_dlb = FALSE, + prolog; +#if 0 /* moved to util/mdlib.c and rendered via do_runtime_info() */ + const char *lua_info[] = { + "About Lua: Copyright (c) 1994-2017 Lua.org, PUC-Rio.", + /* 1 2 3 4 5 6 7 + 1234567890123456789012345678901234567890123456789012345678901234567890123456789 + */ + " \"Permission is hereby granted, free of charge, to any person obtaining", + " a copy of this software and associated documentation files (the ", + " \"Software\"), to deal in the Software without restriction including", + " without limitation the rights to use, copy, modify, merge, publish,", + " distribute, sublicense, and/or sell copies of the Software, and to ", + " permit persons to whom the Software is furnished to do so, subject to", + " the following conditions:", + " The above copyright notice and this permission notice shall be", + " included in all copies or substantial portions of the Software.\"", + (const char *) 0 + }; +#endif /*0*/ +#if defined(OPTIONS_AT_RUNTIME) || defined(CROSSCOMPILE_TARGET) + use_dlb = FALSE; +#else + done_rt = TRUE; +#endif /* instead of using ``display_file(OPTIONS_USED,TRUE)'' we handle the file manually so we can include dynamic version info */ @@ -119,58 +183,76 @@ doextversion() putstr(win, 0, p); } - f = dlb_fopen(OPTIONS_USED, "r"); - if (!f) { - putstr(win, 0, ""); - Sprintf(buf, "[Configuration '%s' not available?]", OPTIONS_USED); - putstr(win, 0, buf); - } else { - /* - * already inserted above: - * + outdented program name and version plus build date and time - * dat/options; display contents with lines prefixed by '-' deleted: - * - blank-line - * - indented program name and version - * blank-line - * outdented feature header - * - blank-line - * indented feature list - * spread over multiple lines - * blank-line - * outdented windowing header - * - blank-line - * indented windowing choices with - * optional second line for default - * - blank-line - * - EOF - */ - boolean prolog = TRUE; /* to skip indented program name */ - - while (dlb_fgets(buf, BUFSZ, f)) { - (void) strip_newline(buf); - if (index(buf, '\t') != 0) - (void) tabexpand(buf); - - if (*buf && *buf != ' ') { - /* found outdented header; insert a separator since we'll - have skipped corresponding blank line inside the file */ - putstr(win, 0, ""); - prolog = FALSE; - } - /* skip blank lines and prolog (progame name plus version) */ - if (prolog || !*buf) - continue; - - if (index(buf, ':')) - insert_rtoption(buf); - - if (*buf) - putstr(win, 0, buf); + if (use_dlb) { + f = dlb_fopen(OPTIONS_USED, "r"); + if (!f) { + putstr(win, 0, ""); + Sprintf(buf, "[Configuration '%s' not available?]", OPTIONS_USED); + putstr(win, 0, buf); + done_dlb = TRUE; } - (void) dlb_fclose(f); - display_nhwindow(win, FALSE); - destroy_nhwindow(win); } + /* + * already inserted above: + * + outdented program name and version plus build date and time + * dat/options; display contents with lines prefixed by '-' deleted: + * - blank-line + * - indented program name and version + * blank-line + * outdented feature header + * - blank-line + * indented feature list + * spread over multiple lines + * blank-line + * outdented windowing header + * - blank-line + * indented windowing choices with + * optional second line for default + * - blank-line + * - EOF + */ + + prolog = TRUE; /* to skip indented program name */ + for (;;) { + if (use_dlb && !done_dlb) { + if (!dlb_fgets(buf, BUFSZ, f)) { + done_dlb = TRUE; + continue; + } + } else if (!done_rt) { + if (!(rtbuf = do_runtime_info(&rtcontext))) { + done_rt = TRUE; + continue; + } + (void) strncpy(buf, rtbuf, BUFSZ - 1); + buf[BUFSZ - 1] = '\0'; + } else { + break; + } + (void) strip_newline(buf); + if (index(buf, '\t') != 0) + (void) tabexpand(buf); + + if (*buf && *buf != ' ') { + /* found outdented header; insert a separator since we'll + have skipped corresponding blank line inside the file */ + putstr(win, 0, ""); + prolog = FALSE; + } + /* skip blank lines and prolog (progame name plus version) */ + if (prolog || !*buf) + continue; + + if (index(buf, ':')) + insert_rtoption(buf); + + if (*buf) + putstr(win, 0, buf); + } + if (use_dlb) + (void) dlb_fclose(f); + display_nhwindow(win, FALSE); + destroy_nhwindow(win); return 0; } @@ -219,6 +301,8 @@ static struct rt_opt { const char *token, *value; } rt_opts[] = { { ":PATMATCH:", regex_id }, + { ":LUAVERSION:", (const char *) g.lua_ver }, + { ":LUACOPYRIGHT:", (const char *) g.lua_copyright }, }; /* @@ -233,9 +317,13 @@ char *buf; { int i; + if (!g.lua_ver[0]) + get_lua_version(); + for (i = 0; i < SIZE(rt_opts); ++i) { - if (strstri(buf, rt_opts[i].token)) + if (strstri(buf, rt_opts[i].token) && *rt_opts[i].value) { (void) strsubst(buf, rt_opts[i].token, rt_opts[i].value); + } /* we don't break out of the loop after a match; there might be other matches on the same line */ } @@ -309,26 +397,17 @@ unsigned long utdflags; if (rlen == 0) return FALSE; } - if (nhfp->fieldlevel) { - sfi_char(nhfp, &indicator, "indicate", "format", 1); - sfi_int(nhfp, &filecmc, "validate", "critical_members_count", 1); - cmc = critical_members_count(); - } if (cmc != filecmc) return FALSE; - if (nhfp->fieldlevel && (nhfp->fnidx > historical)) { - sfi_version_info(nhfp, &vers_info, "version", "version_info", 1); - } else { - rlen = read(nhfp->fd, (genericptr_t) &vers_info, sizeof vers_info); - minit(); /* ZEROCOMP */ - if (rlen == 0) { - if (verbose) { - pline("File \"%s\" is empty?", name); - wait_synch(); - } - return FALSE; + rlen = read(nhfp->fd, (genericptr_t) &vers_info, sizeof vers_info); + minit(); /* ZEROCOMP */ + if (rlen == 0) { + if (verbose) { + pline("File \"%s\" is empty?", name); + wait_synch(); } + return FALSE; } if (!check_version(&vers_info, name, verbose, utdflags)) { @@ -347,17 +426,6 @@ NHFILE *nhfp; int cmc = 0; if (nhfp->mode & WRITING) { - if (nhfp->fieldlevel) { - indicate = (nhfp->fnidx == ascii) ? 'a' : 'l'; - sfo_char(nhfp, &indicate, "indicate", "format", 1); - cmc = critical_members_count(); - { -#if 0 - pline("critical-members=%d.", cmc); -#endif - } - sfo_int(nhfp, &cmc, "validate", "critical_members_count", 1); - } if (nhfp->structlevel) { indicate = 'h'; /* historical */ bwrite(nhfp->fd, (genericptr_t) &indicate, sizeof indicate); @@ -370,11 +438,23 @@ void store_version(nhfp) NHFILE *nhfp; { +#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_HOST) static const struct version_info version_data = { VERSION_NUMBER, VERSION_FEATURES, VERSION_SANITY1, VERSION_SANITY2, VERSION_SANITY3 +#else + struct version_info version_data = { + 0UL,0UL,0UL,0UL,0Ul +#endif }; +#if defined(CROSSCOMPILE) && !defined(CROSSCOMPILE_HOST) + version_data.incarnation = VERSION_NUMBER; /* actual version number */ + version_data.feature_set = VERSION_FEATURES; /* bitmask of config settings */ + version_data.entity_count = VERSION_SANITY1; /* # of monsters and objects */ + version_data.struct_sizes1 = VERSION_SANITY2; /* size of key structs */ + version_data.struct_sizes2 = VERSION_SANITY3; /* size of more key structs */ +#endif if (nhfp->structlevel) { bufoff(nhfp->fd); /* bwrite() before bufon() uses plain write() */ @@ -383,11 +463,6 @@ NHFILE *nhfp; (unsigned) (sizeof version_data)); bufon(nhfp->fd); } - if (nhfp->fieldlevel) { - store_formatindicator(nhfp); - sfo_version_info(nhfp, (struct version_info *) &version_data, - "version", "version_info", 1); - } return; } diff --git a/src/windows.c b/src/windows.c index dfb3f3629..e51929a57 100644 --- a/src/windows.c +++ b/src/windows.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 windows.c $NHDT-Date: 1526933747 2018/05/21 20:15:47 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.48 $ */ +/* NetHack 3.6 windows.c $NHDT-Date: 1575245096 2019/12/02 00:04:56 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.60 $ */ /* Copyright (c) D. Cohrs, 1993. */ /* NetHack may be freely redistributed. See license for details. */ @@ -523,7 +523,9 @@ static void FDECL(hup_void_fdecl_winid, (winid)); static void FDECL(hup_void_fdecl_constchar_p, (const char *)); static struct window_procs hup_procs = { - "hup", 0L, 0L, hup_init_nhwindows, + "hup", 0L, 0L, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + hup_init_nhwindows, hup_void_ndecl, /* player_selection */ hup_void_ndecl, /* askname */ hup_void_ndecl, /* get_nh_event */ @@ -1089,12 +1091,13 @@ static FILE *dumplog_file; #ifdef DUMPLOG static time_t dumplog_now; -static char *FDECL(dump_fmtstr, (const char *, char *)); - -static char * -dump_fmtstr(fmt, buf) +char * +dump_fmtstr(fmt, buf, fullsubs) const char *fmt; char *buf; +boolean fullsubs; /* True -> full substitution for file name, False -> + * partial substitution for '--showpaths' feedback + * where there's no game in progress when executed */ { const char *fp = fmt; char *bp = buf; @@ -1117,7 +1120,7 @@ char *buf; * may or may not interfere with that usage.] */ - while (fp && *fp && len < BUFSZ-1) { + while (fp && *fp && len < BUFSZ - 1) { if (*fp == '%') { fp++; switch (*fp) { @@ -1128,38 +1131,68 @@ char *buf; Sprintf(tmpbuf, "%%"); break; case 't': /* game start, timestamp */ - Sprintf(tmpbuf, "%lu", (unsigned long) ubirthday); + if (fullsubs) + Sprintf(tmpbuf, "%lu", (unsigned long) ubirthday); + else + Strcpy(tmpbuf, "{game start cookie}"); break; case 'T': /* current time, timestamp */ - Sprintf(tmpbuf, "%lu", (unsigned long) now); + if (fullsubs) + Sprintf(tmpbuf, "%lu", (unsigned long) now); + else + Strcpy(tmpbuf, "{current time cookie}"); break; case 'd': /* game start, YYYYMMDDhhmmss */ - Sprintf(tmpbuf, "%08ld%06ld", - yyyymmdd(ubirthday), hhmmss(ubirthday)); + if (fullsubs) + Sprintf(tmpbuf, "%08ld%06ld", + yyyymmdd(ubirthday), hhmmss(ubirthday)); + else + Strcpy(tmpbuf, "{game start date+time}"); break; case 'D': /* current time, YYYYMMDDhhmmss */ - Sprintf(tmpbuf, "%08ld%06ld", yyyymmdd(now), hhmmss(now)); + if (fullsubs) + Sprintf(tmpbuf, "%08ld%06ld", yyyymmdd(now), hhmmss(now)); + else + Strcpy(tmpbuf, "{current date+time}"); break; - case 'v': /* version, eg. "3.6.2-0" */ + case 'v': /* version, eg. "3.6.4-0" */ Sprintf(tmpbuf, "%s", version_string(verbuf)); break; case 'u': /* UID */ Sprintf(tmpbuf, "%ld", uid); break; case 'n': /* player name */ - Sprintf(tmpbuf, "%s", *g.plname ? g.plname : "unknown"); + if (fullsubs) + Sprintf(tmpbuf, "%s", *g.plname ? g.plname : "unknown"); + else + Strcpy(tmpbuf, "{hero name}"); break; case 'N': /* first character of player name */ - Sprintf(tmpbuf, "%c", *g.plname ? *g.plname : 'u'); + if (fullsubs) + Sprintf(tmpbuf, "%c", *g.plname ? *g.plname : 'u'); + else + Strcpy(tmpbuf, "{hero initial}"); break; } + if (fullsubs) { + /* replace potentially troublesome characters (including + even though it might be an acceptable file name + character); user shouldn't be able to get ' ' or '/' + or '\\' into plname[] but play things safe */ + (void) strNsubst(tmpbuf, " ", "_", 0); + (void) strNsubst(tmpbuf, "/", "_", 0); + (void) strNsubst(tmpbuf, "\\", "_", 0); + /* note: replacements are only done on field substitutions, + not on the template (from sysconf or DUMPLOG_FILE) */ + } - slen = strlen(tmpbuf); - if (len + slen < BUFSZ-1) { + slen = (int) strlen(tmpbuf); + if (len + slen < BUFSZ - 1) { len += slen; Sprintf(bp, "%s", tmpbuf); bp += slen; - if (*fp) fp++; + if (*fp) + fp++; } else break; } else { @@ -1187,9 +1220,9 @@ time_t now; #ifdef SYSCF if (!sysopt.dumplogfile) return; - fname = dump_fmtstr(sysopt.dumplogfile, buf); + fname = dump_fmtstr(sysopt.dumplogfile, buf, TRUE); #else - fname = dump_fmtstr(DUMPLOG_FILE, buf); + fname = dump_fmtstr(DUMPLOG_FILE, buf, TRUE); #endif dumplog_file = fopen(fname, "w"); dumplog_windowprocs_backup = windowprocs; @@ -1340,4 +1373,28 @@ boolean onoff_flag; } } +#ifdef TTY_GRAPHICS +#ifdef TEXTCOLOR +#ifdef TOS +extern const char *hilites[CLR_MAX]; +#else +extern NEARDATA char *hilites[CLR_MAX]; +#endif +#endif +#endif + +int +has_color(color) +int color; +{ + return (iflags.use_color && windowprocs.name + && (windowprocs.wincap & WC_COLOR) && windowprocs.has_color[color] +#ifdef TTY_GRAPHICS +#if defined(TEXTCOLOR) && defined(TERMLIB) && !defined(NO_TERMS) + && (hilites[color] != 0) +#endif +#endif + ); +} + /*windows.c*/ diff --git a/src/wizard.c b/src/wizard.c index dbc61241e..0cf531ea8 100644 --- a/src/wizard.c +++ b/src/wizard.c @@ -9,7 +9,6 @@ /* - generalized for 3.1 (mike@bullns.on01.bull.ca) */ #include "hack.h" -#include "qtext.h" static short FDECL(which_arti, (int)); static boolean FDECL(mon_has_arti, (struct monst *, SHORT_P)); @@ -762,13 +761,14 @@ register struct monst *mtmp; random_insult[rn2(SIZE(random_insult))]); } else if (is_lminion(mtmp) && !(mtmp->isminion && EMIN(mtmp)->renegade)) { - com_pager(rn2(QTN_ANGELIC - 1 + (Hallucination ? 1 : 0)) - + QT_ANGELIC); + com_pager("angel_cuss"); /* TODO: the Hallucination msg */ + /*com_pager(rn2(QTN_ANGELIC - 1 + (Hallucination ? 1 : 0)) + + QT_ANGELIC);*/ } else { if (!rn2(is_minion(mtmp->data) ? 100 : 5)) pline("%s casts aspersions on your ancestry.", Monnam(mtmp)); else - com_pager(rn2(QTN_DEMONIC) + QT_DEMONIC); + com_pager("demon_cuss"); } } diff --git a/src/worm.c b/src/worm.c index 0d14c83a0..3d7fb3f93 100644 --- a/src/worm.c +++ b/src/worm.c @@ -4,9 +4,6 @@ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" -#include "lev.h" -#include "sfproto.h" - #define newseg() (struct wseg *) alloc(sizeof (struct wseg)) #define dealloc_seg(wseg) free((genericptr_t) (wseg)) @@ -493,8 +490,6 @@ NHFILE *nhfp; /* Save number of segments */ if (nhfp->structlevel) bwrite(nhfp->fd, (genericptr_t) &count, sizeof(int)); - if (nhfp->fieldlevel) - sfo_int(nhfp, &count, "worm", "segment_count", 1); /* Save segment locations of the monster. */ if (count) { for (curr = wtails[i]; curr; curr = curr->nseg) { @@ -502,20 +497,12 @@ NHFILE *nhfp; bwrite(nhfp->fd, (genericptr_t) &(curr->wx), sizeof(xchar)); bwrite(nhfp->fd, (genericptr_t) &(curr->wy), sizeof(xchar)); } - if (nhfp->fieldlevel) { - sfo_xchar(nhfp, &(curr->wx), "worm", "wx", 1); - sfo_xchar(nhfp, &(curr->wy), "worm", "wy", 1); - } } } } if (nhfp->structlevel) { bwrite(nhfp->fd, (genericptr_t) wgrowtime, sizeof(wgrowtime)); } - if (nhfp->fieldlevel) { - for (i = 0; i < MAX_NUM_WORMS; ++i) - sfo_long(nhfp, &wgrowtime[i], "worm", "wgrowtime", 1); - } } if (release_data(nhfp)) { @@ -544,14 +531,12 @@ void rest_worm(nhfp) NHFILE *nhfp; { - int i, j, count; + int i, j, count = 0; struct wseg *curr, *temp; for (i = 1; i < MAX_NUM_WORMS; i++) { if (nhfp->structlevel) mread(nhfp->fd, (genericptr_t) &count, sizeof(int)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &count, "worm", "segment_count", 1); /* Get the segments. */ for (curr = (struct wseg *) 0, j = 0; j < count; j++) { @@ -561,10 +546,6 @@ NHFILE *nhfp; mread(nhfp->fd, (genericptr_t) &(temp->wx), sizeof(xchar)); mread(nhfp->fd, (genericptr_t) &(temp->wy), sizeof(xchar)); } - if (nhfp->fieldlevel) { - sfi_xchar(nhfp, &(temp->wx), "worm", "wx", 1); - sfi_xchar(nhfp, &(temp->wy), "worm", "wy", 1); - } if (curr) curr->nseg = temp; else @@ -576,10 +557,6 @@ NHFILE *nhfp; if (nhfp->structlevel) { mread(nhfp->fd, (genericptr_t) wgrowtime, sizeof(wgrowtime)); } - if (nhfp->fieldlevel) { - for (i = 0; i < MAX_NUM_WORMS; ++i) - sfi_long(nhfp, &wgrowtime[i], "worm", "wgrowtime", 1); - } } /* diff --git a/src/write.c b/src/write.c index be48b67b5..28d916f48 100644 --- a/src/write.c +++ b/src/write.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 write.c $NHDT-Date: 1450261366 2015/12/16 10:22:46 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.17 $ */ +/* NetHack 3.6 write.c $NHDT-Date: 1573346194 2019/11/10 00:36:34 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.20 $ */ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" @@ -18,7 +18,7 @@ register struct obj *otmp; return (10 * objects[otmp->otyp].oc_level); switch (otmp->otyp) { -#ifdef MAIL +#ifdef MAIL_STRUCTURES case SCR_MAIL: return 2; #endif @@ -109,7 +109,7 @@ register struct obj *pen; return 0; } else if (Glib) { pline("%s from your %s.", Tobjnam(pen, "slip"), - makeplural(body_part(FINGER))); + fingers_or_gloves(FALSE)); dropx(pen); return 1; } @@ -333,7 +333,7 @@ found: } new_obj->blessed = (curseval > 0); new_obj->cursed = (curseval < 0); -#ifdef MAIL +#ifdef MAIL_STRUCTURES if (new_obj->otyp == SCR_MAIL) /* 0: delivered in-game via external event (or randomly for fake mail); 1: from bones or wishing; 2: written with marker */ diff --git a/src/zap.c b/src/zap.c index 49fb7543b..a9adec794 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 zap.c $NHDT-Date: 1561927499 2019/06/30 20:44:59 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.312 $ */ +/* NetHack 3.6 zap.c $NHDT-Date: 1573688696 2019/11/13 23:44:56 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.316 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1231,7 +1231,7 @@ int mat, minwt; continue; if (obj_resists(otmp, 0, 0)) continue; /* preserve unique objects */ -#ifdef MAIL +#ifdef MAIL_STRUCTURES if (otmp->otyp == SCR_MAIL) continue; #endif @@ -1358,7 +1358,7 @@ struct obj *obj; { long i; -#ifdef MAIL +#ifdef MAIL_STRUCTURES if (obj->otyp == SCR_MAIL) return; #endif @@ -1456,7 +1456,7 @@ int id; /* preserve inventory letter if in inventory */ if (obj_location == OBJ_INVENT) otmp->invlet = obj->invlet; -#ifdef MAIL +#ifdef MAIL_STRUCTURES /* You can't send yourself 100 mail messages and then * polymorph them into useful scrolls */ @@ -3341,13 +3341,20 @@ struct obj **pobj; /* object tossed/used, set to NULL if (range > 3) /* another bounce? */ skiprange(range, &skiprange_start, &skiprange_end); } else if (mtmp && M_IN_WATER(mtmp->data)) { - if ((!Blind && canseemon(mtmp)) || sensemon(mtmp)) + if (!Blind && canspotmon(mtmp)) pline("%s %s over %s.", Yname2(obj), otense(obj, "pass"), mon_nam(mtmp)); + mtmp = (struct monst *) 0; } } - if (mtmp && !(in_skip && M_IN_WATER(mtmp->data))) { + /* if mtmp is a shade and missile passes harmlessly through it, + give message and skip it in order to keep going */ + if (mtmp && (weapon == THROWN_WEAPON || weapon == KICKED_WEAPON) + && shade_miss(&g.youmonst, mtmp, obj, TRUE, TRUE)) + mtmp = (struct monst *) 0; + + if (mtmp) { g.notonhead = (g.bhitpos.x != mtmp->mx || g.bhitpos.y != mtmp->my); if (weapon == FLASHED_LIGHT) { /* FLASHED_LIGHT hitting invisible monster should @@ -4433,7 +4440,11 @@ short exploding_wand_typ; if (is_ice(x, y)) { melt_ice(x, y, (char *) 0); } else if (is_pool(x, y)) { - const char *msgtxt = "You hear hissing gas."; + const char *msgtxt = (!Deaf) + ? "You hear hissing gas." /* Deaf-aware */ + : (type >= 0) + ? "That seemed remarkably uneventful." + : (const char *) 0; if (lev->typ != POOL) { /* MOAT or DRAWBRIDGE_UP */ if (see_it) @@ -4447,7 +4458,8 @@ short exploding_wand_typ; if (see_it) msgtxt = "The water evaporates."; } - Norep("%s", msgtxt); + if (msgtxt) + Norep("%s", msgtxt); if (lev->typ == ROOM) newsym(x, y); } else if (IS_FOUNTAIN(lev->typ)) { diff --git a/sys/amiga/.gitattributes b/sys/amiga/.gitattributes index 732c6177e..f969b5ebc 100644 --- a/sys/amiga/.gitattributes +++ b/sys/amiga/.gitattributes @@ -1,2 +1,2 @@ *.p NHSUBST -* NH_filestag=(file%s_for_Amiga_versions_-_untested_for_3.6.2) +* NH_filestag=(file%s_for_Amiga_versions_-_untested_for_3.6.4) diff --git a/sys/amiga/Makefile.agc b/sys/amiga/Makefile.agc index 6f3c11ecf..da5b38567 100644 --- a/sys/amiga/Makefile.agc +++ b/sys/amiga/Makefile.agc @@ -422,7 +422,7 @@ $(SBIN)makedefs: $(MAKEOBJS) $(LINK) $(LNSPEC) $(SBIN)makedefs $(LIN) $(MAKEOBJS) $(LLIB) $(OO)makedefs.o: $(UTIL)makedefs.c $(I)config.h $(I)permonst.h $(I)monsym.h \ - $(I)objclass.h $(I)patchlevel.h $(I)qtext.h $(I)artilist.h + $(I)objclass.h $(I)patchlevel.h $(I)artilist.h $(CC) $(DEFSPEC)MAKEDEFS_C $(CFLAGS) $(OBJSPEC)$@ $(UTIL)makedefs.c $(SBIN)lev_comp: $(SPLEVOBJS) @@ -938,7 +938,7 @@ $(O)attrib.o: $(NHS)attrib.c $(HDEP) $(I)artifact.h $(O)ball.o: $(NHS)ball.c $(HDEP) -$(O)bones.o: $(NHS)bones.c $(HDEP) $(I)lev.h +$(O)bones.o: $(NHS)bones.c $(HDEP) $(O)botl.o: $(NHS)botl.c $(HDEP) @@ -956,7 +956,7 @@ $(O)display.o: $(NHS)display.c $(HDEP) $(O)dlb.o: $(NHS)dlb.c $(HDEP) $(I)dlb.h -$(O)do.o: $(NHS)do.c $(HDEP) $(I)lev.h +$(O)do.o: $(NHS)do.c $(HDEP) $(O)do_name.o: $(NHS)do_name.c $(HDEP) @@ -977,9 +977,9 @@ $(O)dungeon.o: $(NHS)dungeon.c $(HDEP) $(I)dgn_file.h $(I)dlb.h $(O)eat.o: $(NHS)eat.c $(HDEP) -$(O)end.o: $(NHS)end.c $(HDEP) $(I)lev.h $(I)dlb.h +$(O)end.o: $(NHS)end.c $(HDEP) $(I)dlb.h -$(O)engrave.o: $(NHS)engrave.c $(HDEP) $(I)lev.h +$(O)engrave.o: $(NHS)engrave.c $(HDEP) $(O)exper.o: $(NHS)exper.c $(HDEP) @@ -997,7 +997,7 @@ $(O)hacklib.o: $(NHS)hacklib.c $(HDEP) $(O)invent.o: $(NHS)invent.c $(HDEP) $(I)artifact.h -$(O)light.o: $(NHS)light.c $(HDEP) $(I)lev.h +$(O)light.o: $(NHS)light.c $(HDEP) $(O)lock.o: $(NHS)lock.c $(HDEP) @@ -1020,7 +1020,7 @@ $(O)mklev.o: $(NHS)mklev.c $(HDEP) $(O)mkmap.o: $(NHS)mkmap.c $(HDEP) $(I)sp_lev.h -$(O)mkmaze.o: $(NHS)mkmaze.c $(HDEP) $(I)sp_lev.h $(I)lev.h +$(O)mkmaze.o: $(NHS)mkmaze.c $(HDEP) $(I)sp_lev.h $(O)mkobj.o: $(NHS)mkobj.c $(HDEP) $(I)artifact.h $(I)prop.h @@ -1046,7 +1046,7 @@ $(O)muse.o: $(NHS)muse.c $(HDEP) $(O)music.o: $(NHS)music.c $(HDEP) #interp.c -$(O)o_init.o: $(NHS)o_init.c $(HDEP) $(I)lev.h +$(O)o_init.o: $(NHS)o_init.c $(HDEP) $(O)objects.o: $(NHS)objects.c $(I)config.h $(I)obj.h $(I)objclass.h \ $(I)prop.h $(I)skills.h $(I)color.h @@ -1071,9 +1071,9 @@ $(O)pray.o: $(NHS)pray.c $(HDEP) $(O)priest.o: $(NHS)priest.c $(HDEP) $(I)mfndpos.h -$(O)quest.o: $(NHS)quest.c $(HDEP) $(I)quest.h $(I)qtext.h +$(O)quest.o: $(NHS)quest.c $(HDEP) $(I)quest.h -$(O)questpgr.o: $(NHS)questpgr.c $(HDEP) $(I)qtext.h $(I)dlb.h +$(O)questpgr.o: $(NHS)questpgr.c $(HDEP) $(I)dlb.h $(O)read.o: $(NHS)read.c $(HDEP) @@ -1081,7 +1081,7 @@ $(O)rect.o: $(NHS)rect.c $(HDEP) $(O)region.o: $(NHS)region.c $(HDEP) -$(O)restore.o: $(NHS)restore.c $(HDEP) $(I)lev.h $(I)tcap.h $(I)quest.h +$(O)restore.o: $(NHS)restore.c $(HDEP) $(I)tcap.h $(I)quest.h $(O)rnd.o: $(NHS)rnd.c $(HDEP) @@ -1089,7 +1089,7 @@ $(O)role.o: $(NHS)role.c $(HDEP) $(O)rumors.o: $(NHS)rumors.c $(HDEP) $(I)dlb.h -$(O)save.o: $(NHS)save.c $(HDEP) $(I)lev.h $(I)quest.h +$(O)save.o: $(NHS)save.c $(HDEP) $(I)quest.h $(O)shk.o: $(NHS)shk.c $(HDEP) $(CC) $(CFLAGS) $(CFLAGS2) $(OBJSPEC)$@ $(NHS)shk.c @@ -1112,7 +1112,7 @@ $(O)sys.o: $(NHS)sys.c $(HDEP) $(O)teleport.o: $(NHS)teleport.c $(HDEP) -$(O)timeout.o: $(NHS)timeout.c $(HDEP) $(I)lev.h +$(O)timeout.o: $(NHS)timeout.c $(HDEP) $(O)topten.o: $(NHS)topten.c $(HDEP) $(I)dlb.h @@ -1140,9 +1140,9 @@ $(O)wield.o: $(NHS)wield.c $(HDEP) $(O)windows.o: $(NHS)windows.c $(HDEP) $(I)wintty.h -$(O)wizard.o: $(NHS)wizard.c $(HDEP) $(I)qtext.h +$(O)wizard.o: $(NHS)wizard.c $(HDEP) -$(O)worm.o: $(NHS)worm.c $(HDEP) $(I)lev.h +$(O)worm.o: $(NHS)worm.c $(HDEP) $(O)worn.o: $(NHS)worn.c $(HDEP) diff --git a/sys/amiga/Makefile.ami b/sys/amiga/Makefile.ami index 43e8dbe98..7d7f676e4 100644 --- a/sys/amiga/Makefile.ami +++ b/sys/amiga/Makefile.ami @@ -690,7 +690,7 @@ $(SBIN)makedefs: $(MAKEOBJS) $(LINK) $(LNSPEC) $(SBIN)makedefs $(LIN) $(MAKEOBJS) $(LLIB) $(OO)makedefs.o: $(UTIL)makedefs.c $(I)config.h $(I)permonst.h $(I)monsym.h \ - $(I)objclass.h $(I)patchlevel.h $(I)qtext.h $(I)artilist.h + $(I)objclass.h $(I)patchlevel.h $(I)artilist.h $(CC) $(DEFSPEC)MAKEDEFS_C $(CFLAGS) $(OBJSPEC)$@ $(UTIL)makedefs.c $(SBIN)lev_comp: $(SPLEVOBJS) @@ -1268,7 +1268,7 @@ $(O)attrib.o: $(NHS)attrib.c $(HDEP) $(I)artifact.h $(O)ball.o: $(NHS)ball.c $(HDEP) -$(O)bones.o: $(NHS)bones.c $(HDEP) $(I)lev.h +$(O)bones.o: $(NHS)bones.c $(HDEP) $(O)botl.o: $(NHS)botl.c $(HDEP) @@ -1286,7 +1286,7 @@ $(O)display.o: $(NHS)display.c $(HDEP) $(O)dlb.o: $(NHS)dlb.c $(HDEP) $(I)dlb.h -$(O)do.o: $(NHS)do.c $(HDEP) $(I)lev.h +$(O)do.o: $(NHS)do.c $(HDEP) $(O)do_name.o: $(NHS)do_name.c $(HDEP) @@ -1307,9 +1307,9 @@ $(O)dungeon.o: $(NHS)dungeon.c $(HDEP) $(I)dgn_file.h $(I)dlb.h $(O)eat.o: $(NHS)eat.c $(HDEP) -$(O)end.o: $(NHS)end.c $(HDEP) $(I)lev.h $(I)dlb.h +$(O)end.o: $(NHS)end.c $(HDEP) $(I)dlb.h -$(O)engrave.o: $(NHS)engrave.c $(HDEP) $(I)lev.h +$(O)engrave.o: $(NHS)engrave.c $(HDEP) $(O)exper.o: $(NHS)exper.c $(HDEP) @@ -1327,7 +1327,7 @@ $(O)hacklib.o: $(NHS)hacklib.c $(HDEP) $(O)invent.o: $(NHS)invent.c $(HDEP) $(I)artifact.h -$(O)light.o: $(NHS)light.c $(HDEP) $(I)lev.h +$(O)light.o: $(NHS)light.c $(HDEP) $(O)lock.o: $(NHS)lock.c $(HDEP) @@ -1350,7 +1350,7 @@ $(O)mklev.o: $(NHS)mklev.c $(HDEP) $(O)mkmap.o: $(NHS)mkmap.c $(HDEP) $(I)sp_lev.h -$(O)mkmaze.o: $(NHS)mkmaze.c $(HDEP) $(I)sp_lev.h $(I)lev.h +$(O)mkmaze.o: $(NHS)mkmaze.c $(HDEP) $(I)sp_lev.h $(O)mkobj.o: $(NHS)mkobj.c $(HDEP) $(I)artifact.h $(I)prop.h @@ -1377,7 +1377,7 @@ $(O)muse.o: $(NHS)muse.c $(HDEP) $(O)music.o: $(NHS)music.c $(HDEP) #interp.c -$(O)o_init.o: $(NHS)o_init.c $(HDEP) $(I)lev.h +$(O)o_init.o: $(NHS)o_init.c $(HDEP) $(O)objects.o: $(NHS)objects.c $(I)config.h $(I)obj.h $(I)objclass.h \ $(I)prop.h $(I)skills.h $(I)color.h @@ -1403,9 +1403,9 @@ $(O)pray.o: $(NHS)pray.c $(HDEP) $(O)priest.o: $(NHS)priest.c $(HDEP) $(I)mfndpos.h -$(O)quest.o: $(NHS)quest.c $(HDEP) $(I)quest.h $(I)qtext.h +$(O)quest.o: $(NHS)quest.c $(HDEP) $(I)quest.h -$(O)questpgr.o: $(NHS)questpgr.c $(HDEP) $(I)qtext.h $(I)dlb.h +$(O)questpgr.o: $(NHS)questpgr.c $(HDEP) $(I)dlb.h $(O)read.o: $(NHS)read.c $(HDEP) @@ -1413,7 +1413,7 @@ $(O)rect.o: $(NHS)rect.c $(HDEP) $(O)region.o: $(NHS)region.c $(HDEP) -$(O)restore.o: $(NHS)restore.c $(HDEP) $(I)lev.h $(I)tcap.h $(I)quest.h +$(O)restore.o: $(NHS)restore.c $(HDEP) $(I)tcap.h $(I)quest.h $(O)rnd.o: $(NHS)rnd.c $(HDEP) @@ -1421,7 +1421,7 @@ $(O)role.o: $(NHS)role.c $(HDEP) $(O)rumors.o: $(NHS)rumors.c $(HDEP) $(I)dlb.h -$(O)save.o: $(NHS)save.c $(HDEP) $(I)lev.h $(I)quest.h +$(O)save.o: $(NHS)save.c $(HDEP) $(I)quest.h $(O)shk.o: $(NHS)shk.c $(HDEP) #SFD_INSTEAD #none @@ -1445,7 +1445,7 @@ $(O)sys.o: $(NHS)sys.c $(HDEP) $(O)teleport.o: $(NHS)teleport.c $(HDEP) -$(O)timeout.o: $(NHS)timeout.c $(HDEP) $(I)lev.h +$(O)timeout.o: $(NHS)timeout.c $(HDEP) $(O)topten.o: $(NHS)topten.c $(HDEP) $(I)dlb.h @@ -1476,9 +1476,9 @@ $(O)wield.o: $(NHS)wield.c $(HDEP) $(O)windows.o: $(NHS)windows.c $(HDEP) $(I)wintty.h -$(O)wizard.o: $(NHS)wizard.c $(HDEP) $(I)qtext.h +$(O)wizard.o: $(NHS)wizard.c $(HDEP) -$(O)worm.o: $(NHS)worm.c $(HDEP) $(I)lev.h +$(O)worm.o: $(NHS)worm.c $(HDEP) $(O)worn.o: $(NHS)worn.c $(HDEP) diff --git a/sys/amiga/winami.c b/sys/amiga/winami.c index e1f5c7eb3..8a595640a 100644 --- a/sys/amiga/winami.c +++ b/sys/amiga/winami.c @@ -28,7 +28,9 @@ long amii_scrnmode; * the intuition interface for the amiga... */ struct window_procs amii_procs = { - "amii", WC_COLOR | WC_HILITE_PET | WC_INVERSE, 0L, amii_init_nhwindows, + "amii", WC_COLOR | WC_HILITE_PET | WC_INVERSE, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */ + 0L, amii_init_nhwindows, amii_player_selection, amii_askname, amii_get_nh_event, amii_exit_nhwindows, amii_suspend_nhwindows, amii_resume_nhwindows, amii_create_nhwindow, amii_clear_nhwindow, amii_display_nhwindow, @@ -60,7 +62,9 @@ struct window_procs amii_procs = { * a shared library to allow the executable to be smaller. */ struct window_procs amiv_procs = { - "amitile", WC_COLOR | WC_HILITE_PET | WC_INVERSE, 0L, amii_init_nhwindows, + "amitile", WC_COLOR | WC_HILITE_PET | WC_INVERSE, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */ + 0L, amii_init_nhwindows, amii_player_selection, amii_askname, amii_get_nh_event, amii_exit_nhwindows, amii_suspend_nhwindows, amii_resume_nhwindows, amii_create_nhwindow, amii_clear_nhwindow, amii_display_nhwindow, diff --git a/sys/amiga/winfuncs.c b/sys/amiga/winfuncs.c index 84838ed22..380954681 100644 --- a/sys/amiga/winfuncs.c +++ b/sys/amiga/winfuncs.c @@ -1978,7 +1978,7 @@ if(u.uz.dlevel != x){ } else /* AMII, or Rogue level in either version */ { /* map glyph to character and color */ - (void) mapglyph(glyph, &och, &color, &special, x, y); + (void) mapglyph(glyph, &och, &color, &special, x, y, 0); ch = (uchar) och; if (WINVERS_AMIV) { /* implies Rogue level here */ amii_curs(win, x, y); diff --git a/sys/atari/.gitattributes b/sys/atari/.gitattributes index dea950a06..ff75d0637 100644 --- a/sys/atari/.gitattributes +++ b/sys/atari/.gitattributes @@ -1 +1 @@ -* NH_filestag=(file%s_for_Atari_version_-_untested_for_3.6.2) +* NH_filestag=(file%s_for_Atari_version_-_untested_for_3.6.4) diff --git a/sys/be/.gitattributes b/sys/be/.gitattributes index 76f62f434..76b400189 100644 --- a/sys/be/.gitattributes +++ b/sys/be/.gitattributes @@ -1 +1 @@ -* NH_filestag=(file%s_for_BeOS_version_-_untested_for_3.6.2) +* NH_filestag=(file%s_for_BeOS_version_-_untested_for_3.6.4) diff --git a/sys/mac/macwin.c b/sys/mac/macwin.c index 210b13994..aec93d0b0 100644 --- a/sys/mac/macwin.c +++ b/sys/mac/macwin.c @@ -3251,7 +3251,9 @@ struct window_procs mac_procs = { WC_COLOR | WC_HILITE_PET | WC_FONT_MAP | WC_FONT_MENU | WC_FONT_MESSAGE | WC_FONT_STATUS | WC_FONT_TEXT | WC_FONTSIZ_MAP | WC_FONTSIZ_MENU | WC_FONTSIZ_MESSAGE | WC_FONTSIZ_STATUS | WC_FONTSIZ_TEXT, - 0L, mac_init_nhwindows, + 0L, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */ + mac_init_nhwindows, mac_unimplemented, /* see macmenu.c:mac_askname() for player selection */ mac_askname, mac_get_nh_event, mac_exit_nhwindows, mac_suspend_nhwindows, mac_unimplemented, mac_create_nhwindow, mac_clear_nhwindow, diff --git a/sys/mac/mttymain.c b/sys/mac/mttymain.c index 5231e84da..2cd59a9d2 100644 --- a/sys/mac/mttymain.c +++ b/sys/mac/mttymain.c @@ -269,6 +269,33 @@ _mt_init_stuff(void) clear_tty(_mt_window); InitMenuRes(); + + { + /* update the window proc has_color table */ + int i, setting = 0; + Rect r; +// Point p = {0, 0}; + GDHandle gh = (GDHandle) 0; + + if (_mt_in_color) { + GetWindowBounds(_mt_window, kWindowContentRgn, &r); +// SetPortWindowPort(_mt_window); +// LocalToGlobal (&p); +// OffsetRect (&r, p.h, p.v); + gh = GetMaxDevice(&r); + /* > 4 bpp */ + setting = ((*((*gh)->gdPMap))->pixelSize > 4) ? 1 : 0; + } + + for (i = 0; i < CLR_MAX ; ++i) { + tty_procs.has_color[i] = + (i == CLR_BLACK || i == NO_COLOR || i == CLR_WHITE) + ? 1 + : (_mt_in_color && gh) + ? setting + : 0; + } + } } int @@ -302,6 +329,8 @@ getreturn(char *str) (void) tgetch(); } +#if 0 /* this function is commented out */ +/* the tty has_color[] table is filled in during init above */ int has_color(int color) { @@ -327,6 +356,7 @@ has_color(int color) return (*((*gh)->gdPMap))->pixelSize > 4; /* > 4 bpp */ } +#endif void tty_delay_output(void) diff --git a/sys/msdos/.gitattributes b/sys/msdos/.gitattributes index f24897760..a0b35794c 100644 --- a/sys/msdos/.gitattributes +++ b/sys/msdos/.gitattributes @@ -4,6 +4,6 @@ Makefile.* NHSUBST Install.* NHSUBST moveinit.pat NH_header=no vesa.h NH_header=no -* NH_filestag=(file%s_for_MSDOS_version_-_untested_for_3.6.2) +* NH_filestag=(file%s_for_MSDOS_version_-_tested_for_3.6.4_via_partial_cross-compile_only) nhico.uu NH_filestag=(file%s_for_running_MSDOS_binary_under_Windows) nhpif.uu NH_filestag=>nhico.uu diff --git a/sys/msdos/Makefile.BC b/sys/msdos/Makefile.BC index b537ad0e7..beb4b9758 100644 --- a/sys/msdos/Makefile.BC +++ b/sys/msdos/Makefile.BC @@ -879,7 +879,6 @@ DATE_H = $(INCL)\date.h DGN_FILE_H = $(INCL)\dgn_file.h DLB_H = $(INCL)\dlb.h FUNC_TAB_H = $(INCL)\func_tab.h -LEV_H = $(INCL)\lev.h LEV_COMP_H = $(INCL)\lev_comp.h MAIL_H = $(INCL)\mail.h MFNDPOS_H = $(INCL)\mfndpos.h @@ -888,7 +887,6 @@ OBJ_H = $(INCL)\obj.h OBJCLASS_H = $(INCL)\objclass.h OBJECTS_H = $(INCL)\objects.h PROP_H = $(INCL)\prop.h -QTEXT_H = $(INCL)\qtext.h QUEST_H = $(INCL)\quest.h SP_LEV_H = $(INCL)\sp_lev.h TERMCAP_H = $(INCL)\tcap.h @@ -1025,7 +1023,7 @@ $(U)makedefs.exe: $(MAKEOBJS) @$(LINK) $(LFLAGSU) $(MAKEOBJS), $@,, $(CLIB) $(BCMDL); $(O)makedefs.o: $(CONFIG_H) $(PERMONST_H) $(OBJCLASS_H) \ - $(MONSYM_H) $(QTEXT_H) $(PATCHLEVEL_H) \ + $(MONSYM_H) $(PATCHLEVEL_H) \ $(U)makedefs.c @echo $(BCOPTS1) > $(VROOMMCFG) @echo $(BCOPTS2) >> $(VROOMMCFG) @@ -1790,7 +1788,7 @@ $(O)alloc.o: $(SRC)\alloc.c $(CONFIG_H) @echo $(BCOPTS2) >> $(VROOMMCFG) $(CC) $(CFLAGSN) $(COBJNAM)$@ $(SRC)\alloc.c $(O)ball.o: $(PCHO) $(SRC)\ball.c $(HACK_H) -$(O)bones.o: $(PCHO) $(SRC)\bones.c $(HACK_H) $(LEV_H) +$(O)bones.o: $(PCHO) $(SRC)\bones.c $(HACK_H) $(O)decl.o: $(PCHO) $(SRC)\decl.c $(HACK_H) $(QUEST_H) $(O)detect.o: $(PCHO) $(SRC)\detect.c $(HACK_H) $(ARTIFACT_H) $(O)dig.o: $(PCHO) $(SRC)\dig.c $(HACK_H) # check dep @@ -1807,7 +1805,7 @@ $(O)drawing.o: $(SRC)\drawing.c $(HACK_H) $(TERMCAP_H) @echo $(BCOPTS1) >> $(VROOMMCFG) @echo $(BCOPTS2) >> $(VROOMMCFG) $(CC) $(CFLAGSN) $(COBJNAM)$@ $(SRC)\drawing.c -$(O)end.o: $(SRC)\end.c $(HACK_H) $(LEV_H) $(DLB_H) +$(O)end.o: $(SRC)\end.c $(HACK_H) $(DLB_H) @type schema$(SCHEMA).bc | find "$(@B)_o" > $(VROOMMCFG) @echo $(BCOPTS1) >> $(VROOMMCFG) @echo $(BCOPTS2) >> $(VROOMMCFG) @@ -1820,7 +1818,7 @@ $(O)mapglyph.o: $(PCHO) $(SRC)\mapglyph.c $(HACK_H) $(O)minion.o: $(PCHO) $(SRC)\minion.c $(HACK_H) $(O)mklev.o: $(PCHO) $(SRC)\mklev.c $(HACK_H) $(O)mkmap.o: $(PCHO) $(SRC)\mkmap.c $(HACK_H) $(SP_LEV_H) -$(O)mkmaze.o: $(PCHO) $(SRC)\mkmaze.c $(HACK_H) $(SP_LEV_H) $(LEV_H) +$(O)mkmaze.o: $(PCHO) $(SRC)\mkmaze.c $(HACK_H) $(SP_LEV_H) $(O)monst.o: $(SRC)\monst.c $(CONFIG_H) $(PERMONST_H) $(MONSYM_H) \ $(COLOR_H) $(ALIGN_H) @type schema$(SCHEMA).bc | find "$(@B)_o" > $(VROOMMCFG) @@ -1835,7 +1833,7 @@ $(O)monstr.o: $(SRC)\monstr.c $(CONFIG_H) $(O)mplayer.o: $(PCHO) $(SRC)\mplayer.c $(HACK_H) $(O)muse.o: $(PCHO) $(SRC)\muse.c $(HACK_H) $(O)music.o: $(PCHO) $(SRC)\music.c $(HACK_H) -$(O)o_init.o: $(PCHO) $(SRC)\o_init.c $(HACK_H) $(LEV_H) +$(O)o_init.o: $(PCHO) $(SRC)\o_init.c $(HACK_H) $(O)objects.o: $(SRC)\objects.c $(CONFIG_H) $(OBJ_H) $(OBJCLASS_H) \ $(PROP_H) $(COLOR_H) @type schema$(SCHEMA).bc | find "$(@B)_o" > $(VROOMMCFG) @@ -1854,16 +1852,16 @@ $(O)pager.o: $(SRC)\pager.c $(HACK_H) $(DLB_H) $(CC) $(CFLAGNO) $(COBJNAM)$@ $(SRC)\pager.c $(O)pickup.o: $(PCHO) $(SRC)\pickup.c $(HACK_H) $(O)pray.o: $(PCHO) $(SRC)\pray.c $(HACK_H) -$(O)quest.o: $(PCHO) $(SRC)\quest.c $(HACK_H) $(QUEST_H) $(QTEXT_H) -$(O)questpgr.o: $(PCHO) $(SRC)\questpgr.c $(HACK_H) $(QTEXT_H) $(DLB_H) +$(O)quest.o: $(PCHO) $(SRC)\quest.c $(HACK_H) $(QUEST_H) +$(O)questpgr.o: $(PCHO) $(SRC)\questpgr.c $(HACK_H) $(DLB_H) $(O)rect.o: $(PCHO) $(SRC)\rect.c $(HACK_H) $(O)region.o: $(PCHO) $(SRC)\region.c $(HACK_H) -$(O)restore.o: $(PCHO) $(SRC)\restore.c $(HACK_H) $(LEV_H) $(TERMCAP_H) \ +$(O)restore.o: $(PCHO) $(SRC)\restore.c $(HACK_H) $(TERMCAP_H) \ $(QUEST_H) $(O)rip.o: $(PCHO) $(SRC)\rip.c $(HACK_H) $(O)role.o: $(PCHO) $(SRC)\role.c $(HACK_H) $(O)rumors.o: $(PCHO) $(SRC)\rumors.c $(HACK_H) $(DLB_H) -$(O)save.o: $(PCHO) $(SRC)\save.c $(HACK_H) $(LEV_H) $(QUEST_H) +$(O)save.o: $(PCHO) $(SRC)\save.c $(HACK_H) $(QUEST_H) $(O)sit.o: $(PCHO) $(SRC)\sit.c $(HACK_H) $(ARTIFACT_H) $(O)steed.o: $(PCHO) $(SRC)\steed.c $(HACK_H) $(O)sys.o: $(PCHO) $(SRC)\sys.c $(HACK_H) @@ -1883,7 +1881,7 @@ $(O)vis_tab.o: $(SRC)\vis_tab.c $(HACK_H) $(VIS_TAB_H) $(CC) $(CFLAGSN) $(COBJNAM)$@ $(SRC)\vis_tab.c $(O)wield.o: $(PCHO) $(SRC)\wield.c $(HACK_H) $(O)windows.o: $(PCHO) $(SRC)\windows.c $(HACK_H) $(WINTTY_H) -$(O)worm.o: $(PCHO) $(SRC)\worm.c $(HACK_H) $(LEV_H) +$(O)worm.o: $(PCHO) $(SRC)\worm.c $(HACK_H) $(O)worn.o: $(PCHO) $(SRC)\worn.c $(HACK_H) $(O)write.o: $(PCHO) $(SRC)\write.c $(HACK_H) @@ -1901,14 +1899,14 @@ $(O)attrib.0: $(PCH0) $(SRC)\attrib.c $(HACK_H) $(O)botl.0: $(PCH0) $(SRC)\botl.c $(HACK_H) $(O)cmd.0: $(PCH0) $(SRC)\cmd.c $(HACK_H) $(FUNC_TAB_H) $(O)dbridge.0: $(PCH0) $(SRC)\dbridge.c $(HACK_H) -$(O)do.0: $(PCH0) $(SRC)\do.c $(HACK_H) $(LEV_H) +$(O)do.0: $(PCH0) $(SRC)\do.c $(HACK_H) $(O)do_name.0: $(PCH0) $(SRC)\do_name.c $(HACK_H) $(O)do_wear.0: $(PCH0) $(SRC)\do_wear.c $(HACK_H) $(O)dogmove.0: $(PCH0) $(SRC)\dogmove.c $(HACK_H) $(MFNDPOS_H) $(O)dungeon.0: $(PCH0) $(SRC)\dungeon.c $(HACK_H) $(ALIGN_H) $(DGN_FILE_H) \ $(DLB_H) $(O)eat.0: $(PCH0) $(SRC)\eat.c $(HACK_H) -$(O)engrave.0: $(PCH0) $(SRC)\engrave.c $(HACK_H) $(LEV_H) +$(O)engrave.0: $(PCH0) $(SRC)\engrave.c $(HACK_H) $(O)explode.0: $(PCH0) $(SRC)\explode.c $(HACK_H) $(O)hacklib.0: $(PCH0) $(SRC)\hacklib.c $(HACK_H) $(O)invent.0: $(PCH0) $(SRC)\invent.c $(HACK_H) $(ARTIFACT_H) @@ -1932,13 +1930,13 @@ $(O)shk.0: $(PCH0) $(SRC)\shk.c $(HACK_H) $(O)shknam.0: $(PCH0) $(SRC)\shknam.c $(HACK_H) $(O)sounds.0: $(PCH0) $(SRC)\sounds.c $(HACK_H) $(O)steal.0: $(PCH0) $(SRC)\steal.c $(HACK_H) -$(O)timeout.0: $(PCH0) $(SRC)\timeout.c $(HACK_H) $(LEV_H) +$(O)timeout.0: $(PCH0) $(SRC)\timeout.c $(HACK_H) $(O)track.0: $(PCH0) $(SRC)\track.c $(HACK_H) $(O)trap.0: $(PCH0) $(SRC)\trap.c $(HACK_H) $(O)vault.0: $(PCH0) $(SRC)\vault.c $(HACK_H) $(O)weapon.0: $(PCH0) $(SRC)\weapon.c $(HACK_H) $(O)were.0: $(PCH0) $(SRC)\were.c $(HACK_H) -$(O)wizard.0: $(PCH0) $(SRC)\wizard.c $(HACK_H) $(QTEXT_H) +$(O)wizard.0: $(PCH0) $(SRC)\wizard.c $(HACK_H) $(O)zap.0: $(PCH0) $(SRC)\zap.c $(HACK_H) # @@ -1952,12 +1950,12 @@ $(O)attrib.1: $(PCH1) $(SRC)\attrib.c $(HACK_H) $(O)botl.1: $(PCH1) $(SRC)\botl.c $(HACK_H) $(O)cmd.1: $(PCH1) $(SRC)\cmd.c $(HACK_H) $(FUNC_TAB_H) $(O)dbridge.1: $(PCH1) $(SRC)\dbridge.c $(HACK_H) -$(O)do.1: $(PCH1) $(SRC)\do.c $(HACK_H) $(LEV_H) +$(O)do.1: $(PCH1) $(SRC)\do.c $(HACK_H) $(O)do_wear.1: $(PCH1) $(SRC)\do_wear.c $(HACK_H) $(O)dog.1: $(PCH1) $(SRC)\dog.c $(HACK_H) $(O)dungeon.1: $(PCH1) $(SRC)\dungeon.c $(HACK_H) $(ALIGN_H) $(DGN_FILE_H) $(DLB_H) $(O)eat.1: $(PCH1) $(SRC)\eat.c $(HACK_H) -$(O)engrave.1: $(PCH1) $(SRC)\engrave.c $(HACK_H) $(LEV_H) +$(O)engrave.1: $(PCH1) $(SRC)\engrave.c $(HACK_H) $(O)explode.1: $(PCH1) $(SRC)\explode.c $(HACK_H) $(O)hack.1: $(PCH1) $(SRC)\hack.c $(HACK_H) $(O)hacklib.1: $(PCH1) $(SRC)\hacklib.c $(HACK_H) @@ -1974,7 +1972,7 @@ $(O)polyself.1: $(PCH1) $(SRC)\polyself.c $(HACK_H) $(O)rnd.1: $(PCH1) $(SRC)\rnd.c $(HACK_H) $(O)shk.1: $(PCH1) $(SRC)\shk.c $(HACK_H) $(O)steal.1: $(PCH1) $(SRC)\steal.c $(HACK_H) -$(O)timeout.1: $(PCH1) $(SRC)\timeout.c $(HACK_H) $(LEV_H) +$(O)timeout.1: $(PCH1) $(SRC)\timeout.c $(HACK_H) $(O)track.1: $(PCH1) $(SRC)\track.c $(HACK_H) $(O)trap.1: $(PCH1) $(SRC)\trap.c $(HACK_H) $(O)weapon.1: $(PCH1) $(SRC)\weapon.c $(HACK_H) @@ -1985,11 +1983,11 @@ $(O)zap.1: $(PCH1) $(SRC)\zap.c $(HACK_H) # $(O)attrib.2: $(PCH2) $(SRC)\attrib.c $(HACK_H) -$(O)do.2: $(PCH2) $(SRC)\do.c $(HACK_H) $(LEV_H) +$(O)do.2: $(PCH2) $(SRC)\do.c $(HACK_H) $(O)do_name.2: $(PCH2) $(SRC)\do_name.c $(HACK_H) $(O)do_wear.2: $(PCH2) $(SRC)\do_wear.c $(HACK_H) $(O)dog.2: $(PCH2) $(SRC)\dog.c $(HACK_H) -$(O)engrave.2: $(PCH2) $(SRC)\engrave.c $(HACK_H) $(LEV_H) +$(O)engrave.2: $(PCH2) $(SRC)\engrave.c $(HACK_H) $(O)hack.2: $(PCH2) $(SRC)\hack.c $(HACK_H) $(O)hacklib.2: $(PCH2) $(SRC)\hacklib.c $(HACK_H) $(O)invent.2: $(PCH2) $(SRC)\invent.c $(HACK_H) $(ARTIFACT_H) @@ -2005,7 +2003,7 @@ $(O)zap.2: $(PCH2) $(SRC)\zap.c $(HACK_H) # OVL3 # -$(O)do.3: $(PCH3) $(SRC)\do.c $(HACK_H) $(LEV_H) +$(O)do.3: $(PCH3) $(SRC)\do.c $(HACK_H) $(O)hack.3: $(PCH3) $(SRC)\hack.c $(HACK_H) $(O)invent.3: $(PCH3) $(SRC)\invent.c $(HACK_H) $(ARTIFACT_H) $(O)light.3: $(PCH3) $(SRC)\light.c $(HACK_H) @@ -2024,13 +2022,13 @@ $(O)attrib.B: $(PCHB) $(SRC)\attrib.c $(HACK_H) $(O)botl.B: $(PCHB) $(SRC)\botl.c $(HACK_H) $(O)cmd.B: $(PCHB) $(SRC)\cmd.c $(HACK_H) $(FUNC_TAB_H) $(O)dbridge.B: $(PCHB) $(SRC)\dbridge.c $(HACK_H) -$(O)do.B: $(PCHB) $(SRC)\do.c $(HACK_H) $(LEV_H) +$(O)do.B: $(PCHB) $(SRC)\do.c $(HACK_H) $(O)do_name.B: $(PCHB) $(SRC)\do_name.c $(HACK_H) $(O)do_wear.B: $(PCHB) $(SRC)\do_wear.c $(HACK_H) $(O)dog.B: $(PCHB) $(SRC)\dog.c $(HACK_H) $(O)dogmove.B: $(PCHB) $(SRC)\dogmove.c $(HACK_H) $(MFNDPOS_H) $(O)eat.B: $(PCHB) $(SRC)\eat.c $(HACK_H) -$(O)engrave.B: $(PCHB) $(SRC)\engrave.c $(HACK_H) $(LEV_H) +$(O)engrave.B: $(PCHB) $(SRC)\engrave.c $(HACK_H) $(O)hack.B: $(PCHB) $(SRC)\hack.c $(HACK_H) $(O)hacklib.B: $(PCHB) $(SRC)\hacklib.c $(HACK_H) $(O)invent.B: $(PCHB) $(SRC)\invent.c $(HACK_H) $(ARTIFACT_H) @@ -2061,13 +2059,13 @@ $(O)shk.B: $(PCHB) $(SRC)\shk.c $(HACK_H) $(O)shknam.B: $(PCHB) $(SRC)\shknam.c $(HACK_H) $(O)sounds.B: $(PCHB) $(SRC)\sounds.c $(HACK_H) $(O)steal.B: $(PCHB) $(SRC)\steal.c $(HACK_H) -$(O)timeout.B: $(PCHB) $(SRC)\timeout.c $(HACK_H) $(LEV_H) +$(O)timeout.B: $(PCHB) $(SRC)\timeout.c $(HACK_H) $(O)track.B: $(PCHB) $(SRC)\track.c $(HACK_H) $(O)trap.B: $(PCHB) $(SRC)\trap.c $(HACK_H) $(O)vault.B: $(PCHB) $(SRC)\vault.c $(HACK_H) $(O)weapon.B: $(PCHB) $(SRC)\weapon.c $(HACK_H) $(O)were.B: $(PCHB) $(SRC)\were.c $(HACK_H) -$(O)wizard.B: $(PCHB) $(SRC)\wizard.c $(HACK_H) $(QTEXT_H) +$(O)wizard.B: $(PCHB) $(SRC)\wizard.c $(HACK_H) $(O)zap.B: $(PCHB) $(SRC)\zap.c $(HACK_H) # end of file diff --git a/sys/msdos/Makefile.GCC b/sys/msdos/Makefile.GCC index 7fe34c12c..cfe9b28d3 100644 --- a/sys/msdos/Makefile.GCC +++ b/sys/msdos/Makefile.GCC @@ -38,6 +38,20 @@ GAMEDIR =../binary ADD_CURSES=Y PDCURSES_TOP=../../pdcurses +#--------------------------------------------------------------- +# Location of LUA +# +# Original source needs to be obtained from: +# http://www.lua.org/ftp/lua-5.3.5.tar.gz +# +# This build assumes that the LUA sources are located +# at the specified location. If they are actually elsewhere +# you'll need to specify the correct spot below in order to +# successfully build NetHack-3.7. +# +ADD_LUA=Y +LUATOP=../lib/lua535 + # #============================================================================== # This marks the end of the BUILD DECISIONS section. @@ -206,19 +220,12 @@ VGAOBJ = $(O)vidvga.o $(O)vidvesa.o MAKESRC = makedefs.c +ifneq "$(ADD_LUA)" "Y" SPLEVSRC = lev_yacc.c lev_$(LEX).c lev_main.c panic.c - -DGNCOMPSRC = dgn_yacc.c dgn_$(LEX).c dgn_main.c +endif MAKEDEFSOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o -SPLEVOBJS = $(O)lev_yacc.o $(O)lev_$(LEX).o $(O)lev_main.o $(O)alloc.o \ - $(O)monst.o $(O)objects.o $(O)panic.o \ - $(O)drawing.o $(O)decl.o $(O)stubvid.o - -DGNCOMPOBJS = $(O)dgn_yacc.o $(O)dgn_$(LEX).o $(O)dgn_main.o $(O)alloc.o \ - $(O)panic.o - RECOVOBJS = $(O)recover.o @@ -301,12 +308,18 @@ VOBJ20 = $(O)vis_tab.o $(O)weapon.o $(O)were.o $(O)wield.o $(O)windows. 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 $(REGEX) $(O)isaac64.o +VOBJ24 = $(O)sfstruct.o SOBJ = $(O)msdos.o $(O)pcsys.o $(O)tty.o $(O)unix.o \ $(O)video.o $(O)vidtxt.o $(O)pckeys.o VVOBJ = $(O)version.o +ifeq "$(ADD_LUA)" "Y" +LUAOBJ = $(O)nhlua.o $(O)nhlsel.o $(O)nhlobj.o +LUA_QTEXT_FILE = "quest.lua" +endif + ifeq "$(ADD_CURSES)" "Y" CURSESOBJ= $(O)cursdial.o $(O)cursinit.o $(O)cursinvt.o $(O)cursmain.o \ $(O)cursmesg.o $(O)cursmisc.o $(O)cursstat.o $(O)curswins.o @@ -318,11 +331,42 @@ VOBJ = $(VOBJ01) $(VOBJ02) $(VOBJ03) $(VOBJ04) $(VOBJ05) \ $(VOBJ06) $(VOBJ07) $(VOBJ08) $(VOBJ09) $(VOBJ10) \ $(VOBJ11) $(VOBJ12) $(VOBJ13) $(VOBJ14) $(VOBJ15) \ $(VOBJ16) $(VOBJ17) $(VOBJ18) $(VOBJ19) $(VOBJ20) \ - $(VOBJ21) $(VOBJ22) $(VOBJ23) \ - $(CURSESOBJ) + $(VOBJ21) $(VOBJ22) $(VOBJ23) $(VOBJ24) $(VOBJ25) \ + $(CURSESOBJ) $(LUAOBJ) ALLOBJ = $(VOBJ) $(SOBJ) $(TILOBJ) $(TILOBJ2) $(VVOBJ) +ifeq "$(ADD_LUA)" "Y" +#===============-================================================= +# LUA library +# Source from http://www.lua.org/ftp/lua-5.3.5.tar.gz +#================================================================= + +LUASRC = $(LUATOP)/src +LUALIB = $(O)lua535s.a +LUADLL = $(O)lua535.a +LUAINCL = -I$(LUASRC) +#LUAFLAGS = unix added -lm here? +LUATARGETS = lua.exe luac.exe $(LUADLL) $(LUALIB) + +LUASRCFILES = lapi.c lauxlib.c lbaselib.c lbitlib.c lcode.c \ + lcorolib.c lctype.c ldblib.c ldebug.c ldo.c \ + ldump.c lfunc.c lgc.c linit.c liolib.c llex.c \ + lmathlib.c lmem.c loadlib.c lobject.c lopcodes.c \ + loslib.c lparser.c lstate.c lstring.c lstrlib.c \ + ltable.c ltablib.c ltm.c lundump.c lutf8lib.c \ + lvm.c lzio.c + +LUAOBJFILES = $(O)lapi.o $(O)lauxlib.o $(O)lbaselib.o $(O)lbitlib.o \ + $(O)lcode.o $(O)lcorolib.o $(O)lctype.o $(O)ldblib.o \ + $(O)ldebug.o $(O)ldo.o $(O)ldump.o $(O)lfunc.o \ + $(O)lgc.o $(O)linit.o $(O)liolib.o $(O)llex.o \ + $(O)lmathlib.o $(O)lmem.o $(O)loadlib.o $(O)lobject.o \ + $(O)lopcodes.o $(O)loslib.o $(O)lparser.o $(O)lstate.o \ + $(O)lstring.o $(O)lstrlib.o $(O)ltable.o $(O)ltablib.o \ + $(O)ltm.o $(O)lundump.o $(O)lutf8lib.o $(O)lvm.o $(O)lzio.o +endif + ifeq "$(ADD_CURSES)" "Y" #========================================== # PDCurses build macros @@ -334,11 +378,12 @@ PDCSRC = $(PDCURSES_TOP)/pdcurses PDCDOS = $(PDCURSES_TOP)/dos PDCLIBOBJS = $(O)addch.o $(O)addchstr.o $(O)addstr.o $(O)attr.o $(O)beep.o \ $(O)bkgd.o $(O)border.o $(O)clear.o $(O)color.o $(O)delch.o $(O)deleteln.o \ - $(O)getch.o $(O)getstr.o $(O)getyx.o $(O)inch.o $(O)inchstr.o \ + $(O)getch.o $(O)getstr.o $(O)getyx.o $(O)inch.o $(O)inchstr.o \ $(O)initscr.o $(O)inopts.o $(O)insch.o $(O)insstr.o $(O)instr.o $(O)kernel.o \ $(O)keyname.o $(O)mouse.o $(O)move.o $(O)outopts.o $(O)overlay.o $(O)pad.o \ $(O)panel.o $(O)printw.o $(O)refresh.o $(O)scanw.o $(O)scr_dump.o $(O)scroll.o \ - $(O)slk.o $(O)termattr.o $(O)touch.o $(O)util.o $(O)window.o $(O)debug.o + $(O)slk.o $(O)termattr.o $(O)touch.o $(O)util.o $(O)window.o \ + $(O)debug.o PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o \ $(O)pdcscrn.o $(O)pdcsetsc.o $(O)pdcutil.o @@ -420,7 +465,7 @@ CURSESDEF= CURSESLIB= endif -INCLDIR=-I../include -I../sys/msdos +INCLDIR=-I../include -I../sys/msdos $(LUAINCL) # Debugging #cflags = -pg -c $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DSUPPRESS_GRAPHICS @@ -511,6 +556,15 @@ $(OBJ)/%.o : $(PDCSRC)/%.c $(OBJ)/%.o : $(PDCDOS)/%.c $(CC) $(PDCINCL) $(cflags) -o$@ $< +ifeq "$(ADD_LUA)" "Y" +#========================================== +# Rules for LUA files +#========================================== + +$(OBJ)/%.o : $(LUASRC)/%.c + $(CC) $(cflags) -o$@ $< +endif + #========================================== # Primary Targets. #========================================== @@ -526,11 +580,13 @@ default: $(GAMEFILE) util: $(O)utility.tag +ifneq "$(ADD_LUA)" "Y" LEVCOMPEXE = $(U)lev_comp.exe - +else +LEVCOMPEXE = +endif $(O)utility.tag: $(INCL)/date.h $(INCL)/trap.h $(INCL)/onames.h \ - $(INCL)/pm.h monstr.c vis_tab.c $(LEVCOMPEXE) \ - $(U)dgn_comp.exe $(TILEUTIL) + $(INCL)/pm.h monstr.c vis_tab.c $(TILEUTIL) $(subst /,\,echo utilities made > $@) tileutil: $(U)gif2txt.exe $(U)txt2ppm.exe @@ -547,7 +603,11 @@ ifeq ($(USE_DLB),Y) else @$(subst /,\,copy $(DAT)/*. $(GAMEDIR)) @$(subst /,\,copy $(DAT)/*.dat $(GAMEDIR)) +ifeq "$(ADD_LUA)" "Y" + @$(subst /,\,copy $(DAT)/*.lua $(GAMEDIR)) +else @$(subst /,\,copy $(DAT)/*.lev $(GAMEDIR)) +endif @$(subst /,\,copy $(MSYS)/msdoshlp.txt $(GAMEDIR)) @$(subst /,\,if exist $(GAMEDIR)/makefile. del $(GAMEDIR)/makefile.) endif @@ -572,7 +632,7 @@ endif # The main target. #========================================== -$(GAMEFILE): $(O)obj.tag $(PATCHLEV_H) $(PDCLIB) \ +$(GAMEFILE): $(O)obj.tag $(PATCHLEV_H) $(PDCLIB) $(LUATARGETS) \ $(O)utility.tag $(ALLOBJ) $(O)$(GAME).lnk @if exist temp.a del temp.a @ar ru temp.a $(VOBJ01) @@ -604,11 +664,14 @@ $(GAMEFILE): $(O)obj.tag $(PATCHLEV_H) $(PDCLIB) \ @ar ru temp.a $(TILOBJ) @ar ru temp.a $(TILOBJ2) @ar ru temp.a $(VVOBJ) +ifeq "$(ADD_LUA)" "Y" + @ar ru temp.a $(LUAOBJ) +endif ifeq "$(ADD_CURSES)" "Y" @ar ru temp.a $(CURSESOBJ) endif $(LINK) $(LFLAGS) -o$(GAME).exe temp.a \ - $(PDCLIB) $(LIBRARIES) $(ZLIB) + $(PDCLIB) $(LUALIB) $(LIBRARIES) $(ZLIB) @$(subst /,\,stubedit $(GAME).exe minstack=2048K) @$(subst /,\,copy $(GAME).exe $(GAMEFILE)) @$(subst /,\,del $(GAME).exe) @@ -643,6 +706,9 @@ $(O)$(GAME).lnk: $(ALLOBJ) echo $(TILOBJ) >> $(subst /,\,$@) echo $(TILOBJ2) >> $(subst /,\,$@) echo $(VVOBJ) >> $(subst /,\,$@) +ifeq "$(ADD_LUA)" "Y" + echo $(LUAOBJ) >> $(subst /,\,$@) +endif ifeq "$(ADD_CURSES)" "Y" echo $(CURSESOBJ) >> $(subst /,\,$@) endif @@ -683,8 +749,9 @@ $(U)makedefs.exe: $(MAKEDEFSOBJS) $(LINK) $(LFLAGS) -o$@ $(MAKEDEFSOBJS) $(O)makedefs.o: $(CONFIG_H) $(PERMONST_H) $(INCL)/objclass.h \ - $(INCL)/monsym.h $(INCL)/qtext.h $(U)makedefs.c + $(INCL)/monsym.h $(U)makedefs.c +ifneq "$(ADD_LUA)" "Y" #========================================== # Level Compiler Dependencies #========================================== @@ -757,58 +824,6 @@ else @$(subst /,\,copy $(SSHR)/lev_lex.c $@) @$(subst /,\,echo.>>$@) endif - -#========================================== -# Dungeon Dependencies -#========================================== - -$(U)dgn_comp.exe: $(DGNCOMPOBJS) - $(LINK) $(LFLAGS) -o$@ $(DGNCOMPOBJS) - -ifeq "$(DO_YACC)" "YACC_ACT" -$(U)dgn_yacc.c $(INCL)/dgn_comp.h : $(U)dgn_comp.y - @$(subst /,\,chdir $(UTIL)) - @$(subst /,\,$(YACC) -d dgn_comp.y) - @$(subst /,\,copy $(YTABC) dgn_yacc.c) - @$(subst /,\,copy $(YTABH) $(INCL)/dgn_comp.h) - @$(subst /,\,@del $(YTABC)) - @$(subst /,\,@del $(YTABH)) - @$(subst /,\,chdir $(SRC)) -else -$(U)dgn_yacc.c: $(SSHR)/dgn_yacc.c - @echo --- - @echo For now, we will copy the prebuilt $(U)dgn_yacc.c and - @echo dgn_comp.h from $(SSHR) into $(U) and use that. - @$(subst /,\,copy $(SSHR)/dgn_yacc.c $(U)dgn_yacc.c) - @$(subst /,\,echo.>>$(U)dgn_yacc.c) - -$(INCL)/dgn_comp.h: $(SSHR)/dgn_comp.h - @echo --- - @echo For now, we will copy the prebuilt dgn_comp.h - @echo from $(SSHR) into $(INCL) and use that. - @$(subst /,\,copy $(SSHR)/dgn_comp.h $(INCL)/dgn_comp.h) - @$(subst /,\,echo.>>$(INCL)/dgn_comp.h) - -endif - -ifeq "$(DO_LEX)" "LEX_ACT" - -$(U)dgn_$(LEX).c: $(U)dgn_comp.l $(INCL)/dgn_comp.h - @$(subst /,\,chdir $(UTIL)) - @$(subst /,\,$(LEX) $(FLEXSKEL) dgn_comp.l) - @$(subst /,\,if exist $@ del $@) - @$(subst /,\,copy $(LEXYYC) $@) - @$(subst /,\,del $(LEXYYC)) - @$(subst /,\,chdir $(SRC)) -else - -$(U)dgn_$(LEX).c: $(SSHR)/dgn_lex.c $(INCL)/dgn_comp.h - @echo --- - @echo For now, we will copy the prebuilt dgn_lex.c - @echo from $(SSHR) into $(U) and use it. - @$(subst /,\,copy $(SSHR)/dgn_lex.c $@) - @$(subst /,\,echo.>>$@) - endif #========================================== @@ -944,7 +959,11 @@ endif #========================================== $(O)pdcurses.a : $(PDCLIBOBJS) $(PDCOBJS) - ar rcs $@ $(PDCLIBOBJS) $(PDCOBJS) + ar rcS $@ $(PDCLIBOBJS1) + ar rcS $@ $(PDCLIBOBJS2) + ar rcS $@ $(PDCLIBOBJS3) + ar rcS $@ $(PDCLIBOBJS4) + ar rcs $@ $(PDCOBJS) #========================================== # Other Util Dependencies. @@ -985,8 +1004,10 @@ $(DAT)/data: $(O)utility.tag $(DATABASE) $(DAT)/rumors: $(O)utility.tag $(DAT)/rumors.tru $(DAT)/rumors.fal @$(subst /,\,$(U)makedefs.exe -r) +ifndef LUA_QTEXT_FILE $(DAT)/quest.dat: $(O)utility.tag $(DAT)/quest.txt @$(subst /,\,$(U)makedefs.exe -q) +endif $(DAT)/oracles: $(O)utility.tag $(DAT)/oracles.txt @$(subst /,\,$(U)makedefs.exe -h) @@ -1000,65 +1021,32 @@ $(DAT)/engrave: $(O)utility.tag $(DAT)/engrave.txt $(DAT)/epitaph: $(O)utility.tag $(DAT)/epitaph.txt @$(subst /,\,$(U)makedefs.exe -s) -$(O)sp_lev.tag: $(O)utility.tag \ - $(DAT)/bigroom.des $(DAT)/castle.des \ - $(DAT)/endgame.des $(DAT)/gehennom.des $(DAT)/knox.des \ - $(DAT)/medusa.des $(DAT)/oracle.des $(DAT)/tower.des \ - $(DAT)/yendor.des $(DAT)/arch.des $(DAT)/barb.des \ - $(DAT)/caveman.des $(DAT)/healer.des $(DAT)/knight.des \ - $(DAT)/monk.des $(DAT)/priest.des $(DAT)/ranger.des \ - $(DAT)/rogue.des $(DAT)/samurai.des $(DAT)/tourist.des \ - $(DAT)/valkyrie.des $(DAT)/wizard.des - @$(subst /,\,cd $(DAT)) - @$(subst /,\,$(U)lev_comp bigroom.des) - @$(subst /,\,$(U)lev_comp castle.des) - @$(subst /,\,$(U)lev_comp endgame.des) - @$(subst /,\,$(U)lev_comp gehennom.des) - @$(subst /,\,$(U)lev_comp knox.des) - @$(subst /,\,$(U)lev_comp mines.des) - @$(subst /,\,$(U)lev_comp medusa.des) - @$(subst /,\,$(U)lev_comp oracle.des) - @$(subst /,\,$(U)lev_comp sokoban.des) - @$(subst /,\,$(U)lev_comp tower.des) - @$(subst /,\,$(U)lev_comp yendor.des) - @$(subst /,\,$(U)lev_comp arch.des) - @$(subst /,\,$(U)lev_comp barb.des) - @$(subst /,\,$(U)lev_comp caveman.des) - @$(subst /,\,$(U)lev_comp healer.des) - @$(subst /,\,$(U)lev_comp knight.des) - @$(subst /,\,$(U)lev_comp monk.des) - @$(subst /,\,$(U)lev_comp priest.des) - @$(subst /,\,$(U)lev_comp ranger.des) - @$(subst /,\,$(U)lev_comp rogue.des) - @$(subst /,\,$(U)lev_comp samurai.des) - @$(subst /,\,$(U)lev_comp tourist.des) - @$(subst /,\,$(U)lev_comp valkyrie.des) - @$(subst /,\,$(U)lev_comp wizard.des) - @$(subst /,\,cd $(SRC)) +$(O)sp_lev.tag: $(O)utility.tag @$(subst /,\,echo sp_levs done > $@) -$(DAT)/dungeon: $(O)utility.tag $(DAT)/dungeon.def - @$(subst /,\,$(U)makedefs.exe -e) - @$(subst /,\,cd $(DAT)) - @$(subst /,\,$(U)dgn_comp.exe dungeon.pdf) - @$(subst /,\,cd $(SRC)) - #========================================== # DLB stuff #========================================== #note that dir below assumes bin/dir.exe from djgpp distribution # -$(DAT)/nhdat: $(U)dlb_main.exe $(DAT)/data $(DAT)/rumors $(DAT)/dungeon \ - $(DAT)/oracles $(DAT)/quest.dat $(O)sp_lev.tag \ - $(DAT)/bogusmon $(DAT)/engrave $(DAT)/epitaph $(DAT)/tribute +$(DAT)/nhdat: $(U)dlb_main.exe $(DAT)/data $(DAT)/rumors \ + $(DAT)/oracles \ +ifndef LUA_QTEXT_FILE + $(DAT)/quest.dat \ +endif + $(O)sp_lev.tag \ + $(DAT)/bogusmon $(DAT)/engrave $(DAT)/epitaph $(DAT)/tribute @$(subst /,\,echo dat done >$(O)dat.tag) @$(subst /,\,cd $(DAT)) @$(subst /,\,copy $(MSYS)/msdoshlp.txt .) - @$(LS) data dungeon oracles options quest.dat rumors help hh >dlb.lst + @$(LS) data oracles options rumors help hh >dlb.lst +ifndef LUA_QTEXT_FILE + @$(LS) quest.dat >>dlb.lst +endif @$(LS) cmdhelp history opthelp wizhelp license msdoshlp.txt >>dlb.lst @$(LS) bogusmon engrave epitaph tribute >>dlb.lst - $(LS) $(subst /,\,*.lev) >>dlb.lst + $(LS) $(subst /,\,*.lua) >>dlb.lst @$(subst /,\,$(U)dlb_main cvIf dlb.lst nhdat) @$(subst /,\,cd $(SRC)) @@ -1085,10 +1073,7 @@ clean: spotless: clean - $(subst /,\,if exist $(U)dgn_flex.c del $(U)dgn_flex.c) - $(subst /,\,if exist $(U)dgn_lex.c del $(U)dgn_lex.c) $(subst /,\,if exist $(U)makedefs.exe del $(U)makedefs.exe) - $(subst /,\,if exist $(U)dgn_comp.exe del $(U)dgn_comp.exe) $(subst /,\,if exist $(U)recover.exe del $(U)recover.exe) $(subst /,\,if exist $(U)tilemap.exe del $(U)tilemap.exe) $(subst /,\,if exist $(U)tile2bmp.exe del $(U)tile2bmp.exe) @@ -1100,24 +1085,105 @@ spotless: clean $(subst /,\,if exist $(INCL)/onames.h del $(INCL)/onames.h) $(subst /,\,if exist $(INCL)/pm.h del $(INCL)/pm.h) $(subst /,\,if exist $(INCL)/date.h del $(INCL)/date.h) - $(subst /,\,if exist $(INCL)/dgn_comp.h del $(INCL)/dgn_comp.h) - $(subst /,\,if exist $(INCL)/lev_comp.h del $(INCL)/lev_comp.h) $(subst /,\,if exist $(SRC)/monstr.c del $(SRC)/monstr.c) $(subst /,\,if exist $(SRC)/vis_tab.c del $(SRC)/vis_tab.c) $(subst /,\,if exist $(SRC)/tile.c del $(SRC)/tile.c) $(subst /,\,if exist $(DAT)/options del $(DAT)/options) $(subst /,\,if exist $(DAT)/data del $(DAT)/data) $(subst /,\,if exist $(DAT)/rumors del $(DAT)/rumors) - $(subst /,\,if exist $(DAT)/dungeon.pdf del $(DAT)/dungeon.pdf) - $(subst /,\,if exist $(DAT)/dungeon del $(DAT)/dungeon) $(subst /,\,if exist $(DAT)/oracles del $(DAT)/oracles) +ifndef LUA_QTEXT_FILE $(subst /,\,if exist $(DAT)/quest.dat del $(DAT)/quest.dat) +endif + $(subst /,\,if exist $(DAT)/bogusmon del $(DAT)/bogusmon) + $(subst /,\,if exist $(DAT)/engrave del $(DAT)/engrave) + $(subst /,\,if exist $(DAT)/epitaph del $(DAT)/epitaph) + $(subst /,\,if exist $(DAT)/dlb.lst del $(DAT)/dlb.lst) + $(subst /,\,if exist $(DAT)/nhdat del $(DAT)/nhdat) + $(subst /,\,if exist $(TILE_BMP) del $(TILE_BMP)) + $(subst /,\,if exist $(WSHR)/monthin.txt del $(WSHR)/monthin.txt) + $(subst /,\,if exist $(WSHR)/objthin.txt del $(WSHR)/objthin.txt) + $(subst /,\,if exist $(WSHR)/oththin.txt del $(WSHR)/oththin.txt) + +#========================================== +# Create directory for holding object files +#========================================== + +$(O)obj.tag: + -$(subst /,\,@if not exist $(OBJ)/*.* mkdir $(OBJ)) + @$(subst /,\,@echo directory created > $@) + +#=========================================== +# Work around some djgpp long file name woes +#=========================================== + +$(PATCHLEV_H): + @$(subst /,\,if not exist $@ copy $(INCL)/patchlevel.h $(INCL)/patchlev.h) + +#============================================================= +# LUA +#============================================================= + +lua.exe: $(O)lua.o $(LUALIB) + $(link) $(LFLAGS) -o$@ $(O)lua.o $(LUALIB) + +luac.exe: $(O)luac.o $(O)lua535s.a + $(link) $(LFLAGSU) -o$@ $(O)luac.o $(LUALIB) + +$(O)lua535.a: $(LUAOBJFILES) + $(cc) -shared -Wl,--export-all-symbols \ + -Wl,--add-stdcall-alias -o $@ $< + +$(O)lua535s.a: $(LUAOBJFILES) + ar rcs $@ $(LUAOBJFILES) + +$(O)lua.o: $(LUASRC)/lua.c +$(O)luac.o: $(LUASRC)/luac.c + +#========================================== +# Housekeeping. +#========================================== + +clean: + $(subst /,\,if exist $(O)*.o del $(O)*.o) + $(subst /,\,if exist $(O)dat.tag del $(O)dat.tag) + $(subst /,\,if exist $(O)install.tag del $(O)install.tag) + $(subst /,\,if exist $(O)$(GAME).lnk del $(O)$(GAME).lnk) + $(subst /,\,if exist $(O)obj.tag del $(O)obj.tag) + $(subst /,\,if exist $(O)sp_lev.tag del $(O)sp_lev.tag) + $(subst /,\,if exist $(O)thintile.tag del $(O)thintile.tag) + $(subst /,\,if exist $(O)utility.tag del $(O)utility.tag) + $(subst /,\,if exist temp.a del temp.a) + +spotless: clean + + $(subst /,\,if exist $(U)makedefs.exe del $(U)makedefs.exe) + $(subst /,\,if exist $(U)recover.exe del $(U)recover.exe) + $(subst /,\,if exist $(U)tilemap.exe del $(U)tilemap.exe) + $(subst /,\,if exist $(U)tile2bmp.exe del $(U)tile2bmp.exe) + $(subst /,\,if exist $(U)tile2bin.exe del $(U)tile2bin.exe) + $(subst /,\,if exist $(U)til2bin2.exe del $(U)til2bin2.exe) + $(subst /,\,if exist $(U)thintile.exe del $(U)thintile.exe) + $(subst /,\,if exist $(U)dlb_main.exe del $(U)dlb_main.exe) + $(subst /,\,if exist $(INCL)/vis_tab.h del $(INCL)/vis_tab.h) + $(subst /,\,if exist $(INCL)/onames.h del $(INCL)/onames.h) + $(subst /,\,if exist $(INCL)/pm.h del $(INCL)/pm.h) + $(subst /,\,if exist $(INCL)/date.h del $(INCL)/date.h) + $(subst /,\,if exist $(SRC)/monstr.c del $(SRC)/monstr.c) + $(subst /,\,if exist $(SRC)/vis_tab.c del $(SRC)/vis_tab.c) + $(subst /,\,if exist $(SRC)/tile.c del $(SRC)/tile.c) + $(subst /,\,if exist $(DAT)/options del $(DAT)/options) + $(subst /,\,if exist $(DAT)/data del $(DAT)/data) + $(subst /,\,if exist $(DAT)/rumors del $(DAT)/rumors) + $(subst /,\,if exist $(DAT)/oracles del $(DAT)/oracles) +ifndef LUA_QTEXT_FILE + $(subst /,\,if exist $(DAT)/quest.dat del $(DAT)/quest.dat) +endif $(subst /,\,if exist $(DAT)/bogusmon del $(DAT)/bogusmon) $(subst /,\,if exist $(DAT)/engrave del $(DAT)/engrave) $(subst /,\,if exist $(DAT)/epitaph del $(DAT)/epitaph) $(subst /,\,if exist $(DAT)/dlb.lst del $(DAT)/dlb.lst) $(subst /,\,if exist $(DAT)/nhdat del $(DAT)/nhdat) - $(subst /,\,if exist $(DAT)/*.lev del $(DAT)/*.lev) $(subst /,\,if exist $(TILE_BMP) del $(TILE_BMP)) $(subst /,\,if exist $(WSHR)/monthin.txt del $(WSHR)/monthin.txt) $(subst /,\,if exist $(WSHR)/objthin.txt del $(WSHR)/objthin.txt) @@ -1332,7 +1398,7 @@ $(O)apply.o: apply.c $(HACK_H) $(O)artifact.o: artifact.c $(HACK_H) $(INCL)/artifact.h $(INCL)/artilist.h $(O)attrib.o: attrib.c $(HACK_H) $(O)ball.o: ball.c $(HACK_H) -$(O)bones.o: bones.c $(HACK_H) $(INCL)/lev.h +$(O)bones.o: bones.c $(HACK_H) $(O)botl.o: botl.c $(HACK_H) $(O)cmd.o: cmd.c $(HACK_H) $(INCL)/func_tab.h $(O)dbridge.o: dbridge.c $(HACK_H) @@ -1342,7 +1408,7 @@ $(O)dig.o: dig.c $(HACK_H) $(O)display.o: display.c $(HACK_H) $(O)dlb.o: dlb.c $(CONFIG_H) $(INCL)/dlb.h $(CC) $(cflags) -I../sys/msdos -o$@ dlb.c -$(O)do.o: do.c $(HACK_H) $(INCL)/lev.h +$(O)do.o: do.c $(HACK_H) $(O)do_name.o: do_name.c $(HACK_H) $(O)do_wear.o: do_wear.c $(HACK_H) $(O)dog.o: dog.c $(HACK_H) @@ -1352,8 +1418,8 @@ $(O)dothrow.o: dothrow.c $(HACK_H) $(O)drawing.o: drawing.c $(HACK_H) $(INCL)/tcap.h $(O)dungeon.o: dungeon.c $(HACK_H) $(INCL)/dgn_file.h $(INCL)/dlb.h $(O)eat.o: eat.c $(HACK_H) -$(O)end.o: end.c $(HACK_H) $(INCL)/lev.h $(INCL)/dlb.h -$(O)engrave.o: engrave.c $(HACK_H) $(INCL)/lev.h +$(O)end.o: end.c $(HACK_H) $(INCL)/dlb.h +$(O)engrave.o: engrave.c $(HACK_H) $(O)exper.o: exper.c $(HACK_H) $(O)explode.o: explode.c $(HACK_H) $(O)extralev.o: extralev.c $(HACK_H) @@ -1362,7 +1428,7 @@ $(O)fountain.o: fountain.c $(HACK_H) $(O)hack.o: hack.c $(HACK_H) $(O)hacklib.o: hacklib.c $(HACK_H) $(O)invent.o: invent.c $(HACK_H) -$(O)light.o: light.c $(HACK_H) $(INCL)/lev.h +$(O)light.o: light.c $(HACK_H) $(O)lock.o: lock.c $(HACK_H) $(O)mail.o: mail.c $(HACK_H) $(INCL)/mail.h $(O)makemon.o: makemon.c $(HACK_H) @@ -1373,7 +1439,7 @@ $(O)mhitu.o: mhitu.c $(HACK_H) $(INCL)/artifact.h $(O)minion.o: minion.c $(HACK_H) $(O)mklev.o: mklev.c $(HACK_H) $(O)mkmap.o: mkmap.c $(HACK_H) $(INCL)/sp_lev.h -$(O)mkmaze.o: mkmaze.c $(HACK_H) $(INCL)/sp_lev.h $(INCL)/lev.h +$(O)mkmaze.o: mkmaze.c $(HACK_H) $(INCL)/sp_lev.h $(O)mkobj.o: mkobj.c $(HACK_H) $(O)mkroom.o: mkroom.c $(HACK_H) $(O)mon.o: mon.c $(HACK_H) $(INCL)/mfndpos.h @@ -1386,7 +1452,10 @@ $(O)mplayer.o: mplayer.c $(HACK_H) $(O)mthrowu.o: mthrowu.c $(HACK_H) $(O)muse.o: muse.c $(HACK_H) $(O)music.o: music.c $(HACK_H) #interp.c -$(O)o_init.o: o_init.c $(HACK_H) $(INCL)/lev.h +$(O)nhlua.o: nhlua.c $(HACK_H) +$(O)nhlsel.o: nhlsel.c $(HACK_H) +$(O)nhlobj.o: nhlobj.c $(HACK_H) +$(O)o_init.o: o_init.c $(HACK_H) $(O)objects.o: objects.c $(CONFIG_H) $(INCL)/obj.h $(INCL)/objclass.h \ $(INCL)/prop.h $(INCL)/skills.h $(INCL)/color.h $(O)objnam.o: objnam.c $(HACK_H) @@ -1399,17 +1468,17 @@ $(O)polyself.o: polyself.c $(HACK_H) $(O)potion.o: potion.c $(HACK_H) $(O)pray.o: pray.c $(HACK_H) $(O)priest.o: priest.c $(HACK_H) $(INCL)/mfndpos.h -$(O)quest.o: quest.c $(HACK_H) $(INCL)/qtext.h -$(O)questpgr.o: questpgr.c $(HACK_H) $(INCL)/dlb.h $(INCL)/qtext.h +$(O)quest.o: quest.c $(HACK_H) +$(O)questpgr.o: questpgr.c $(HACK_H) $(INCL)/dlb.h $(O)read.o: read.c $(HACK_H) $(O)rect.o: rect.c $(HACK_H) -$(O)region.o: region.c $(HACK_H) $(INCL)/lev.h -$(O)restore.o: restore.c $(HACK_H) $(INCL)/lev.h $(INCL)/tcap.h +$(O)region.o: region.c $(HACK_H) +$(O)restore.o: restore.c $(HACK_H) $(INCL)/tcap.h $(O)rip.o: rip.c $(HACK_H) $(O)rnd.o: rnd.c $(HACK_H) $(O)role.o: role.c $(HACK_H) -$(O)rumors.o: rumors.c $(HACK_H) $(INCL)/lev.h $(INCL)/dlb.h -$(O)save.o: save.c $(HACK_H) $(INCL)/lev.h +$(O)rumors.o: rumors.c $(HACK_H) $(INCL)/dlb.h +$(O)save.o: save.c $(HACK_H) $(O)shk.o: shk.c $(HACK_H) $(O)shknam.o: shknam.c $(HACK_H) $(O)sit.o: sit.c $(HACK_H) $(INCL)/artifact.h @@ -1420,7 +1489,7 @@ $(O)steal.o: steal.c $(HACK_H) $(O)steed.o: steed.c $(HACK_H) $(O)sys.o: sys.c $(HACK_H) $(O)teleport.o: teleport.c $(HACK_H) -$(O)timeout.o: timeout.c $(HACK_H) $(INCL)/lev.h +$(O)timeout.o: timeout.c $(HACK_H) $(O)topten.o: topten.c $(HACK_H) $(INCL)/dlb.h $(PATCHLEV_H) $(O)track.o: track.c $(HACK_H) $(O)trap.o: trap.c $(HACK_H) @@ -1433,8 +1502,8 @@ $(O)weapon.o: weapon.c $(HACK_H) $(O)were.o: were.c $(HACK_H) $(O)wield.o: wield.c $(HACK_H) $(O)windows.o: windows.c $(HACK_H) $(INCL)/wingem.h $(INCL)/winGnome.h -$(O)wizard.o: wizard.c $(HACK_H) $(INCL)/qtext.h -$(O)worm.o: worm.c $(HACK_H) $(INCL)/lev.h +$(O)wizard.o: wizard.c $(HACK_H) +$(O)worm.o: worm.c $(HACK_H) $(O)worn.o: worn.c $(HACK_H) $(O)write.o: write.c $(HACK_H) $(O)zap.o: zap.c $(HACK_H) diff --git a/sys/msdos/Makefile.MSC b/sys/msdos/Makefile.MSC index 488382a7a..60ef58d9d 100644 --- a/sys/msdos/Makefile.MSC +++ b/sys/msdos/Makefile.MSC @@ -583,7 +583,7 @@ $(U)makedefs.exe: $(MAKEOBJS) << makedefs.o: $(CONFIG_H) $(PERMONST_H) $(INCL)\objclass.h \ - $(INCL)\monsym.h $(INCL)\qtext.h $(UTIL)\makedefs.c + $(INCL)\monsym.h $(UTIL)\makedefs.c # The following include files depend on makedefs to be created. # @@ -1114,7 +1114,7 @@ apply.o: apply.c $(HACK_H) artifact.o: artifact.c $(HACK_H) $(INCL)\artifact.h $(INCL)\artilist.h attrib.o: attrib.c $(HACK_H) $(INCL)\artifact.h ball.o: ball.c $(HACK_H) -bones.o: bones.c $(HACK_H) $(INCL)\lev.h +bones.o: bones.c $(HACK_H) botl.o: botl.c $(HACK_H) cmd.o: cmd.c $(HACK_H) $(INCL)\func_tab.h dbridge.o: dbridge.c $(HACK_H) @@ -1123,7 +1123,7 @@ detect.o: detect.c $(HACK_H) $(INCL)\artifact.h dig.o: dig.c $(HACK_H) display.o: display.c $(HACK_H) dlb.o: dlb.c $(CONFIG_H) $(INCL)\dlb.h -do.o: do.c $(HACK_H) $(INCL)\lev.h +do.o: do.c $(HACK_H) do_name.o: do_name.c $(HACK_H) do_wear.o: do_wear.c $(HACK_H) dog.o: dog.c $(HACK_H) @@ -1133,8 +1133,8 @@ dothrow.o: dothrow.c $(HACK_H) drawing.o: drawing.c $(HACK_H) $(INCL)\tcap.h dungeon.o: dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h eat.o: eat.c $(HACK_H) -end.o: end.c $(HACK_H) $(INCL)\lev.h $(INCL)\dlb.h -engrave.o: engrave.c $(HACK_H) $(INCL)\lev.h +end.o: end.c $(HACK_H) $(INCL)\dlb.h +engrave.o: engrave.c $(HACK_H) exper.o: exper.c $(HACK_H) explode.o: explode.c $(HACK_H) extralev.o: extralev.c $(HACK_H) @@ -1143,7 +1143,7 @@ fountain.o: fountain.c $(HACK_H) hack.o: hack.c $(HACK_H) hacklib.o: hacklib.c $(HACK_H) invent.o: invent.c $(HACK_H) $(INCL)\artifact.h -light.o: light.c $(HACK_H) $(INCL)\lev.h +light.o: light.c $(HACK_H) lock.o: lock.c $(HACK_H) mail.o: mail.c $(HACK_H) $(INCL)\mail.h makemon.o: makemon.c $(HACK_H) @@ -1154,7 +1154,7 @@ mhitu.o: mhitu.c $(HACK_H) $(INCL)\artifact.h minion.o: minion.c $(HACK_H) mklev.o: mklev.c $(HACK_H) mkmap.o: mkmap.c $(HACK_H) $(INCL)\sp_lev.h -mkmaze.o: mkmaze.c $(HACK_H) $(INCL)\sp_lev.h $(INCL)\lev.h +mkmaze.o: mkmaze.c $(HACK_H) $(INCL)\sp_lev.h mkobj.o: mkobj.c $(HACK_H) $(INCL)\artifact.h mkroom.o: mkroom.c $(HACK_H) mon.o: mon.c $(HACK_H) $(INCL)\mfndpos.h @@ -1167,7 +1167,7 @@ mplayer.o: mplayer.c $(HACK_H) mthrowu.o: mthrowu.c $(HACK_H) muse.o: muse.c $(HACK_H) music.o: music.c $(HACK_H) #interp.c -o_init.o: o_init.c $(HACK_H) $(INCL)\lev.h +o_init.o: o_init.c $(HACK_H) objects.o: objects.c $(CONFIG_H) $(INCL)\obj.h $(INCL)\objclass.h \ $(INCL)\prop.h $(INCL)\skills.h $(INCL)\color.h objnam.o: objnam.c $(HACK_H) @@ -1181,17 +1181,17 @@ polyself.o: polyself.c $(HACK_H) potion.o: potion.c $(HACK_H) pray.o: pray.c $(HACK_H) priest.o: priest.c $(HACK_H) $(INCL)\mfndpos.h -quest.o: quest.c $(HACK_H) $(INCL)\qtext.h -questpgr.o: questpgr.c $(HACK_H) $(INCL)\dlb.h $(INCL)\qtext.h +quest.o: quest.c $(HACK_H) +questpgr.o: questpgr.c $(HACK_H) $(INCL)\dlb.h read.o: read.c $(HACK_H) rect.o: rect.c $(HACK_H) region.o: region.c $(HACK_H) -restore.o: restore.c $(HACK_H) $(INCL)\lev.h $(INCL)\tcap.h +restore.o: restore.c $(HACK_H) $(INCL)\tcap.h rip.o: rip.c $(HACK_H) rnd.o: rnd.c $(HACK_H) role.o: role.c $(HACK_H) -rumors.o: rumors.c $(HACK_H) $(INCL)\lev.h $(INCL)\dlb.h -save.o: save.c $(HACK_H) $(INCL)\lev.h +rumors.o: rumors.c $(HACK_H) $(INCL)\dlb.h +save.o: save.c $(HACK_H) shk.o: shk.c $(HACK_H) shknam.o: shknam.c $(HACK_H) sit.o: sit.c $(HACK_H) $(INCL)\artifact.h @@ -1202,7 +1202,7 @@ steal.o: steal.c $(HACK_H) steed.o: steed.c $(HACK_H) sys.o: sys.c $(HACK_H) teleport.o: teleport.c $(HACK_H) -timeout.o: timeout.c $(HACK_H) $(INCL)\lev.h +timeout.o: timeout.c $(HACK_H) topten.o: topten.c $(HACK_H) $(INCL)\dlb.h $(INCL)\patchlev.h track.o: track.c $(HACK_H) trap.o: trap.c $(HACK_H) @@ -1215,8 +1215,8 @@ weapon.o: weapon.c $(HACK_H) were.o: were.c $(HACK_H) wield.o: wield.c $(HACK_H) windows.o: windows.c $(HACK_H) $(INCL)\wingem.h -wizard.o: wizard.c $(HACK_H) $(INCL)\qtext.h -worm.o: worm.c $(HACK_H) $(INCL)\lev.h +wizard.o: wizard.c $(HACK_H) +worm.o: worm.c $(HACK_H) worn.o: worn.c $(HACK_H) write.o: write.c $(HACK_H) zap.o: zap.c $(HACK_H) diff --git a/sys/msdos/Makefile1.cross b/sys/msdos/Makefile1.cross new file mode 100644 index 000000000..a2af8b1fb --- /dev/null +++ b/sys/msdos/Makefile1.cross @@ -0,0 +1,644 @@ +# NetHack 3.7 Makefile1.cross +# Cross-compile msdos version of NetHack using a +# linux-hosted djgpp cross-compiler. +# +# Makefile1.cross (this file) is for the host-side obj files and +# utilities that will run on the host platform only. +# +# Makefile2.cross is for the target platform obj files +# and utilities. +# +# Makefile2 utilizes the djgpp cross-compiler from Andrew Wu: +# https://github.com/andrewwutw/build-djgpp +# +# Currently, in NetHack 3.7, it is now feasible to cross-compile +# the game in a 2-stage process. Makefile1.cross (this file) carries +# out the 1st stage. +# +# The GNU Make has a problem if you include a drive spec below. +GAMEDIR =../msdos-binary + +# +#============================================================================== +# This marks the end of the BUILD DECISIONS section. +#============================================================================== +# +# Directories, gcc likes unix style directory specs +# + +OBJ = o +HOBJ = host_o +DAT = ../dat +DOC = ../doc +INCL = ../include +LIB = ../lib +MSYS = ../sys/msdos +SRC = ../src +SSHR = ../sys/share +UTIL = ../util +WIN = ../win/tty +WCURSES = ../win/curses +WSHR = ../win/share + +# +# Executables. +# +HOST_CC = gcc +HOST_LINK = gcc +MAKEBIN = make + +# +# Special libraries and how to link them in. +# +LIBS = -lpc +LIBRARIES = $(LIBS) + +# +# Yacc/Lex off +# +YACC_LEX = N + +# +# Uncomment the line below if you want to store all the level files, +# help files, etc. in a single library file. +# +USE_DLB = Y + +#=============================================== +#======= End of Modification Section =========== +#=============================================== +################################################ +# # +# Nothing below here should have to be changed.# +# # +################################################ + +# Changing this conditional block is not recommended +ifeq "$(USE_DLB)" "Y" +DLBFLG = -DDLB +else +DLBFLG = +endif + +TERMLIB = + +#========================================== +#================ MACROS ================== +#========================================== +# This section creates shorthand macros for many objects +# referenced later on in the Makefile. +# +# Have windows path styles available for use in commands +# +W_OBJ =$(subst /,\, $(OBJ)) +W_INCL =$(subst /,\, $(INCL)) +W_DAT =$(subst /,\, $(DAT)) +W_DOC =$(subst /,\, $(DOC)) +W_UTIL =$(subst /,\, $(UTIL)) +W_SRC =$(subst /,\, $(SRC)) +W_SSYS =$(subst /,\, $(SSYS)) +W_MSWSYS =$(subst /,\, $(MSWSYS)) +W_TTY =$(subst /,\, $(TTY)) +W_MSWIN =$(subst /,\, $(MSWIN)) +ifeq "$(ADD_CURSES)" "Y" +W_WCURSES =$(subst /,\, $(WCURSES)) +endif +W_WSHR =$(subst /,\, $(WSHR)) +W_GAMEDIR =$(subst /,\, $(GAMEDIR)) + +# +# Shorten up the location for some files +# + +O = $(OBJ)/ +HOST_O = $(HOBJ)/ +U = $(UTIL)/ + +#========================================== +# Utility Objects. +#========================================== + +MAKESRC = makedefs.c + +MAKEDEFSOBJS = $(HOST_O)makedefs.o $(HOST_O)monst.o $(HOST_O)objects.o + +LUA_QTEXT_FILE = "quest.lua" + +#SPLEVSRC = lev_yacc.c lev_$(LEX).c lev_main.c panic.c +#DGNCOMPSRC = dgn_yacc.c dgn_$(LEX).c dgn_main.c +#SPLEVOBJS = $(HOST_O)lev_yacc.o $(HOST_O)lev_$(LEX).o $(HOST_O)lev_main.o $(HOST_O)alloc.o \ +# $(HOST_O)monst.o $(HOST_O)objects.o $(HOST_O)panic.o \ +# $(HOST_O)drawing.o $(HOST_O)decl.o $(HOST_O)stubvid.o +#DGNCOMPOBJS = $(HOST_O)dgn_yacc.o $(HOST_O)dgn_$(LEX).o $(HOST_O)dgn_main.o $(HOST_O)alloc.o \ +# $(HOST_O)panic.o + +#========================================== +# Tile related object files. +#========================================== + +TILOBJ = $(HOST_O)tile.o $(VGAOBJ) + +TILOBJ2 = $(HOST_O)tileset.o $(HOST_O)bmptiles.o $(HOST_O)giftiles.o + +TEXTIO = $(HOST_O)tiletext.o $(HOST_O)tiletxt.o $(HOST_O)drawing.o $(HOST_O)decl.o $(HOST_O)monst.o \ + $(HOST_O)objects.o + +TEXTIO2 = $(HOST_O)tiletex2.o $(HOST_O)tiletxt2.o $(HOST_O)drawing.o $(HOST_O)decl.o $(HOST_O)monst.o \ + $(HOST_O)objects.o + +TILE_BMP = $(DAT)/NHTILES.BMP + +TILEUTIL = $(TILOBJ) $(TILE_BMP) + +TILEFILES = $(WSHR)/monsters.txt $(WSHR)/objects.txt $(WSHR)/other.txt + +TILEFILES2 = $(WSHR)/monthin.txt $(WSHR)/objthin.txt $(WSHR)/oththin.txt + +GIFREADERS = $(HOST_O)gifread.o $(HOST_O)alloc.o $(HOST_O)panic.o + +GIFREAD2 = $(HOST_O)gifread2.o $(HOST_O)alloc.o $(HOST_O)panic.o + +PPMWRITERS = $(HOST_O)ppmwrite.o $(HOST_O)alloc.o $(HOST_O)panic.o + +PPMWRIT2 = $(HOST_O)ppmwrit2.o $(HOST_O)alloc.o $(HOST_O)panic.o + +#========================================== +# Object files. +#========================================== + +DLBOBJ = $(HOST_O)dlb.o + +ALLOBJ = $(MAKEDEFSOBJS) $(TILOBJ) $(TILOBJ2) $(TEXTIO) $(TEXTIO2) + +#========================================== +# Header file macros +#========================================== + +PATCHLEV_H = $(INCL)/patchlev.h +DGN_FILE_H = $(INCL)/align.h $(INCL)/dgn_file.h +DUNGEON_H = $(INCL)/align.h $(INCL)/dungeon.h +MONDATA_H = $(INCL)/align.h $(INCL)/mondata.h +MONST_H = $(INCL)/align.h $(INCL)/monst.h $(INCL)/mextra.h +PERMONST_H = $(INCL)/monattk.h $(INCL)/monflag.h $(INCL)/align.h \ + $(INCL)/permonst.h +REGION_H = $(INCL)/region.h +RM_H = $(INCL)/align.h $(INCL)/rm.h +SKILLS_H = $(INCL)/skills.h +SP_LEV_H = $(INCL)/align.h $(INCL)/sp_lev.h +YOUPROP_H = $(PERMONST_H) $(MONDATA_H) $(INCL)/prop.h \ + $(INCL)/pm.h $(INCL)/youprop.h +YOU_H = $(MONST_H) $(YOUPROP_H) $(INCL)/align.h \ + $(INCL)/attrib.h $(INCL)/you.h +DISPLAY_H = $(MONDATA_H) $(INCL)/vision.h $(INCL)/display.h +PCCONF_H = $(INCL)/micro.h $(INCL)/system.h $(INCL)/pcconf.h \ + $(MSYS)/pcvideo.h +DECL_H = $(YOU_H) $(INCL)/spell.h $(INCL)/color.h \ + $(INCL)/obj.h $(INCL)/onames.h $(INCL)/pm.h \ + $(INCL)/decl.h +GLOBAL_H = $(PCCONF_H) $(INCL)/coord.h $(INCL)/global.h + +CONFIG_H = $(INCL)/config.h $(INCL)/config1.h $(INCL)/tradstdc.h \ + $(INCL)/global.h $(INCL)/coord.h $(INCL)/vmsconf.h \ + $(INCL)/system.h $(INCL)/nhlua.h $(INCL)/unixconf.h \ + $(INCL)/os2conf.h $(INCL)/micro.h $(INCL)/pcconf.h \ + $(INCL)/tosconf.h $(INCL)/amiconf.h $(INCL)/macconf.h \ + $(INCL)/beconf.h $(INCL)/wceconf.h $(INCL)/ntconf.h + +HACK_H = $(INCL)/hack.h $(CONFIG_H) $(INCL)/lint.h $(INCL)/align.h \ + $(INCL)/dungeon.h $(INCL)/monsym.h $(INCL)/mkroom.h \ + $(INCL)/objclass.h $(INCL)/youprop.h $(INCL)/prop.h \ + $(INCL)/permonst.h $(INCL)/monattk.h \ + $(INCL)/monflag.h $(INCL)/mondata.h $(INCL)/pm.h \ + $(INCL)/wintype.h $(INCL)/context.h $(INCL)/rm.h \ + $(INCL)/botl.h $(INCL)/rect.h \ + $(INCL)/region.h $(INCL)/decl.h $(INCL)/quest.h \ + $(INCL)/spell.h $(INCL)/color.h $(INCL)/obj.h \ + $(INCL)/you.h $(INCL)/attrib.h $(INCL)/monst.h \ + $(INCL)/mextra.h $(INCL)/skills.h $(INCL)/onames.h \ + $(INCL)/timeout.h $(INCL)/trap.h $(INCL)/flag.h \ + $(INCL)/vision.h $(INCL)/display.h $(INCL)/engrave.h \ + $(INCL)/winprocs.h $(INCL)/sys.h $(INCL)/wintty.h \ + $(INCL)/trampoli.h + +DLB_H = $(INCL)/dlb.h + +ifeq ($(SUPPRESS_GRAPHICS),Y) +TILE_H = +else +TILE_H = $(WSHR)/tile.h $(INCL)/tileset.h +endif + +ifeq ($(USE_DLB),Y) +DLB = dlb +DLBOBJS = $(HOST_O)dlb_main.o $(HOST_O)dlb.o $(HOST_O)alloc.o $(HOST_O)panic.o +else +DLB = +DLBOBJS = +endif + +#========================================== +# More compiler setup macros +#========================================== +# +CURSESDEF= +CURSESLIB= +INCLDIR=-I../include -I../sys/msdos +# Debugging +#cflags = -pg -c $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DSUPPRESS_GRAPHICS -DCROSSCOMPILE -CROSSCOMPILE_HOST +#LFLAGS = -pg +# +#cflags = -c -O $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DSUPPRESS_GRAPHICS -DCROSSCOMPILE -DCROSSCOMPILE_HOST +#LFLAGS = +# +# Debugging +#cflags = -g -c $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DUSE_TILES -DCROSSCOMPILE -DCROSSCOMPILE_HOST +#LFLAGS = -g +# +# Normal +cflags = -c -O $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DUSE_TILES -DCROSSCOMPILE -DCROSSCOMPILE_HOST +LFLAGS = + +#========================================== +#================ RULES ================== +#========================================== + +.SUFFIXES: .o .til .uu .c .y .l + +#========================================== +# Rules for host files in src +#========================================== + +$(HOST_O)%.o : $(SRC)/%.c + $(HOST_CC) $(cflags) -o$@ $< + +#========================================== +# Rules for host files in sys/msdos +#========================================== + +$(HOST_O)%.o : $(MSYS)/%.c + $(HOST_CC) $(cflags) -I../sys/msdos -o$@ $< + +#========================================== +# Rules for host files in util +#========================================== + +$(HOST_O)%.o : $(SRC)/%.c + $(HOST_CC) $(cflags) -o$@ $< + +$(HOST_O)%.o : %.c + $(HOST_CC) $(cflags) -o$@ $< + +#========================================== +# Rules for host files in win/share +#========================================== + +$(HOST_O)%.o : $(WSHR)/%.c + $(HOST_CC) $(cflags) -I../win/share -o$@ $< + +#========================================== +# Primary Targets. +#========================================== + +# The default target. + +all : prereq + +prereq: $(HOST_O)prereq.tag + @echo Done. + +default: prereq + +util: $(HOST_O)utility.tag + +$(HOST_O)utility.tag: $(INCL)/date.h $(INCL)/trap.h $(INCL)/onames.h \ + $(INCL)/pm.h vis_tab.c $(TILEUTIL) + echo host utilities made > $@ + +tileutil: $(U)gif2txt $(U)txt2ppm + @echo Optional tile development utilities are up to date. + +$(HOST_O)prereq.tag: $(INCL)/nhlua.h hobj.tag $(U)makedefs \ + $(HOST_O)utility.tag $(DAT)/nhdat + echo prereq done >$@ + +$(INCL)/nhlua.h: + cd $(INCL); \ + echo '/* nhlua.h - generated by Makefile1.cross */' > $@; \ + echo '#include "../lib/lua-5.3.5/src/lua.h"' >> $@; \ + sed -e '/(lua_error)/!d' -e '/(lua_error)/s/;/ NORETURN;/1' < $(LIB)/lua-5.3.5/src/lua.h >> $@; \ + echo '#include "../lib/lua-5.3.5/src/lualib.h"' >> $@; \ + echo '#include "../lib/lua-5.3.5/src/lauxlib.h"' >> $@; \ + echo '/*nhlua.h*/' >> $@; \ + cd $(SRC) + +#========================================== +# Other host targets. +#========================================== + +#note that dir below assumes bin/dir from djgpp distribution +# +$(DAT)/nhdat: $(U)dlb_main $(DAT)/data $(DAT)/rumors \ + $(DAT)/oracles \ + $(DAT)/bogusmon $(DAT)/engrave $(DAT)/epitaph $(DAT)/tribute + cd $(DAT); \ + pwd; \ + cp $(MSYS)/msdoshlp.txt .; \ + ls -1 data oracles options rumors help hh >dlb.lst; \ + ls -1 cmdhelp history opthelp wizhelp license >>dlb.lst; \ + ls -1 bogusmon engrave epitaph tribute msdoshlp.txt >>dlb.lst; \ + ls -1 *.lua >>dlb.lst; \ + $(U)dlb_main cvIf dlb.lst nhdat; \ + cd $(SRC) + +$(U)dlb_main: $(DLBOBJS) + $(HOST_LINK) $(LFLAGS) -o$@ $(DLBOBJS) + +$(HOST_O)dlb_main.o: $(U)dlb_main.c $(INCL)/config.h $(DLB_H) + $(HOST_CC) $(cflags) -o$@ $(U)dlb_main.c + + +$(INCL)/date.h : $(U)makedefs + -$(U)makedefs -v + +$(INCL)/onames.h: $(U)makedefs + -$(U)makedefs -o + +$(INCL)/pm.h: $(U)makedefs + -$(U)makedefs -p + +#monstr.c: $(U)makedefs +# -$(U)makedefs -m + +$(INCL)/vis_tab.h: $(U)makedefs + -$(U)makedefs -z + +vis_tab.c: $(U)makedefs + -$(U)makedefs -z + +# make data.base an 8.3 filename to prevent an make warning +DATABASE = $(DAT)/data.bas + +$(DAT)/data: $(HOST_O)utility.tag $(DATABASE) + $(U)makedefs -d + +$(DAT)/rumors: $(HOST_O)utility.tag $(DAT)/rumors.tru $(DAT)/rumors.fal + $(U)makedefs -r + +$(DAT)/oracles: $(HOST_O)utility.tag $(DAT)/oracles.txt + $(U)makedefs -h + +$(DAT)/bogusmon: $(HOST_O)utility.tag $(DAT)/bogusmon.txt + $(U)makedefs -s + +$(DAT)/engrave: $(HOST_O)utility.tag $(DAT)/engrave.txt + $(U)makedefs -s + +$(DAT)/epitaph: $(HOST_O)utility.tag $(DAT)/epitaph.txt + $(U)makedefs -s + +#=============================================== +# Create directory for holding host object files +#=============================================== + +hobj.tag: + mkdir -p ./$(HOBJ) + echo directory ready ./$(HOBJ) + +#========================================== +# Makedefs Stuff +#========================================== + +$(U)makedefs: $(MAKEDEFSOBJS) + $(HOST_LINK) $(LFLAGS) -o$@ $(MAKEDEFSOBJS) + +$(O)makedefs$(HOST).o: + +$(HOST_O)makedefs.o: $(U)makedefs.c $(SRC)/mdlib.c $(CONFIG_H) $(INCL)/permonst.h \ + $(INCL)/objclass.h $(INCL)/monsym.h \ + $(INCL)/artilist.h $(INCL)/dungeon.h $(INCL)/obj.h \ + $(INCL)/monst.h $(INCL)/you.h $(INCL)/flag.h \ + $(INCL)/dlb.h $(INCL)/patchlevel.h + +#============================================= +# Header file moves required for tile support +#============================================= + +ifeq ($(SUPPRESS_GRAPHICS),Y) + +else +# +# Tile Mapping +# + +$(SRC)/tile.c: $(U)tilemap + @$(U)tilemap + @echo A new $@ has been created + +$(U)tilemap: $(HOST_O)tilemap.o + $(HOST_LINK) $(LFLAGS) -o$@ $(HOST_O)tilemap.o + +$(HOST_O)tilemap.o: $(WSHR)/tilemap.c $(HACK_H) $(TILE_H) + $(HOST_CC) $(cflags) -I$(WSHR) -I$(MSYS) -o$@ $(WSHR)/tilemap.c + + +#========================================== +# Tile Utilities +# Required for tile support +#========================================== + +#$(DAT)/NetHack1.tib: $(TILEFILES) $(U)tile2bin +# @echo Creating binary tile files +# cd $(DAT) +# $(U)tile2bin +# cd $(SRC) + +#$(DAT)/NetHacko.tib: $(HOST_O)thintile.tag $(TILEFILES2) $(U)til2bin2 +# @echo Creating overview binary tile files +# cd $(DAT) +# $(U)til2bin2 +# cd $(SRC) + +$(DAT)/NHTILES.BMP: $(TILEFILES) $(U)tile2bmp + @echo Creating binary tile files which may take some time + @cd $(DAT) + @$(U)tile2bmp $@ + @cd $(SRC) + +$(U)tile2bmp: $(HOST_O)tile2bmp.o $(TEXTIO) + -rm -f temp.a + ar r temp.a $(TEXTIO) + $(HOST_LINK) $(LFLAGS) -o$@ $(HOST_O)tile2bmp.o temp.a + +#$(U)tile2bin: $(HOST_O)tile2bin.o $(TEXTIO) +# -rm -f temp.a +# ar r temp.a $(TEXTIO) +# $(HOST_LINK) $(LFLAGS) -o$@ $(HOST_O)tile2bin.o temp.a + +#$(U)til2bin2: $(HOST_O)til2bin2.o $(TEXTIO2) +# -rm -f temp.a +# ar r temp.a $(TEXTIO2) +# $(HOST_LINK) $(LFLAGS) -o$@ $(HOST_O)til2bin2.o temp.a + +#$(U)thintile: $(HOST_O)thintile.o +# $(HOST_LINK) $(LFLAGS) -o$@ $(HOST_O)thintile.o + +#$(HOST_O)thintile.o: $(HACK_H) $(WSHR)/tile.h $(WSHR)/thintile.c +# -rm -f temp.a +# ar r temp.a $(TEXTIO) +# $(HOST_LINK) $(LFLAGS) -o$@ $(HOST_O)tile2bmp.o temp.a + +#$(HOST_O)thintile.o: $(HACK_H) $(WSHR)/tile.h $(WSHR)/thintile.c +# $(HOST_CC) $(cflags) -I$(MSYS) -I$(WSHR) -DTILE -DOVERVIEW_FILE -o$@ $(WSHR)/thintile.c + +#$(HOST_O)thintile.tag: $(U)thintile $(TILEFILES) +# $(U)thintile +# echo thintiles created >$@ + +$(HOST_O)tile2bmp.o: $(HACK_H) $(TILE_H) $(WSHR)/tile2bmp.c + $(HOST_CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(WSHR)/tile2bmp.c + +#$(HOST_O)tile2bin.o: $(HACK_H) $(TILE_H) $(MSYS)/pctiles.h $(MSYS)/pcvideo.h $(MSYS)/tile2bin.c +# $(HOST_CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(MSYS)/tile2bin.c + +#$(HOST_O)til2bin2.o: $(HACK_H) $(TILE_H) $(MSYS)/pctiles.h $(MSYS)/pcvideo.h $(MSYS)/tile2bin.c +# $(HOST_CC) $(cflags) -I$(MSYS) -I$(WSHR) -DTILE_X=8 -DOVERVIEW_FILE -o$@ $(MSYS)/tile2bin.c + +$(HOST_O)tiletext.o: $(CONFIG_H) $(TILE_H) $(WSHR)/tiletext.c + $(HOST_CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(WSHR)/tiletext.c + +$(HOST_O)tiletex2.o: $(CONFIG_H) $(TILE_H) $(WSHR)/tiletext.c + $(HOST_CC) $(cflags) -I$(MSYS) -I$(WSHR) -DTILE_X=8 -o$@ $(WSHR)/tiletext.c + +$(HOST_O)tiletxt.o: $(CONFIG_H) $(TILE_H) $(WSHR)/tilemap.c + $(HOST_CC) $(cflags) -I$(MSYS) -I$(WSHR) -DTILETEXT -o$@ $(WSHR)/tilemap.c + +$(HOST_O)tiletxt2.o: $(CONFIG_H) $(TILE_H) $(WSHR)/tilemap.c + $(HOST_CC) $(cflags) -I$(MSYS) -I$(WSHR) -DTILETEXT -DTILE_X=8 -o$@ $(WSHR)/tilemap.c +# +# Optional GIF Utilities (for development) +# + +$(U)gif2txt: $(GIFREADERS) $(TEXTIO) + $(HOST_LINK) $(LFLAGS) -o$@ $(GIFREADERS) $(TEXTIO) + +$(U)gif2txt2: $(GIFREAD2) $(TEXTIO2) + $(HOST_LINK) $(LFLAGS) -o$@ $(GIFREAD2) $(TEXTIO2) + +$(U)txt2ppm: $(PPMWRITERS) $(TEXTIO) + $(HOST_LINK) $(LFLAGS) -o$@ $(PPMWRITERS) $(TEXTIO) + +$(U)txt2ppm2: $(PPMWRIT2) $(TEXTIO2) + $(HOST_LINK) $(LFLAGS) -o$@ $(PPMWRIT2) $(TEXTIO2) + +$(HOST_O)gifread.o: $(CONFIG_H) $(WSHR)/tile.h $(WSHR)/gifread.c + +$(HOST_O)gifread2.o: $(CONFIG_H) $(WSHR)/tile.h $(WSHR)/gifread.c + $(HOST_CC) $(cflags) -DTILE_X=8 -o$@ $(WSHR)/gifread.c + +ppmwrite.c: $(WSHR)/ppmwrite.c + cp $(WSHR)/ppmwrite.c . + +$(HOST_O)ppmwrite.o: $(CONFIG_H) $(WSHR)/tile.h + +$(HOST_O)ppmwrit2.o: $(CONFIG_H) $(WSHR)/tile.h ppmwrite.c + $(HOST_CC) $(cflags) -DTILE_X=8 -o$@ ppmwrite.c + +# +# Optional tile viewer (development sources only) +# + +$(U)viewtib: $(HOST_O)viewtib.o + $(HOST_LINK) $(LFLAGS) -o$@ $(HOST_O)viewtib.o $(LIBRARIES) + +$(HOST_O)viewtib.o: $(MSYS)/viewtib.c + +endif + +#========================================== +# Other host Util Dependencies. +#========================================== + +$(HOST_O)monst.o: $(CONFIG_H) $(PERMONST_H) $(INCL)/monsym.h \ + $(INCL)/color.h monst.c + $(HOST_CC) $(cflags) -o$@ monst.c + +$(HOST_O)objects.o: $(CONFIG_H) $(INCL)/obj.h $(INCL)/objclass.h \ + $(INCL)/prop.h $(INCL)/color.h objects.c + $(HOST_CC) $(cflags) -o$@ objects.c + +$(HOST_O)panic.o: $(CONFIG_H) $(U)panic.c + $(HOST_CC) $(cflags) -o$@ $(U)panic.c + +#========================================== +# Housekeeping for host side. +#========================================== + +clean: + rm ./host_o/*.o + if [ -f $(HOST_O)prereq.tag ]; then rm $(HOST_O)prereq.tag; fi; + if [ -f hobj.tag ]; then rm hobj.tag; fi; + if [ -f $(HOST_O)utility.tag ]; then rm $(HOST_O)utility.tag; fi; + if [ -f temp.a ]; then rm temp.a; fi; + +spotless: clean + + if [ -f $(INCL)/pm.h ]; then rm $(INCL)/pm.h; fi; +## if [ -f $(U)dgn_flex.c ]; then rm $(U)dgn_flex.c; fi; +## if [ -f $(U)dgn_lex.c ]; then rm $(U)dgn_lex.c; fi; +# if [ -f $(U)makedefs ]; then rm $(U)makedefs; fi; +## if [ -f $(U)dgn_comp ]; then rm $(U)dgn_comp; fi; +# if [ -f $(U)recover.exe ]; then rm $(U)recover.exe; fi; +# if [ -f $(U)tilemap ]; then rm $(U)tilemap; fi; +# if [ -f $(U)tile2bmp ]; then rm $(U)tile2bmp; fi; +## if [ -f $(U)tile2bin ]; then rm $(U)tile2bin; fi; +## if [ -f $(U)til2bin2 ]; then rm $(U)til2bin2; fi; +## if [ -f $(U)thintile ]; then rm $(U)thintile; fi; +# if [ -f $(U)dlb_main ]; then rm $(U)dlb_main; fi; +# if [ -f $(INCL)/vis_tab.h ]; then rm $(INCL)/vis_tab.h; fi; +# if [ -f $(INCL)/onames.h ]; then rm $(INCL)/onames.h; fi; +# if [ -f $(INCL)/pm.h ]; then rm $(INCL)/pm.h; fi; +# if [ -f $(INCL)/date.h ]; then rm $(INCL)/date.h; fi; +## if [ -f $(INCL)/dgn_comp.h ]; then rm $(INCL)/dgn_comp.h; fi; +## if [ -f $(INCL)/lev_comp.h ]; then rm $(INCL)/lev_comp.h; fi; +# if [ -f $(SRC)/vis_tab.c ]; then rm $(SRC)/vis_tab.c; fi; +# if [ -f $(SRC)/tile.c ]; then rm $(SRC)/tile.c; fi; +# if [ -f $(DAT)/options ]; then rm $(DAT)/options; fi; +# if [ -f $(DAT)/data ]; then rm $(DAT)/data; fi; +# if [ -f $(DAT)/rumors ]; then rm $(DAT)/rumors; fi; +## if [ -f $(DAT)/dungeon.pdf ]; then rm $(DAT)/dungeon.pdf; fi; +## if [ -f $(DAT)/dungeon ]; then rm $(DAT)/dungeon; fi; +# if [ -f $(DAT)/oracles ]; then rm $(DAT)/oracles; fi; +## if [ -f $(DAT)/quest.dat ]; then rm $(DAT)/quest.dat; fi; +# if [ -f $(DAT)/bogusmon ]; then rm $(DAT)/bogusmon; fi; +# if [ -f $(DAT)/engrave ]; then rm $(DAT)/engrave; fi; +# if [ -f $(DAT)/epitaph ]; then rm $(DAT)/epitaph; fi; +# if [ -f $(DAT)/dlb.lst ]; then rm $(DAT)/dlb.lst; fi; +# if [ -f $(DAT)/nhdat ]; then rm $(DAT)/nhdat; fi; +# if [ -f $(DAT)/*.lev ]; then rm $(DAT)/*.lev; fi; +# if [ -f $(TILE_BMP) ]; then rm $(TILE_BMP); fi; +# if [ -f $(WSHR)/monthin.txt ]; then rm $(WSHR)/monthin.txt; fi; +# if [ -f $(WSHR)/objthin.txt ]; then rm $(WSHR)/objthin.txt; fi; +# if [ -f $(WSHR)/oththin.txt ]; then rm $(WSHR)/oththin.txt; fi; + +#========================================== +# Game Dependencies +#========================================== + +# src dependencies + +$(HOST_O)tile.o: tile.c $(HACK_H) +$(HOST_O)vis_tab.o: vis_tab.c $(CONFIG_H) $(INCL)/vis_tab.h +$(HOST_O)alloc.o: alloc.c $(CONFIG_H) +$(HOST_O)dlb.o: dlb.c $(CONFIG_H) $(INCL)/dlb.h + $(HOST_CC) $(cflags) -I../sys/msdos -o$@ dlb.c +$(HOST_O)monst.o: monst.c $(CONFIG_H) $(INCL)/permonst.h $(INCL)/align.h \ + $(INCL)/monattk.h $(INCL)/monflag.h $(INCL)/monsym.h \ + $(INCL)/color.h +$(HOST_O)objects.o: objects.c $(CONFIG_H) $(INCL)/obj.h $(INCL)/objclass.h \ + $(INCL)/prop.h $(INCL)/skills.h $(INCL)/color.h +$(HOST_O)tileset.o: $(WSHR)/tileset.c $(HACK_H) +$(HOST_O)bmptiles.o: $(WSHR)/bmptiles.c $(INCL)/config.h $(INCL)/tileset.h $(INCL)/integer.h +$(HOST_O)giftiles.o: $(WSHR)/giftiles.c $(INCL)/config.h $(INCL)/tileset.h $(INCL)/integer.h + +# end of file + diff --git a/sys/msdos/Makefile2.cross b/sys/msdos/Makefile2.cross new file mode 100644 index 000000000..0b42d58fa --- /dev/null +++ b/sys/msdos/Makefile2.cross @@ -0,0 +1,1167 @@ +# NetHack 3.7 Makefile2.cross +# Cross-compile msdos version of NetHack using a +# linux-hosted djgpp cross-compiler. +# +# Makefile1.cross is for the host-side obj files and utilities that +# will run on the host platform only. +# +# Makefile2.cross (this file) is for the target platform obj files +# and utilities. +# +# Makefile2 utilizes the djgpp cross-compiler from Andrew Wu: +# https://github.com/andrewwutw/build-djgpp +# +# Currently, in NetHack 3.7, it is now feasible to cross-compile +# the game in a 2-stage process. Makefile2.cross (this file) carries +# out the 2nd stage. +# +# A proof-of-concept to cross-compile NetHack 3.7 was achieved on +# November 22, 2019 using the msdos set of Makefiles. +# +# + +# Game Installation Variables +# NOTE: Make sure GAMEDIR exists before make is started. + +GAME = NETHACK +# The GNU Make has a problem if you include a drive spec below (unfortunately). +GAMEDIR =../msdos-binary + +# Optional PDCurses support +# Uncomment these and set them appropriately if you want to +# include curses port support alongside TTY support in your +# NetHack.exe binary. +# +# You'll have to set PDCURSES_H to the correct location of the +# PDCurses header (.h) files and PDCURSES_C to the location +# of your PDCurses C files which must already be resident on +# your machine. +# +ADD_CURSES=Y +PDCURSES_TOP=../lib/pdcurses + +# Set top of djgpp if not specified through ENV variables prior to make: +#DJGPP_TOP = $(HOME)/lib/djgpp + +#--------------------------------------------------------------- +# Location of LUA +# +# Original source needs to be obtained from: +# http://www.lua.org/ftp/lua-5.3.5.tar.gz +# +# This build assumes that the LUA sources are located +# at the specified location. If they are actually elsewhere +# you'll need to specify the correct spot below in order to +# successfully build NetHack-3.7. +# +ADD_LUA=Y +LUATOP=../lib/lua-5.3.5 +# +# +#============================================================================== +# This marks the end of the BUILD DECISIONS section. +#============================================================================== +# +# Directories, gcc likes unix style directory specs +# + +TARGET = msdos +OBJ = $(TARGET)_o +HOBJ = host_o +DAT = ../dat +DOC = ../doc +INCL = ../include +LIB = ../lib +MSYS = ../sys/msdos +SRC = ../src +SSHR = ../sys/share +UTIL = ../util +WIN = ../win/tty +WCURSES = ../win/curses +WSHR = ../win/share + +# +# Executables. +ifndef DJGPP_TOP +ifdef TRAVIS_BUILD_DIR +DJGPP_TOP = TRAVIS_BUILD_DIR/lib/djgpp +else +DJGPP_TOP = $(HOME)/lib/djgpp +endif +endif + +TARGET_CC = $(DJGPP_TOP)/i586-pc-msdosdjgpp/bin/gcc +TARGET_LINK = $(DJGPP_TOP)/i586-pc-msdosdjgpp/bin/gcc +TARGET_STUBEDIT = $(DJGPP_TOP)/i586-pc-msdosdjgpp/bin/stubedit +TARGET_AR = $(DJGPP_TOP)/i586-pc-msdosdjgpp/bin/ar +MAKEBIN = make + +# +# Special libraries and how to link them in. + +LIBS = -lpc + +# If TERMLIB is defined in pcconf.h, comment out the upper line and +# uncomment the lower. Note that you must build the termc library +# and place it in djgpp's lib directory. See termcap.zip for details + +TERMLIB = +#TERMLIB = -ltermc + +LIBRARIES = $(LIBS) $(TERMLIB) + +# +# Yacc/Lex ... if you got 'em. +# +# If you have yacc/lex or a work-alike set YACC_LEX to Y +# +YACC_LEX = N + +ifeq "$(YACC_LEX)" "Y" +DO_YACC = YACC_ACT +DO_LEX = LEX_ACT +endif + +# If YACC_LEX is Y above, set the following to values appropriate for +# your tools. +# +YACC = bison -y +LEX = lex +# +# If your flex and bison port mess with the output names directly +# you must set the file names to the appropriate output file names +# here +#YTABC = y_tab.c +#YTABH = y_tab.h +#LEXYYC = lexyy.c +# +# If your flex and bison are able to produce files named +# y.tab.c, y.tab.h or lex.yy.c you might have to set these +# to the short file name equivalent (DIR /X to reveal them): +YTABC = ytab~1.c +YTABH = ytab~1.h +LEXYYC = lexyy~1.c + +# +# Uncomment the line below if you want to store all the level files, +# help files, etc. in a single library file. + +USE_DLB = Y + +# djgpp includes ls.exe and touch.exe in fil41b.zip from the v2gnu +# folder so be sure to include that when downloading djgpp. Doing +# so will make changing this unnecessary. + +LS = ls -1 # ls.exe from djgpp distribution +#LS = dir /l/b # DOS command + +# To build a binary without any graphics +# suitable for blind players, +# set SUPPRESS_GRAPHICS to Y +# (Note: binary will require ANSI.SYS driver or equivalent loaded) +# SUPPRESS_GRAPHICS = Y +SUPPRESS_GRAPHICS = + +# ZLIB Support +# To support zlib compression in bones and save files, you must +# define ZLIB_COMP in include/config.h. +# You must also have a zlib library to link NetHack with, and +# for the djgpp build, you need one compatible with djgpp. +# At the time that this was written (post-NetHack 3.4.3) the +# following URL was a valid place to get a pre-built djgpp library +# to add to your djgpp tools directory tree. +# http://www.delorie.com/pub/djgpp/current/v2tk/zlib114b.zip +# +# If you defined ZLIB_COMP in include/config.h to build in support +# for ZLIB compression, you need to uncomment the line below. +#ZLIB= -lz + +#=============================================== +#======= End of Modification Section =========== +#=============================================== +################################################ +# # +# Nothing below here should have to be changed.# +# # +################################################ + +GAMEFILE = $(GAMEDIR)/$(GAME).EXE + +# Changing this conditional block is not recommended +ifeq "$(USE_DLB)" "Y" +DLBFLG = -DDLB +else +DLBFLG = +endif + +TERMLIB = +# Build NetHack suitable for blind players + +#========================================== +#================ MACROS ================== +#========================================== +# This section creates shorthand macros for many objects +# referenced later on in the Makefile. +# +# Have windows path styles available for use in commands +# +W_OBJ =$(subst /,\, $(OBJ)) +W_INCL =$(subst /,\, $(INCL)) +W_DAT =$(subst /,\, $(DAT)) +W_DOC =$(subst /,\, $(DOC)) +W_UTIL =$(subst /,\, $(UTIL)) +W_SRC =$(subst /,\, $(SRC)) +W_SSYS =$(subst /,\, $(SSYS)) +W_MSWSYS =$(subst /,\, $(MSWSYS)) +W_TTY =$(subst /,\, $(TTY)) +W_MSWIN =$(subst /,\, $(MSWIN)) +ifeq "$(ADD_CURSES)" "Y" +W_WCURSES =$(subst /,\, $(WCURSES)) +endif +W_WSHR =$(subst /,\, $(WSHR)) +W_GAMEDIR =$(subst /,\, $(GAMEDIR)) + +# +# Shorten up the location for some files +# + +O = $(OBJ)/ +HOST_O = $(HOBJ)/ +U = $(UTIL)/ + +#========================================== +# Tile related object files. +#========================================== + +#ifeq ($(SUPPRESS_GRAPHICS),Y) +#TILOBJ = +#TILOBJ2 = +#TEXTIO = +#TEXTIO2 = +#TILE_BMP = +#TILEUTIL = +#TILEFILES = +#TILEFILES2 = +#GIFREADERS = +#GIFREAD2 = +#PPMWRITERS = +#PPMWRIT2 = +# +#else +# +#TILOBJ = $(O)tile.o $(VIDEO_OBJ) +# +#TILOBJ2 = $(O)tileset.o $(O)bmptiles.o $(O)giftiles.o +# +#TEXTIO = $(HOST_O)tiletext.o $(HOST_O)tiletxt.o $(HOST_O)drawing.o $(HOST_O)decl.o $(HOST_O)monst.o \ +# $(HOST_O)objects.o $(HOST_O)stubvid.o +# +#TEXTIO2 = $(HOST_O)tiletex2.o $(HOST_O)tiletxt2.o $(HOST_O)drawing.o $(HOST_O)decl.o $(HOST_O)monst.o \ +# $(HOST_O)objects.o $(HOST_O)stubvid.o +#TILEUTIL = $(TILOBJ) $(U)tile2bin $(U)til2bin2 $(TILE_BMP) $(PLANAR_TIB) $(OVERVIEW_TIB) +# +#TILEFILES = $(WSHR)/monsters.txt $(WSHR)/objects.txt $(WSHR)/other.txt +# +#TILEFILES2 = $(WSHR)/monthin.txt $(WSHR)/objthin.txt $(WSHR)/oththin.txt +# +#GIFREADERS = $(HOST_O)gifread.o $(HOST_O)alloc.o $(HOST_O)panic.o +# +#GIFREAD2 = $(HOST_O)gifread2.o $(HOST_O)alloc.o $(HOST_O)panic.o +# +#PPMWRITERS = $(HOST_O)ppmwrite.o $(HOST_O)alloc.o $(HOST_O)panic.o +# +#PPMWRIT2 = $(HOST_O)ppmwrit2.o $(HOST_O)alloc.o $(HOST_O)panic.o +#endif + +PLANAR_TIB = $(DAT)/NETHACK1.tib +OVERVIEW_TIB = $(DAT)/NETHACKO.tib +TILE_BMP = $(DAT)/NHTILES.BMP + +##REGEX = $(O)pmatchregex.o +##REGEX = $(O)cppregex.o +REGEX = $(O)posixreg.o +DLBOBJ = $(O)dlb.o +VIDEO_OBJ = $(O)vidvga.o $(O)vidvesa.o $(O)tile.o $(O)tileset.o $(O)bmptiles.o $(O)giftiles.o +RECOVOBJS = $(O)recover.o + +# Object files for the game itself. + + +VOBJ01 = $(O)allmain.o $(O)alloc.o $(O)apply.o $(O)artifact.o $(O)attrib.o +VOBJ02 = $(O)ball.o $(O)bones.o $(O)botl.o $(O)cmd.o $(O)dbridge.o +VOBJ03 = $(O)decl.o $(O)detect.o $(O)display.o $(O)do.o $(O)do_name.o +VOBJ04 = $(O)do_wear.o $(O)dog.o $(O)dogmove.o $(O)dokick.o $(O)dothrow.o +VOBJ05 = $(O)drawing.o $(O)dungeon.o $(O)eat.o $(O)end.o $(O)engrave.o +VOBJ06 = $(O)exper.o $(O)explode.o $(O)extralev.o $(O)files.o $(O)fountain.o +VOBJ07 = $(O)getline.o $(O)hack.o $(O)hacklib.o $(O)invent.o $(O)lock.o +VOBJ08 = $(O)mail.o $(O)main.o $(O)makemon.o $(O)mapglyph.o $(O)mcastu.o $(O)mhitm.o +VOBJ09 = $(O)mhitu.o $(O)minion.o $(O)mkmap.o $(O)mklev.o $(O)mkmaze.o +VOBJ10 = $(O)mkobj.o $(O)mkroom.o $(O)mon.o $(O)mondata.o $(O)monmove.o +VOBJ11 = $(O)monst.o $(O)mplayer.o $(O)mthrowu.o $(O)muse.o +VOBJ12 = $(O)music.o $(O)o_init.o $(O)objects.o $(O)objnam.o $(O)options.o +VOBJ13 = $(O)pickup.o $(O)pline.o $(O)polyself.o $(O)potion.o $(O)quest.o +VOBJ14 = $(O)questpgr.o $(O)pager.o $(O)pray.o $(O)priest.o $(O)read.o +VOBJ15 = $(O)rect.o $(O)restore.o $(O)rip.o $(O)rnd.o $(O)role.o +VOBJ16 = $(O)rumors.o $(O)save.o $(O)shk.o $(O)shknam.o $(O)sit.o +VOBJ17 = $(O)sounds.o $(O)sp_lev.o $(O)spell.o $(O)steal.o $(O)steed.o +VOBJ18 = $(O)termcap.o $(O)timeout.o $(O)topl.o $(O)topten.o $(O)track.o +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 $(REGEX) $(O)isaac64.o $(VIDEO_OBJ) +VOBJ24 = $(O)sfstruct.o + +SOBJ = $(O)msdos.o $(O)pcsys.o $(O)tty.o $(O)unix.o \ + $(O)video.o $(O)vidtxt.o $(O)pckeys.o + +VVOBJ = $(O)version.o + +MDLIB = $(O)mdlib.o + +ifeq "$(ADD_LUA)" "Y" +LUAOBJ = $(O)nhlua.o $(O)nhlsel.o $(O)nhlobj.o +LUA_QTEXT_FILE = "quest.lua" +endif + +ifeq "$(ADD_CURSES)" "Y" +CURSESOBJ= $(O)cursdial.o $(O)cursinit.o $(O)cursinvt.o $(O)cursmain.o \ + $(O)cursmesg.o $(O)cursmisc.o $(O)cursstat.o $(O)curswins.o +else +CURSESOBJ= +endif + +VOBJ = $(VOBJ01) $(VOBJ02) $(VOBJ03) $(VOBJ04) $(VOBJ05) \ + $(VOBJ06) $(VOBJ07) $(VOBJ08) $(VOBJ09) $(VOBJ10) \ + $(VOBJ11) $(VOBJ12) $(VOBJ13) $(VOBJ14) $(VOBJ15) \ + $(VOBJ16) $(VOBJ17) $(VOBJ18) $(VOBJ19) $(VOBJ20) \ + $(VOBJ21) $(VOBJ22) $(VOBJ23) $(VOBJ24) $(VOBJ25) \ + $(LUAOBJ) $(CURSESOBJ) $(MDLIB) + +ALLOBJ = $(VOBJ) $(SOBJ) $(TILOBJ) $(TILOBJ2) $(VVOBJ) + +ifeq "$(ADD_LUA)" "Y" +#===============-================================================= +# LUA library +# Source from http://www.lua.org/ftp/lua-5.3.5.tar.gz +#================================================================= + +LUASRC = $(LUATOP)/src +LUALIB = $(O)lua535s.a +#LUADLL = $(O)lua535.a +LUAINCL = -I$(LUASRC) +#LUAFLAGS = unix added -lm here? +LUATARGETS = lua.exe luac.exe $(LUALIB) +#LUATARGETS = $(LUADLL) $(LUALIB) + +LUASRCFILES = lapi.c lauxlib.c lbaselib.c lbitlib.c lcode.c \ + lcorolib.c lctype.c ldblib.c ldebug.c ldo.c \ + ldump.c lfunc.c lgc.c linit.c liolib.c llex.c \ + lmathlib.c lmem.c loadlib.c lobject.c lopcodes.c \ + loslib.c lparser.c lstate.c lstring.c lstrlib.c \ + ltable.c ltablib.c ltm.c lundump.c lutf8lib.c \ + lvm.c lzio.c + +LUAOBJFILES1 = $(O)lapi.o $(O)lauxlib.o $(O)lbaselib.o $(O)lbitlib.o \ + $(O)lcode.o $(O)lcorolib.o $(O)lctype.o $(O)ldblib.o +LUAOBJFILES2 = $(O)ldebug.o $(O)ldo.o $(O)ldump.o $(O)lfunc.o \ + $(O)lgc.o $(O)linit.o $(O)liolib.o $(O)llex.o +LUAOBJFILES3 = $(O)lmathlib.o $(O)lmem.o $(O)loadlib.o $(O)lobject.o \ + $(O)lopcodes.o $(O)loslib.o $(O)lparser.o $(O)lstate.o +LUAOBJFILES4 = $(O)lstring.o $(O)lstrlib.o $(O)ltable.o $(O)ltablib.o \ + $(O)ltm.o $(O)lundump.o $(O)lutf8lib.o $(O)lvm.o $(O)lzio.o + +#LUAOBJFILES = $(O)lapi.o $(O)lauxlib.o $(O)lbaselib.o $(O)lbitlib.o \ +# $(O)lcode.o $(O)lcorolib.o $(O)lctype.o $(O)ldblib.o \ +# $(O)ldebug.o $(O)ldo.o $(O)ldump.o $(O)lfunc.o \ +# $(O)lgc.o $(O)linit.o $(O)liolib.o $(O)llex.o \ +# $(O)lmathlib.o $(O)lmem.o $(O)loadlib.o $(O)lobject.o \ +# $(O)lopcodes.o $(O)loslib.o $(O)lparser.o $(O)lstate.o \ +# $(O)lstring.o $(O)lstrlib.o $(O)ltable.o $(O)ltablib.o \ +# $(O)ltm.o $(O)lundump.o $(O)lutf8lib.o $(O)lvm.o $(O)lzio.o + +LUALIBOBJS = $(LUAOBJFILES1) $(LUAOBJFILES2) $(LUAOBJFILES3) $(LUAOBJFILES4) +endif + +ifeq "$(ADD_CURSES)" "Y" +#========================================== +# PDCurses build macros +#========================================== +PDCURSES_CURSES_H = $(PDCURSES_TOP)/curses.h +PDCURSES_CURSPRIV_H = $(PDCURSES_TOP)/curspriv.h +PDCURSES_HEADERS = $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H) +PDCSRC = $(PDCURSES_TOP)/pdcurses +PDCDOS = $(PDCURSES_TOP)/dos +PDCLIBOBJS1 = $(O)addch.o $(O)addchstr.o $(O)addstr.o $(O)attr.o $(O)beep.o \ + $(O)bkgd.o $(O)border.o $(O)clear.o $(O)color.o $(O)delch.o $(O)deleteln.o \ + $(O)getch.o +PDCLIBOBJS2 = $(O)getstr.o $(O)getyx.o $(O)inch.o $(O)inchstr.o $(O)initscr.o \ + $(O)inopts.o $(O)insch.o $(O)insstr.o $(O)instr.o $(O)kernel.o \ + $(O)keyname.o $(O)mouse.o +PDCLIBOBJS3 = $(O)move.o $(O)outopts.o $(O)overlay.o $(O)pad.o $(O)panel.o \ + $(O)printw.o $(O)refresh.o $(O)scanw.o $(O)scr_dump.o $(O)scroll.o \ + $(O)slk.o $(O)termattr.o +PDCLIBOBJS4 = $(O)touch.o $(O)util.o $(O)window.o $(O)debug.o +PDCLIBOBJS = $(PDCLIBOBJS1) $(PDCLIBOBJS2) $(PDCLIBOBJS3) $(PDCLIBOBJS4) + +PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o \ + $(O)pdcscrn.o $(O)pdcsetsc.o $(O)pdcutil.o + +#PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o $(O)pdcscrn.o \ +# $(O)pdcsetsc.o $(O)pdcutil.o + +PDCLIB = $(O)pdcurses.a + +#PDCINCL = -I$(PDCURSES_TOP) -I$(PDCSRC) -I$(PDCDOS) +PDCINCL = -I$(PDCURSES_TOP) -I$(PDCDOS) +else +PDCLIB = +endif + +#========================================== +# Header file macros +#========================================== + +PATCHLEV_H = $(INCL)/patchlev.h +DGN_FILE_H = $(INCL)/align.h $(INCL)/dgn_file.h +DUNGEON_H = $(INCL)/align.h $(INCL)/dungeon.h +MONDATA_H = $(INCL)/align.h $(INCL)/mondata.h +MONST_H = $(INCL)/align.h $(INCL)/monst.h $(INCL)/mextra.h +PERMONST_H = $(INCL)/monattk.h $(INCL)/monflag.h $(INCL)/align.h \ + $(INCL)/permonst.h +REGION_H = $(INCL)/region.h +RM_H = $(INCL)/align.h $(INCL)/rm.h +SKILLS_H = $(INCL)/skills.h +SP_LEV_H = $(INCL)/align.h $(INCL)/sp_lev.h +YOUPROP_H = $(PERMONST_H) $(MONDATA_H) $(INCL)/prop.h \ + $(INCL)/pm.h $(INCL)/youprop.h +YOU_H = $(MONST_H) $(YOUPROP_H) $(INCL)/align.h \ + $(INCL)/attrib.h $(INCL)/you.h +DISPLAY_H = $(MONDATA_H) $(INCL)/vision.h $(INCL)/display.h +PCCONF_H = $(INCL)/micro.h $(INCL)/system.h $(INCL)/pcconf.h \ + $(MSYS)/pcvideo.h +DECL_H = $(YOU_H) $(INCL)/spell.h $(INCL)/color.h \ + $(INCL)/obj.h $(INCL)/onames.h $(INCL)/pm.h \ + $(INCL)/decl.h +GLOBAL_H = $(PCCONF_H) $(INCL)/coord.h $(INCL)/global.h + +CONFIG_H = $(INCL)/config.h $(INCL)/config1.h $(INCL)/tradstdc.h \ + $(INCL)/global.h $(INCL)/coord.h $(INCL)/vmsconf.h \ + $(INCL)/system.h $(INCL)/nhlua.h $(INCL)/unixconf.h \ + $(INCL)/os2conf.h $(INCL)/micro.h $(INCL)/pcconf.h \ + $(INCL)/tosconf.h $(INCL)/amiconf.h $(INCL)/macconf.h \ + $(INCL)/beconf.h $(INCL)/wceconf.h $(INCL)/ntconf.h + +HACK_H = $(INCL)/hack.h $(CONFIG_H) $(INCL)/lint.h $(INCL)/align.h \ + $(INCL)/dungeon.h $(INCL)/monsym.h $(INCL)/mkroom.h \ + $(INCL)/objclass.h $(INCL)/youprop.h $(INCL)/prop.h \ + $(INCL)/permonst.h $(INCL)/monattk.h \ + $(INCL)/monflag.h $(INCL)/mondata.h $(INCL)/pm.h \ + $(INCL)/wintype.h $(INCL)/context.h $(INCL)/rm.h \ + $(INCL)/botl.h $(INCL)/rect.h \ + $(INCL)/region.h $(INCL)/decl.h $(INCL)/quest.h \ + $(INCL)/spell.h $(INCL)/color.h $(INCL)/obj.h \ + $(INCL)/you.h $(INCL)/attrib.h $(INCL)/monst.h \ + $(INCL)/mextra.h $(INCL)/skills.h $(INCL)/onames.h \ + $(INCL)/timeout.h $(INCL)/trap.h $(INCL)/flag.h \ + $(INCL)/vision.h $(INCL)/display.h $(INCL)/engrave.h \ + $(INCL)/winprocs.h $(INCL)/sys.h $(INCL)/wintty.h \ + $(INCL)/trampoli.h + +DLB_H = $(INCL)/dlb.h + +ifeq ($(SUPPRESS_GRAPHICS),Y) +TILE_H = +else +TILE_H = $(WSHR)/tile.h $(INCL)/tileset.h +endif + +ifeq ($(USE_DLB),Y) +DLB = dlb +DLBOBJS = $(O)dlb_main.o $(O)dlb.o $(O)alloc.o $(O)panic.o +else +DLB = +DLBOBJS = +endif + +#========================================== +# More compiler setup macros +#========================================== +# +ifeq "$(ADD_CURSES)" "Y" +CURSESDEF=-D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE" +else +CURSESDEF= +CURSESLIB= +endif + +INCLDIR=-I../include -I../sys/msdos $(LUAINCL) + +# Debugging +#cflags = -pg -c $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DSUPPRESS_GRAPHICS -DCROSSCOMPILE -DCROSSCOMPILE_TARGET +#LFLAGS = -pg + +#cflags = -c -O $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DSUPPRESS_GRAPHICS -DCROSSCOMPILE-DCROSSCOMPILE_TARGET +#LFLAGS = + +# Debugging +#cflags = -g -c $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DUSE_TILES -DCROSSCOMPILE -DCROSSCOMPILE_TARGET +#LFLAGS = -g + +# Normal +cflags = -c -O $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DUSE_TILES -DCROSSCOMPILE -DCROSSCOMPILE_TARGET +LFLAGS = + +#========================================== +#================ RULES ================== +#========================================== + +.SUFFIXES: .o .til .uu .c .y .l + +#========================================== +# Rules for files in src +#========================================== + +$(OBJ)/%.o : %.c + $(TARGET_CC) $(cflags) -o$@ $< + +$(OBJ)/%.o : $(SRC)/%.c + $(TARGET_CC) $(cflags) -o$@ $< + +#========================================== +# Rules for files in sys/share +#========================================== + +$(OBJ)/%.o : $(SSHR)/%.c + $(TARGET_CC) $(cflags) -o$@ $< + +#========================================== +# Rules for files in sys/msdos +#========================================== + +$(OBJ)/%.o : $(MSYS)/%.c + $(TARGET_CC) $(cflags) -I../sys/msdos -o$@ $< + +#========================================== +# Rules for files in util +#========================================== + +$(OBJ)/%.o : $(UTIL)/%.c + $(TARGET_CC) $(cflags) -o$@ $< + +#========================================== +# Rules for files in win/share +#========================================== + +$(OBJ)/%.o : $(WSHR)/%.c + $(TARGET_CC) $(cflags) -I../win/share -o$@ $< + +#========================================== +# Rules for files in win/tty +#========================================== + +$(OBJ)/%.o : $(TTY)/%.c + $(TARGET_CC) $(cflags) -o$@ $< + +#========================================== +# Rules for files in win/curses +#========================================== + +$(OBJ)/%.o : $(WCURSES)/%.c + $(TARGET_CC) -DPDC_NCMOUSE $(PDCINCL) $(cflags) -o$@ $< + +#========================================== +# Rules for files in PDCurses +#========================================== + +$(OBJ)/%.o : $(PDCURSES_TOP)/%.c + $(TARGET_CC) $(PDCINCL) $(cflags) -o$@ $< + +$(OBJ)/%.o : $(PDCSRC)/%.c + $(TARGET_CC) $(PDCINCL) $(cflags) -o$@ $< + +$(OBJ)/%.o : $(PDCDOS)/%.c + $(TARGET_CC) $(PDCINCL) $(cflags) -o$@ $< + +ifeq "$(ADD_LUA)" "Y" +#========================================== +# Rules for LUA files +#========================================== + +$(OBJ)/%.o : $(LUASRC)/%.c + $(TARGET_CC) $(cflags) -o$@ $< +endif + +#========================================== +# Primary Targets. +#========================================== + +# The default target. + +all : install + +install: $(GAMEFILE) $(O)install.tag + @echo Done. + +default: $(GAMEFILE) + +util: $(O)utility.tag + +$(O)utility.tag: $(INCL)/date.h $(INCL)/trap.h $(INCL)/onames.h \ + $(INCL)/pm.h vis_tab.c $(TILEUTIL) + echo utilities made > $@ + +tileutil: $(U)gif2txt $(U)txt2ppm + @echo Optional tile development utilities are up to date. + +recover.exe: $(U)recover +# @$(subst /,\,if exist $(U)recover copy $(U)recover $(GAMEDIR)) +# @$(subst /,\,if exist $(DOC)/recover.txt copy $(DOC)/recover.txt $(GAMEDIR)) + +$(O)install.tag: $(DAT)/nhdat $(GAMEFILE) +ifeq ($(USE_DLB),Y) + cp $(DAT)/nhdat $(GAMEDIR)/NHDAT + cp $(DAT)/license $(GAMEDIR)/LICENSE +else + cp $(DAT)/*. $(GAMEDIR) + cp $(DAT)/*.dat $(GAMEDIR) + cp $(MSYS)/msdoshlp.txt $(GAMEDIR)) +ifeq "$(ADD_LUA)" "Y" + cp $(DAT)/*.lua $(GAMEDIR) +endif +endif +ifdef TERMLIB + cp $(SSHR)/termcap $(GAMEDIR)/TERMCAP) +endif +# if [ -f $(TILE_BMP) ]; then rm $(TILE_BMP); fi; + if [ -f $(TILE_BMP) ]; then cp $(TILE_BMP) $(GAMEDIR)/NHTILES.BMP; fi; + if [ -f $(DAT)/symbols ]; then cp $(DAT)/symbols $(GAMEDIR)/SYMBOLS; fi; + if [ -f $(SSHR)/NetHack.cnf ]; then cp $(SSHR)/NetHack.cnf $(GAMEDIR)/NETHACK.CNF; fi; + -touch $(GAMEDIR)/RECORD + if [ -f ../sys/msdos/sysconf ]; then cp ../sys/msdos/sysconf $(GAMEDIR)/SYSCONF; fi; + if [ -f $(DOC)/nethack.txt ]; then cp $(DOC)/nethack.txt $(GAMEDIR)/NETHACK.TXT; fi; + @echo install done > $@ + +#========================================== +# The main target. +#========================================== + +$(GAMEFILE): $(O)obj.tag $(PDCLIB) $(LUALIB) \ + $(O)utility.tag $(ALLOBJ) $(O)$(GAME).lnk + if [ -f temp.a ]; then rm temp.a; fi; + @$(TARGET_AR) r temp.a $(VOBJ01) + @$(TARGET_AR) r temp.a $(VOBJ02) + @$(TARGET_AR) r temp.a $(VOBJ03) + @$(TARGET_AR) r temp.a $(VOBJ04) + @$(TARGET_AR) r temp.a $(VOBJ05) + @$(TARGET_AR) r temp.a $(VOBJ06) + @$(TARGET_AR) r temp.a $(VOBJ07) + @$(TARGET_AR) r temp.a $(VOBJ08) + @$(TARGET_AR) r temp.a $(VOBJ09) + @$(TARGET_AR) r temp.a $(VOBJ10) + @$(TARGET_AR) r temp.a $(VOBJ11) + @$(TARGET_AR) r temp.a $(VOBJ12) + @$(TARGET_AR) r temp.a $(VOBJ13) + @$(TARGET_AR) r temp.a $(VOBJ14) + @$(TARGET_AR) r temp.a $(VOBJ15) + @$(TARGET_AR) r temp.a $(VOBJ16) + @$(TARGET_AR) r temp.a $(VOBJ17) + @$(TARGET_AR) r temp.a $(VOBJ18) + @$(TARGET_AR) r temp.a $(VOBJ19) + @$(TARGET_AR) r temp.a $(VOBJ20) + @$(TARGET_AR) r temp.a $(VOBJ21) + @$(TARGET_AR) r temp.a $(VOBJ22) + @$(TARGET_AR) r temp.a $(VOBJ23) + @$(TARGET_AR) r temp.a $(VOBJ24) + @$(TARGET_AR) r temp.a $(VOBJ25) + @$(TARGET_AR) r temp.a $(VIDEO_OBJ) + @$(TARGET_AR) r temp.a $(SOBJ) + @$(TARGET_AR) r temp.a $(TILOBJ) + @$(TARGET_AR) r temp.a $(TILOBJ2) +ifeq "$(ADD_LUA)" "Y" + @$(TARGET_AR) r temp.a $(LUAOBJ) +endif + @$(TARGET_AR) r temp.a $(VVOBJ) +ifeq "$(ADD_CURSES)" "Y" + @$(TARGET_AR) r temp.a $(CURSESOBJ) +endif + @$(TARGET_AR) r temp.a $(MDLIB) + $(TARGET_LINK) $(LFLAGS) -o$(GAME).exe temp.a $(PDCLIB) $(LUALIB) $(LIBRARIES) $(ZLIB) + $(TARGET_STUBEDIT) $(GAME).exe minstack=2048K + cp $(GAME).exe $(GAMEFILE) + rm $(GAME).exe + +$(O)$(GAME).lnk: $(ALLOBJ) + echo $(VOBJ01) > $@ + echo $(VOBJ02) >> $@ + echo $(VOBJ03) >> $@ + echo $(VOBJ04) >> $@ + echo $(VOBJ05) >> $@ + echo $(VOBJ06) >> $@ + echo $(VOBJ07) >> $@ + echo $(VOBJ08) >> $@ + echo $(VOBJ09) >> $@ + echo $(VOBJ10) >> $@ + echo $(VOBJ11) >> $@ + echo $(VOBJ12) >> $@ + echo $(VOBJ13) >> $@ + echo $(VOBJ14) >> $@ + echo $(VOBJ15) >> $@ + echo $(VOBJ16) >> $@ + echo $(VOBJ17) >> $@ + echo $(VOBJ18) >> $@ + echo $(VOBJ19) >> $@ + echo $(VOBJ20) >> $@ + echo $(VOBJ21) >> $@ + echo $(VOBJ22) >> $@ + echo $(VOBJ23) >> $@ + echo $(VOBJ24) >> $@ + echo $(VOBJ25) >> $@ + echo $(SOBJ) >> $@ + echo $(TILOBJ) >> $@ + echo $(TILOBJ2) >> $@ +ifeq "$(ADD_LUA)" "Y" + echo $(LUAOBJ) >> $@ +endif + echo $(VVOBJ) >> $@ +ifeq "$(ADD_CURSES)" "Y" + echo $(CURSESOBJ) >> $@ +endif + +#========================================== +#=========== SECONDARY TARGETS ============ +#========================================== +# +#========================================== +# Recover Utility +#========================================== + +$(U)recover.exe: $(RECOVOBJS) + $(TARGET_LINK) $(LFLAGS) -o$@ $(O)recover.o + +$(O)recover.o: $(CONFIG_H) $(U)recover.c + $(TARGET_CC) $(cflags) -o$@ $(U)recover.c + +#========================================== +# Header file moves required for tile support +#========================================== + +ifeq ($(SUPPRESS_GRAPHICS),Y) + +else +# +# Tile Mapping +# + +#$(SRC)/tile.c: $(U)tilemap +# @$(U)tilemap +# @echo A new $@ has been created + +endif + +#========================================== +# PDCurses Library +#========================================== + +$(O)pdcurses.a : $(PDCLIBOBJS) $(PDCOBJS) + if [ -f $@ ]; then rm $@; fi; + $(TARGET_AR) rcS $@ $(PDCLIBOBJS1) + $(TARGET_AR) rcS $@ $(PDCLIBOBJS2) + $(TARGET_AR) rcS $@ $(PDCLIBOBJS3) + $(TARGET_AR) rcS $@ $(PDCLIBOBJS4) + $(TARGET_AR) rcs $@ $(PDCOBJS) + +#========================================== +# Other Util Dependencies. +#========================================== + +$(O)alloc.o: $(CONFIG_H) alloc.c + $(TARGET_CC) $(cflags) -o$@ alloc.c + +$(O)drawing.o: $(CONFIG_H) drawing.c $(MSYS)/pcvideo.h + $(TARGET_CC) $(cflags) -I$(MSYS) -o$@ drawing.c + +$(O)decl.o: $(CONFIG_H) decl.c + $(TARGET_CC) $(cflags) -o$@ decl.c + +$(O)monst.o: $(CONFIG_H) $(PERMONST_H) $(INCL)/monsym.h \ + $(INCL)/color.h monst.c + $(TARGET_CC) $(cflags) -o$@ monst.c + +$(O)objects.o: $(CONFIG_H) $(INCL)/obj.h $(INCL)/objclass.h \ + $(INCL)/prop.h $(INCL)/color.h objects.c + $(TARGET_CC) $(cflags) -o$@ objects.c + +$(O)dat.tag: $(DAT)/nhdat + @echo dat done >$@ + +#============================================================= +# Lua +#============================================================= + +lua.exe: $(O)lua.o $(LUALIB) + $(TARGET_LINK) $(LFLAGS) -o$@ $(O)lua.o $(LUALIB) + +luac.exe: $(O)luac.o $(LUALIB) + $(TARGET_LINK) $(LFLAGSU) -o$@ $(O)luac.o $(LUALIB) + +$(O)lua.o: $(LUASRC)/lua.c +$(O)luac.o: $(LUASRC)/luac.c + +#========================================== +# Lua lib +#========================================== + +$(LUALIB): $(LUALIBOBJS) + if [ -f $@ ]; then rm $@; fi; + $(TARGET_AR) rcS $@ $(LUAOBJFILES1) + $(TARGET_AR) rcS $@ $(LUAOBJFILES2) + $(TARGET_AR) rcS $@ $(LUAOBJFILES3) + $(TARGET_AR) rcs $@ $(LUAOBJFILES4) + +#$(LUADLL): $(LUALIBOBJS) +# $(TARGET_CC) -shared -Wl,--export-all-symbols \ +# -Wl,--add-stdcall-alias -o $@ $< + +#========================================== +# Housekeeping. +#========================================== + +clean: + rm ./o/*.o + if [ -f $(O)install.tag ]; then rm $(O)install.tag; fi; + if [ -f $(O)obj.tag ]; then rm $(O)obj.tag; fi; + if [ -f $(O)$(GAME).lnk ]; then rm temp.a; fi; + if [ -f temp.a ]; then rm temp.a; fi; + +spotless: clean + + if [ -f $(U)recover.exe ]; then rm $(U)recover.exe; fi; + if [ -f $(INCL)/vis_tab.h ]; then rm $(INCL)/vis_tab.h; fi; + if [ -f $(INCL)/onames.h ]; then rm $(INCL)/onames.h; fi; + if [ -f $(INCL)/pm.h ]; then rm $(INCL)/pm.h; fi; + if [ -f $(INCL)/date.h ]; then rm $(INCL)/date.h; fi; +# if [ -f $(SRC)/monstr.c ]; then rm $(SRC)/monstr.c; fi; + if [ -f $(SRC)/vis_tab.c ]; then rm $(SRC)/vis_tab.c; fi; + if [ -f $(SRC)/tile.c ]; then rm $(SRC)/tile.c; fi; + if [ -f $(DAT)/options ]; then rm $(DAT)/options; fi; + if [ -f $(DAT)/data ]; then rm $(DAT)/data; fi; + if [ -f $(DAT)/rumors ]; then rm $(DAT)/rumors; fi; + if [ -f $(DAT)/oracles ]; then rm $(DAT)/oracles; fi; +ifndef LUA_QTEXT_FILE + if [ -f $(DAT)/quest.dat ]; then rm $(DAT)/quest.dat; fi; +endif + if [ -f $(DAT)/bogusmon ]; then rm $(DAT)/bogusmon; fi; + if [ -f $(DAT)/engrave ]; then rm $(DAT)/engrave; fi; + if [ -f $(DAT)/epitaph ]; then rm $(DAT)/epitaph; fi; + if [ -f $(DAT)/dlb.lst ]; then rm $(DAT)/dlb.lst; fi; + if [ -f $(TILE_BMP) ]; then rm $(TILE_BMP); fi; + if [ -f $(PLANAR_TIB) ]; then rm $(PLANAR_TIB); fi; + if [ -f $(OVERVIEW_TIB) ]; then rm $(OVERVIEW_TIB); fi; + if [ -f $(WSHR)/monthin.txt ]; then rm $(WSHR)/monthin.txt; fi; + if [ -f $(WSHR)/objthin.txt ]; then rm $(WSHR)/objthin.txt; fi; + if [ -f $(WSHR)/oththin.txt ]; then rm $(WSHR)/oththin.txt; fi; + +#========================================== +# Create directory for holding object files +#========================================== + +$(O)obj.tag: + -mkdir -p $(OBJ) + @echo directory ready $(OBJ) + +#========================================== +# Game Dependencies +#========================================== + +# sys/share +$(O)main.o: $(HACK_H) $(DLB_H) $(SSHR)/pcmain.c + $(TARGET_CC) $(cflags) -o$@ $(SSHR)/pcmain.c + +$(O)tty.o: $(HACK_H) $(INCL)/wintty.h $(SSHR)/pctty.c + $(TARGET_CC) $(cflags) -o$@ $(SSHR)/pctty.c + +$(O)unix.o: $(HACK_H) $(SSHR)/pcunix.c + $(TARGET_CC) $(cflags) -o$@ $(SSHR)/pcunix.c + +$(O)pcsys.o : $(HACK_H) $(SSHR)/pcsys.c + $(TARGET_CC) $(cflags) -o$@ $(SSHR)/pcsys.c + +$(O)posixreg.o : $(HACK_H) $(SSHR)/posixreg.c + $(TARGET_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 + $(TARGET_CC) $(cflags) -o$@ $(SSHR)/pmatchre.c + +# sys/msdos +$(O)msdos.o : $(HACK_H) $(MSYS)/msdos.c +$(O)pckeys.o : $(HACK_H) $(MSYS)/pckeys.c +$(O)pctiles.o : $(HACK_H) $(MSYS)/pctiles.c $(MSYS)/portio.h + $(TARGET_CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(MSYS)/pctiles.c +$(O)sound.o : $(HACK_H) $(MSYS)/sound.c $(MSYS)/portio.h +$(O)video.o : $(HACK_H) $(MSYS)/pcvideo.h $(MSYS)/portio.h $(MSYS)/video.c +$(O)vidvga.o : $(HACK_H) $(MSYS)/pcvideo.h $(MSYS)/portio.h $(TILE_H) $(MSYS)/vidvga.c + $(TARGET_CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(MSYS)/vidvga.c +$(O)vidvesa.o : $(HACK_H) $(MSYS)/pcvideo.h $(MSYS)/portio.h $(TILE_H) $(MSYS)/vidvesa.c + $(TARGET_CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(MSYS)/vidvesa.c +$(O)vidtxt.o : $(HACK_H) $(MSYS)/pcvideo.h $(MSYS)/portio.h $(TILE_H) $(MSYS)/vidtxt.c +$(O)stubvid.o : $(HACK_H) $(MSYS)/pcvideo.h $(MSYS)/video.c + $(TARGET_CC) $(cflags) -I$(MSYS) -DSTUBVIDEO -o$@ $(MSYS)/video.c +# +# The rest are stolen from sys/unix/Makefile.src, +# with the following changes: +# o -c (which is included in cflags) substituted with -o$@ , +# o an explicit build instruction for dlb.o because it requires +# a .h file in ../sys/msdos. +# o the PATCHLEV_H macro is substitued for $(INCL)/patchlevel.h +# to work around a long filename issue. +# o $(CFLAGS) changed to $(cflags) +# Other than that, these dependencies are untouched. +# That means that there is some irrelevant stuff +# in here, but maintenance should be easier. +# +# +# src dependencies +#$(O)tos.o: ../sys/atari/tos.c $(HACK_H) $(INCL)/tcap.h + $(TARGET_CC) $(cflags) -o$@ ../sys/atari/tos.c +$(O)pcmain.o: ../sys/share/pcmain.c $(HACK_H) $(INCL)/dlb.h \ + #$(INCL)/win32api.h + $(TARGET_CC) $(cflags) -o$@ ../sys/share/pcmain.c +$(O)pctty.o: ../sys/share/pctty.c $(HACK_H) + $(TARGET_CC) $(cflags) -o$@ ../sys/share/pctty.c +$(O)pcunix.o: ../sys/share/pcunix.c $(HACK_H) + $(TARGET_CC) $(cflags) -o$@ ../sys/share/pcunix.c +$(O)random.o: ../sys/share/random.c $(HACK_H) + $(TARGET_CC) $(cflags) -o$@ ../sys/share/random.c +$(O)ioctl.o: ../sys/share/ioctl.c $(HACK_H) $(INCL)/tcap.h + $(TARGET_CC) $(cflags) -o$@ ../sys/share/ioctl.c +$(O)unixtty.o: ../sys/share/unixtty.c $(HACK_H) + $(TARGET_CC) $(cflags) -o$@ ../sys/share/unixtty.c +$(O)unixmain.o: ../sys/unix/unixmain.c $(HACK_H) $(INCL)/dlb.h + $(TARGET_CC) $(cflags) -o$@ ../sys/unix/unixmain.c +$(O)unixunix.o: ../sys/unix/unixunix.c $(HACK_H) + $(TARGET_CC) $(cflags) -o$@ ../sys/unix/unixunix.c +$(O)unixres.o: ../sys/unix/unixres.c $(CONFIG_H) + $(TARGET_CC) $(cflags) -o$@ ../sys/unix/unixres.c +$(O)bemain.o: ../sys/be/bemain.c $(HACK_H) $(INCL)/dlb.h + $(TARGET_CC) $(cflags) -o$@ ../sys/be/bemain.c +$(O)getline.o: ../win/tty/getline.c $(HACK_H) $(INCL)/func_tab.h + $(TARGET_CC) $(cflags) -o$@ ../win/tty/getline.c +$(O)termcap.o: ../win/tty/termcap.c $(HACK_H) $(INCL)/tcap.h + $(TARGET_CC) $(cflags) -o$@ ../win/tty/termcap.c +$(O)topl.o: ../win/tty/topl.c $(HACK_H) $(INCL)/tcap.h + $(TARGET_CC) $(cflags) -o$@ ../win/tty/topl.c +$(O)wintty.o: ../win/tty/wintty.c $(HACK_H) $(INCL)/dlb.h \ + $(INCL)/date.h $(PATCHLEV_H) $(INCL)/tcap.h + $(TARGET_CC) $(cflags) -o$@ ../win/tty/wintty.c +$(O)Window.o: ../win/X11/Window.c $(INCL)/xwindowp.h $(INCL)/xwindow.h \ + $(CONFIG_H) + $(TARGET_CC) $(cflags) -o$@ ../win/X11/Window.c +$(O)dialogs.o: ../win/X11/dialogs.c $(CONFIG_H) + $(TARGET_CC) $(cflags) -o$@ ../win/X11/dialogs.c +$(O)winX.o: ../win/X11/winX.c $(HACK_H) $(INCL)/winX.h $(INCL)/dlb.h \ + $(PATCHLEV_H) ../win/X11/nh72icon \ + ../win/X11/nh56icon ../win/X11/nh32icon + $(TARGET_CC) $(cflags) -o$@ ../win/X11/winX.c +$(O)winmap.o: ../win/X11/winmap.c $(INCL)/xwindow.h $(HACK_H) $(INCL)/dlb.h \ + $(INCL)/winX.h $(INCL)/tile2x11.h + $(TARGET_CC) $(cflags) -o$@ ../win/X11/winmap.c +$(O)winmenu.o: ../win/X11/winmenu.c $(HACK_H) $(INCL)/winX.h + $(TARGET_CC) $(cflags) -o$@ ../win/X11/winmenu.c +$(O)winmesg.o: ../win/X11/winmesg.c $(INCL)/xwindow.h $(HACK_H) $(INCL)/winX.h + $(TARGET_CC) $(cflags) -o$@ ../win/X11/winmesg.c +$(O)winmisc.o: ../win/X11/winmisc.c $(HACK_H) $(INCL)/func_tab.h \ + $(INCL)/winX.h + $(TARGET_CC) $(cflags) -o$@ ../win/X11/winmisc.c +$(O)winstat.o: ../win/X11/winstat.c $(HACK_H) $(INCL)/winX.h + $(TARGET_CC) $(cflags) -o$@ ../win/X11/winstat.c +$(O)wintext.o: ../win/X11/wintext.c $(HACK_H) $(INCL)/winX.h $(INCL)/xwindow.h + $(TARGET_CC) $(cflags) -o$@ ../win/X11/wintext.c +$(O)winval.o: ../win/X11/winval.c $(HACK_H) $(INCL)/winX.h + $(TARGET_CC) $(cflags) -o$@ ../win/X11/winval.c +#$(O)tile.o: tile.c $(HACK_H) +#$(HOST_O)tile.o: tile.c $(HACK_H) +$(O)gnaskstr.o: ../win/gnome/gnaskstr.c ../win/gnome/gnaskstr.h \ + ../win/gnome/gnmain.h + $(TARGET_CC) $(cflags) $(GNOMEINC) -o$@ ../win/gnome/gnaskstr.c +$(O)gnbind.o: ../win/gnome/gnbind.c ../win/gnome/gnbind.h ../win/gnome/gnmain.h \ + ../win/gnome/gnaskstr.h ../win/gnome/gnyesno.h + $(TARGET_CC) $(cflags) $(GNOMEINC) -o$@ ../win/gnome/gnbind.c +$(O)gnglyph.o: ../win/gnome/gnglyph.c ../win/gnome/gnglyph.h $(INCL)/tile2x11.h + $(TARGET_CC) $(cflags) $(GNOMEINC) -o$@ ../win/gnome/gnglyph.c +$(O)gnmain.o: ../win/gnome/gnmain.c ../win/gnome/gnmain.h ../win/gnome/gnsignal.h \ + ../win/gnome/gnbind.h ../win/gnome/gnopts.h $(HACK_H) \ + $(INCL)/date.h + $(TARGET_CC) $(cflags) $(GNOMEINC) -o$@ ../win/gnome/gnmain.c +$(O)gnmap.o: ../win/gnome/gnmap.c ../win/gnome/gnmap.h ../win/gnome/gnglyph.h \ + ../win/gnome/gnsignal.h $(HACK_H) + $(TARGET_CC) $(cflags) $(GNOMEINC) -o$@ ../win/gnome/gnmap.c +$(O)gnmenu.o: ../win/gnome/gnmenu.c ../win/gnome/gnmenu.h ../win/gnome/gnmain.h \ + ../win/gnome/gnbind.h + $(TARGET_CC) $(cflags) $(GNOMEINC) -o$@ ../win/gnome/gnmenu.c +$(O)gnmesg.o: ../win/gnome/gnmesg.c ../win/gnome/gnmesg.h ../win/gnome/gnsignal.h + $(TARGET_CC) $(cflags) $(GNOMEINC) -o$@ ../win/gnome/gnmesg.c +$(O)gnopts.o: ../win/gnome/gnopts.c ../win/gnome/gnopts.h ../win/gnome/gnglyph.h \ + ../win/gnome/gnmain.h ../win/gnome/gnmap.h $(HACK_H) + $(TARGET_CC) $(cflags) $(GNOMEINC) -o$@ ../win/gnome/gnopts.c +$(O)gnplayer.o: ../win/gnome/gnplayer.c ../win/gnome/gnplayer.h \ + ../win/gnome/gnmain.h $(HACK_H) + $(TARGET_CC) $(cflags) $(GNOMEINC) -o$@ ../win/gnome/gnplayer.c +$(O)gnsignal.o: ../win/gnome/gnsignal.c ../win/gnome/gnsignal.h \ + ../win/gnome/gnmain.h + $(TARGET_CC) $(cflags) $(GNOMEINC) -o$@ ../win/gnome/gnsignal.c +$(O)gnstatus.o: ../win/gnome/gnstatus.c ../win/gnome/gnstatus.h \ + ../win/gnome/gnsignal.h ../win/gnome/gn_xpms.h \ + ../win/gnome/gnomeprv.h + $(TARGET_CC) $(cflags) $(GNOMEINC) -o$@ ../win/gnome/gnstatus.c +$(O)gntext.o: ../win/gnome/gntext.c ../win/gnome/gntext.h ../win/gnome/gnmain.h \ + ../win/gnome/gn_rip.h + $(TARGET_CC) $(cflags) $(GNOMEINC) -o$@ ../win/gnome/gntext.c +$(O)gnworn.o: ../win/gnome/gnworn.c ../win/gnome/gnworn.h ../win/gnome/gnglyph.h \ + ../win/gnome/gnsignal.h ../win/gnome/gnomeprv.h + $(TARGET_CC) $(cflags) $(GNOMEINC) -o$@ ../win/gnome/gnworn.c +$(O)gnyesno.o: ../win/gnome/gnyesno.c ../win/gnome/gnbind.h ../win/gnome/gnyesno.h + $(TARGET_CC) $(cflags) $(GNOMEINC) -o$@ ../win/gnome/gnyesno.c +$(O)wingem.o: ../win/gem/wingem.c $(HACK_H) $(INCL)/func_tab.h $(INCL)/dlb.h \ + $(PATCHLEV_H) $(INCL)/wingem.h + $(TARGET_CC) $(cflags) -o$@ ../win/gem/wingem.c +$(O)wingem1.o: ../win/gem/wingem1.c $(INCL)/gem_rsc.h $(INCL)/load_img.h \ + $(INCL)/gr_rect.h $(INCL)/wintype.h $(INCL)/wingem.h + $(TARGET_CC) $(cflags) -o$@ ../win/gem/wingem1.c +$(O)load_img.o: ../win/gem/load_img.c $(INCL)/load_img.h + $(TARGET_CC) $(cflags) -o$@ ../win/gem/load_img.c +$(O)gr_rect.o: ../win/gem/gr_rect.c $(INCL)/gr_rect.h + $(TARGET_CC) $(cflags) -o$@ ../win/gem/gr_rect.c +$(O)qt_win.o: ../win/Qt/qt_win.cpp $(HACK_H) $(INCL)/func_tab.h \ + $(INCL)/dlb.h $(PATCHLEV_H) $(INCL)/tile2x11.h \ + $(INCL)/qt_win.h $(INCL)/qt_clust.h $(INCL)/qt_kde0.h \ + $(INCL)/qt_xpms.h qt_win.moc qt_kde0.moc qttableview.moc + $(CXX) $(CXXFLAGS) -o$@ ../win/Qt/qt_win.cpp +$(O)qt_clust.o: ../win/Qt/qt_clust.cpp $(INCL)/qt_clust.h + $(CXX) $(CXXFLAGS) -o$@ ../win/Qt/qt_clust.cpp +$(O)qttableview.o: ../win/Qt/qttableview.cpp $(INCL)/qttableview.h + $(CXX) $(CXXFLAGS) -o$@ ../win/Qt/qttableview.cpp +#$(O)monstr.o: monstr.c $(CONFIG_H) +$(O)vis_tab.o: vis_tab.c $(CONFIG_H) $(INCL)/vis_tab.h +$(O)allmain.o: allmain.c $(HACK_H) +$(O)alloc.o: alloc.c $(CONFIG_H) +$(O)apply.o: apply.c $(HACK_H) +$(O)artifact.o: artifact.c $(HACK_H) $(INCL)/artifact.h $(INCL)/artilist.h +$(O)attrib.o: attrib.c $(HACK_H) +$(O)ball.o: ball.c $(HACK_H) +$(O)bones.o: bones.c $(HACK_H) +$(O)botl.o: botl.c $(HACK_H) +$(O)cmd.o: cmd.c $(HACK_H) $(INCL)/func_tab.h +$(O)dbridge.o: dbridge.c $(HACK_H) +$(O)decl.o: decl.c $(HACK_H) +$(O)detect.o: detect.c $(HACK_H) $(INCL)/artifact.h +$(O)dig.o: dig.c $(HACK_H) +$(O)display.o: display.c $(HACK_H) +$(O)dlb.o: dlb.c $(CONFIG_H) $(INCL)/dlb.h + $(TARGET_CC) $(cflags) -I../sys/msdos -o$@ dlb.c +$(O)do.o: do.c $(HACK_H) +$(O)do_name.o: do_name.c $(HACK_H) +$(O)do_wear.o: do_wear.c $(HACK_H) +$(O)dog.o: dog.c $(HACK_H) +$(O)dogmove.o: dogmove.c $(HACK_H) $(INCL)/mfndpos.h +$(O)dokick.o: dokick.c $(HACK_H) +$(O)dothrow.o: dothrow.c $(HACK_H) +$(O)drawing.o: drawing.c $(HACK_H) $(INCL)/tcap.h +$(O)dungeon.o: dungeon.c $(HACK_H) $(INCL)/dgn_file.h $(INCL)/dlb.h +$(O)eat.o: eat.c $(HACK_H) +$(O)end.o: end.c $(HACK_H) $(INCL)/dlb.h +$(O)engrave.o: engrave.c $(HACK_H) +$(O)exper.o: exper.c $(HACK_H) +$(O)explode.o: explode.c $(HACK_H) +$(O)extralev.o: extralev.c $(HACK_H) +$(O)files.o: files.c $(HACK_H) $(INCL)/dlb.h +$(O)fountain.o: fountain.c $(HACK_H) +$(O)hack.o: hack.c $(HACK_H) +$(O)hacklib.o: hacklib.c $(HACK_H) +$(O)invent.o: invent.c $(HACK_H) +$(O)light.o: light.c $(HACK_H) +$(O)lock.o: lock.c $(HACK_H) +$(O)mail.o: mail.c $(HACK_H) $(INCL)/mail.h +$(O)makemon.o: makemon.c $(HACK_H) +$(O)mapglyph.o: mapglyph.c $(HACK_H) +$(O)mcastu.o: mcastu.c $(HACK_H) +$(O)mhitm.o: mhitm.c $(HACK_H) $(INCL)/artifact.h +$(O)mhitu.o: mhitu.c $(HACK_H) $(INCL)/artifact.h +$(O)minion.o: minion.c $(HACK_H) +$(O)mklev.o: mklev.c $(HACK_H) +$(O)mkmap.o: mkmap.c $(HACK_H) $(INCL)/sp_lev.h +$(O)mkmaze.o: mkmaze.c $(HACK_H) $(INCL)/sp_lev.h +$(O)mkobj.o: mkobj.c $(HACK_H) +$(O)mkroom.o: mkroom.c $(HACK_H) +$(O)mon.o: mon.c $(HACK_H) $(INCL)/mfndpos.h +$(O)mondata.o: mondata.c $(HACK_H) +$(O)monmove.o: monmove.c $(HACK_H) $(INCL)/mfndpos.h $(INCL)/artifact.h +$(O)monst.o: monst.c $(CONFIG_H) $(INCL)/permonst.h $(INCL)/align.h \ + $(INCL)/monattk.h $(INCL)/monflag.h $(INCL)/monsym.h \ + $(INCL)/color.h +$(O)mplayer.o: mplayer.c $(HACK_H) +$(O)mthrowu.o: mthrowu.c $(HACK_H) +$(O)muse.o: muse.c $(HACK_H) +$(O)music.o: music.c $(HACK_H) #interp.c +$(O)o_init.o: o_init.c $(HACK_H) +$(O)objects.o: objects.c $(CONFIG_H) $(INCL)/obj.h $(INCL)/objclass.h \ + $(INCL)/prop.h $(INCL)/skills.h $(INCL)/color.h +$(O)objnam.o: objnam.c $(HACK_H) +$(O)options.o: options.c $(CONFIG_H) $(INCL)/objclass.h $(INCL)/flag.h \ + $(HACK_H) $(INCL)/tcap.h +$(O)pager.o: pager.c $(HACK_H) $(INCL)/dlb.h +$(O)pickup.o: pickup.c $(HACK_H) +$(O)pline.o: pline.c $(HACK_H) +$(O)polyself.o: polyself.c $(HACK_H) +$(O)potion.o: potion.c $(HACK_H) +$(O)pray.o: pray.c $(HACK_H) +$(O)priest.o: priest.c $(HACK_H) $(INCL)/mfndpos.h +$(O)quest.o: quest.c $(HACK_H) +$(O)questpgr.o: questpgr.c $(HACK_H) $(INCL)/dlb.h +$(O)read.o: read.c $(HACK_H) +$(O)rect.o: rect.c $(HACK_H) +$(O)region.o: region.c $(HACK_H) +$(O)restore.o: restore.c $(HACK_H) $(INCL)/tcap.h +$(O)rip.o: rip.c $(HACK_H) +$(O)rnd.o: rnd.c $(HACK_H) +$(O)role.o: role.c $(HACK_H) +$(O)rumors.o: rumors.c $(HACK_H) $(INCL)/dlb.h +$(O)save.o: save.c $(HACK_H) +$(O)shk.o: shk.c $(HACK_H) +$(O)shknam.o: shknam.c $(HACK_H) +$(O)sit.o: sit.c $(HACK_H) $(INCL)/artifact.h +$(O)sounds.o: sounds.c $(HACK_H) +$(O)sp_lev.o: sp_lev.c $(HACK_H) $(INCL)/dlb.h $(INCL)/sp_lev.h +$(O)spell.o: spell.c $(HACK_H) +$(O)steal.o: steal.c $(HACK_H) +$(O)steed.o: steed.c $(HACK_H) +$(O)sys.o: sys.c $(HACK_H) +$(O)teleport.o: teleport.c $(HACK_H) +$(O)timeout.o: timeout.c $(HACK_H) +$(O)topten.o: topten.c $(HACK_H) $(INCL)/dlb.h $(PATCHLEV_H) +$(O)track.o: track.c $(HACK_H) +$(O)trap.o: trap.c $(HACK_H) +$(O)u_init.o: u_init.c $(HACK_H) +$(O)uhitm.o: uhitm.c $(HACK_H) +$(O)vault.o: vault.c $(HACK_H) +$(O)version.o: version.c $(HACK_H) $(INCL)/date.h $(PATCHLEV_H) +$(O)vision.o: vision.c $(HACK_H) $(INCL)/vis_tab.h +$(O)weapon.o: weapon.c $(HACK_H) +$(O)were.o: were.c $(HACK_H) +$(O)wield.o: wield.c $(HACK_H) +$(O)windows.o: windows.c $(HACK_H) $(INCL)/wingem.h $(INCL)/winGnome.h +$(O)wizard.o: wizard.c $(HACK_H) +$(O)worm.o: worm.c $(HACK_H) +$(O)worn.o: worn.c $(HACK_H) +$(O)write.o: write.c $(HACK_H) +$(O)zap.o: zap.c $(HACK_H) +$(O)pmatchre.o: $(SSHR)/pmatchre.c $(HACK_H) +$(O)tileset.o: $(WSHR)/tileset.c $(HACK_H) +$(O)bmptiles.o: $(WSHR)/bmptiles.c $(INCL)/config.h $(INCL)/tileset.h $(INCL)/integer.h +$(O)giftiles.o: $(WSHR)/giftiles.c $(INCL)/config.h $(INCL)/tileset.h $(INCL)/integer.h + +# end of file + diff --git a/sys/msdos/msdos-cross-compile.sh b/sys/msdos/msdos-cross-compile.sh new file mode 100644 index 000000000..4dd7ee617 --- /dev/null +++ b/sys/msdos/msdos-cross-compile.sh @@ -0,0 +1,108 @@ +#!/bin/sh +#set -x + +if [ -z "$TRAVIS_BUILD_DIR" ]; then + export DJGPP_TOP=$(pwd)/lib/djgpp +else + export DJGPP_TOP="$TRAVIS_BUILD_DIR/lib/djgpp" +fi + +if [ ! -d "$(pwd)/lib" ]; then + echo "Set up for Unix build and 'make fetch-lua' first." + exit 1 +fi + +DJGPP_URL="https://github.com/andrewwutw/build-djgpp/releases/download/v2.9/" +if [ "$(uname)" = "Darwin" ]; then + #Mac + DJGPP_FILE="djgpp-osx-gcc550.tar.bz2" +elif [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]; then + #Linux + DJGPP_FILE="djgpp-linux64-gcc550.tar.bz2" +elif [ "$(expr substr $(uname -s) 1 10)" = "MINGW32_NT" ]; then + #mingw + DJGPP_FILE="djgpp-mingw-gcc550-standalone.zip" +else + echo "No DJGPP release for you, sorry." + exit 1 +fi + +DJGPP_URL="$DJGPP_URL$DJGPP_FILE" + +# export + +if [ ! -d lib ]; then +mkdir -p lib +fi + +cd lib +if [ ! -f "$DJGPP_FILE" ]; then + if [ "$(uname)" = "Darwin" ]; then + #Mac + curl -L $DJGPP_URL -o $DJGPP_FILE + else + wget --no-hsts "$DJGPP_URL" + fi +fi + +if [ ! -d djgpp/i586-pc-msdosdjgpp ]; then + tar xjf "$DJGPP_FILE" + rm -f $DJGPP_FILE +fi + +# DOS-extender for use with djgpp +if [ ! -d djgpp/cwsdpmi ]; then + if [ "$(uname)" = "Darwin" ]; then + #Mac + curl http://sandmann.dotster.com/cwsdpmi/csdpmi7b.zip -o csdpmi7b.zip + else + wget --no-hsts http://sandmann.dotster.com/cwsdpmi/csdpmi7b.zip + fi + cd djgpp + mkdir -p cwsdpmi + cd cwsdpmi + unzip ../../csdpmi7b.zip + cd ../../ + rm csdpmi7b.zip +fi + +# PDCurses +if [ ! -d "pdcurses" ]; then + echo "Getting ../pdcurses from https://github.com/wmcbrine/PDCurses.git" ; \ + git clone --depth 1 https://github.com/wmcbrine/PDCurses.git pdcurses +fi + +cd ../ + +#echo after dos extender + +cd src + +mkdir -p ../msdos-binary +cp ../dat/data.base ../dat/data.bas +cp ../include/patchlevel.h ../include/patchlev.h +cp ../doc/Guidebook.txt ../doc/guidebk.txt +cp ../sys/share/posixregex.c ../sys/share/posixreg.c +#cp ../sys/msdos/Makefile1.cross ../src/Makefile1 +#cp ../sys/msdos/Makefile2.cross ../src/Makefile2 +make -f ../sys/msdos/Makefile1.cross +#cat ../include/date.h +export GCC_EXEC_PREFIX=$DJGPP_TOP/lib/gcc/ +# export + +#pwd + +make -f ../sys/msdos/Makefile2.cross +unset GCC_EXEC_PREFIX +#pwd + +if [ -f ../lib/djgpp/cwsdpmi/bin/CWSDPMI.EXE ]; then + cp ../lib/djgpp/cwsdpmi/bin/CWSDPMI.EXE ../msdos-binary/CWSDPMI.EXE; +fi + +# ls -l ../msdos-binary +cd ../msdos-binary +zip -9 ../lib/NH370DOS.ZIP * +cd ../ +ls -l lib/NH370DOS.ZIP + diff --git a/sys/msdos/setup.bat b/sys/msdos/setup.bat index b5c9c9c0b..8c16863ae 100755 --- a/sys/msdos/setup.bat +++ b/sys/msdos/setup.bat @@ -16,7 +16,7 @@ goto err_set echo Checking to see if directories are set up properly ... if not exist ..\..\include\hack.h goto err_dir if not exist ..\..\src\hack.c goto err_dir -if not exist ..\..\dat\wizard.des goto err_dir +if not exist ..\..\dat\wizard1.lua goto err_dir if not exist ..\..\util\makedefs.c goto err_dir if not exist ..\..\win\tty\wintty.c goto err_dir echo Directories OK. diff --git a/sys/winnt/sysconf b/sys/msdos/sysconf similarity index 72% rename from sys/winnt/sysconf rename to sys/msdos/sysconf index 283a55df4..505d589ba 100644 --- a/sys/winnt/sysconf +++ b/sys/msdos/sysconf @@ -1,11 +1,11 @@ # -# NetHack 3.6 sysconf $NHDT-Date: 1524689357 2018/04/25 20:49:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.22 $ +# NetHack 3.7 sysconf $NHDT-Date: 1524689357 2018/04/25 20:49:17 $ $NHDT-Branch: NetHack-3.7.0 $:$NHDT-Revision: 1.22 $ # Copyright (c) 2015 by Michael Allison # NetHack may be freely redistributed. See license for details. # # Sample sysconf file. # The sysconf file is only used if NetHack is compiled with SYSCF defined. -# This file uses the same syntax as nethack.cf. +# This file uses the same syntax as nethack.cnf. # Which users can use WIZARD (debugging) mode (the -D flag). # A value of * allows anyone to enter debugging mode. @@ -24,7 +24,7 @@ WIZARDS=* # Only available if NetHack was compiled with DUMPLOG # Allows following placeholders: # %% literal '%' -# %v version (eg. "3.6.2-0") +# %v version (eg. "3.7.0-0") # %u game UID # %t game start time, UNIX timestamp format # %T current time, UNIX timestamp format @@ -52,6 +52,11 @@ WIZARDS=* # Uncomment the next line to disable the SEDUCE option. #SEDUCE=0 +# Uncomment the next line to enable some accessibility features such +# as S_hero_override and S_pet_override symbols for screen readers +# in the user config file. +#ACCESSIBILITY=1 + # Record (high score) file options. # CAUTION: changing these after people have started playing games can # lead to lost high scores! @@ -72,30 +77,27 @@ WIZARDS=* # IMPORTANT: If you change any of these locations, the directories they # point at must exist. NetHack will not create them for you. # -# HACKDIR is the default location for everything. -# Note: On Windows HACKDIR defaults to the location -# of the NetHack.exe or NetHackw.exe file so -# setting HACKDIR below to override that is -# not usually necessary or recommended. -#HACKDIR=c:\games\nethack -# # The location that users can adjust their config file startup options -#CONFIGDIR=c:\games\nethack -# -# The location that level files in progress are stored (default=HACKDIR, writeable) -#LEVELDIR=c:\nethack\levels -# -# The location where saved games are kept (default=HACKDIR, writeable) -#SAVEDIR=c:\nethack\save -# -# The location that bones files are kept (default=HACKDIR, writeable) -#BONESDIR=c:\nethack\save -# -# The location that file synchronization locks are stored (default=HACKDIR, writeable) -#LOCKDIR=c:\nethack\levels +#CONFIGDIR=C:\NETHACK # # The location that a record of game aborts and self-diagnosed game problems # is kept (default=HACKDIR, writeable) -#TROUBLEDIR=c:\nethack\trouble - - +#TROUBLEDIR=C:\NETHACK +# +# The location that documentation and helps files are placed +#HACKDIR=C:\NETHACK +# +# The location that level files in progress are stored (writeable) +#LEVELDIR=C:\NETHACK\LEVELS +# +# The location where saved games are kept (writeable) +#SAVEDIR=C:\NETHACK\SAVES +# +# The location that bones files are kept (writeable) +#BONESDIR=C:\NETHACK\BONES +# +# The location that score files are kept (writeable) +#SCOREDIR=C:\NETHACK +# +# The location that file synchronization locks are stored (writeable) +#LOCKDIR=C:\NETHACK diff --git a/sys/msdos/tile2bin.c b/sys/msdos/tile2bin.c index 4c7a3228d..5d10248e4 100644 --- a/sys/msdos/tile2bin.c +++ b/sys/msdos/tile2bin.c @@ -17,7 +17,7 @@ #include "tile.h" #include "pctiles.h" -#include +/* #include */ #ifndef MONITOR_HEAP #include #endif diff --git a/sys/msdos/video.c b/sys/msdos/video.c index e53cc9d5f..21b400152 100644 --- a/sys/msdos/video.c +++ b/sys/msdos/video.c @@ -227,6 +227,7 @@ register int col, row; } } +#if 0 int has_color(int color) { @@ -237,6 +238,7 @@ has_color(int color) return 0; #endif } +#endif void home() @@ -571,8 +573,10 @@ const char *s; } } -void xputc(ch) /* write out character (and attribute) */ -char ch; +/* same signature as 'putchar()' with potential failure result ignored */ +int +xputc(ch) /* write out character (and attribute) */ +int ch; { int i; char attribute; @@ -591,16 +595,17 @@ char ch; vesa_xputc(ch, attribute); #endif /*SCREEN_VESA*/ } + return 0; } -void xputg(glyphnum, ch, - special) /* write out a glyph picture at current location */ +/* write out a glyph picture at current location */ +void xputg(glyphnum, ch, special) int glyphnum; int ch; unsigned special; { if (!iflags.grmode || !iflags.tile_view) { - xputc((char) ch); + (void) xputc((char) ch); #ifdef SCREEN_VGA } else if (iflags.grmode && iflags.usevga) { vga_xputg(glyphnum, ch, special); diff --git a/sys/os2/.gitattributes b/sys/os2/.gitattributes index 9a0ea4eb3..d3d1c307d 100644 --- a/sys/os2/.gitattributes +++ b/sys/os2/.gitattributes @@ -1,2 +1,2 @@ Makefile.* NHSUBST -* NH_filestag=(file%s_for_OS/2_version_-_untested_for_3.6.2) +* NH_filestag=(file%s_for_OS/2_version_-_untested_for_3.6.4) diff --git a/sys/os2/Makefile.os2 b/sys/os2/Makefile.os2 index 4afcf0fdf..545c91b87 100644 --- a/sys/os2/Makefile.os2 +++ b/sys/os2/Makefile.os2 @@ -950,7 +950,7 @@ $(TEMP)\makedefs.rsp : $(MAKEOBJS) $(TEMP)\$(MKDFDEF) $(ECHO) $(MKDFMD) $(LFLAGS);>> $@ $(OBJ)\makedefs.o : $(UTIL)\$(CB) $(CONFIG_H) $(INCL)\permonst.h $(INCL)\objclass.h \ - $(INCL)\monsym.h $(INCL)\artilist.h $(INCL)\qtext.h + $(INCL)\monsym.h $(INCL)\artilist.h $(UTILCC) # @@ -1519,7 +1519,7 @@ $(OBJ)\attrib.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\artifact.h $(SRCCC) $(OBJ)\ball.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) -$(OBJ)\bones.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\lev.h +$(OBJ)\bones.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) $(OBJ)\botl.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) @@ -1537,7 +1537,7 @@ $(OBJ)\display.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) $(OBJ)\dlb.o : $(SRC)\$(CB) $(CONFIG_H) $(INCL)\dlb.h $(SRCCC) -$(OBJ)\do.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\lev.h +$(OBJ)\do.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) $(OBJ)\do_name.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) @@ -1557,9 +1557,9 @@ $(OBJ)\dungeon.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\dgn_file.h $(SRCCC) $(OBJ)\eat.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) -$(OBJ)\end.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\lev.h +$(OBJ)\end.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) -$(OBJ)\engrave.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\lev.h +$(OBJ)\engrave.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) $(OBJ)\exper.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) @@ -1643,9 +1643,9 @@ $(OBJ)\pray.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) $(OBJ)\priest.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\mfndpos.h $(SRCCC) -$(OBJ)\quest.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\quest.h $(INCL)\qtext.h +$(OBJ)\quest.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\quest.h $(SRCCC) -$(OBJ)\questpgr.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\qtext.h +$(OBJ)\questpgr.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) $(OBJ)\read.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) @@ -1653,7 +1653,7 @@ $(OBJ)\region.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) $(OBJ)\rect.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) -$(OBJ)\restore.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\lev.h $(INCL)\tcap.h $(INCL)\quest.h +$(OBJ)\restore.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\tcap.h $(INCL)\quest.h $(SRCCC) $(OBJ)\rip.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) @@ -1663,7 +1663,7 @@ $(OBJ)\role.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) $(OBJ)\rumors.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) -$(OBJ)\save.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\lev.h $(INCL)\quest.h +$(OBJ)\save.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\quest.h $(SRCCC) $(OBJ)\shk.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) @@ -1711,9 +1711,9 @@ $(OBJ)\wield.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) $(OBJ)\windows.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) -$(OBJ)\wizard.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\qtext.h +$(OBJ)\wizard.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) -$(OBJ)\worm.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\lev.h +$(OBJ)\worm.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) $(OBJ)\worn.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) diff --git a/sys/share/.gitattributes b/sys/share/.gitattributes index 6169bc89e..271c3c59f 100644 --- a/sys/share/.gitattributes +++ b/sys/share/.gitattributes @@ -5,16 +5,16 @@ dgn_comp.h NH_header=no lev_comp.h NH_header=no Makefile.lib NH_header=no -Makefile.lib NH_filestag=(file%s_for_MSDOS_and_OS/2_versions_-_untested_for_3.6.2) -#termcap.uu NH_filestag=(file%s_for_MSDOS_and_OS/2_versions_-_untested_for_3.6.2) +Makefile.lib NH_filestag=(file%s_for_MSDOS_and_OS/2_versions_-_untested_for_3.6.4) +#termcap.uu NH_filestag=(file%s_for_MSDOS_and_OS/2_versions_-_untested_for_3.6.4) termcap.uu NH_filestag=>Makefile.lib -pcmain.c NH_filestag=(file_for_MSDOS,_OS/2,_Amiga,_and_Atari_versions_-_untested_for_3.6.2) +pcmain.c NH_filestag=(file_for_MSDOS,_OS/2,_Amiga,_and_Atari_versions_-_untested_for_3.6.4) -pcsys.c NH_filestag=(file%s_for_MSDOS,_OS/2_and_Atari_versions_-_untested_for_3.6.2) +pcsys.c NH_filestag=(file%s_for_MSDOS,_OS/2_and_Atari_versions_-_tested_on_MSDOS_for_3.6.4_via_partial_cross-compile_only) pcunix.c NH_filestag=>pcsys.c -NetHack.cnf NH_filestag=(file_for_MSDOS,_OS/2,_and_Atari_versions_-_untested_for_3.6.2) +NetHack.cnf NH_filestag=(file_for_MSDOS,_OS/2,_and_Atari_versions_-_untested_for_3.6.4) pctty.c NH_filestag=>NetHack.cnf ioctl.c NH_filestag=(file%s_for_UNIX_and_Be_versions) diff --git a/sys/share/dgn_comp.h b/sys/share/dgn_comp.h deleted file mode 100644 index 8f3ecfd64..000000000 --- a/sys/share/dgn_comp.h +++ /dev/null @@ -1,27 +0,0 @@ -#define INTEGER 257 -#define A_DUNGEON 258 -#define BRANCH 259 -#define CHBRANCH 260 -#define LEVEL 261 -#define RNDLEVEL 262 -#define CHLEVEL 263 -#define RNDCHLEVEL 264 -#define UP_OR_DOWN 265 -#define PROTOFILE 266 -#define DESCRIPTION 267 -#define DESCRIPTOR 268 -#define LEVELDESC 269 -#define ALIGNMENT 270 -#define LEVALIGN 271 -#define ENTRY 272 -#define STAIR 273 -#define NO_UP 274 -#define NO_DOWN 275 -#define PORTAL 276 -#define STRING 277 -typedef union -{ - int i; - char* str; -} YYSTYPE; -extern YYSTYPE yylval; diff --git a/sys/share/dgn_lex.c b/sys/share/dgn_lex.c deleted file mode 100644 index 752fcd55a..000000000 --- a/sys/share/dgn_lex.c +++ /dev/null @@ -1,2000 +0,0 @@ - -#line 3 "dgn_lex.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex via 'flex -S flexhack.skl' - * where flexhack.skl is a nethack-specific alternate skeleton derived - * from flex 2.6.0's skel.c (which in turn was generated from flex.skl). - * - * Support for C++, re-entrancy, and table serialization stripped out. - * NetHack's usage doesn't need them and we want to reduce the size and - * complexity of this skeleton as well as of the generated scanner code. - */ -#define FLEXHACK_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 0 - -#include "config.h" - -#include - -/* we don't care if actual types happen to have more bits than their names; - the tables will just take up more space, possibly slowing the parse; - still, allow config.h to override these via typedef+#define if desired */ -#ifndef FLEX_INT32_T -typedef int flex_int32_t; -#endif -#ifndef FLEX_INT16_T -typedef short int flex_int16_t; -#endif -#ifndef FLEX_UINT16_T -typedef unsigned short int flex_uint16_t; -#endif - -#define yyconst const - -#define FDECL_dummy /*empty*/ - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (uchar) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#endif - -/* The state buf must be large enough to hold one state per character - * in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -extern yy_size_t yyleng; -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -#define YY_LESS_LINENO(n) -#define YY_LINENO_REWIND_TO(ptr) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg); \ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - -}; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart FDECL(FDECL_dummy, (FILE *input_file )); -void yy_switch_to_buffer FDECL(FDECL_dummy, (YY_BUFFER_STATE new_buffer )); -YY_BUFFER_STATE yy_create_buffer FDECL(FDECL_dummy, (FILE *file,int size )); -void yy_delete_buffer FDECL(FDECL_dummy, (YY_BUFFER_STATE b )); -void yy_flush_buffer FDECL(FDECL_dummy, (YY_BUFFER_STATE b )); -void yypush_buffer_state FDECL(FDECL_dummy, (YY_BUFFER_STATE new_buffer )); -void yypop_buffer_state FDECL(FDECL_dummy, (void )); - -static void yyensure_buffer_stack FDECL(FDECL_dummy, (void )); -static void yy_load_buffer_state FDECL(FDECL_dummy, (void )); -static void yy_init_buffer FDECL(FDECL_dummy, (YY_BUFFER_STATE b,FILE *file )); - -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE yy_scan_buffer FDECL(FDECL_dummy, (char *base,yy_size_t size )); -YY_BUFFER_STATE yy_scan_string FDECL(FDECL_dummy, (yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes FDECL(FDECL_dummy, (yyconst char *bytes,yy_size_t len )); - -void *yyalloc FDECL(FDECL_dummy, (yy_size_t )); -void *yyrealloc FDECL(FDECL_dummy, (void *,yy_size_t )); -void yyfree FDECL(FDECL_dummy, (void * )); - -#define yy_new_buffer yy_create_buffer -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ) { \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ) { \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -typedef unsigned char YY_CHAR; - -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; - -typedef int yy_state_type; - -extern int yylineno; - -int yylineno = 1; - -extern char *yytext; -#ifdef yytext_ptr -#undef yytext_ptr -#endif -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state FDECL(FDECL_dummy, (void )); -static yy_state_type yy_try_NUL_trans FDECL(FDECL_dummy, (yy_state_type current_state )); -static int yy_get_next_buffer FDECL(FDECL_dummy, (void )); -static void yy_fatal_error FDECL(FDECL_dummy, (yyconst char msg[] )) NORETURN; - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 35 -#define YY_END_OF_BUFFER 36 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[196] = - { 0, - 0, 0, 36, 34, 33, 32, 34, 34, 29, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 33, - 32, 0, 30, 29, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 2, 0, 31, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, - 4, 0, 25, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 6, 0, 0, 0, 5, 0, 0, 23, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 20, 0, 0, 0, 0, 8, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, 0, 22, - 15, 0, 21, 7, 19, 0, 0, 0, 0, 0, - 0, 13, 0, 0, 0, 26, 16, 0, 0, 12, - 0, 0, 0, 11, 9, 0, 17, 18, 0, 27, - 0, 28, 24, 10, 0 - - } ; - -static yyconst YY_CHAR yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 5, 6, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 7, 1, 1, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 1, 1, 1, - 1, 1, 1, 1, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 1, 1, 17, 18, 19, 20, 21, - 1, 22, 23, 24, 25, 26, 1, 1, 27, 1, - 1, 1, 1, 1, 28, 1, 29, 1, 30, 31, - - 32, 33, 34, 35, 36, 1, 37, 38, 39, 40, - 41, 42, 1, 43, 44, 45, 46, 1, 47, 1, - 1, 48, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst YY_CHAR yy_meta[49] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1 - } ; - -static yyconst flex_uint16_t yy_base[198] = - { 0, - 0, 213, 218, 220, 215, 220, 213, 210, 207, 196, - 190, 196, 37, 191, 197, 186, 188, 171, 164, 172, - 174, 173, 18, 160, 159, 154, 157, 11, 194, 194, - 220, 190, 220, 187, 177, 184, 183, 167, 170, 164, - 161, 166, 174, 155, 136, 144, 134, 132, 133, 26, - 135, 143, 147, 128, 145, 220, 170, 220, 158, 152, - 154, 159, 154, 145, 44, 142, 47, 124, 124, 125, - 129, 129, 115, 27, 121, 113, 111, 120, 115, 116, - 134, 142, 132, 128, 137, 121, 130, 129, 125, 129, - 131, 97, 220, 105, 94, 101, 95, 96, 94, 99, - - 105, 101, 89, 220, 95, 112, 114, 51, 112, 107, - 220, 110, 114, 111, 106, 96, 85, 76, 81, 82, - 88, 69, 220, 81, 76, 75, 220, 78, 99, 220, - 88, 97, 87, 88, 92, 93, 88, 91, 90, 71, - 65, 220, 62, 60, 57, 56, 220, 59, 54, 74, - 84, 65, 66, 220, 70, 65, 70, 60, 68, 220, - 220, 52, 220, 220, 220, 46, 50, 57, 61, 67, - 62, 220, 67, 64, 63, 220, 220, 42, 41, 220, - 61, 53, 49, 220, 220, 50, 220, 220, 51, 220, - 46, 220, 220, 220, 220, 62, 60 - - } ; - -static yyconst flex_int16_t yy_def[198] = - { 0, - 195, 1, 195, 195, 195, 195, 195, 196, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 197, 195, - 195, 196, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 197, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 0, 195, 195 - - } ; - -static yyconst flex_uint16_t yy_nxt[269] = - { 0, - 4, 5, 6, 7, 8, 4, 9, 10, 11, 12, - 13, 14, 4, 4, 4, 4, 15, 4, 4, 4, - 16, 17, 4, 4, 4, 4, 4, 4, 4, 18, - 19, 4, 4, 4, 20, 4, 4, 21, 22, 23, - 4, 24, 25, 26, 27, 28, 4, 4, 38, 49, - 55, 87, 56, 74, 75, 88, 90, 98, 50, 131, - 57, 39, 32, 91, 194, 193, 192, 132, 191, 190, - 189, 188, 99, 187, 186, 185, 184, 183, 182, 181, - 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, - 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, - - 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, - 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, - 140, 139, 138, 137, 136, 135, 134, 133, 130, 129, - 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, - 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, - 108, 107, 106, 105, 104, 103, 102, 101, 100, 97, - 96, 95, 94, 93, 92, 89, 86, 85, 84, 83, - 82, 81, 58, 80, 79, 78, 77, 76, 73, 72, - 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, - 61, 60, 59, 34, 33, 30, 58, 54, 53, 52, - - 51, 48, 47, 46, 45, 44, 43, 42, 41, 40, - 37, 36, 35, 34, 33, 31, 30, 195, 29, 3, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195 - } ; - -static yyconst flex_int16_t yy_chk[269] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 13, 23, - 28, 65, 28, 50, 50, 65, 67, 74, 23, 108, - 197, 13, 196, 67, 191, 189, 186, 108, 183, 182, - 181, 179, 74, 178, 175, 174, 173, 171, 170, 169, - 168, 167, 166, 162, 159, 158, 157, 156, 155, 153, - 152, 151, 150, 149, 148, 146, 145, 144, 143, 141, - - 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, - 129, 128, 126, 125, 124, 122, 121, 120, 119, 118, - 117, 116, 115, 114, 113, 112, 110, 109, 107, 106, - 105, 103, 102, 101, 100, 99, 98, 97, 96, 95, - 94, 92, 91, 90, 89, 88, 87, 86, 85, 84, - 83, 82, 81, 80, 79, 78, 77, 76, 75, 73, - 72, 71, 70, 69, 68, 66, 64, 63, 62, 61, - 60, 59, 57, 55, 54, 53, 52, 51, 49, 48, - 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, - 37, 36, 35, 34, 32, 30, 29, 27, 26, 25, - - 24, 22, 21, 20, 19, 18, 17, 16, 15, 14, - 12, 11, 10, 9, 8, 7, 5, 3, 2, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 195, 195, 195, 195 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -/* NetHack 3.6 dgn_comp.l $NHDT-Date: 1522193682 2018/03/27 23:34:42 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.20 $ */ -/* Copyright (c) 1989 by Jean-Christophe Collet */ -/* Copyright (c) 1990 by M. Stephenson */ -/* NetHack may be freely redistributed. See license for details. */ - -#define DGN_COMP - -#include "config.h" -#include "dgn_comp.h" -#include "dgn_file.h" - -/* - * Most of these don't exist in flex, yywrap is macro and - * yyunput is properly declared in flex.skel. - */ -#if !defined(FLEX_SCANNER) && !defined(FLEXHACK_SCANNER) -int FDECL(yyback, (int *,int)); -int NDECL(yylook); -int NDECL(yyinput); -int NDECL(yywrap); -int NDECL(yylex); - /* Traditional lexes let yyunput() and yyoutput() default to int; - * newer ones may declare them as void since they don't return - * values. For even more fun, the lex supplied as part of the - * newer unbundled compiler for SunOS 4.x adds the void declarations - * (under __STDC__ or _cplusplus ifdefs -- otherwise they remain - * int) while the bundled lex and the one with the older unbundled - * compiler do not. To detect this, we need help from outside -- - * sys/unix/Makefile.utl. - * - * Digital UNIX is difficult and still has int in spite of all - * other signs. - */ -# if defined(NeXT) || defined(SVR4) || defined(_AIX32) -# define VOIDYYPUT -# endif -# if !defined(VOIDYYPUT) && defined(POSIX_TYPES) -# if !defined(BOS) && !defined(HISX) && !defined(_M_UNIX) && !defined(VMS) -# define VOIDYYPUT -# endif -# endif -# if !defined(VOIDYYPUT) && defined(WEIRD_LEX) -# if defined(SUNOS4) && defined(__STDC__) && (WEIRD_LEX > 1) -# define VOIDYYPUT -# endif -# endif -# if defined(VOIDYYPUT) && defined(__osf__) -# undef VOIDYYPUT -# endif -# ifdef VOIDYYPUT -void FDECL(yyunput, (int)); -void FDECL(yyoutput, (int)); -# else -int FDECL(yyunput, (int)); -int FDECL(yyoutput, (int)); -# endif - -#else /* !FLEX_SCANNER && !FLEXHACK_SCANNER */ -/* most recent flex allows suppressing yyunput() altogether when not needed */ -#define YY_NO_UNPUT -#define YY_NO_INPUT -#endif - -#if defined(FLEX_SCANNER) || defined(FLEXHACK_SCANNER) -/* older flex wants this */ -#define YY_MALLOC_DECL genericptr_t FDECL(malloc, (size_t)); \ - genericptr_t FDECL(realloc, (genericptr_t, size_t)); -/* newer flex assumes so needs this in case it's been suppressed */ -YY_MALLOC_DECL -#endif - -void FDECL(init_yyin, (FILE *)); -void FDECL(init_yyout, (FILE *)); - -/* this doesn't always get put in dgn_comp.h - * (esp. when using older versions of bison) - */ -extern YYSTYPE yylval; - -int nh_line_number = 1; - -#define INITIAL 0 - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int yylex_destroy FDECL(FDECL_dummy, (void )); -int yyget_debug FDECL(FDECL_dummy, (void )); -void yyset_debug FDECL(FDECL_dummy, (int debug_flag )); -YY_EXTRA_TYPE yyget_extra FDECL(FDECL_dummy, (void )); -void yyset_extra FDECL(FDECL_dummy, (YY_EXTRA_TYPE user_defined )); -FILE *yyget_in FDECL(FDECL_dummy, (void )); -void yyset_in FDECL(FDECL_dummy, (FILE * _in_str )); -FILE *yyget_out FDECL(FDECL_dummy, (void )); -void yyset_out FDECL(FDECL_dummy, (FILE * _out_str )); -yy_size_t yyget_leng FDECL(FDECL_dummy, (void )); -char *yyget_text FDECL(FDECL_dummy, (void )); -int yyget_lineno FDECL(FDECL_dummy, (void )); -void yyset_lineno FDECL(FDECL_dummy, (int _line_number )); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -extern int yywrap FDECL(FDECL_dummy, (void )); -#endif - -#ifndef YY_NO_UNPUT - -void yyunput FDECL(FDECL_dummy, (int c,char *buf_ptr )); -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy FDECL(FDECL_dummy, (char *,yyconst char *,int )); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen FDECL(FDECL_dummy, (yyconst char * )); -#endif - -#ifndef YY_NO_INPUT - -static int input FDECL(FDECL_dummy, (void )); - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else -#define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex FDECL(FDECL_dummy, (void)); - -#define YY_DECL int yylex () -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK /*LINTED*/break; -#endif - -#define YY_RULE_SETUP \ - if ( yyleng > 0 ) \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ - (yytext[yyleng - 1] == '\n'); \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_load_buffer_state( ); - } - - { - - while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); - yy_current_state += YY_AT_BOL(); -yy_match: - do - { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 196 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 220 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -YY_RULE_SETUP -return(A_DUNGEON); - YY_BREAK -case 2: -YY_RULE_SETUP -{ yylval.i=1; return(UP_OR_DOWN); } - YY_BREAK -case 3: -YY_RULE_SETUP -{ yylval.i=0; return(UP_OR_DOWN); } - YY_BREAK -case 4: -YY_RULE_SETUP -return(ENTRY); - YY_BREAK -case 5: -YY_RULE_SETUP -return(STAIR); - YY_BREAK -case 6: -YY_RULE_SETUP -return(NO_UP); - YY_BREAK -case 7: -YY_RULE_SETUP -return(NO_DOWN); - YY_BREAK -case 8: -YY_RULE_SETUP -return(PORTAL); - YY_BREAK -case 9: -YY_RULE_SETUP -return(PROTOFILE); - YY_BREAK -case 10: -YY_RULE_SETUP -return(DESCRIPTION); - YY_BREAK -case 11: -YY_RULE_SETUP -return(LEVELDESC); - YY_BREAK -case 12: -YY_RULE_SETUP -return(ALIGNMENT); - YY_BREAK -case 13: -YY_RULE_SETUP -return(LEVALIGN); - YY_BREAK -case 14: -YY_RULE_SETUP -{ yylval.i=TOWN ; return(DESCRIPTOR); } - YY_BREAK -case 15: -YY_RULE_SETUP -{ yylval.i=HELLISH ; return(DESCRIPTOR); } - YY_BREAK -case 16: -YY_RULE_SETUP -{ yylval.i=MAZELIKE ; return(DESCRIPTOR); } - YY_BREAK -case 17: -YY_RULE_SETUP -{ yylval.i=ROGUELIKE ; return(DESCRIPTOR); } - YY_BREAK -case 18: -YY_RULE_SETUP -{ yylval.i=D_ALIGN_NONE ; return(DESCRIPTOR); } - YY_BREAK -case 19: -YY_RULE_SETUP -{ yylval.i=D_ALIGN_NONE ; return(DESCRIPTOR); } - YY_BREAK -case 20: -YY_RULE_SETUP -{ yylval.i=D_ALIGN_LAWFUL ; return(DESCRIPTOR); } - YY_BREAK -case 21: -YY_RULE_SETUP -{ yylval.i=D_ALIGN_NEUTRAL ; return(DESCRIPTOR); } - YY_BREAK -case 22: -YY_RULE_SETUP -{ yylval.i=D_ALIGN_CHAOTIC ; return(DESCRIPTOR); } - YY_BREAK -case 23: -YY_RULE_SETUP -return(BRANCH); - YY_BREAK -case 24: -YY_RULE_SETUP -return(CHBRANCH); - YY_BREAK -case 25: -YY_RULE_SETUP -return(LEVEL); - YY_BREAK -case 26: -YY_RULE_SETUP -return(RNDLEVEL); - YY_BREAK -case 27: -YY_RULE_SETUP -return(CHLEVEL); - YY_BREAK -case 28: -YY_RULE_SETUP -return(RNDCHLEVEL); - YY_BREAK -case 29: -YY_RULE_SETUP -{ yylval.i=atoi(yytext); return(INTEGER); } - YY_BREAK -case 30: -/* rule 30 can match eol */ -YY_RULE_SETUP -{ yytext[yyleng - 1] = '\0'; /* discard the trailing \" */ - yylval.str = dupstr(yytext + 1); /* skip the first \" */ - return STRING; } - YY_BREAK -case 31: -/* rule 31 can match eol */ -YY_RULE_SETUP -{ nh_line_number++; } - YY_BREAK -case 32: -/* rule 32 can match eol */ -YY_RULE_SETUP -{ nh_line_number++; } - YY_BREAK -case 33: -YY_RULE_SETUP -; /* skip trailing tabs & spaces */ - YY_BREAK -case 34: -YY_RULE_SETUP -{ return yytext[0]; } - YY_BREAK -case 35: -YY_RULE_SETUP -ECHO; - YY_BREAK -case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of user's declarations */ -} /* end of yylex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer () -{ - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = (yytext_ptr); - yy_size_t number_to_move, i; - int ret_val; - - if ((yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1]) - YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed"); - - if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0) { - /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } else { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for (i = 0; i < number_to_move; ++i) - *(dest++) = *(source++); - - if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING) { - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - } else { - yy_size_t num_to_read; - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; - - /* [pr] This could probably be (b->yy_buf_size < number_to_move) - * since the allocated size is actually b->yy_buf_size + 2. - * The old code calculated num_to_read above (with same formula - * as is used below), then used (num_to_read <= 0) here, which - * got broken when num_to_read was changed to an unsigned type. */ - while (b->yy_buf_size <= number_to_move + 1) { - /* Not enough room in the buffer - grow it. */ - - int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) { - b->yy_buf_size += b->yy_buf_size / 4; - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if (! b->yy_ch_buf) - YY_FATAL_ERROR("fatal error - scanner input buffer overflow"); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - } - - num_to_read = b->yy_buf_size - number_to_move - 1; - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ((yy_n_chars) == 0) { - if (number_to_move == YY_MORE_ADJ) { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); - } else { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; - } - } else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) - > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) - yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if (! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) - YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()"); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before EOB char was reached */ - -static yy_state_type yy_get_previous_state () -{ - yy_state_type yy_current_state; - char *yy_cp; - - yy_current_state = (yy_start); - yy_current_state += YY_AT_BOL(); - - for (yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp) { - - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 196 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -static yy_state_type yy_try_NUL_trans (yy_current_state ) - yy_state_type yy_current_state; -{ - int yy_is_jam; - char *yy_cp = (yy_c_buf_p); - - YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 196 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 195); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_UNPUT - -void yyunput (c,yy_bp ) - int c; - char * yy_bp; -{ - char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - yy_size_t number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#endif - -#ifndef YY_NO_INPUT -static int input () -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart(yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - return input(); - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(uchar *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); - - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - -void yyrestart (input_file ) - FILE * input_file; -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ -void yy_switch_to_buffer (new_buffer ) - YY_BUFFER_STATE new_buffer; -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void yy_load_buffer_state () -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ -YY_BUFFER_STATE yy_create_buffer (file,size ) - FILE * file; - int size; -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - if (!size) - size = YY_BUF_SIZE; - - b->yy_buf_size = (yy_size_t)size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ -void yy_delete_buffer (b ) - YY_BUFFER_STATE b; -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); - - yyfree((void *) b ); -} - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ -static void yy_init_buffer (b,file ) - YY_BUFFER_STATE b; - FILE * file; -{ - int oerrno = errno; - - yy_flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ -void yy_flush_buffer (b ) - YY_BUFFER_STATE b; -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yypush_buffer_state (new_buffer ) - YY_BUFFER_STATE new_buffer; -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yypop_buffer_state () -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack () -{ - yy_size_t num_to_alloc; - - if (!(yy_buffer_stack)) { - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ -#if 1 /* [PR] avoid C++-style comment; older C compilers choke on it */ - num_to_alloc = 2; /* also changed to match the comment... */ -#else - num_to_alloc = 1; // After all that talk, this was set to 1 anyways... -#endif - (yy_buffer_stack) = (struct yy_buffer_state**) - yyalloc(num_to_alloc * sizeof(struct yy_buffer_state*) ); - if (!(yy_buffer_stack)) - YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()"); - - (void) memset((yy_buffer_stack), 0, - num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1) { - /* Increase the buffer to prepare for a possible push. */ - yy_size_t grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**) - yyrealloc((yy_buffer_stack),num_to_alloc * sizeof(struct yy_buffer_state*) ); - if (!(yy_buffer_stack)) - YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()"); - - /* zero only the new slots.*/ - (void) memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, - grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified - * character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (base,size ) - char * base; - yy_size_t size; -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer(b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to yylex() - * will scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (yystr ) - yyconst char * yystr; -{ - - return yy_scan_bytes(yystr,strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to - * yylex() will scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a - * bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (yybytes,_yybytes_len ) - yyconst char * yybytes; - yy_size_t _yybytes_len; -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - yy_size_t i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (msg ) - yyconst char* msg; -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg); \ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int yyget_lineno () -{ - - return yylineno; -} - -/** Get the input stream. - * - */ -FILE *yyget_in () -{ - return yyin; -} - -/** Get the output stream. - * - */ -FILE *yyget_out () -{ - return yyout; -} - -/** Get the length of the current token. - * - */ -yy_size_t yyget_leng () -{ - return yyleng; -} - -/** Get the current token. - * - */ - -char *yyget_text () -{ - return yytext; -} - -/** Set the current line number. - * @param _line_number line number - * - */ -void yyset_lineno (_line_number ) - int _line_number; -{ - - yylineno = _line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param _in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void yyset_in (_in_str ) - FILE * _in_str; -{ - yyin = _in_str ; -} - -void yyset_out (_out_str ) - FILE * _out_str; -{ - yyout = _out_str ; -} - -int yyget_debug () -{ - return yy_flex_debug; -} - -void yyset_debug (_bdebug ) - int _bdebug; -{ - yy_flex_debug = _bdebug ; -} - -static int yy_init_globals () -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = (FILE *) 0; - yyout = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy () -{ - - /* Pop the buffer stack, destroying each element. */ - while (YY_CURRENT_BUFFER) { - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner - * so the next time yylex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (s1,s2,n ) - char* s1; - yyconst char * s2; - int n; -{ - - int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (s ) - yyconst char * s; -{ - int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *yyalloc (size ) - yy_size_t size; -{ - - return (void *) malloc( size ); -} - -void *yyrealloc (ptr,size ) - void * ptr; - yy_size_t size; -{ - - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void yyfree (ptr ) - void * ptr; -{ - - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -/* routine to switch to another input file; needed for flex */ -void -init_yyin( input_f ) -FILE *input_f; -{ -#if defined(FLEX_SCANNER) || defined(FLEXHACK_SCANNER) - if (yyin) - yyrestart(input_f); - else -#endif - yyin = input_f; -} - -/* analogous routine (for completeness) */ -void -init_yyout( output_f ) -FILE *output_f; -{ - yyout = output_f; -} - -/*dgn_comp.l*/ - diff --git a/sys/share/dgn_yacc.c b/sys/share/dgn_yacc.c deleted file mode 100644 index 742a7b1a7..000000000 --- a/sys/share/dgn_yacc.c +++ /dev/null @@ -1,1053 +0,0 @@ -#ifndef lint -/* static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; */ -/* static char nhsccsid[] = "@(#)yaccpar 1.9.0-nh (NetHack) 12/03/2015"; */ -#endif -#define YYBYACC 1 -#define YYMAJOR 1 -#define YYMINOR 9 -#define YYSUBMINOR "0-nh" - -#define yyclearin (yychar=(-1)) -#define yyerrok (yyerrflag=0) -#define YYRECOVERING (yyerrflag!=0) -#define YYPREFIX "yy" -/* NetHack 3.6 dgn_comp.y $NHDT-Date: 1551901399 2019/03/06 19:43:19 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.15 $ */ -/* Copyright (c) 1989 by Jean-Christophe Collet */ -/* Copyright (c) 1990 by M. Stephenson */ -/* NetHack may be freely redistributed. See license for details. */ - -/* - * This file contains the Dungeon Compiler code - */ - -/* In case we're using bison in AIX. This definition must be - * placed before any other C-language construct in the file - * excluding comments and preprocessor directives (thanks IBM - * for this wonderful feature...). - * - * Note: some cpps barf on this 'undefined control' (#pragma). - * Addition of the leading space seems to prevent barfage for now, - * and AIX will still see the directive in its non-standard locale. - */ - -#ifdef _AIX - #pragma alloca /* keep leading space! */ -#endif - -#include "config.h" -#include "date.h" -#include "dgn_file.h" - -void FDECL(yyerror, (const char *)); -void FDECL(yywarning, (const char *)); -int NDECL(yylex); -int NDECL(yyparse); -int FDECL(getchain, (char *)); -int NDECL(check_dungeon); -int NDECL(check_branch); -int NDECL(check_level); -void NDECL(init_dungeon); -void NDECL(init_branch); -void NDECL(init_level); -void NDECL(output_dgn); - -#define Free(ptr) free((genericptr_t)ptr) - -#ifdef AMIGA -# undef printf -#ifndef LATTICE -# define memset(addr,val,len) setmem(addr,len,val) -#endif -#endif - -#define ERR (-1) - -static struct couple couple; -static struct tmpdungeon tmpdungeon[MAXDUNGEON]; -static struct tmplevel tmplevel[LEV_LIMIT]; -static struct tmpbranch tmpbranch[BRANCH_LIMIT]; - -static int in_dungeon = 0, n_dgns = -1, n_levs = -1, n_brs = -1; - -extern int fatal_error; -extern const char *fname; -extern FILE *yyin, *yyout; /* from dgn_lex.c */ - -typedef union -{ - int i; - char* str; -} YYSTYPE; -#define INTEGER 257 -#define A_DUNGEON 258 -#define BRANCH 259 -#define CHBRANCH 260 -#define LEVEL 261 -#define RNDLEVEL 262 -#define CHLEVEL 263 -#define RNDCHLEVEL 264 -#define UP_OR_DOWN 265 -#define PROTOFILE 266 -#define DESCRIPTION 267 -#define DESCRIPTOR 268 -#define LEVELDESC 269 -#define ALIGNMENT 270 -#define LEVALIGN 271 -#define ENTRY 272 -#define STAIR 273 -#define NO_UP 274 -#define NO_DOWN 275 -#define PORTAL 276 -#define STRING 277 -#define YYERRCODE 256 -short yylhs[] = { -1, - 0, 0, 5, 5, 6, 6, 6, 6, 7, 1, - 1, 8, 8, 8, 12, 13, 15, 15, 14, 10, - 10, 10, 10, 10, 16, 16, 17, 17, 18, 18, - 19, 19, 20, 20, 9, 9, 22, 23, 3, 3, - 3, 3, 3, 2, 2, 4, 21, 11, -}; -short yylen[] = { 2, - 0, 1, 1, 2, 1, 1, 1, 1, 6, 0, - 1, 1, 1, 1, 3, 1, 3, 3, 3, 1, - 1, 1, 1, 1, 6, 7, 7, 8, 3, 3, - 7, 8, 8, 9, 1, 1, 7, 8, 0, 1, - 1, 1, 1, 0, 1, 1, 5, 5, -}; -short yydefred[] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 3, 5, 6, 7, 8, - 12, 13, 14, 16, 20, 21, 22, 23, 24, 35, - 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, - 0, 0, 19, 17, 29, 18, 30, 15, 46, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 11, 9, 0, 40, - 41, 42, 43, 0, 0, 0, 0, 0, 0, 0, - 0, 45, 37, 0, 27, 0, 0, 0, 0, 0, - 38, 28, 33, 0, 48, 47, 34, -}; -short yydgoto[] = { 14, - 78, 93, 84, 60, 15, 16, 17, 18, 19, 20, - 68, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 70, 30, 31, -}; -short yysindex[] = { -237, - -46, -45, -44, -39, -38, -30, -22, -21, -20, -19, - -18, -17, -16, 0, -237, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -262, -234, -233, -232, -230, -229, -228, -227, -217, - -216, -215, -214, -202, 0, -221, -7, -219, -221, -221, - -221, -221, 0, 0, 0, 0, 0, 0, 0, 19, - 20, 21, -2, -1, -212, -211, -190, -189, -188, -271, - 19, 20, 20, 27, 28, 29, 0, 0, 30, 0, - 0, 0, 0, -193, -271, -182, -180, 19, 19, -179, - -178, 0, 0, -193, 0, -177, -176, -175, 42, 43, - 0, 0, 0, -172, 0, 0, 0, -}; -short yyrindex[] = { 86, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 87, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 16, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 31, 1, 46, 0, 0, 0, 0, - 0, 0, 0, 31, 0, 61, 76, 0, 0, 0, - 0, 0, 0, 91, 0, 0, 0, -}; -short yygindex[] = { 0, - 0, -6, 4, -43, 0, 75, 0, 0, 0, 0, - -71, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -62, 0, 0, -}; -#define YYTABLESIZE 363 -short yytable[] = { 85, - 39, 80, 81, 82, 83, 63, 64, 65, 66, 86, - 87, 32, 33, 34, 46, 10, 97, 98, 35, 36, - 1, 2, 3, 4, 5, 6, 7, 37, 8, 9, - 44, 10, 11, 12, 13, 38, 39, 40, 41, 42, - 43, 44, 47, 48, 49, 25, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 61, 62, 67, 69, - 26, 72, 73, 71, 74, 75, 76, 77, 79, 88, - 89, 92, 90, 91, 95, 31, 96, 99, 100, 102, - 103, 104, 105, 106, 107, 1, 2, 101, 94, 45, - 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 0, 39, - 39, 39, 39, 10, 10, 10, 10, 10, 10, 10, - 0, 10, 10, 0, 10, 10, 10, 10, 44, 44, - 44, 44, 44, 44, 44, 0, 44, 44, 0, 44, - 44, 44, 44, 25, 25, 25, 25, 25, 25, 25, - 0, 25, 25, 0, 25, 25, 25, 25, 26, 26, - 26, 26, 26, 26, 26, 0, 26, 26, 0, 26, - 26, 26, 26, 31, 31, 31, 31, 31, 31, 31, - 0, 31, 31, 0, 31, 31, 31, 31, 32, 32, - 32, 32, 32, 32, 32, 0, 32, 32, 0, 32, - 32, 32, 32, -}; -short yycheck[] = { 71, - 0, 273, 274, 275, 276, 49, 50, 51, 52, 72, - 73, 58, 58, 58, 277, 0, 88, 89, 58, 58, - 258, 259, 260, 261, 262, 263, 264, 58, 266, 267, - 0, 269, 270, 271, 272, 58, 58, 58, 58, 58, - 58, 58, 277, 277, 277, 0, 277, 277, 277, 277, - 268, 268, 268, 268, 257, 277, 64, 277, 40, 40, - 0, 64, 64, 43, 277, 277, 257, 257, 257, 43, - 43, 265, 44, 44, 257, 0, 257, 257, 257, 257, - 257, 257, 41, 41, 257, 0, 0, 94, 85, 15, - 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, -1, 269, - 270, 271, 272, 258, 259, 260, 261, 262, 263, 264, - -1, 266, 267, -1, 269, 270, 271, 272, 258, 259, - 260, 261, 262, 263, 264, -1, 266, 267, -1, 269, - 270, 271, 272, 258, 259, 260, 261, 262, 263, 264, - -1, 266, 267, -1, 269, 270, 271, 272, 258, 259, - 260, 261, 262, 263, 264, -1, 266, 267, -1, 269, - 270, 271, 272, 258, 259, 260, 261, 262, 263, 264, - -1, 266, 267, -1, 269, 270, 271, 272, 258, 259, - 260, 261, 262, 263, 264, -1, 266, 267, -1, 269, - 270, 271, 272, -}; -#define YYFINAL 14 -#ifndef YYDEBUG -#define YYDEBUG 0 -#endif -#define YYMAXTOKEN 277 -#if YYDEBUG -char *yyname[] = { -"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,"'('","')'",0,"'+'","','",0,0,0,0,0,0,0,0,0,0,0,0,0,"':'",0,0,0,0,0, -"'@'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"INTEGER", -"A_DUNGEON","BRANCH","CHBRANCH","LEVEL","RNDLEVEL","CHLEVEL","RNDCHLEVEL", -"UP_OR_DOWN","PROTOFILE","DESCRIPTION","DESCRIPTOR","LEVELDESC","ALIGNMENT", -"LEVALIGN","ENTRY","STAIR","NO_UP","NO_DOWN","PORTAL","STRING", -}; -char *yyrule[] = { -"$accept : file", -"file :", -"file : dungeons", -"dungeons : dungeon", -"dungeons : dungeons dungeon", -"dungeon : dungeonline", -"dungeon : dungeondesc", -"dungeon : branches", -"dungeon : levels", -"dungeonline : A_DUNGEON ':' STRING bones_tag rcouple optional_int", -"optional_int :", -"optional_int : INTEGER", -"dungeondesc : entry", -"dungeondesc : descriptions", -"dungeondesc : prototype", -"entry : ENTRY ':' INTEGER", -"descriptions : desc", -"desc : DESCRIPTION ':' DESCRIPTOR", -"desc : ALIGNMENT ':' DESCRIPTOR", -"prototype : PROTOFILE ':' STRING", -"levels : level1", -"levels : level2", -"levels : levdesc", -"levels : chlevel1", -"levels : chlevel2", -"level1 : LEVEL ':' STRING bones_tag '@' acouple", -"level1 : RNDLEVEL ':' STRING bones_tag '@' acouple INTEGER", -"level2 : LEVEL ':' STRING bones_tag '@' acouple INTEGER", -"level2 : RNDLEVEL ':' STRING bones_tag '@' acouple INTEGER INTEGER", -"levdesc : LEVELDESC ':' DESCRIPTOR", -"levdesc : LEVALIGN ':' DESCRIPTOR", -"chlevel1 : CHLEVEL ':' STRING bones_tag STRING '+' rcouple", -"chlevel1 : RNDCHLEVEL ':' STRING bones_tag STRING '+' rcouple INTEGER", -"chlevel2 : CHLEVEL ':' STRING bones_tag STRING '+' rcouple INTEGER", -"chlevel2 : RNDCHLEVEL ':' STRING bones_tag STRING '+' rcouple INTEGER INTEGER", -"branches : branch", -"branches : chbranch", -"branch : BRANCH ':' STRING '@' acouple branch_type direction", -"chbranch : CHBRANCH ':' STRING STRING '+' rcouple branch_type direction", -"branch_type :", -"branch_type : STAIR", -"branch_type : NO_UP", -"branch_type : NO_DOWN", -"branch_type : PORTAL", -"direction :", -"direction : UP_OR_DOWN", -"bones_tag : STRING", -"acouple : '(' INTEGER ',' INTEGER ')'", -"rcouple : '(' INTEGER ',' INTEGER ')'", -}; -#endif -#ifdef YYSTACKSIZE -#undef YYMAXDEPTH -#define YYMAXDEPTH YYSTACKSIZE -#else -#ifdef YYMAXDEPTH -#define YYSTACKSIZE YYMAXDEPTH -#else -#define YYSTACKSIZE 500 -#define YYMAXDEPTH 500 -#endif -#endif -int yydebug; -int yynerrs; -int yyerrflag; -int yychar; -short *yyssp; -YYSTYPE *yyvsp; -YYSTYPE yyval; -YYSTYPE yylval; -short yyss[YYSTACKSIZE]; -YYSTYPE yyvs[YYSTACKSIZE]; -#define yystacksize YYSTACKSIZE - -void -init_dungeon() -{ - if(++n_dgns > MAXDUNGEON) { - (void) fprintf(stderr, "FATAL - Too many dungeons (limit: %d).\n", - MAXDUNGEON); - (void) fprintf(stderr, "To increase the limit edit MAXDUNGEON in global.h\n"); - exit(EXIT_FAILURE); - } - - in_dungeon = 1; - tmpdungeon[n_dgns].lev.base = 0; - tmpdungeon[n_dgns].lev.rand = 0; - tmpdungeon[n_dgns].chance = 100; - Strcpy(tmpdungeon[n_dgns].name, ""); - Strcpy(tmpdungeon[n_dgns].protoname, ""); - tmpdungeon[n_dgns].flags = 0; - tmpdungeon[n_dgns].levels = 0; - tmpdungeon[n_dgns].branches = 0; - tmpdungeon[n_dgns].entry_lev = 0; -} - -void -init_level() -{ - if(++n_levs > LEV_LIMIT) { - - yyerror("FATAL - Too many special levels defined."); - exit(EXIT_FAILURE); - } - tmplevel[n_levs].lev.base = 0; - tmplevel[n_levs].lev.rand = 0; - tmplevel[n_levs].chance = 100; - tmplevel[n_levs].rndlevs = 0; - tmplevel[n_levs].flags = 0; - Strcpy(tmplevel[n_levs].name, ""); - tmplevel[n_levs].chain = -1; -} - -void -init_branch() -{ - if(++n_brs > BRANCH_LIMIT) { - - yyerror("FATAL - Too many special levels defined."); - exit(EXIT_FAILURE); - } - tmpbranch[n_brs].lev.base = 0; - tmpbranch[n_brs].lev.rand = 0; - Strcpy(tmpbranch[n_brs].name, ""); - tmpbranch[n_brs].chain = -1; -} - -int -getchain(s) - char *s; -{ - int i; - - if(strlen(s)) { - - for(i = n_levs - tmpdungeon[n_dgns].levels + 1; i <= n_levs; i++) - if(!strcmp(tmplevel[i].name, s)) return i; - - yyerror("Can't locate the specified chain level."); - return(-2); - } - return(-1); -} - -/* - * Consistancy checking routines: - * - * - A dungeon must have a unique name. - * - A dungeon must have a originating "branch" command - * (except, of course, for the first dungeon). - * - A dungeon must have a proper depth (at least (1, 0)). - */ - -int -check_dungeon() -{ - int i; - - for(i = 0; i < n_dgns; i++) - if(!strcmp(tmpdungeon[i].name, tmpdungeon[n_dgns].name)) { - yyerror("Duplicate dungeon name."); - return(0); - } - - if(n_dgns) - for(i = 0; i < n_brs - tmpdungeon[n_dgns].branches; i++) { - if(!strcmp(tmpbranch[i].name, tmpdungeon[n_dgns].name)) break; - - if(i >= n_brs - tmpdungeon[n_dgns].branches) { - yyerror("Dungeon cannot be reached."); - return(0); - } - } - - if(tmpdungeon[n_dgns].lev.base <= 0 || - tmpdungeon[n_dgns].lev.rand < 0) { - yyerror("Invalid dungeon depth specified."); - return(0); - } - return(1); /* OK */ -} - -/* - * - A level must have a unique level name. - * - If chained, the level used as reference for the chain - * must be in this dungeon, must be previously defined, and - * the level chained from must be "non-probabilistic" (ie. - * have a 100% chance of existing). - */ - -int -check_level() -{ - int i; - - if(!in_dungeon) { - yyerror("Level defined outside of dungeon."); - return(0); - } - - for(i = 0; i < n_levs; i++) - if(!strcmp(tmplevel[i].name, tmplevel[n_levs].name)) { - yyerror("Duplicate level name."); - return(0); - } - - if(tmplevel[i].chain == -2) { - yyerror("Invaild level chain reference."); - return(0); - } else if(tmplevel[i].chain != -1) { /* there is a chain */ - /* KMH -- tmplevel[tmpbranch[i].chain].chance was in error */ - if(tmplevel[tmplevel[i].chain].chance != 100) { - yyerror("Level cannot chain from a probabilistic level."); - return(0); - } else if(tmplevel[i].chain == n_levs) { - yyerror("A level cannot chain to itself!"); - return(0); - } - } - return(1); /* OK */ -} - -/* - * - A branch may not branch backwards - to avoid branch loops. - * - A branch name must be unique. - * (ie. You can only have one entry point to each dungeon). - * - If chained, the level used as reference for the chain - * must be in this dungeon, must be previously defined, and - * the level chained from must be "non-probabilistic" (ie. - * have a 100% chance of existing). - */ - -int -check_branch() -{ - int i; - - if(!in_dungeon) { - yyerror("Branch defined outside of dungeon."); - return(0); - } - - for(i = 0; i < n_dgns; i++) - if(!strcmp(tmpdungeon[i].name, tmpbranch[n_brs].name)) { - - yyerror("Reverse branching not allowed."); - return(0); - } - - if(tmpbranch[i].chain == -2) { - - yyerror("Invaild branch chain reference."); - return(0); - } else if(tmpbranch[i].chain != -1) { /* it is chained */ - - if(tmplevel[tmpbranch[i].chain].chance != 100) { - yyerror("Branch cannot chain from a probabilistic level."); - return(0); - } - } - return(1); /* OK */ -} - -/* - * Output the dungon definition into a file. - * - * The file will have the following format: - * - * [ nethack version ID ] - * [ number of dungeons ] - * [ first dungeon struct ] - * [ levels for the first dungeon ] - * ... - * [ branches for the first dungeon ] - * ... - * [ second dungeon struct ] - * ... - */ - -void -output_dgn() -{ - int nd, cl = 0, nl = 0, - cb = 0, nb = 0; - static struct version_info version_data = { - VERSION_NUMBER, VERSION_FEATURES, - VERSION_SANITY1, VERSION_SANITY2, VERSION_SANITY3 - }; - - if(++n_dgns <= 0) { - yyerror("FATAL - no dungeons were defined."); - exit(EXIT_FAILURE); - } - - if (fwrite((char *)&version_data, sizeof version_data, 1, yyout) != 1) { - yyerror("FATAL - output failure."); - exit(EXIT_FAILURE); - } - - (void) fwrite((char *)&n_dgns, sizeof(int), 1, yyout); - for (nd = 0; nd < n_dgns; nd++) { - (void) fwrite((char *)&tmpdungeon[nd], sizeof(struct tmpdungeon), - 1, yyout); - - nl += tmpdungeon[nd].levels; - for(; cl < nl; cl++) - (void) fwrite((char *)&tmplevel[cl], sizeof(struct tmplevel), - 1, yyout); - - nb += tmpdungeon[nd].branches; - for(; cb < nb; cb++) - (void) fwrite((char *)&tmpbranch[cb], sizeof(struct tmpbranch), - 1, yyout); - } - /* apparently necessary for Think C 5.x, otherwise harmless */ - (void) fflush(yyout); -} - -/*dgn_comp.y*/ -#define YYABORT goto yyabort -#define YYREJECT goto yyabort -#define YYACCEPT goto yyaccept -#define YYERROR goto yyerrlab -int -yyparse() -{ - register int yym, yyn, yystate; -#if YYDEBUG - register char *yys; - extern char *getenv(); - - if ((yys = getenv("YYDEBUG")) != 0) - { - yyn = *yys; - if (yyn >= '0' && yyn <= '9') - yydebug = yyn - '0'; - } -#endif - - yynerrs = 0; - yyerrflag = 0; - yychar = (-1); - - yyssp = yyss; - yyvsp = yyvs; - *yyssp = yystate = 0; - -yyloop: - if ((yyn = yydefred[yystate]) != 0) goto yyreduce; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, yystate, yychar, yys); - } -#endif - } - if ((yyn = yysindex[yystate]) != 0 && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, shifting to state %d\n", - YYPREFIX, yystate, yytable[yyn]); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - yychar = (-1); - if (yyerrflag > 0) --yyerrflag; - goto yyloop; - } - if ((yyn = yyrindex[yystate]) != 0 && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { - yyn = yytable[yyn]; - goto yyreduce; - } - if (yyerrflag) goto yyinrecovery; - goto yynewerror; -yynewerror: - yyerror("syntax error"); - goto yyerrlab; -yyerrlab: - ++yynerrs; -yyinrecovery: - if (yyerrflag < 3) - { - yyerrflag = 3; - for (;;) - { - if ((yyn = yysindex[*yyssp]) != 0 && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, error recovery shifting\ - to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - goto yyloop; - } - else - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: error recovery discarding state %d\n", - YYPREFIX, *yyssp); -#endif - if (yyssp <= yyss) goto yyabort; - --yyssp; - --yyvsp; - } - } - } - else - { - if (yychar == 0) goto yyabort; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, error recovery discards token %d (%s)\n", - YYPREFIX, yystate, yychar, yys); - } -#endif - yychar = (-1); - goto yyloop; - } -yyreduce: -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, reducing by rule %d (%s)\n", - YYPREFIX, yystate, yyn, yyrule[yyn]); -#endif - yym = yylen[yyn]; - yyval = yyvsp[1-yym]; - switch (yyn) - { -case 2: -{ - output_dgn(); - } -break; -case 9: -{ - init_dungeon(); - Strcpy(tmpdungeon[n_dgns].name, yyvsp[-3].str); - tmpdungeon[n_dgns].boneschar = (char)yyvsp[-2].i; - tmpdungeon[n_dgns].lev.base = couple.base; - tmpdungeon[n_dgns].lev.rand = couple.rand; - tmpdungeon[n_dgns].chance = yyvsp[0].i; - Free(yyvsp[-3].str); - } -break; -case 10: -{ - yyval.i = 0; - } -break; -case 11: -{ - yyval.i = yyvsp[0].i; - } -break; -case 15: -{ - tmpdungeon[n_dgns].entry_lev = yyvsp[0].i; - } -break; -case 17: -{ - if(yyvsp[0].i <= TOWN || yyvsp[0].i >= D_ALIGN_CHAOTIC) - yyerror("Illegal description - ignoring!"); - else - tmpdungeon[n_dgns].flags |= yyvsp[0].i ; - } -break; -case 18: -{ - if(yyvsp[0].i && yyvsp[0].i < D_ALIGN_CHAOTIC) - yyerror("Illegal alignment - ignoring!"); - else - tmpdungeon[n_dgns].flags |= yyvsp[0].i ; - } -break; -case 19: -{ - Strcpy(tmpdungeon[n_dgns].protoname, yyvsp[0].str); - Free(yyvsp[0].str); - } -break; -case 25: -{ - init_level(); - Strcpy(tmplevel[n_levs].name, yyvsp[-3].str); - tmplevel[n_levs].boneschar = (char)yyvsp[-2].i; - tmplevel[n_levs].lev.base = couple.base; - tmplevel[n_levs].lev.rand = couple.rand; - tmpdungeon[n_dgns].levels++; - Free(yyvsp[-3].str); - } -break; -case 26: -{ - init_level(); - Strcpy(tmplevel[n_levs].name, yyvsp[-4].str); - tmplevel[n_levs].boneschar = (char)yyvsp[-3].i; - tmplevel[n_levs].lev.base = couple.base; - tmplevel[n_levs].lev.rand = couple.rand; - tmplevel[n_levs].rndlevs = yyvsp[0].i; - tmpdungeon[n_dgns].levels++; - Free(yyvsp[-4].str); - } -break; -case 27: -{ - init_level(); - Strcpy(tmplevel[n_levs].name, yyvsp[-4].str); - tmplevel[n_levs].boneschar = (char)yyvsp[-3].i; - tmplevel[n_levs].lev.base = couple.base; - tmplevel[n_levs].lev.rand = couple.rand; - tmplevel[n_levs].chance = yyvsp[0].i; - tmpdungeon[n_dgns].levels++; - Free(yyvsp[-4].str); - } -break; -case 28: -{ - init_level(); - Strcpy(tmplevel[n_levs].name, yyvsp[-5].str); - tmplevel[n_levs].boneschar = (char)yyvsp[-4].i; - tmplevel[n_levs].lev.base = couple.base; - tmplevel[n_levs].lev.rand = couple.rand; - tmplevel[n_levs].chance = yyvsp[-1].i; - tmplevel[n_levs].rndlevs = yyvsp[0].i; - tmpdungeon[n_dgns].levels++; - Free(yyvsp[-5].str); - } -break; -case 29: -{ - if(yyvsp[0].i >= D_ALIGN_CHAOTIC) - yyerror("Illegal description - ignoring!"); - else - tmplevel[n_levs].flags |= yyvsp[0].i ; - } -break; -case 30: -{ - if(yyvsp[0].i && yyvsp[0].i < D_ALIGN_CHAOTIC) - yyerror("Illegal alignment - ignoring!"); - else - tmplevel[n_levs].flags |= yyvsp[0].i ; - } -break; -case 31: -{ - init_level(); - Strcpy(tmplevel[n_levs].name, yyvsp[-4].str); - tmplevel[n_levs].boneschar = (char)yyvsp[-3].i; - tmplevel[n_levs].chain = getchain(yyvsp[-2].str); - tmplevel[n_levs].lev.base = couple.base; - tmplevel[n_levs].lev.rand = couple.rand; - if(!check_level()) n_levs--; - else tmpdungeon[n_dgns].levels++; - Free(yyvsp[-4].str); - Free(yyvsp[-2].str); - } -break; -case 32: -{ - init_level(); - Strcpy(tmplevel[n_levs].name, yyvsp[-5].str); - tmplevel[n_levs].boneschar = (char)yyvsp[-4].i; - tmplevel[n_levs].chain = getchain(yyvsp[-3].str); - tmplevel[n_levs].lev.base = couple.base; - tmplevel[n_levs].lev.rand = couple.rand; - tmplevel[n_levs].rndlevs = yyvsp[0].i; - if(!check_level()) n_levs--; - else tmpdungeon[n_dgns].levels++; - Free(yyvsp[-5].str); - Free(yyvsp[-3].str); - } -break; -case 33: -{ - init_level(); - Strcpy(tmplevel[n_levs].name, yyvsp[-5].str); - tmplevel[n_levs].boneschar = (char)yyvsp[-4].i; - tmplevel[n_levs].chain = getchain(yyvsp[-3].str); - tmplevel[n_levs].lev.base = couple.base; - tmplevel[n_levs].lev.rand = couple.rand; - tmplevel[n_levs].chance = yyvsp[0].i; - if(!check_level()) n_levs--; - else tmpdungeon[n_dgns].levels++; - Free(yyvsp[-5].str); - Free(yyvsp[-3].str); - } -break; -case 34: -{ - init_level(); - Strcpy(tmplevel[n_levs].name, yyvsp[-6].str); - tmplevel[n_levs].boneschar = (char)yyvsp[-5].i; - tmplevel[n_levs].chain = getchain(yyvsp[-4].str); - tmplevel[n_levs].lev.base = couple.base; - tmplevel[n_levs].lev.rand = couple.rand; - tmplevel[n_levs].chance = yyvsp[-1].i; - tmplevel[n_levs].rndlevs = yyvsp[0].i; - if(!check_level()) n_levs--; - else tmpdungeon[n_dgns].levels++; - Free(yyvsp[-6].str); - Free(yyvsp[-4].str); - } -break; -case 37: -{ - init_branch(); - Strcpy(tmpbranch[n_brs].name, yyvsp[-4].str); - tmpbranch[n_brs].lev.base = couple.base; - tmpbranch[n_brs].lev.rand = couple.rand; - tmpbranch[n_brs].type = yyvsp[-1].i; - tmpbranch[n_brs].up = yyvsp[0].i; - if(!check_branch()) n_brs--; - else tmpdungeon[n_dgns].branches++; - Free(yyvsp[-4].str); - } -break; -case 38: -{ - init_branch(); - Strcpy(tmpbranch[n_brs].name, yyvsp[-5].str); - tmpbranch[n_brs].chain = getchain(yyvsp[-4].str); - tmpbranch[n_brs].lev.base = couple.base; - tmpbranch[n_brs].lev.rand = couple.rand; - tmpbranch[n_brs].type = yyvsp[-1].i; - tmpbranch[n_brs].up = yyvsp[0].i; - if(!check_branch()) n_brs--; - else tmpdungeon[n_dgns].branches++; - Free(yyvsp[-5].str); - Free(yyvsp[-4].str); - } -break; -case 39: -{ - yyval.i = TBR_STAIR; /* two way stair */ - } -break; -case 40: -{ - yyval.i = TBR_STAIR; /* two way stair */ - } -break; -case 41: -{ - yyval.i = TBR_NO_UP; /* no up staircase */ - } -break; -case 42: -{ - yyval.i = TBR_NO_DOWN; /* no down staircase */ - } -break; -case 43: -{ - yyval.i = TBR_PORTAL; /* portal connection */ - } -break; -case 44: -{ - yyval.i = 0; /* defaults to down */ - } -break; -case 45: -{ - yyval.i = yyvsp[0].i; - } -break; -case 46: -{ - char *p = yyvsp[0].str; - if (strlen(p) != 1) { - if (strcmp(p, "none") != 0) - yyerror("Bones marker must be a single char, or \"none\"!"); - *p = '\0'; - } - yyval.i = *p; - Free(p); - } -break; -case 47: -{ - if (yyvsp[-3].i < -MAXLEVEL || yyvsp[-3].i > MAXLEVEL) { - yyerror("Abs base out of dlevel range - zeroing!"); - couple.base = couple.rand = 0; - } else if (yyvsp[-1].i < -1 || - ((yyvsp[-3].i < 0) ? (MAXLEVEL + yyvsp[-3].i + yyvsp[-1].i + 1) > MAXLEVEL : - (yyvsp[-3].i + yyvsp[-1].i) > MAXLEVEL)) { - yyerror("Abs range out of dlevel range - zeroing!"); - couple.base = couple.rand = 0; - } else { - couple.base = yyvsp[-3].i; - couple.rand = yyvsp[-1].i; - } - } -break; -case 48: -{ - if (yyvsp[-3].i < -MAXLEVEL || yyvsp[-3].i > MAXLEVEL) { - yyerror("Rel base out of dlevel range - zeroing!"); - couple.base = couple.rand = 0; - } else { - couple.base = yyvsp[-3].i; - couple.rand = yyvsp[-1].i; - } - } -break; - } - yyssp -= yym; - yystate = *yyssp; - yyvsp -= yym; - yym = yylhs[yyn]; - if (yystate == 0 && yym == 0) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state 0 to\ - state %d\n", YYPREFIX, YYFINAL); -#endif - yystate = YYFINAL; - *++yyssp = YYFINAL; - *++yyvsp = yyval; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, YYFINAL, yychar, yys); - } -#endif - } - if (yychar == 0) goto yyaccept; - goto yyloop; - } - if ((yyn = yygindex[yym]) != 0 && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) - yystate = yytable[yyn]; - else - yystate = yydgoto[yym]; -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state %d \ -to state %d\n", YYPREFIX, *yyssp, yystate); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate; - *++yyvsp = yyval; - goto yyloop; -yyoverflow: - yyerror("yacc stack overflow"); -yyabort: - return (1); -yyaccept: - return (0); -} diff --git a/sys/share/lev_comp.h b/sys/share/lev_comp.h deleted file mode 100644 index 1e3f16fa4..000000000 --- a/sys/share/lev_comp.h +++ /dev/null @@ -1,212 +0,0 @@ -#define CHAR 257 -#define INTEGER 258 -#define BOOLEAN 259 -#define PERCENT 260 -#define SPERCENT 261 -#define MINUS_INTEGER 262 -#define PLUS_INTEGER 263 -#define MAZE_GRID_ID 264 -#define SOLID_FILL_ID 265 -#define MINES_ID 266 -#define ROGUELEV_ID 267 -#define MESSAGE_ID 268 -#define MAZE_ID 269 -#define LEVEL_ID 270 -#define LEV_INIT_ID 271 -#define GEOMETRY_ID 272 -#define NOMAP_ID 273 -#define OBJECT_ID 274 -#define COBJECT_ID 275 -#define MONSTER_ID 276 -#define TRAP_ID 277 -#define DOOR_ID 278 -#define DRAWBRIDGE_ID 279 -#define object_ID 280 -#define monster_ID 281 -#define terrain_ID 282 -#define MAZEWALK_ID 283 -#define WALLIFY_ID 284 -#define REGION_ID 285 -#define FILLING 286 -#define IRREGULAR 287 -#define JOINED 288 -#define ALTAR_ID 289 -#define LADDER_ID 290 -#define STAIR_ID 291 -#define NON_DIGGABLE_ID 292 -#define NON_PASSWALL_ID 293 -#define ROOM_ID 294 -#define PORTAL_ID 295 -#define TELEPRT_ID 296 -#define BRANCH_ID 297 -#define LEV 298 -#define MINERALIZE_ID 299 -#define CORRIDOR_ID 300 -#define GOLD_ID 301 -#define ENGRAVING_ID 302 -#define FOUNTAIN_ID 303 -#define POOL_ID 304 -#define SINK_ID 305 -#define NONE 306 -#define RAND_CORRIDOR_ID 307 -#define DOOR_STATE 308 -#define LIGHT_STATE 309 -#define CURSE_TYPE 310 -#define ENGRAVING_TYPE 311 -#define DIRECTION 312 -#define RANDOM_TYPE 313 -#define RANDOM_TYPE_BRACKET 314 -#define A_REGISTER 315 -#define ALIGNMENT 316 -#define LEFT_OR_RIGHT 317 -#define CENTER 318 -#define TOP_OR_BOT 319 -#define ALTAR_TYPE 320 -#define UP_OR_DOWN 321 -#define SUBROOM_ID 322 -#define NAME_ID 323 -#define FLAGS_ID 324 -#define FLAG_TYPE 325 -#define MON_ATTITUDE 326 -#define MON_ALERTNESS 327 -#define MON_APPEARANCE 328 -#define ROOMDOOR_ID 329 -#define IF_ID 330 -#define ELSE_ID 331 -#define TERRAIN_ID 332 -#define HORIZ_OR_VERT 333 -#define REPLACE_TERRAIN_ID 334 -#define EXIT_ID 335 -#define SHUFFLE_ID 336 -#define QUANTITY_ID 337 -#define BURIED_ID 338 -#define LOOP_ID 339 -#define FOR_ID 340 -#define TO_ID 341 -#define SWITCH_ID 342 -#define CASE_ID 343 -#define BREAK_ID 344 -#define DEFAULT_ID 345 -#define ERODED_ID 346 -#define TRAPPED_STATE 347 -#define RECHARGED_ID 348 -#define INVIS_ID 349 -#define GREASED_ID 350 -#define FEMALE_ID 351 -#define CANCELLED_ID 352 -#define REVIVED_ID 353 -#define AVENGE_ID 354 -#define FLEEING_ID 355 -#define BLINDED_ID 356 -#define PARALYZED_ID 357 -#define STUNNED_ID 358 -#define CONFUSED_ID 359 -#define SEENTRAPS_ID 360 -#define ALL_ID 361 -#define MONTYPE_ID 362 -#define GRAVE_ID 363 -#define ERODEPROOF_ID 364 -#define FUNCTION_ID 365 -#define MSG_OUTPUT_TYPE 366 -#define COMPARE_TYPE 367 -#define UNKNOWN_TYPE 368 -#define rect_ID 369 -#define fillrect_ID 370 -#define line_ID 371 -#define randline_ID 372 -#define grow_ID 373 -#define selection_ID 374 -#define flood_ID 375 -#define rndcoord_ID 376 -#define circle_ID 377 -#define ellipse_ID 378 -#define filter_ID 379 -#define complement_ID 380 -#define gradient_ID 381 -#define GRADIENT_TYPE 382 -#define LIMITED 383 -#define HUMIDITY_TYPE 384 -#define STRING 385 -#define MAP_ID 386 -#define NQSTRING 387 -#define VARSTRING 388 -#define CFUNC 389 -#define CFUNC_INT 390 -#define CFUNC_STR 391 -#define CFUNC_COORD 392 -#define CFUNC_REGION 393 -#define VARSTRING_INT 394 -#define VARSTRING_INT_ARRAY 395 -#define VARSTRING_STRING 396 -#define VARSTRING_STRING_ARRAY 397 -#define VARSTRING_VAR 398 -#define VARSTRING_VAR_ARRAY 399 -#define VARSTRING_COORD 400 -#define VARSTRING_COORD_ARRAY 401 -#define VARSTRING_REGION 402 -#define VARSTRING_REGION_ARRAY 403 -#define VARSTRING_MAPCHAR 404 -#define VARSTRING_MAPCHAR_ARRAY 405 -#define VARSTRING_MONST 406 -#define VARSTRING_MONST_ARRAY 407 -#define VARSTRING_OBJ 408 -#define VARSTRING_OBJ_ARRAY 409 -#define VARSTRING_SEL 410 -#define VARSTRING_SEL_ARRAY 411 -#define METHOD_INT 412 -#define METHOD_INT_ARRAY 413 -#define METHOD_STRING 414 -#define METHOD_STRING_ARRAY 415 -#define METHOD_VAR 416 -#define METHOD_VAR_ARRAY 417 -#define METHOD_COORD 418 -#define METHOD_COORD_ARRAY 419 -#define METHOD_REGION 420 -#define METHOD_REGION_ARRAY 421 -#define METHOD_MAPCHAR 422 -#define METHOD_MAPCHAR_ARRAY 423 -#define METHOD_MONST 424 -#define METHOD_MONST_ARRAY 425 -#define METHOD_OBJ 426 -#define METHOD_OBJ_ARRAY 427 -#define METHOD_SEL 428 -#define METHOD_SEL_ARRAY 429 -#define DICE 430 -typedef union -{ - long i; - char *map; - struct { - long room; - long wall; - long door; - } corpos; - struct { - long area; - long x1; - long y1; - long x2; - long y2; - } lregn; - struct { - long x; - long y; - } crd; - struct { - long ter; - long lit; - } terr; - struct { - long height; - long width; - } sze; - struct { - long die; - long num; - } dice; - struct { - long cfunc; - char *varstr; - } meth; -} YYSTYPE; -extern YYSTYPE yylval; diff --git a/sys/share/lev_lex.c b/sys/share/lev_lex.c deleted file mode 100644 index acf03dbaf..000000000 --- a/sys/share/lev_lex.c +++ /dev/null @@ -1,3310 +0,0 @@ - -#line 3 "lev_lex.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex via 'flex -S flexhack.skl' - * where flexhack.skl is a nethack-specific alternate skeleton derived - * from flex 2.6.0's skel.c (which in turn was generated from flex.skl). - * - * Support for C++, re-entrancy, and table serialization stripped out. - * NetHack's usage doesn't need them and we want to reduce the size and - * complexity of this skeleton as well as of the generated scanner code. - */ -#define FLEXHACK_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 0 - -#include "config.h" - -#include - -/* we don't care if actual types happen to have more bits than their names; - the tables will just take up more space, possibly slowing the parse; - still, allow config.h to override these via typedef+#define if desired */ -#ifndef FLEX_INT32_T -typedef int flex_int32_t; -#endif -#ifndef FLEX_INT16_T -typedef short int flex_int16_t; -#endif -#ifndef FLEX_UINT16_T -typedef unsigned short int flex_uint16_t; -#endif - -#define yyconst const - -#define FDECL_dummy /*empty*/ - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (uchar) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#endif - -/* The state buf must be large enough to hold one state per character - * in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -extern yy_size_t yyleng; -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -#define YY_LESS_LINENO(n) -#define YY_LINENO_REWIND_TO(ptr) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg); \ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - -}; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart FDECL(FDECL_dummy, (FILE *input_file )); -void yy_switch_to_buffer FDECL(FDECL_dummy, (YY_BUFFER_STATE new_buffer )); -YY_BUFFER_STATE yy_create_buffer FDECL(FDECL_dummy, (FILE *file,int size )); -void yy_delete_buffer FDECL(FDECL_dummy, (YY_BUFFER_STATE b )); -void yy_flush_buffer FDECL(FDECL_dummy, (YY_BUFFER_STATE b )); -void yypush_buffer_state FDECL(FDECL_dummy, (YY_BUFFER_STATE new_buffer )); -void yypop_buffer_state FDECL(FDECL_dummy, (void )); - -static void yyensure_buffer_stack FDECL(FDECL_dummy, (void )); -static void yy_load_buffer_state FDECL(FDECL_dummy, (void )); -static void yy_init_buffer FDECL(FDECL_dummy, (YY_BUFFER_STATE b,FILE *file )); - -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE yy_scan_buffer FDECL(FDECL_dummy, (char *base,yy_size_t size )); -YY_BUFFER_STATE yy_scan_string FDECL(FDECL_dummy, (yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes FDECL(FDECL_dummy, (yyconst char *bytes,yy_size_t len )); - -void *yyalloc FDECL(FDECL_dummy, (yy_size_t )); -void *yyrealloc FDECL(FDECL_dummy, (void *,yy_size_t )); -void yyfree FDECL(FDECL_dummy, (void * )); - -#define yy_new_buffer yy_create_buffer -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ) { \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ) { \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -typedef unsigned char YY_CHAR; - -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; - -typedef int yy_state_type; - -extern int yylineno; - -int yylineno = 1; - -extern char *yytext; -#ifdef yytext_ptr -#undef yytext_ptr -#endif -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state FDECL(FDECL_dummy, (void )); -static yy_state_type yy_try_NUL_trans FDECL(FDECL_dummy, (yy_state_type current_state )); -static int yy_get_next_buffer FDECL(FDECL_dummy, (void )); -static void yy_fatal_error FDECL(FDECL_dummy, (yyconst char msg[] )) NORETURN; - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 200 -#define YY_END_OF_BUFFER 201 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[1057] = - { 0, - 0, 0, 0, 0, 201, 199, 195, 194, 199, 199, - 199, 199, 199, 199, 198, 184, 192, 199, 193, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 199, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 195, 199, 198, 2, 199, 195, 199, 199, 198, 184, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 195, 199, 195, 194, 188, 0, 185, 186, - 0, 0, 182, 198, 181, 183, 184, 198, 190, 189, - - 187, 191, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 39, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 55, 198, 198, 0, 0, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 154, 198, 198, 195, 0, 0, 3, 198, - 2, 2, 0, 195, 0, 182, 198, 181, 184, 198, - 198, 198, 198, 39, 198, 198, 198, 198, 198, 198, - 195, 0, 2, 0, 0, 197, 0, 197, 179, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 54, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 0, 198, 104, 198, 83, - - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 79, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 81, - 198, 198, 198, 198, 198, 139, 198, 198, 198, 198, - 128, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 16, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 126, 198, 198, 198, 198, 198, 198, 198, - - 198, 80, 198, 198, 198, 198, 198, 198, 198, 198, - 196, 198, 198, 198, 58, 198, 198, 198, 22, 198, - 40, 198, 41, 198, 198, 198, 198, 49, 198, 198, - 198, 198, 56, 6, 198, 198, 198, 53, 198, 198, - 198, 36, 198, 198, 198, 198, 42, 198, 35, 198, - 198, 198, 198, 198, 21, 198, 0, 180, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 160, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 155, 158, 114, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 69, 198, 198, 198, - - 198, 198, 198, 198, 198, 198, 121, 198, 198, 67, - 198, 198, 198, 198, 161, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 119, 198, 198, 198, 198, 107, - 198, 198, 198, 198, 198, 198, 198, 65, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 157, 198, 198, 198, - 198, 198, 116, 15, 0, 198, 198, 198, 198, 198, - 28, 198, 59, 198, 198, 198, 198, 198, 13, 198, - 198, 198, 50, 198, 198, 7, 198, 198, 198, 198, - 5, 198, 198, 198, 198, 198, 198, 198, 198, 198, - - 30, 198, 198, 198, 198, 198, 120, 153, 198, 198, - 198, 147, 198, 198, 162, 198, 198, 198, 198, 198, - 141, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 156, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 11, 198, - 198, 198, 198, 198, 198, 198, 113, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 125, 198, 12, 198, 198, 198, 198, 198, 198, 198, - 82, 115, 198, 198, 198, 198, 198, 198, 198, 198, - - 129, 198, 198, 198, 198, 33, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 29, 198, 198, 198, 198, - 198, 198, 17, 31, 198, 27, 198, 198, 198, 198, - 57, 198, 198, 198, 198, 146, 97, 198, 198, 127, - 111, 86, 198, 123, 72, 108, 198, 198, 198, 198, - 165, 198, 198, 87, 198, 94, 130, 198, 74, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 135, 198, 198, 109, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 110, 168, 198, 198, - 198, 16, 198, 198, 198, 198, 77, 198, 117, 198, - - 198, 198, 198, 198, 112, 198, 198, 198, 152, 173, - 198, 198, 78, 198, 198, 198, 198, 198, 198, 198, - 198, 1, 57, 198, 198, 198, 60, 198, 198, 198, - 198, 198, 198, 198, 4, 198, 19, 198, 198, 198, - 198, 198, 62, 43, 198, 46, 26, 198, 163, 99, - 198, 198, 198, 198, 198, 73, 159, 198, 198, 98, - 198, 198, 198, 93, 198, 198, 198, 198, 145, 198, - 198, 198, 198, 198, 136, 198, 198, 198, 198, 198, - 20, 63, 140, 138, 198, 198, 198, 198, 198, 198, - 198, 198, 118, 198, 132, 96, 198, 151, 198, 198, - - 198, 198, 198, 101, 47, 89, 198, 198, 198, 198, - 198, 198, 45, 198, 198, 34, 61, 14, 8, 25, - 198, 198, 198, 198, 198, 23, 198, 169, 198, 198, - 198, 102, 177, 198, 66, 198, 75, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 150, - 9, 198, 198, 198, 198, 198, 144, 198, 85, 68, - 198, 71, 198, 198, 198, 198, 176, 164, 131, 134, - 198, 106, 18, 198, 51, 198, 198, 198, 198, 198, - 198, 95, 142, 198, 198, 70, 174, 122, 198, 167, - 198, 175, 198, 92, 133, 84, 148, 149, 171, 198, - - 198, 198, 100, 172, 91, 198, 64, 198, 10, 137, - 24, 52, 198, 198, 198, 198, 198, 76, 88, 124, - 105, 198, 198, 198, 166, 103, 198, 198, 198, 198, - 198, 198, 198, 198, 90, 198, 37, 38, 198, 198, - 198, 198, 143, 170, 198, 198, 198, 178, 198, 198, - 198, 198, 48, 32, 44, 0 - } ; - -static yyconst YY_CHAR yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 5, 6, 7, 8, 9, 10, 1, 11, 1, - 1, 1, 12, 1, 13, 14, 1, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 1, 1, 16, - 17, 18, 1, 1, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 1, 48, 1, 49, 50, 51, 52, - - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 14, 14, 14, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst YY_CHAR yy_meta[75] = - { 0, - 1, 2, 3, 2, 2, 1, 1, 2, 1, 1, - 1, 2, 4, 2, 4, 1, 1, 1, 5, 5, - 5, 6, 6, 5, 6, 5, 5, 6, 5, 5, - 6, 6, 6, 5, 6, 6, 5, 5, 6, 6, - 5, 6, 6, 6, 1, 2, 1, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 5, 6, 6 - } ; - -static yyconst flex_uint16_t yy_base[1064] = - { 0, - 0, 73, 102, 77, 1254, 1255, 75, 1255, 1250, 1235, - 1244, 0, 1204, 1234, 1233, 78, 66, 1230, 1229, 1215, - 1208, 57, 63, 59, 64, 101, 0, 63, 79, 119, - 94, 1223, 1209, 122, 123, 121, 1222, 104, 105, 100, - 124, 90, 129, 137, 1174, 84, 117, 1176, 139, 150, - 151, 151, 156, 1169, 163, 168, 166, 56, 1184, 1183, - 232, 1232, 216, 1255, 1231, 242, 248, 251, 264, 196, - 155, 167, 208, 228, 241, 1218, 249, 242, 195, 277, - 284, 223, 319, 334, 257, 1255, 1255, 1225, 1255, 0, - 1220, 1219, 1214, 0, 1213, 1255, 298, 1212, 1255, 1255, - - 1255, 1255, 1188, 263, 1188, 264, 1200, 1190, 1203, 1184, - 1195, 1192, 1199, 270, 1185, 1183, 1185, 1195, 0, 1186, - 1190, 1171, 1177, 1165, 1171, 1175, 1174, 1174, 280, 1176, - 292, 1171, 301, 1169, 1162, 1168, 1180, 1178, 1170, 259, - 0, 1177, 1165, 203, 304, 272, 1121, 1143, 1132, 1138, - 1141, 288, 1121, 1125, 1121, 1124, 1123, 1135, 1117, 1119, - 308, 1115, 1109, 1106, 1111, 1110, 1116, 1120, 1111, 1113, - 1111, 1111, 234, 281, 296, 299, 1117, 282, 1103, 1111, - 1096, 81, 315, 1115, 324, 26, 1103, 1102, 1102, 1093, - 330, 1103, 1107, 1093, 1109, 1104, 1107, 281, 333, 1100, - - 1102, 1098, 1090, 342, 323, 321, 1082, 1081, 1083, 1084, - 345, 350, 0, 1081, 332, 407, 1143, 1142, 1255, 363, - 1255, 1255, 1141, 411, 415, 416, 1128, 0, 412, 390, - 396, 404, 415, 1127, 410, 420, 421, 422, 423, 424, - 0, 0, 1255, 1138, 0, 1255, 1129, 1128, 1123, 1118, - 1104, 1116, 1111, 1095, 1096, 1112, 1094, 1088, 1105, 1091, - 1088, 1100, 0, 1092, 1102, 1091, 1099, 1080, 1081, 1096, - 1094, 1082, 1092, 1077, 1090, 1075, 1088, 1091, 1061, 1085, - 1077, 1068, 1083, 1077, 1073, 1071, 1077, 1071, 1072, 1062, - 1059, 1073, 1059, 1060, 1063, 435, 1037, 0, 1042, 0, - - 1027, 1036, 1026, 1028, 1019, 1023, 1021, 1015, 1023, 385, - 1030, 1012, 1016, 1027, 1010, 1016, 1011, 1020, 1007, 1005, - 1009, 0, 1002, 1001, 1011, 1001, 1014, 998, 1015, 383, - 1010, 999, 392, 1012, 989, 1005, 1006, 1000, 988, 0, - 1003, 1003, 996, 999, 989, 0, 982, 983, 991, 994, - 0, 987, 992, 981, 993, 983, 988, 987, 378, 986, - 970, 977, 973, 974, 404, 966, 408, 980, 970, 982, - 979, 968, 966, 970, 974, 392, 956, 967, 967, 971, - 952, 969, 953, 956, 964, 950, 395, 958, 946, 964, - 950, 945, 0, 946, 956, 939, 950, 943, 948, 936, - - 935, 0, 462, 448, 453, 971, 454, 456, 434, 455, - 1255, 965, 979, 970, 0, 979, 970, 957, 0, 975, - 0, 975, 0, 956, 954, 953, 967, 0, 966, 940, - 964, 956, 0, 944, 965, 947, 944, 0, 947, 452, - 959, 0, 960, 945, 944, 957, 953, 950, 0, 937, - 939, 950, 936, 950, 0, 941, 468, 1255, 905, 900, - 899, 911, 908, 909, 894, 908, 907, 895, 904, 903, - 0, 902, 901, 886, 892, 898, 893, 889, 879, 886, - 893, 0, 0, 0, 881, 895, 890, 889, 881, 422, - 887, 882, 886, 880, 883, 868, 0, 921, 879, 858, - - 874, 866, 878, 861, 872, 873, 0, 872, 856, 0, - 870, 873, 859, 862, 0, 429, 852, 850, 844, 850, - 858, 851, 864, 849, 0, 855, 842, 849, 857, 0, - 847, 853, 856, 836, 854, 417, 853, 0, 841, 830, - 831, 835, 844, 828, 842, 846, 842, 824, 829, 821, - 837, 832, 821, 824, 836, 820, 0, 817, 822, 824, - 426, 823, 0, 1255, 876, 463, 859, 466, 475, 476, - 0, 851, 0, 849, 853, 844, 837, 832, 0, 852, - 843, 831, 0, 837, 831, 0, 847, 840, 845, 840, - 0, 835, 842, 822, 829, 827, 825, 835, 822, 824, - - 0, 820, 826, 818, 823, 825, 0, 0, 795, 783, - 793, 0, 792, 791, 0, 782, 780, 789, 780, 773, - 0, 785, 785, 781, 782, 767, 784, 780, 764, 760, - 440, 0, 776, 776, 774, 760, 763, 770, 770, 749, - 768, 435, 760, 756, 758, 754, 763, 758, 745, 761, - 757, 758, 758, 741, 741, 754, 740, 752, 0, 751, - 739, 753, 746, 734, 735, 749, 0, 731, 743, 727, - 721, 739, 728, 734, 730, 732, 727, 721, 737, 732, - 0, 721, 0, 714, 714, 713, 712, 712, 725, 725, - 443, 0, 723, 722, 717, 720, 705, 711, 708, 712, - - 0, 717, 733, 483, 490, 0, 734, 732, 726, 736, - 735, 734, 727, 723, 739, 0, 724, 712, 81, 122, - 205, 226, 0, 0, 311, 0, 350, 460, 483, 476, - 0, 472, 478, 468, 463, 0, 0, 461, 464, 0, - 0, 0, 457, 0, 0, 0, 456, 458, 467, 447, - 0, 469, 470, 0, 458, 0, 0, 474, 0, 471, - 470, 466, 480, 478, 478, 475, 470, 472, 482, 473, - 470, 488, 479, 0, 483, 489, 0, 473, 475, 493, - 488, 476, 481, 495, 489, 488, 0, 0, 491, 503, - 489, 0, 480, 486, 492, 489, 0, 496, 514, 505, - - 495, 510, 497, 503, 0, 499, 509, 510, 0, 0, - 511, 515, 0, 518, 509, 520, 520, 521, 522, 508, - 528, 0, 563, 564, 557, 545, 0, 560, 551, 552, - 553, 543, 553, 559, 0, 562, 0, 565, 554, 571, - 545, 558, 0, 0, 557, 0, 0, 536, 0, 0, - 544, 545, 546, 548, 548, 0, 0, 539, 535, 0, - 544, 537, 540, 0, 554, 554, 547, 543, 0, 552, - 546, 554, 566, 553, 0, 551, 565, 551, 568, 568, - 0, 0, 0, 0, 565, 559, 561, 572, 566, 574, - 555, 576, 1255, 577, 0, 0, 579, 0, 583, 570, - - 579, 575, 563, 0, 0, 0, 585, 586, 587, 587, - 581, 606, 0, 618, 619, 0, 0, 0, 0, 0, - 601, 627, 606, 615, 611, 0, 602, 0, 599, 600, - 591, 0, 0, 591, 0, 595, 0, 604, 589, 602, - 593, 611, 594, 605, 610, 598, 603, 613, 601, 0, - 0, 608, 614, 606, 605, 620, 0, 621, 0, 0, - 622, 0, 611, 614, 621, 618, 0, 0, 0, 0, - 627, 0, 0, 657, 0, 658, 662, 664, 648, 662, - 650, 0, 0, 619, 634, 0, 0, 0, 621, 0, - 630, 0, 641, 0, 0, 0, 0, 0, 0, 630, - - 640, 626, 0, 0, 0, 628, 0, 628, 0, 0, - 0, 0, 667, 668, 663, 664, 678, 0, 0, 0, - 0, 642, 650, 652, 0, 0, 652, 683, 677, 681, - 673, 685, 658, 660, 0, 661, 0, 0, 692, 696, - 689, 650, 0, 0, 685, 692, 687, 0, 685, 690, - 691, 687, 0, 0, 0, 1255, 724, 726, 732, 735, - 741, 746, 751 - } ; - -static yyconst flex_int16_t yy_def[1064] = - { 0, - 1056, 1, 1, 3, 1056, 1056, 1056, 1056, 1056, 1056, - 1057, 1058, 1059, 1056, 1060, 1060, 1056, 1056, 1056, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1056, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1056, 1061, 1060, 1056, 1056, 1062, 1062, 1062, 1060, 69, - 69, 69, 69, 1060, 69, 69, 69, 69, 69, 69, - 69, 69, 1062, 1061, 1056, 1056, 1056, 1057, 1056, 1058, - 1056, 1063, 1056, 1060, 1060, 1056, 1060, 1060, 1056, 1056, - - 1056, 1056, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1056, 1056, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1056, 1061, 1061, 1056, 1060, - 1056, 1056, 1056, 83, 83, 83, 69, 69, 69, 69, - 69, 1060, 69, 69, 69, 69, 69, 69, 69, 69, - 83, 84, 1056, 1061, 84, 1056, 1056, 1056, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1056, 1060, 1060, 1060, 1060, - - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - - 1060, 1060, 1060, 69, 69, 1060, 69, 69, 69, 69, - 1056, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1056, 1056, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1056, 1056, 69, 1060, 69, 69, 69, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - - 1060, 1060, 1060, 69, 69, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 69, 69, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1056, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, - 1060, 1060, 1060, 1060, 1060, 0, 1056, 1056, 1056, 1056, - 1056, 1056, 1056 - } ; - -static yyconst flex_uint16_t yy_nxt[1330] = - { 0, - 6, 7, 8, 9, 7, 10, 11, 6, 12, 6, - 13, 14, 15, 6, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 27, 27, 29, - 30, 31, 32, 33, 27, 34, 35, 36, 27, 27, - 37, 27, 27, 27, 38, 6, 6, 27, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 27, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 27, 27, 27, 61, 105, 85, 61, 61, 85, - 62, 83, 99, 100, 84, 107, 119, 96, 110, 106, - 111, 356, 97, 113, 120, 108, 114, 121, 109, 357, - - 112, 122, 115, 63, 64, 65, 66, 63, 144, 67, - 836, 123, 128, 68, 69, 67, 70, 212, 145, 213, - 71, 72, 73, 116, 74, 75, 129, 76, 77, 98, - 76, 78, 175, 117, 347, 79, 118, 124, 80, 81, - 132, 125, 82, 140, 133, 126, 176, 67, 135, 136, - 348, 127, 163, 141, 134, 164, 142, 837, 165, 152, - 137, 138, 153, 139, 146, 154, 147, 177, 155, 227, - 148, 149, 156, 76, 150, 151, 157, 166, 178, 158, - 159, 227, 179, 160, 230, 170, 161, 181, 167, 171, - 168, 182, 162, 172, 169, 183, 173, 185, 186, 189, - - 192, 184, 104, 190, 194, 96, 187, 144, 195, 227, - 229, 198, 188, 191, 193, 199, 203, 145, 209, 200, - 204, 196, 227, 205, 201, 202, 231, 131, 210, 838, - 206, 211, 207, 216, 220, 208, 216, 227, 125, 217, - 106, 240, 126, 85, 222, 223, 224, 98, 127, 1056, - 222, 223, 1056, 222, 223, 227, 227, 110, 85, 232, - 235, 85, 839, 227, 122, 226, 222, 223, 225, 112, - 233, 225, 234, 114, 123, 225, 227, 225, 228, 115, - 120, 251, 227, 227, 227, 252, 331, 227, 292, 227, - 227, 227, 227, 227, 293, 254, 332, 227, 227, 255, - - 227, 227, 236, 237, 227, 263, 140, 96, 264, 225, - 278, 279, 97, 296, 238, 138, 141, 239, 145, 142, - 216, 222, 223, 241, 281, 284, 242, 282, 297, 333, - 342, 298, 374, 334, 285, 227, 243, 244, 245, 299, - 305, 245, 375, 335, 306, 245, 245, 245, 245, 98, - 307, 343, 245, 245, 245, 336, 316, 245, 840, 245, - 245, 337, 245, 245, 338, 339, 340, 245, 317, 318, - 245, 245, 841, 319, 245, 349, 350, 353, 362, 245, - 388, 363, 351, 376, 354, 386, 355, 377, 387, 389, - 364, 365, 383, 394, 384, 366, 403, 367, 401, 402, - - 396, 385, 378, 397, 227, 245, 273, 398, 216, 399, - 227, 216, 85, 395, 217, 224, 1056, 1056, 225, 225, - 225, 96, 225, 225, 227, 406, 229, 404, 260, 227, - 226, 270, 405, 407, 227, 227, 227, 227, 227, 457, - 408, 470, 490, 494, 518, 519, 471, 537, 227, 409, - 491, 549, 288, 410, 524, 527, 525, 550, 287, 538, - 528, 495, 227, 98, 564, 565, 566, 227, 227, 227, - 227, 569, 457, 592, 634, 415, 676, 227, 424, 677, - 227, 458, 568, 657, 570, 593, 700, 635, 658, 227, - 227, 754, 842, 701, 765, 704, 811, 227, 571, 812, - - 766, 601, 705, 755, 227, 843, 844, 845, 823, 846, - 847, 848, 849, 824, 458, 850, 851, 852, 853, 854, - 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, - 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, - 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, - 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, - 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, - 905, 906, 907, 908, 909, 910, 911, 227, 227, 912, - 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, - 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, - - 933, 934, 935, 936, 937, 938, 847, 939, 940, 941, - 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, - 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, - 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, - 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, - 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, - 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, - 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, - 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, - 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, - - 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, - 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, - 1052, 1053, 1054, 1055, 88, 88, 88, 88, 88, 88, - 90, 90, 91, 91, 835, 91, 91, 91, 94, 94, - 94, 218, 218, 218, 218, 218, 218, 225, 225, 225, - 225, 247, 247, 834, 247, 247, 247, 833, 832, 831, - 830, 829, 828, 827, 826, 825, 822, 821, 820, 819, - 818, 817, 816, 815, 814, 813, 810, 809, 808, 807, - 806, 805, 804, 803, 802, 801, 800, 799, 798, 797, - 796, 795, 794, 793, 792, 791, 790, 789, 788, 787, - - 786, 785, 784, 783, 782, 781, 780, 779, 778, 777, - 776, 775, 774, 773, 772, 771, 770, 769, 768, 767, - 764, 763, 762, 761, 760, 759, 758, 757, 756, 753, - 752, 751, 750, 749, 748, 747, 746, 745, 744, 743, - 742, 741, 740, 739, 738, 737, 736, 735, 734, 733, - 732, 731, 730, 729, 728, 727, 726, 725, 724, 723, - 722, 721, 720, 719, 718, 717, 716, 715, 714, 713, - 712, 711, 710, 709, 708, 707, 706, 703, 564, 702, - 699, 698, 697, 696, 695, 694, 693, 692, 691, 690, - 689, 688, 687, 686, 685, 684, 683, 682, 681, 680, - - 679, 678, 675, 674, 673, 672, 671, 670, 669, 668, - 667, 666, 665, 664, 663, 662, 661, 660, 659, 656, - 655, 654, 653, 652, 651, 650, 649, 648, 647, 646, - 645, 644, 643, 642, 641, 640, 639, 638, 637, 636, - 633, 632, 631, 630, 629, 628, 627, 626, 625, 624, - 623, 622, 621, 620, 619, 618, 617, 616, 615, 614, - 613, 612, 611, 610, 609, 608, 607, 606, 605, 604, - 603, 602, 601, 600, 599, 598, 597, 596, 595, 594, - 591, 590, 589, 588, 587, 586, 585, 584, 583, 582, - 581, 580, 579, 578, 577, 576, 575, 574, 573, 572, - - 571, 567, 563, 562, 561, 560, 559, 558, 557, 556, - 555, 554, 553, 552, 551, 548, 547, 546, 545, 544, - 543, 542, 541, 540, 539, 536, 535, 534, 533, 532, - 531, 530, 529, 526, 523, 522, 521, 520, 438, 517, - 516, 515, 514, 513, 512, 511, 510, 509, 508, 507, - 506, 505, 504, 503, 502, 501, 500, 499, 498, 497, - 496, 493, 492, 489, 488, 487, 486, 485, 484, 483, - 482, 481, 480, 479, 478, 477, 476, 475, 474, 473, - 472, 469, 468, 467, 466, 465, 464, 463, 462, 461, - 460, 459, 456, 455, 454, 453, 452, 451, 450, 449, - - 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, - 438, 437, 436, 435, 434, 433, 432, 431, 430, 429, - 428, 427, 426, 425, 424, 423, 422, 421, 420, 419, - 418, 417, 416, 415, 414, 413, 412, 249, 411, 411, - 243, 227, 227, 222, 219, 219, 400, 393, 392, 391, - 390, 382, 381, 380, 379, 373, 372, 371, 370, 369, - 368, 361, 360, 359, 358, 352, 346, 345, 344, 341, - 330, 329, 328, 327, 326, 325, 324, 323, 322, 321, - 320, 315, 314, 313, 312, 311, 310, 309, 308, 304, - 303, 302, 301, 300, 295, 294, 291, 290, 289, 288, - - 287, 286, 283, 280, 277, 276, 275, 274, 273, 272, - 271, 270, 269, 268, 267, 266, 265, 262, 261, 260, - 259, 258, 257, 256, 253, 250, 249, 95, 93, 248, - 246, 89, 227, 221, 219, 215, 214, 197, 180, 174, - 143, 131, 130, 104, 103, 102, 101, 95, 93, 92, - 89, 87, 86, 1056, 5, 1056, 1056, 1056, 1056, 1056, - 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - - 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056 - } ; - -static yyconst flex_int16_t yy_chk[1330] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 2, 22, 7, 2, 4, 7, - 2, 4, 17, 17, 4, 23, 28, 16, 24, 22, - 24, 186, 16, 25, 28, 23, 25, 29, 23, 186, - - 24, 29, 25, 2, 3, 3, 3, 4, 38, 3, - 719, 29, 31, 3, 3, 3, 3, 58, 38, 58, - 3, 3, 3, 26, 3, 3, 31, 3, 3, 16, - 3, 3, 46, 26, 182, 3, 26, 30, 3, 3, - 34, 30, 3, 36, 34, 30, 46, 3, 35, 35, - 182, 30, 42, 36, 34, 42, 36, 720, 42, 40, - 35, 35, 40, 35, 39, 40, 39, 47, 40, 71, - 39, 39, 41, 3, 39, 39, 41, 43, 47, 41, - 41, 72, 47, 41, 71, 44, 41, 49, 43, 44, - 43, 49, 41, 44, 43, 49, 44, 50, 50, 51, - - 52, 49, 72, 51, 53, 70, 50, 144, 53, 79, - 70, 55, 50, 51, 52, 55, 56, 144, 57, 55, - 56, 53, 73, 56, 55, 55, 73, 79, 57, 721, - 56, 57, 56, 61, 63, 56, 61, 82, 63, 61, - 73, 82, 63, 66, 66, 66, 66, 70, 63, 67, - 67, 67, 68, 68, 68, 75, 78, 74, 85, 74, - 78, 85, 722, 77, 78, 68, 69, 69, 69, 74, - 75, 69, 77, 75, 78, 69, 69, 69, 69, 75, - 77, 104, 69, 69, 69, 104, 173, 69, 140, 69, - 69, 80, 69, 69, 140, 106, 173, 69, 81, 106, - - 69, 69, 80, 80, 69, 114, 81, 97, 114, 69, - 129, 129, 97, 145, 80, 80, 81, 80, 145, 81, - 83, 83, 83, 83, 131, 133, 83, 131, 146, 174, - 178, 146, 198, 174, 133, 69, 84, 84, 84, 146, - 152, 84, 198, 174, 152, 84, 84, 84, 84, 97, - 152, 178, 84, 84, 84, 175, 161, 84, 725, 84, - 84, 175, 84, 84, 176, 176, 176, 84, 161, 161, - 84, 84, 727, 161, 84, 183, 183, 185, 191, 84, - 206, 191, 183, 199, 185, 205, 185, 199, 205, 206, - 191, 191, 204, 211, 204, 191, 220, 191, 215, 215, - - 212, 204, 199, 212, 230, 84, 220, 212, 216, 212, - 231, 216, 224, 211, 216, 224, 225, 226, 224, 225, - 226, 229, 225, 226, 235, 232, 229, 230, 232, 233, - 226, 235, 231, 233, 236, 237, 238, 239, 240, 296, - 238, 310, 330, 333, 359, 359, 310, 376, 409, 239, - 330, 387, 237, 240, 365, 367, 365, 387, 236, 376, - 367, 333, 404, 229, 403, 403, 404, 405, 407, 410, - 408, 409, 457, 440, 490, 405, 536, 566, 407, 536, - 568, 296, 408, 516, 410, 440, 561, 490, 516, 569, - 570, 631, 728, 561, 642, 569, 691, 704, 566, 691, - - 642, 568, 570, 631, 705, 729, 730, 732, 704, 733, - 734, 735, 738, 705, 457, 739, 743, 747, 748, 749, - 750, 752, 753, 755, 758, 760, 761, 762, 763, 764, - 765, 766, 767, 768, 769, 770, 771, 772, 773, 775, - 776, 778, 779, 780, 781, 782, 783, 784, 785, 786, - 789, 790, 791, 793, 794, 795, 796, 798, 799, 800, - 801, 802, 803, 804, 806, 807, 808, 811, 812, 814, - 815, 816, 817, 818, 819, 820, 821, 823, 824, 825, - 826, 828, 829, 830, 831, 832, 833, 834, 836, 838, - 839, 840, 841, 842, 845, 848, 851, 852, 853, 854, - - 855, 858, 859, 861, 862, 863, 824, 865, 866, 867, - 868, 870, 871, 872, 873, 874, 876, 877, 878, 879, - 880, 885, 886, 887, 888, 889, 890, 891, 892, 894, - 897, 899, 900, 901, 902, 903, 907, 908, 909, 910, - 911, 912, 914, 915, 921, 922, 923, 924, 925, 927, - 929, 930, 931, 934, 936, 938, 939, 940, 941, 942, - 943, 944, 945, 946, 947, 948, 949, 952, 953, 954, - 955, 956, 958, 961, 963, 964, 965, 966, 971, 974, - 976, 977, 978, 979, 980, 981, 984, 985, 989, 991, - 993, 1000, 1001, 1002, 1006, 1008, 1013, 1014, 1015, 1016, - - 1017, 1022, 1023, 1024, 1027, 1028, 1029, 1030, 1031, 1032, - 1033, 1034, 1036, 1039, 1040, 1041, 1042, 1045, 1046, 1047, - 1049, 1050, 1051, 1052, 1057, 1057, 1057, 1057, 1057, 1057, - 1058, 1058, 1059, 1059, 718, 1059, 1059, 1059, 1060, 1060, - 1060, 1061, 1061, 1061, 1061, 1061, 1061, 1062, 1062, 1062, - 1062, 1063, 1063, 717, 1063, 1063, 1063, 715, 714, 713, - 712, 711, 710, 709, 708, 707, 703, 702, 700, 699, - 698, 697, 696, 695, 694, 693, 690, 689, 688, 687, - 686, 685, 684, 682, 680, 679, 678, 677, 676, 675, - 674, 673, 672, 671, 670, 669, 668, 666, 665, 664, - - 663, 662, 661, 660, 658, 657, 656, 655, 654, 653, - 652, 651, 650, 649, 648, 647, 646, 645, 644, 643, - 641, 640, 639, 638, 637, 636, 635, 634, 633, 630, - 629, 628, 627, 626, 625, 624, 623, 622, 620, 619, - 618, 617, 616, 614, 613, 611, 610, 609, 606, 605, - 604, 603, 602, 600, 599, 598, 597, 596, 595, 594, - 593, 592, 590, 589, 588, 587, 585, 584, 582, 581, - 580, 578, 577, 576, 575, 574, 572, 567, 565, 562, - 560, 559, 558, 556, 555, 554, 553, 552, 551, 550, - 549, 548, 547, 546, 545, 544, 543, 542, 541, 540, - - 539, 537, 535, 534, 533, 532, 531, 529, 528, 527, - 526, 524, 523, 522, 521, 520, 519, 518, 517, 514, - 513, 512, 511, 509, 508, 506, 505, 504, 503, 502, - 501, 500, 499, 498, 496, 495, 494, 493, 492, 491, - 489, 488, 487, 486, 485, 481, 480, 479, 478, 477, - 476, 475, 474, 473, 472, 470, 469, 468, 467, 466, - 465, 464, 463, 462, 461, 460, 459, 456, 454, 453, - 452, 451, 450, 448, 447, 446, 445, 444, 443, 441, - 439, 437, 436, 435, 434, 432, 431, 430, 429, 427, - 426, 425, 424, 422, 420, 418, 417, 416, 414, 413, - - 412, 406, 401, 400, 399, 398, 397, 396, 395, 394, - 392, 391, 390, 389, 388, 386, 385, 384, 383, 382, - 381, 380, 379, 378, 377, 375, 374, 373, 372, 371, - 370, 369, 368, 366, 364, 363, 362, 361, 360, 358, - 357, 356, 355, 354, 353, 352, 350, 349, 348, 347, - 345, 344, 343, 342, 341, 339, 338, 337, 336, 335, - 334, 332, 331, 329, 328, 327, 326, 325, 324, 323, - 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, - 311, 309, 308, 307, 306, 305, 304, 303, 302, 301, - 299, 297, 295, 294, 293, 292, 291, 290, 289, 288, - - 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, - 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, - 267, 266, 265, 264, 262, 261, 260, 259, 258, 257, - 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, - 244, 234, 227, 223, 218, 217, 214, 210, 209, 208, - 207, 203, 202, 201, 200, 197, 196, 195, 194, 193, - 192, 190, 189, 188, 187, 184, 181, 180, 179, 177, - 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, - 162, 160, 159, 158, 157, 156, 155, 154, 153, 151, - 150, 149, 148, 147, 143, 142, 139, 138, 137, 136, - - 135, 134, 132, 130, 128, 127, 126, 125, 124, 123, - 122, 121, 120, 118, 117, 116, 115, 113, 112, 111, - 110, 109, 108, 107, 105, 103, 98, 95, 93, 92, - 91, 88, 76, 65, 62, 60, 59, 54, 48, 45, - 37, 33, 32, 21, 20, 19, 18, 15, 14, 13, - 11, 10, 9, 5, 1056, 1056, 1056, 1056, 1056, 1056, - 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - - 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -/* NetHack 3.6 lev_comp.l $NHDT-Date: 1543372935 2018/11/28 02:42:15 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.29 $ */ -/* Copyright (c) 1989 by Jean-Christophe Collet */ -/* NetHack may be freely redistributed. See license for details. */ - -#define LEV_LEX_C - -#include "hack.h" -#include "lev_comp.h" -#include "sp_lev.h" - -/* Most of these don't exist in flex, yywrap is macro and - * yyunput is properly declared in flex.skel. - */ -#if !defined(FLEX_SCANNER) && !defined(FLEXHACK_SCANNER) -int FDECL(yyback, (int *,int)); -int NDECL(yylook); -int NDECL(yyinput); -int NDECL(yywrap); -int NDECL(yylex); - /* Traditional lexes let yyunput() and yyoutput() default to int; - * newer ones may declare them as void since they don't return - * values. For even more fun, the lex supplied as part of the - * newer unbundled compiler for SunOS 4.x adds the void declarations - * (under __STDC__ or _cplusplus ifdefs -- otherwise they remain - * int) while the bundled lex and the one with the older unbundled - * compiler do not. To detect this, we need help from outside -- - * sys/unix/Makefile.utl. - * - * Digital UNIX is difficult and still has int in spite of all - * other signs. - */ -# if defined(NeXT) || defined(SVR4) || defined(_AIX32) -# define VOIDYYPUT -# endif -# if !defined(VOIDYYPUT) && defined(POSIX_TYPES) -# if !defined(BOS) && !defined(HISX) && !defined(_M_UNIX) && !defined(VMS) -# define VOIDYYPUT -# endif -# endif -# if !defined(VOIDYYPUT) && defined(WEIRD_LEX) -# if defined(SUNOS4) && defined(__STDC__) && (WEIRD_LEX > 1) -# define VOIDYYPUT -# endif -# endif -# if defined(VOIDYYPUT) && defined(__osf__) -# undef VOIDYYPUT -# endif -# ifdef VOIDYYPUT -void FDECL(yyunput, (int)); -void FDECL(yyoutput, (int)); -# else -int FDECL(yyunput, (int)); -int FDECL(yyoutput, (int)); -# endif - -#else /* !FLEX_SCANNER && !FLEXHACK_SCANNER */ -/* most recent flex allows suppressing yyunput() altogether when not needed */ -#define YY_NO_UNPUT -#define YY_NO_INPUT -#endif - -#if defined(FLEX_SCANNER) || defined(FLEXHACK_SCANNER) -/* older flex wants this */ -#define YY_MALLOC_DECL genericptr_t FDECL(malloc, (size_t)); \ - genericptr_t FDECL(realloc, (genericptr_t, size_t)); -/* newer flex assumes so needs this in case it's been suppressed */ -YY_MALLOC_DECL -#endif - -void FDECL(init_yyin, (FILE *)); -void FDECL(init_yyout, (FILE *)); - -long NDECL(handle_varstring_check); -long FDECL(corefunc_str_check, (char *, long)); - -extern void VDECL(lc_error, (const char *, ...)); -extern struct lc_vardefs *FDECL(vardef_defined,(struct lc_vardefs *,char *, int)); - -extern struct lc_vardefs *vardefs; - -extern long FDECL(method_defined, (char *, long, long *)); - -void FDECL(savetoken, (char *)); -void NDECL(newline); -void FDECL(advancepos, (char *)); - -/* - * This doesn't always get put in lev_comp.h - * (esp. when using older versions of bison). - */ -extern YYSTYPE yylval; - -int nh_line_number = 1; -int token_start_pos = 0; -char curr_token[512]; -static char map[4096]; -static int map_cnt = 0; - -FILE *orig_yyin = NULL; - -#define ST_RET(x) do { savetoken(yytext); return x; } while (0); -#define ST_RETF(y, x) do { savetoken(yytext); y; return x; } while (0); - -#define INITIAL 0 -#define MAPC 1 - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int yylex_destroy FDECL(FDECL_dummy, (void )); -int yyget_debug FDECL(FDECL_dummy, (void )); -void yyset_debug FDECL(FDECL_dummy, (int debug_flag )); -YY_EXTRA_TYPE yyget_extra FDECL(FDECL_dummy, (void )); -void yyset_extra FDECL(FDECL_dummy, (YY_EXTRA_TYPE user_defined )); -FILE *yyget_in FDECL(FDECL_dummy, (void )); -void yyset_in FDECL(FDECL_dummy, (FILE * _in_str )); -FILE *yyget_out FDECL(FDECL_dummy, (void )); -void yyset_out FDECL(FDECL_dummy, (FILE * _out_str )); -yy_size_t yyget_leng FDECL(FDECL_dummy, (void )); -char *yyget_text FDECL(FDECL_dummy, (void )); -int yyget_lineno FDECL(FDECL_dummy, (void )); -void yyset_lineno FDECL(FDECL_dummy, (int _line_number )); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -extern int yywrap FDECL(FDECL_dummy, (void )); -#endif - -#ifndef YY_NO_UNPUT - -void yyunput FDECL(FDECL_dummy, (int c,char *buf_ptr )); -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy FDECL(FDECL_dummy, (char *,yyconst char *,int )); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen FDECL(FDECL_dummy, (yyconst char * )); -#endif - -#ifndef YY_NO_INPUT - -static int input FDECL(FDECL_dummy, (void )); - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else -#define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex FDECL(FDECL_dummy, (void)); - -#define YY_DECL int yylex () -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK /*LINTED*/break; -#endif - -#define YY_RULE_SETUP \ - if ( yyleng > 0 ) \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ - (yytext[yyleng - 1] == '\n'); \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_load_buffer_state( ); - } - - { - - while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); - yy_current_state += YY_AT_BOL(); -yy_match: - do - { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 1057 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 1255 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -YY_RULE_SETUP -{ - savetoken(yytext); - BEGIN(INITIAL); - yylval.map = (char *) alloc(map_cnt + 1); - (void) strncpy(yylval.map, map, map_cnt); - yylval.map[map_cnt] = 0; - map_cnt = 0; - return MAP_ID; - } - YY_BREAK -case 2: -/* rule 2 can match eol */ -YY_RULE_SETUP -{ - int len = yyleng; - savetoken(yytext); - /* convert \r\n to \n */ - if (len >= 2 && yytext[len - 2] == '\r') - len -= 1; - (void) strncpy(map + map_cnt, yytext, len); - map_cnt += len; - map[map_cnt - 1] = '\n'; - map[map_cnt] = '\0'; - newline(); - } - YY_BREAK -case 3: -/* rule 3 can match eol */ -YY_RULE_SETUP -{ savetoken(yytext); newline(); } - YY_BREAK -case 4: -YY_RULE_SETUP -ST_RET(MESSAGE_ID); - YY_BREAK -case 5: -YY_RULE_SETUP -ST_RET(NOMAP_ID); - YY_BREAK -case 6: -YY_RULE_SETUP -ST_RET(MAZE_ID); - YY_BREAK -case 7: -YY_RULE_SETUP -ST_RET(LEVEL_ID); - YY_BREAK -case 8: -YY_RULE_SETUP -ST_RET(LEV_INIT_ID); - YY_BREAK -case 9: -YY_RULE_SETUP -ST_RET(MAZE_GRID_ID); - YY_BREAK -case 10: -YY_RULE_SETUP -ST_RET(SOLID_FILL_ID); - YY_BREAK -case 11: -YY_RULE_SETUP -ST_RET(MINES_ID); - YY_BREAK -case 12: -YY_RULE_SETUP -ST_RET(ROGUELEV_ID); - YY_BREAK -case 13: -YY_RULE_SETUP -ST_RET(FLAGS_ID); - YY_BREAK -case 14: -YY_RULE_SETUP -ST_RET(GEOMETRY_ID); - YY_BREAK -case 15: -/* rule 15 can match eol */ -YY_RULE_SETUP -{ savetoken(yytext); BEGIN(MAPC); newline(); } - YY_BREAK -case 16: -YY_RULE_SETUP -ST_RET(object_ID); - YY_BREAK -case 17: -YY_RULE_SETUP -ST_RET(OBJECT_ID); - YY_BREAK -case 18: -YY_RULE_SETUP -ST_RET(COBJECT_ID); - YY_BREAK -case 19: -YY_RULE_SETUP -ST_RET(MONSTER_ID); - YY_BREAK -case 20: -YY_RULE_SETUP -ST_RET(monster_ID); - YY_BREAK -case 21: -YY_RULE_SETUP -ST_RET(TRAP_ID); - YY_BREAK -case 22: -YY_RULE_SETUP -ST_RET(DOOR_ID); - YY_BREAK -case 23: -YY_RULE_SETUP -ST_RET(ROOMDOOR_ID); - YY_BREAK -case 24: -YY_RULE_SETUP -ST_RET(DRAWBRIDGE_ID); - YY_BREAK -case 25: -YY_RULE_SETUP -ST_RET(MAZEWALK_ID); - YY_BREAK -case 26: -YY_RULE_SETUP -ST_RET(WALLIFY_ID); - YY_BREAK -case 27: -YY_RULE_SETUP -ST_RET(REGION_ID); - YY_BREAK -case 28: -YY_RULE_SETUP -ST_RET(ALTAR_ID); - YY_BREAK -case 29: -YY_RULE_SETUP -ST_RET(LADDER_ID); - YY_BREAK -case 30: -YY_RULE_SETUP -ST_RET(STAIR_ID); - YY_BREAK -case 31: -YY_RULE_SETUP -ST_RET(PORTAL_ID); - YY_BREAK -case 32: -YY_RULE_SETUP -ST_RET(TELEPRT_ID); - YY_BREAK -case 33: -YY_RULE_SETUP -ST_RET(BRANCH_ID); - YY_BREAK -case 34: -YY_RULE_SETUP -ST_RET(FOUNTAIN_ID); - YY_BREAK -case 35: -YY_RULE_SETUP -ST_RET(SINK_ID); - YY_BREAK -case 36: -YY_RULE_SETUP -ST_RET(POOL_ID); - YY_BREAK -case 37: -YY_RULE_SETUP -ST_RET(NON_DIGGABLE_ID); - YY_BREAK -case 38: -YY_RULE_SETUP -ST_RET(NON_PASSWALL_ID); - YY_BREAK -case 39: -YY_RULE_SETUP -ST_RET(IF_ID); - YY_BREAK -case 40: -YY_RULE_SETUP -ST_RET(ELSE_ID); - YY_BREAK -case 41: -YY_RULE_SETUP -ST_RET(EXIT_ID); - YY_BREAK -case 42: -YY_RULE_SETUP -ST_RET(ROOM_ID); - YY_BREAK -case 43: -YY_RULE_SETUP -ST_RET(SUBROOM_ID); - YY_BREAK -case 44: -YY_RULE_SETUP -ST_RET(RAND_CORRIDOR_ID); - YY_BREAK -case 45: -YY_RULE_SETUP -ST_RET(CORRIDOR_ID); - YY_BREAK -case 46: -YY_RULE_SETUP -ST_RET(TERRAIN_ID); - YY_BREAK -case 47: -YY_RULE_SETUP -ST_RET(terrain_ID); - YY_BREAK -case 48: -YY_RULE_SETUP -ST_RET(REPLACE_TERRAIN_ID); - YY_BREAK -case 49: -YY_RULE_SETUP -ST_RET(GOLD_ID); - YY_BREAK -case 50: -YY_RULE_SETUP -ST_RET(GRAVE_ID); - YY_BREAK -case 51: -YY_RULE_SETUP -ST_RET(ENGRAVING_ID); - YY_BREAK -case 52: -YY_RULE_SETUP -ST_RET(MINERALIZE_ID); - YY_BREAK -case 53: -YY_RULE_SETUP -ST_RET(NAME_ID); - YY_BREAK -case 54: -YY_RULE_SETUP -ST_RET(FOR_ID); - YY_BREAK -case 55: -YY_RULE_SETUP -ST_RET(TO_ID); - YY_BREAK -case 56: -YY_RULE_SETUP -ST_RET(LOOP_ID); - YY_BREAK -case 57: -YY_RULE_SETUP -ST_RET(SWITCH_ID); - YY_BREAK -case 58: -YY_RULE_SETUP -ST_RET(CASE_ID); - YY_BREAK -case 59: -YY_RULE_SETUP -ST_RET(BREAK_ID); - YY_BREAK -case 60: -YY_RULE_SETUP -ST_RET(DEFAULT_ID); - YY_BREAK -case 61: -YY_RULE_SETUP -ST_RET(FUNCTION_ID); - YY_BREAK -case 62: -YY_RULE_SETUP -ST_RET(SHUFFLE_ID); - YY_BREAK -case 63: -YY_RULE_SETUP -ST_RET(MONTYPE_ID); - YY_BREAK -case 64: -YY_RULE_SETUP -ST_RET(selection_ID); - YY_BREAK -case 65: -YY_RULE_SETUP -ST_RET(rect_ID); - YY_BREAK -case 66: -YY_RULE_SETUP -ST_RET(fillrect_ID); - YY_BREAK -case 67: -YY_RULE_SETUP -ST_RET(line_ID); - YY_BREAK -case 68: -YY_RULE_SETUP -ST_RET(randline_ID); - YY_BREAK -case 69: -YY_RULE_SETUP -ST_RET(grow_ID); - YY_BREAK -case 70: -YY_RULE_SETUP -ST_RET(flood_ID); - YY_BREAK -case 71: -YY_RULE_SETUP -ST_RET(rndcoord_ID); - YY_BREAK -case 72: -YY_RULE_SETUP -ST_RET(circle_ID); - YY_BREAK -case 73: -YY_RULE_SETUP -ST_RET(ellipse_ID); - YY_BREAK -case 74: -YY_RULE_SETUP -ST_RET(filter_ID); - YY_BREAK -case 75: -YY_RULE_SETUP -ST_RET(gradient_ID); - YY_BREAK -case 76: -YY_RULE_SETUP -ST_RET(complement_ID); - YY_BREAK -case 77: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=SEL_GRADIENT_RADIAL; return GRADIENT_TYPE; } - YY_BREAK -case 78: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=SEL_GRADIENT_SQUARE; return GRADIENT_TYPE; } - YY_BREAK -case 79: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=DRY; return HUMIDITY_TYPE; } - YY_BREAK -case 80: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=WET; return HUMIDITY_TYPE; } - YY_BREAK -case 81: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=HOT; return HUMIDITY_TYPE; } - YY_BREAK -case 82: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=SOLID; return HUMIDITY_TYPE; } - YY_BREAK -case 83: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=ANY_LOC; return HUMIDITY_TYPE; } - YY_BREAK -case 84: -YY_RULE_SETUP -ST_RET(LEV); - YY_BREAK -case 85: -YY_RULE_SETUP -ST_RET(QUANTITY_ID); - YY_BREAK -case 86: -YY_RULE_SETUP -ST_RET(BURIED_ID); - YY_BREAK -case 87: -YY_RULE_SETUP -ST_RET(ERODED_ID); - YY_BREAK -case 88: -YY_RULE_SETUP -ST_RET(ERODEPROOF_ID); - YY_BREAK -case 89: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=1; return TRAPPED_STATE; } - YY_BREAK -case 90: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=0; return TRAPPED_STATE; } - YY_BREAK -case 91: -YY_RULE_SETUP -ST_RET(RECHARGED_ID); - YY_BREAK -case 92: -YY_RULE_SETUP -ST_RET(INVIS_ID); - YY_BREAK -case 93: -YY_RULE_SETUP -ST_RET(GREASED_ID); - YY_BREAK -case 94: -YY_RULE_SETUP -ST_RET(FEMALE_ID); - YY_BREAK -case 95: -YY_RULE_SETUP -ST_RET(CANCELLED_ID); - YY_BREAK -case 96: -YY_RULE_SETUP -ST_RET(REVIVED_ID); - YY_BREAK -case 97: -YY_RULE_SETUP -ST_RET(AVENGE_ID); - YY_BREAK -case 98: -YY_RULE_SETUP -ST_RET(FLEEING_ID); - YY_BREAK -case 99: -YY_RULE_SETUP -ST_RET(BLINDED_ID); - YY_BREAK -case 100: -YY_RULE_SETUP -ST_RET(PARALYZED_ID); - YY_BREAK -case 101: -YY_RULE_SETUP -ST_RET(STUNNED_ID); - YY_BREAK -case 102: -YY_RULE_SETUP -ST_RET(CONFUSED_ID); - YY_BREAK -case 103: -YY_RULE_SETUP -ST_RET(SEENTRAPS_ID); - YY_BREAK -case 104: -YY_RULE_SETUP -ST_RET(ALL_ID); - YY_BREAK -case 105: -YY_RULE_SETUP -ST_RETF((yylval.i=1), HORIZ_OR_VERT); - YY_BREAK -case 106: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=2; return HORIZ_OR_VERT; } - YY_BREAK -case 107: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=D_ISOPEN; return DOOR_STATE; } - YY_BREAK -case 108: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=D_CLOSED; return DOOR_STATE; } - YY_BREAK -case 109: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=D_LOCKED; return DOOR_STATE; } - YY_BREAK -case 110: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=D_NODOOR; return DOOR_STATE; } - YY_BREAK -case 111: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=D_BROKEN; return DOOR_STATE; } - YY_BREAK -case 112: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=D_SECRET; return DOOR_STATE; } - YY_BREAK -case 113: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=W_NORTH; return DIRECTION; } - YY_BREAK -case 114: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=W_EAST; return DIRECTION; } - YY_BREAK -case 115: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=W_SOUTH; return DIRECTION; } - YY_BREAK -case 116: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=W_WEST; return DIRECTION; } - YY_BREAK -case 117: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i = -1; return RANDOM_TYPE; } - YY_BREAK -case 118: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i = -1; return RANDOM_TYPE_BRACKET; } - YY_BREAK -case 119: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i = -2; return NONE; } - YY_BREAK -case 120: -YY_RULE_SETUP -ST_RET(A_REGISTER); - YY_BREAK -case 121: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=1; return LEFT_OR_RIGHT; } - YY_BREAK -case 122: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=2; return LEFT_OR_RIGHT; } - YY_BREAK -case 123: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=3; return CENTER; } - YY_BREAK -case 124: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=4; return LEFT_OR_RIGHT; } - YY_BREAK -case 125: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=5; return LEFT_OR_RIGHT; } - YY_BREAK -case 126: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=1; return TOP_OR_BOT; } - YY_BREAK -case 127: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=5; return TOP_OR_BOT; } - YY_BREAK -case 128: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=1; return LIGHT_STATE; } - YY_BREAK -case 129: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=0; return LIGHT_STATE; } - YY_BREAK -case 130: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=1; return FILLING; } - YY_BREAK -case 131: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=0; return FILLING; } - YY_BREAK -case 132: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=0; return IRREGULAR; } - YY_BREAK -case 133: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=1; return IRREGULAR; } - YY_BREAK -case 134: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=1; return JOINED; } - YY_BREAK -case 135: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=0; return JOINED; } - YY_BREAK -case 136: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=1; return LIMITED; } - YY_BREAK -case 137: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=0; return LIMITED; } - YY_BREAK -case 138: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i= AM_NONE; return ALIGNMENT; } - YY_BREAK -case 139: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i= AM_LAWFUL; return ALIGNMENT; } - YY_BREAK -case 140: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i= AM_NEUTRAL; return ALIGNMENT; } - YY_BREAK -case 141: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i= AM_CHAOTIC; return ALIGNMENT; } - YY_BREAK -case 142: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i= AM_SPLEV_CO; return ALIGNMENT; } - YY_BREAK -case 143: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i= AM_SPLEV_NONCO; return ALIGNMENT; } - YY_BREAK -case 144: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=1; return MON_ATTITUDE; } - YY_BREAK -case 145: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=0; return MON_ATTITUDE; } - YY_BREAK -case 146: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=1; return MON_ALERTNESS; } - YY_BREAK -case 147: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=0; return MON_ALERTNESS; } - YY_BREAK -case 148: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i= M_AP_FURNITURE; return MON_APPEARANCE; } - YY_BREAK -case 149: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i= M_AP_MONSTER; return MON_APPEARANCE; } - YY_BREAK -case 150: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i= M_AP_OBJECT; return MON_APPEARANCE; } - YY_BREAK -case 151: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=2; return ALTAR_TYPE; } - YY_BREAK -case 152: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=1; return ALTAR_TYPE; } - YY_BREAK -case 153: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=0; return ALTAR_TYPE; } - YY_BREAK -case 154: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=1; return UP_OR_DOWN; } - YY_BREAK -case 155: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=0; return UP_OR_DOWN; } - YY_BREAK -case 156: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=0; return BOOLEAN; } - YY_BREAK -case 157: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=1; return BOOLEAN; } - YY_BREAK -case 158: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=DUST; return ENGRAVING_TYPE; } - YY_BREAK -case 159: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=ENGRAVE; return ENGRAVING_TYPE; } - YY_BREAK -case 160: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=BURN; return ENGRAVING_TYPE; } - YY_BREAK -case 161: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=MARK; return ENGRAVING_TYPE; } - YY_BREAK -case 162: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=ENGR_BLOOD; return ENGRAVING_TYPE; } - YY_BREAK -case 163: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=1; return CURSE_TYPE; } - YY_BREAK -case 164: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=2; return CURSE_TYPE; } - YY_BREAK -case 165: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=3; return CURSE_TYPE; } - YY_BREAK -case 166: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=NOTELEPORT; return FLAG_TYPE; } - YY_BREAK -case 167: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=HARDFLOOR; return FLAG_TYPE; } - YY_BREAK -case 168: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=NOMMAP; return FLAG_TYPE; } - YY_BREAK -case 169: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=ARBOREAL; return FLAG_TYPE; } /* KMH */ - YY_BREAK -case 170: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=SHORTSIGHTED; return FLAG_TYPE; } - YY_BREAK -case 171: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=MAZELEVEL; return FLAG_TYPE; } - YY_BREAK -case 172: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=PREMAPPED; return FLAG_TYPE; } - YY_BREAK -case 173: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=SHROUD; return FLAG_TYPE; } - YY_BREAK -case 174: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=GRAVEYARD; return FLAG_TYPE; } - YY_BREAK -case 175: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=ICEDPOOLS; return FLAG_TYPE; } - YY_BREAK -case 176: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=SOLIDIFY; return FLAG_TYPE; } - YY_BREAK -case 177: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=CORRMAZE; return FLAG_TYPE; } - YY_BREAK -case 178: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=CHECK_INACCESSIBLES; return FLAG_TYPE; } - YY_BREAK -case 179: -YY_RULE_SETUP -{ char *p = index(yytext, 'd'); - savetoken(yytext); - if (p) { - *p++ = '\0'; - yylval.dice.num = atoi(yytext); - yylval.dice.die = atoi(p); - } else { - yylval.dice.num = yylval.dice.die = 1; - } - return DICE; - } - YY_BREAK -case 180: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i = atoi(yytext + 1); - if (yylval.i < 0 || yylval.i > 100) - lc_error("Unexpected percentile '%li%%'", yylval.i); - return PERCENT; } - YY_BREAK -case 181: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=atoi(yytext); return MINUS_INTEGER; } - YY_BREAK -case 182: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=atoi(yytext); return PLUS_INTEGER; } - YY_BREAK -case 183: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i = atoi(yytext); - if (yylval.i < 0 || yylval.i > 100) - lc_error("Unexpected percentile '%li%%'", yylval.i); - return SPERCENT; } - YY_BREAK -case 184: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i=atoi(yytext); return INTEGER; } - YY_BREAK -case 185: -/* rule 185 can match eol */ -YY_RULE_SETUP -{ savetoken(yytext); - yytext[yyleng - 1] = '\0'; /* discard the trailing \" */ - yylval.map = dupstr(yytext + 1); /* skip the first \" */ - return STRING; } - YY_BREAK -case 186: -YY_RULE_SETUP -{ savetoken(yytext); return handle_varstring_check(); } - YY_BREAK -case 187: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i = SPO_JE; return COMPARE_TYPE; } - YY_BREAK -case 188: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i = SPO_JNE; return COMPARE_TYPE; } - YY_BREAK -case 189: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i = SPO_JNE; return COMPARE_TYPE; } - YY_BREAK -case 190: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i = SPO_JLE; return COMPARE_TYPE; } - YY_BREAK -case 191: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i = SPO_JGE; return COMPARE_TYPE; } - YY_BREAK -case 192: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i = SPO_JL; return COMPARE_TYPE; } - YY_BREAK -case 193: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i = SPO_JG; return COMPARE_TYPE; } - YY_BREAK -case 194: -/* rule 194 can match eol */ -YY_RULE_SETUP -{ newline(); } - YY_BREAK -case 195: -YY_RULE_SETUP -{ advancepos(yytext); } - YY_BREAK -case 196: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i = yytext[2]; return CHAR; } - YY_BREAK -case 197: -YY_RULE_SETUP -{ savetoken(yytext); yylval.i = yytext[1]; return CHAR; } - YY_BREAK -case 198: -YY_RULE_SETUP -ST_RET(UNKNOWN_TYPE); - YY_BREAK -case 199: -YY_RULE_SETUP -{ savetoken(yytext); return yytext[0]; } - YY_BREAK -case 200: -YY_RULE_SETUP -ECHO; - YY_BREAK -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(MAPC): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of user's declarations */ -} /* end of yylex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer () -{ - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = (yytext_ptr); - yy_size_t number_to_move, i; - int ret_val; - - if ((yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1]) - YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed"); - - if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0) { - /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } else { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for (i = 0; i < number_to_move; ++i) - *(dest++) = *(source++); - - if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING) { - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - } else { - yy_size_t num_to_read; - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; - - /* [pr] This could probably be (b->yy_buf_size < number_to_move) - * since the allocated size is actually b->yy_buf_size + 2. - * The old code calculated num_to_read above (with same formula - * as is used below), then used (num_to_read <= 0) here, which - * got broken when num_to_read was changed to an unsigned type. */ - while (b->yy_buf_size <= number_to_move + 1) { - /* Not enough room in the buffer - grow it. */ - - int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) { - b->yy_buf_size += b->yy_buf_size / 4; - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if (! b->yy_ch_buf) - YY_FATAL_ERROR("fatal error - scanner input buffer overflow"); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - } - - num_to_read = b->yy_buf_size - number_to_move - 1; - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ((yy_n_chars) == 0) { - if (number_to_move == YY_MORE_ADJ) { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); - } else { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; - } - } else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) - > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) - yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if (! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) - YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()"); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before EOB char was reached */ - -static yy_state_type yy_get_previous_state () -{ - yy_state_type yy_current_state; - char *yy_cp; - - yy_current_state = (yy_start); - yy_current_state += YY_AT_BOL(); - - for (yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp) { - - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 1057 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -static yy_state_type yy_try_NUL_trans (yy_current_state ) - yy_state_type yy_current_state; -{ - int yy_is_jam; - char *yy_cp = (yy_c_buf_p); - - YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 1057 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 1056); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_UNPUT - -void yyunput (c,yy_bp ) - int c; - char * yy_bp; -{ - char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - yy_size_t number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#endif - -#ifndef YY_NO_INPUT -static int input () -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart(yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - return input(); - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(uchar *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); - - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - -void yyrestart (input_file ) - FILE * input_file; -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ -void yy_switch_to_buffer (new_buffer ) - YY_BUFFER_STATE new_buffer; -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void yy_load_buffer_state () -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ -YY_BUFFER_STATE yy_create_buffer (file,size ) - FILE * file; - int size; -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - if (!size) - size = YY_BUF_SIZE; - - b->yy_buf_size = (yy_size_t)size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ -void yy_delete_buffer (b ) - YY_BUFFER_STATE b; -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); - - yyfree((void *) b ); -} - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ -static void yy_init_buffer (b,file ) - YY_BUFFER_STATE b; - FILE * file; -{ - int oerrno = errno; - - yy_flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ -void yy_flush_buffer (b ) - YY_BUFFER_STATE b; -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yypush_buffer_state (new_buffer ) - YY_BUFFER_STATE new_buffer; -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yypop_buffer_state () -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack () -{ - yy_size_t num_to_alloc; - - if (!(yy_buffer_stack)) { - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ -#if 1 /* [PR] avoid C++-style comment; older C compilers choke on it */ - num_to_alloc = 2; /* also changed to match the comment... */ -#else - num_to_alloc = 1; // After all that talk, this was set to 1 anyways... -#endif - (yy_buffer_stack) = (struct yy_buffer_state**) - yyalloc(num_to_alloc * sizeof(struct yy_buffer_state*) ); - if (!(yy_buffer_stack)) - YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()"); - - (void) memset((yy_buffer_stack), 0, - num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1) { - /* Increase the buffer to prepare for a possible push. */ - yy_size_t grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**) - yyrealloc((yy_buffer_stack),num_to_alloc * sizeof(struct yy_buffer_state*) ); - if (!(yy_buffer_stack)) - YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()"); - - /* zero only the new slots.*/ - (void) memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, - grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified - * character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (base,size ) - char * base; - yy_size_t size; -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer(b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to yylex() - * will scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (yystr ) - yyconst char * yystr; -{ - - return yy_scan_bytes(yystr,strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to - * yylex() will scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a - * bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (yybytes,_yybytes_len ) - yyconst char * yybytes; - yy_size_t _yybytes_len; -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - yy_size_t i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (msg ) - yyconst char* msg; -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg); \ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int yyget_lineno () -{ - - return yylineno; -} - -/** Get the input stream. - * - */ -FILE *yyget_in () -{ - return yyin; -} - -/** Get the output stream. - * - */ -FILE *yyget_out () -{ - return yyout; -} - -/** Get the length of the current token. - * - */ -yy_size_t yyget_leng () -{ - return yyleng; -} - -/** Get the current token. - * - */ - -char *yyget_text () -{ - return yytext; -} - -/** Set the current line number. - * @param _line_number line number - * - */ -void yyset_lineno (_line_number ) - int _line_number; -{ - - yylineno = _line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param _in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void yyset_in (_in_str ) - FILE * _in_str; -{ - yyin = _in_str ; -} - -void yyset_out (_out_str ) - FILE * _out_str; -{ - yyout = _out_str ; -} - -int yyget_debug () -{ - return yy_flex_debug; -} - -void yyset_debug (_bdebug ) - int _bdebug; -{ - yy_flex_debug = _bdebug ; -} - -static int yy_init_globals () -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = (FILE *) 0; - yyout = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy () -{ - - /* Pop the buffer stack, destroying each element. */ - while (YY_CURRENT_BUFFER) { - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner - * so the next time yylex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (s1,s2,n ) - char* s1; - yyconst char * s2; - int n; -{ - - int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (s ) - yyconst char * s; -{ - int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *yyalloc (size ) - yy_size_t size; -{ - - return (void *) malloc( size ); -} - -void *yyrealloc (ptr,size ) - void * ptr; - yy_size_t size; -{ - - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void yyfree (ptr ) - void * ptr; -{ - - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -#ifdef AMIGA -long * -alloc(n) - unsigned n; -{ - return (long *) malloc(n); -} -#endif - -/* routine to switch to another input file; needed for flex */ -void -init_yyin( input_f ) -FILE *input_f; -{ -#if defined(FLEX_SCANNER) || defined(FLEXHACK_SCANNER) - if (yyin) - yyrestart(input_f); - else -#endif - yyin = input_f; - - if (!orig_yyin) - orig_yyin = yyin; -} -/* analogous routine (for completeness) */ -void -init_yyout( output_f ) -FILE *output_f; -{ - yyout = output_f; -} - -long -handle_varstring_check() -{ - struct lc_vardefs *vd; - - yylval.map = dupstr(yytext); - if ((vd = vardef_defined(vardefs, yytext, 1)) != 0) { - long l = vd->var_type; - int a = ((l & SPOVAR_ARRAY) == SPOVAR_ARRAY); - - l &= ~SPOVAR_ARRAY; - if (l == SPOVAR_INT) - return (a ? VARSTRING_INT_ARRAY : VARSTRING_INT); - if (l == SPOVAR_STRING) - return (a ? VARSTRING_STRING_ARRAY : VARSTRING_STRING); - if (l == SPOVAR_VARIABLE) - return (a ? VARSTRING_VAR_ARRAY : VARSTRING_VAR); - if (l == SPOVAR_COORD) - return (a ? VARSTRING_COORD_ARRAY : VARSTRING_COORD); - if (l == SPOVAR_REGION) - return (a ? VARSTRING_REGION_ARRAY : VARSTRING_REGION); - if (l == SPOVAR_MAPCHAR) - return (a ? VARSTRING_MAPCHAR_ARRAY : VARSTRING_MAPCHAR); - if (l == SPOVAR_MONST) - return (a ? VARSTRING_MONST_ARRAY : VARSTRING_MONST); - if (l == SPOVAR_OBJ) - return (a ? VARSTRING_OBJ_ARRAY : VARSTRING_OBJ); - if (l == SPOVAR_SEL) - return (a ? VARSTRING_SEL_ARRAY : VARSTRING_SEL); - } - return VARSTRING; -} - -void -newline() -{ - nh_line_number++; - token_start_pos = 0; - (void) memset((genericptr_t) curr_token, 0, 512); -} - -void -savetoken(s) -char *s; -{ - Sprintf(curr_token, "%s", s); - advancepos(s); -} - -void -advancepos(s) -char *s; -{ - token_start_pos += strlen(s); -} - -/*lev_comp.l*/ - diff --git a/sys/share/lev_yacc.c b/sys/share/lev_yacc.c deleted file mode 100644 index b6ac4d935..000000000 --- a/sys/share/lev_yacc.c +++ /dev/null @@ -1,4985 +0,0 @@ -#ifndef lint -/* static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; */ -/* static char nhsccsid[] = "@(#)yaccpar 1.9.0-nh (NetHack) 12/03/2015"; */ -#endif -#define YYBYACC 1 -#define YYMAJOR 1 -#define YYMINOR 9 -#define YYSUBMINOR "0-nh" - -#define yyclearin (yychar=(-1)) -#define yyerrok (yyerrflag=0) -#define YYRECOVERING (yyerrflag!=0) -#define YYPREFIX "yy" -/* NetHack 3.6 lev_comp.y $NHDT-Date: 1551901401 2019/03/06 19:43:21 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.26 $ */ -/* Copyright (c) 1989 by Jean-Christophe Collet */ -/* NetHack may be freely redistributed. See license for details. */ - -/* - * This file contains the Level Compiler code - * It may handle special mazes & special room-levels - */ - -/* In case we're using bison in AIX. This definition must be - * placed before any other C-language construct in the file - * excluding comments and preprocessor directives (thanks IBM - * for this wonderful feature...). - * - * Note: some cpps barf on this 'undefined control' (#pragma). - * Addition of the leading space seems to prevent barfage for now, - * and AIX will still see the directive. - */ -#ifdef _AIX - #pragma alloca /* keep leading space! */ -#endif - -#define SPEC_LEV /* for USE_OLDARGS (sp_lev.h) */ -#include "hack.h" -#include "sp_lev.h" - -#define ERR (-1) -/* many types of things are put in chars for transference to NetHack. - * since some systems will use signed chars, limit everybody to the - * same number for portability. - */ -#define MAX_OF_TYPE 128 - -#define MAX_NESTED_IFS 20 -#define MAX_SWITCH_CASES 20 - -#define New(type) \ - (type *) memset((genericptr_t) alloc(sizeof (type)), 0, sizeof (type)) -#define NewTab(type, size) (type **) alloc(sizeof (type *) * size) -#define Free(ptr) free((genericptr_t) ptr) - -extern void VDECL(lc_error, (const char *, ...)); -extern void VDECL(lc_warning, (const char *, ...)); -extern void FDECL(yyerror, (const char *)); -extern void FDECL(yywarning, (const char *)); -extern int NDECL(yylex); -int NDECL(yyparse); - -extern int FDECL(get_floor_type, (CHAR_P)); -extern int FDECL(get_room_type, (char *)); -extern int FDECL(get_trap_type, (char *)); -extern int FDECL(get_monster_id, (char *,CHAR_P)); -extern int FDECL(get_object_id, (char *,CHAR_P)); -extern boolean FDECL(check_monster_char, (CHAR_P)); -extern boolean FDECL(check_object_char, (CHAR_P)); -extern char FDECL(what_map_char, (CHAR_P)); -extern void FDECL(scan_map, (char *, sp_lev *)); -extern void FDECL(add_opcode, (sp_lev *, int, genericptr_t)); -extern genericptr_t FDECL(get_last_opcode_data1, (sp_lev *, int)); -extern genericptr_t FDECL(get_last_opcode_data2, (sp_lev *, int, int)); -extern boolean FDECL(check_subrooms, (sp_lev *)); -extern boolean FDECL(write_level_file, (char *,sp_lev *)); -extern struct opvar *FDECL(set_opvar_int, (struct opvar *, long)); -extern void VDECL(add_opvars, (sp_lev *, const char *, ...)); -extern void FDECL(start_level_def, (sp_lev * *, char *)); - -extern struct lc_funcdefs *FDECL(funcdef_new, (long,char *)); -extern void FDECL(funcdef_free_all, (struct lc_funcdefs *)); -extern struct lc_funcdefs *FDECL(funcdef_defined, (struct lc_funcdefs *, - char *, int)); -extern char *FDECL(funcdef_paramtypes, (struct lc_funcdefs *)); -extern char *FDECL(decode_parm_str, (char *)); - -extern struct lc_vardefs *FDECL(vardef_new, (long,char *)); -extern void FDECL(vardef_free_all, (struct lc_vardefs *)); -extern struct lc_vardefs *FDECL(vardef_defined, (struct lc_vardefs *, - char *, int)); - -extern void NDECL(break_stmt_start); -extern void FDECL(break_stmt_end, (sp_lev *)); -extern void FDECL(break_stmt_new, (sp_lev *, long)); - -extern void FDECL(splev_add_from, (sp_lev *, sp_lev *)); - -extern void FDECL(check_vardef_type, (struct lc_vardefs *, char *, long)); -extern void FDECL(vardef_used, (struct lc_vardefs *, char *)); -extern struct lc_vardefs *FDECL(add_vardef_type, (struct lc_vardefs *, - char *, long)); - -extern int FDECL(reverse_jmp_opcode, (int)); - -struct coord { - long x; - long y; -}; - -struct forloopdef { - char *varname; - long jmp_point; -}; -static struct forloopdef forloop_list[MAX_NESTED_IFS]; -static short n_forloops = 0; - - -sp_lev *splev = NULL; - -static struct opvar *if_list[MAX_NESTED_IFS]; - -static short n_if_list = 0; - -unsigned int max_x_map, max_y_map; -int obj_containment = 0; - -int in_container_obj = 0; - -/* integer value is possibly an inconstant value (eg. dice notation - or a variable) */ -int is_inconstant_number = 0; - -int in_switch_statement = 0; -static struct opvar *switch_check_jump = NULL; -static struct opvar *switch_default_case = NULL; -static struct opvar *switch_case_list[MAX_SWITCH_CASES]; -static long switch_case_value[MAX_SWITCH_CASES]; -int n_switch_case_list = 0; - -int allow_break_statements = 0; -struct lc_breakdef *break_list = NULL; - -extern struct lc_vardefs *vardefs; /* variable definitions */ - - -struct lc_vardefs *function_tmp_var_defs = NULL; -extern struct lc_funcdefs *function_definitions; -struct lc_funcdefs *curr_function = NULL; -struct lc_funcdefs_parm * curr_function_param = NULL; -int in_function_definition = 0; -sp_lev *function_splev_backup = NULL; - -extern int fatal_error; -extern int got_errors; -extern int line_number; -extern const char *fname; - -extern char curr_token[512]; - -typedef union -{ - long i; - char *map; - struct { - long room; - long wall; - long door; - } corpos; - struct { - long area; - long x1; - long y1; - long x2; - long y2; - } lregn; - struct { - long x; - long y; - } crd; - struct { - long ter; - long lit; - } terr; - struct { - long height; - long width; - } sze; - struct { - long die; - long num; - } dice; - struct { - long cfunc; - char *varstr; - } meth; -} YYSTYPE; -#define CHAR 257 -#define INTEGER 258 -#define BOOLEAN 259 -#define PERCENT 260 -#define SPERCENT 261 -#define MINUS_INTEGER 262 -#define PLUS_INTEGER 263 -#define MAZE_GRID_ID 264 -#define SOLID_FILL_ID 265 -#define MINES_ID 266 -#define ROGUELEV_ID 267 -#define MESSAGE_ID 268 -#define MAZE_ID 269 -#define LEVEL_ID 270 -#define LEV_INIT_ID 271 -#define GEOMETRY_ID 272 -#define NOMAP_ID 273 -#define OBJECT_ID 274 -#define COBJECT_ID 275 -#define MONSTER_ID 276 -#define TRAP_ID 277 -#define DOOR_ID 278 -#define DRAWBRIDGE_ID 279 -#define object_ID 280 -#define monster_ID 281 -#define terrain_ID 282 -#define MAZEWALK_ID 283 -#define WALLIFY_ID 284 -#define REGION_ID 285 -#define FILLING 286 -#define IRREGULAR 287 -#define JOINED 288 -#define ALTAR_ID 289 -#define LADDER_ID 290 -#define STAIR_ID 291 -#define NON_DIGGABLE_ID 292 -#define NON_PASSWALL_ID 293 -#define ROOM_ID 294 -#define PORTAL_ID 295 -#define TELEPRT_ID 296 -#define BRANCH_ID 297 -#define LEV 298 -#define MINERALIZE_ID 299 -#define CORRIDOR_ID 300 -#define GOLD_ID 301 -#define ENGRAVING_ID 302 -#define FOUNTAIN_ID 303 -#define POOL_ID 304 -#define SINK_ID 305 -#define NONE 306 -#define RAND_CORRIDOR_ID 307 -#define DOOR_STATE 308 -#define LIGHT_STATE 309 -#define CURSE_TYPE 310 -#define ENGRAVING_TYPE 311 -#define DIRECTION 312 -#define RANDOM_TYPE 313 -#define RANDOM_TYPE_BRACKET 314 -#define A_REGISTER 315 -#define ALIGNMENT 316 -#define LEFT_OR_RIGHT 317 -#define CENTER 318 -#define TOP_OR_BOT 319 -#define ALTAR_TYPE 320 -#define UP_OR_DOWN 321 -#define SUBROOM_ID 322 -#define NAME_ID 323 -#define FLAGS_ID 324 -#define FLAG_TYPE 325 -#define MON_ATTITUDE 326 -#define MON_ALERTNESS 327 -#define MON_APPEARANCE 328 -#define ROOMDOOR_ID 329 -#define IF_ID 330 -#define ELSE_ID 331 -#define TERRAIN_ID 332 -#define HORIZ_OR_VERT 333 -#define REPLACE_TERRAIN_ID 334 -#define EXIT_ID 335 -#define SHUFFLE_ID 336 -#define QUANTITY_ID 337 -#define BURIED_ID 338 -#define LOOP_ID 339 -#define FOR_ID 340 -#define TO_ID 341 -#define SWITCH_ID 342 -#define CASE_ID 343 -#define BREAK_ID 344 -#define DEFAULT_ID 345 -#define ERODED_ID 346 -#define TRAPPED_STATE 347 -#define RECHARGED_ID 348 -#define INVIS_ID 349 -#define GREASED_ID 350 -#define FEMALE_ID 351 -#define CANCELLED_ID 352 -#define REVIVED_ID 353 -#define AVENGE_ID 354 -#define FLEEING_ID 355 -#define BLINDED_ID 356 -#define PARALYZED_ID 357 -#define STUNNED_ID 358 -#define CONFUSED_ID 359 -#define SEENTRAPS_ID 360 -#define ALL_ID 361 -#define MONTYPE_ID 362 -#define GRAVE_ID 363 -#define ERODEPROOF_ID 364 -#define FUNCTION_ID 365 -#define MSG_OUTPUT_TYPE 366 -#define COMPARE_TYPE 367 -#define UNKNOWN_TYPE 368 -#define rect_ID 369 -#define fillrect_ID 370 -#define line_ID 371 -#define randline_ID 372 -#define grow_ID 373 -#define selection_ID 374 -#define flood_ID 375 -#define rndcoord_ID 376 -#define circle_ID 377 -#define ellipse_ID 378 -#define filter_ID 379 -#define complement_ID 380 -#define gradient_ID 381 -#define GRADIENT_TYPE 382 -#define LIMITED 383 -#define HUMIDITY_TYPE 384 -#define STRING 385 -#define MAP_ID 386 -#define NQSTRING 387 -#define VARSTRING 388 -#define CFUNC 389 -#define CFUNC_INT 390 -#define CFUNC_STR 391 -#define CFUNC_COORD 392 -#define CFUNC_REGION 393 -#define VARSTRING_INT 394 -#define VARSTRING_INT_ARRAY 395 -#define VARSTRING_STRING 396 -#define VARSTRING_STRING_ARRAY 397 -#define VARSTRING_VAR 398 -#define VARSTRING_VAR_ARRAY 399 -#define VARSTRING_COORD 400 -#define VARSTRING_COORD_ARRAY 401 -#define VARSTRING_REGION 402 -#define VARSTRING_REGION_ARRAY 403 -#define VARSTRING_MAPCHAR 404 -#define VARSTRING_MAPCHAR_ARRAY 405 -#define VARSTRING_MONST 406 -#define VARSTRING_MONST_ARRAY 407 -#define VARSTRING_OBJ 408 -#define VARSTRING_OBJ_ARRAY 409 -#define VARSTRING_SEL 410 -#define VARSTRING_SEL_ARRAY 411 -#define METHOD_INT 412 -#define METHOD_INT_ARRAY 413 -#define METHOD_STRING 414 -#define METHOD_STRING_ARRAY 415 -#define METHOD_VAR 416 -#define METHOD_VAR_ARRAY 417 -#define METHOD_COORD 418 -#define METHOD_COORD_ARRAY 419 -#define METHOD_REGION 420 -#define METHOD_REGION_ARRAY 421 -#define METHOD_MAPCHAR 422 -#define METHOD_MAPCHAR_ARRAY 423 -#define METHOD_MONST 424 -#define METHOD_MONST_ARRAY 425 -#define METHOD_OBJ 426 -#define METHOD_OBJ_ARRAY 427 -#define METHOD_SEL 428 -#define METHOD_SEL_ARRAY 429 -#define DICE 430 -#define YYERRCODE 256 -short yylhs[] = { -1, - 0, 0, 73, 73, 74, 57, 57, 56, 56, 76, - 76, 76, 76, 55, 55, 54, 54, 46, 46, 14, - 14, 75, 75, 26, 26, 22, 22, 23, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 60, 60, 60, 61, 61, 85, 84, 84, 84, 84, - 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, - 84, 38, 38, 44, 44, 43, 43, 42, 42, 41, - 41, 39, 39, 40, 40, 129, 130, 100, 101, 98, - 45, 45, 31, 31, 31, 131, 133, 93, 134, 134, - 136, 135, 137, 135, 99, 138, 138, 139, 140, 94, - 141, 95, 142, 97, 144, 96, 143, 145, 143, 79, - 110, 110, 110, 83, 83, 65, 146, 147, 113, 148, - 112, 10, 10, 68, 68, 69, 69, 70, 70, 71, - 71, 87, 87, 15, 15, 13, 13, 16, 16, 11, - 11, 103, 103, 103, 1, 1, 2, 2, 105, 150, - 105, 149, 20, 20, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 35, 35, 35, 106, 152, 106, 151, 18, 18, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 120, 88, 104, 104, 121, 121, - 102, 117, 118, 109, 119, 82, 17, 17, 91, 114, - 108, 72, 72, 116, 115, 86, 107, 154, 111, 24, - 24, 80, 81, 81, 81, 92, 89, 90, 90, 3, - 3, 4, 4, 29, 29, 28, 28, 27, 27, 27, - 5, 5, 6, 6, 7, 7, 7, 12, 12, 12, - 8, 8, 9, 155, 155, 155, 132, 77, 77, 77, - 77, 32, 32, 32, 30, 30, 127, 127, 127, 33, - 124, 124, 124, 34, 34, 125, 125, 125, 36, 36, - 36, 36, 126, 126, 126, 37, 37, 37, 37, 123, - 123, 122, 122, 122, 122, 122, 122, 122, 122, 122, - 122, 122, 50, 50, 157, 158, 158, 128, 128, 64, - 64, 63, 63, 62, 62, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 48, 48, 156, 47, 47, 47, - 153, 153, 153, 153, 51, 51, 52, 52, 53, 53, - 25, 25, 67, 67, 66, -}; -short yylen[] = { 2, - 0, 1, 1, 2, 3, 3, 5, 1, 1, 5, - 5, 3, 16, 0, 2, 0, 2, 0, 2, 1, - 1, 0, 3, 3, 1, 0, 2, 3, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 3, 5, 3, 5, - 5, 5, 3, 3, 5, 5, 5, 7, 7, 7, - 5, 1, 3, 1, 3, 1, 3, 1, 3, 1, - 3, 1, 3, 1, 3, 0, 0, 8, 4, 1, - 0, 1, 1, 5, 3, 0, 0, 9, 0, 2, - 0, 5, 0, 4, 1, 2, 1, 6, 0, 3, - 0, 6, 0, 4, 0, 4, 1, 0, 4, 3, - 1, 3, 3, 5, 5, 7, 4, 0, 10, 0, - 12, 0, 2, 5, 1, 5, 1, 5, 1, 5, - 1, 9, 5, 1, 1, 1, 1, 1, 3, 1, - 1, 1, 7, 5, 1, 1, 1, 1, 3, 0, - 5, 4, 0, 3, 1, 1, 1, 1, 2, 1, - 1, 1, 1, 1, 3, 3, 3, 1, 1, 3, - 1, 1, 3, 3, 0, 5, 2, 0, 3, 1, - 3, 1, 3, 3, 1, 1, 3, 1, 1, 1, - 3, 1, 1, 1, 5, 7, 5, 8, 1, 3, - 5, 5, 7, 7, 6, 5, 0, 2, 3, 3, - 3, 1, 5, 9, 5, 3, 3, 0, 10, 0, - 1, 7, 5, 5, 3, 5, 7, 9, 1, 1, - 1, 1, 1, 0, 2, 1, 3, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, - 1, 1, 4, 1, 1, 4, 1, 1, 4, 1, - 4, 5, 1, 3, 1, 3, 1, 1, 4, 9, - 1, 1, 4, 1, 5, 1, 1, 4, 1, 1, - 5, 1, 1, 1, 4, 1, 1, 5, 1, 1, - 3, 1, 1, 3, 1, 4, 3, 3, 3, 3, - 3, 3, 1, 1, 3, 1, 3, 0, 1, 1, - 1, 1, 3, 0, 1, 1, 2, 2, 4, 6, - 4, 6, 6, 6, 6, 2, 6, 8, 8, 10, - 14, 2, 1, 3, 1, 3, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 10, 9, -}; -short yydefred[] = { 0, - 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, - 4, 0, 6, 0, 133, 0, 0, 0, 192, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 130, 0, 0, 0, 136, 145, 0, 0, 0, 0, - 93, 82, 73, 83, 74, 84, 75, 85, 76, 86, - 77, 87, 78, 88, 79, 89, 80, 90, 81, 5, - 0, 92, 91, 0, 30, 0, 29, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 149, - 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 155, 0, 0, 0, 0, 94, - 95, 0, 0, 0, 0, 342, 0, 345, 0, 387, - 0, 343, 0, 153, 0, 27, 0, 9, 8, 7, - 0, 304, 305, 0, 0, 340, 0, 0, 0, 12, - 313, 0, 195, 196, 0, 0, 310, 0, 0, 308, - 0, 337, 339, 0, 336, 334, 0, 333, 228, 224, - 225, 330, 332, 0, 329, 327, 0, 326, 0, 0, - 281, 280, 0, 291, 292, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 383, 250, 0, 366, 0, 318, 0, 317, 0, 0, - 0, 0, 0, 403, 0, 0, 266, 267, 283, 282, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 259, 261, 260, 390, 388, 389, 163, 162, - 0, 184, 185, 0, 0, 0, 0, 96, 0, 0, - 0, 0, 126, 0, 0, 0, 0, 135, 0, 0, - 0, 0, 0, 0, 0, 362, 0, 0, 0, 396, - 398, 395, 397, 399, 400, 0, 0, 0, 0, 0, - 0, 103, 0, 0, 104, 0, 150, 24, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 367, 368, 0, 0, 0, 376, 0, - 0, 0, 382, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 156, 0, 0, 151, 0, 0, 0, 0, 344, 352, - 0, 0, 0, 0, 349, 350, 351, 129, 0, 154, - 0, 0, 120, 118, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 341, 11, 262, 0, 10, - 0, 0, 314, 0, 0, 0, 198, 197, 0, 173, - 194, 0, 0, 0, 226, 0, 0, 203, 201, 245, - 183, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 324, 0, 0, 322, 0, 321, 0, 0, 0, 384, - 386, 0, 0, 293, 294, 0, 297, 0, 295, 0, - 296, 251, 0, 0, 0, 252, 0, 175, 0, 0, - 0, 0, 0, 256, 0, 0, 165, 164, 276, 401, - 402, 0, 177, 0, 0, 0, 0, 0, 265, 0, - 0, 147, 0, 0, 137, 274, 0, 0, 0, 356, - 0, 346, 134, 363, 98, 0, 0, 105, 0, 111, - 0, 106, 0, 107, 0, 102, 0, 101, 0, 100, - 28, 306, 0, 0, 316, 309, 0, 311, 0, 0, - 335, 393, 391, 392, 239, 236, 230, 0, 0, 235, - 0, 240, 0, 242, 243, 0, 238, 229, 244, 232, - 394, 0, 328, 0, 0, 0, 369, 0, 0, 0, - 371, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 319, 0, 0, 0, 0, 0, 0, 167, 0, 0, - 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, - 0, 0, 152, 146, 0, 0, 0, 127, 0, 0, - 0, 0, 121, 119, 112, 0, 114, 0, 116, 0, - 0, 0, 312, 193, 338, 0, 0, 0, 0, 0, - 331, 0, 246, 0, 0, 189, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 302, 301, - 272, 0, 0, 253, 0, 179, 0, 0, 254, 258, - 0, 0, 0, 0, 181, 0, 0, 187, 0, 186, - 159, 0, 0, 353, 354, 355, 0, 357, 0, 110, - 0, 109, 0, 108, 0, 0, 0, 234, 237, 241, - 231, 0, 298, 206, 207, 0, 211, 210, 212, 213, - 214, 0, 0, 0, 218, 219, 0, 299, 208, 204, - 0, 0, 248, 0, 372, 0, 377, 0, 373, 0, - 323, 374, 375, 0, 0, 0, 268, 303, 0, 0, - 0, 0, 0, 0, 190, 191, 0, 0, 0, 168, - 0, 0, 0, 0, 0, 0, 128, 113, 115, 117, - 263, 0, 0, 0, 0, 0, 0, 0, 19, 0, - 0, 325, 0, 0, 288, 289, 290, 0, 285, 0, - 0, 0, 174, 0, 0, 278, 166, 176, 0, 0, - 182, 264, 0, 143, 138, 140, 0, 300, 215, 216, - 217, 222, 0, 220, 378, 0, 379, 0, 0, 0, - 271, 269, 0, 0, 0, 170, 0, 169, 141, 0, - 0, 0, 0, 0, 0, 320, 287, 0, 405, 178, - 0, 180, 0, 144, 0, 223, 380, 15, 0, 404, - 171, 142, 0, 0, 0, 0, 20, 21, 0, 0, - 0, 13, 17, 381, -}; -short yydgoto[] = { 3, - 209, 449, 233, 271, 236, 486, 490, 671, 491, 351, - 757, 729, 689, 859, 294, 467, 614, 354, 578, 584, - 730, 80, 337, 822, 512, 133, 788, 789, 747, 345, - 81, 210, 258, 476, 814, 228, 218, 636, 425, 426, - 427, 428, 640, 638, 387, 733, 290, 375, 253, 696, - 329, 330, 331, 861, 835, 190, 4, 82, 83, 84, - 172, 314, 315, 316, 280, 264, 265, 500, 515, 678, - 687, 440, 5, 6, 10, 85, 254, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 277, 318, 478, 229, 219, 259, 529, 408, 697, - 173, 278, 626, 765, 766, 843, 830, 524, 130, 187, - 521, 319, 401, 295, 517, 272, 800, 841, 230, 359, - 220, 355, 580, 790, 196, 182, 530, 531, -}; -short yysindex[] = { 68, - 17, 31, 0, -217, 0, 68, -257, -226, 112, 5680, - 0, 136, 0, -136, 0, 170, 185, 201, 0, 225, - 229, 238, 244, 248, 251, 255, 266, 272, 275, 283, - 304, 309, 346, 366, 378, 380, 382, 383, 396, 397, - 398, 400, 401, 404, 405, 413, 415, -46, 417, 420, - 0, 426, 108, 489, 0, 0, 428, 101, -35, 449, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 432, 0, 0, 430, 0, 5680, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -190, 450, 0, -234, 62, -13, 41, 41, 40, -252, - -121, 109, 109, 1644, -34, 109, 109, 92, -34, -34, - -249, -20, -20, -20, -35, 458, -35, 109, 1644, 1644, - 1644, -160, -249, -174, 0, 1644, -34, 288, -35, 0, - 0, 439, 414, 109, 467, 0, -22, 0, 421, 0, - -9, 0, -14, 0, 163, 0, 385, 0, 0, 0, - -136, 0, 0, 423, 465, 0, 471, 473, 475, 0, - 0, 137, 0, 0, 490, 271, 0, 441, 496, 0, - 503, 0, 0, 276, 0, 0, 452, 0, 0, 0, - 0, 0, 0, 292, 0, 0, 470, 0, 512, 0, - 0, 0, 518, 0, 0, 523, 524, 526, -34, -34, - 109, 109, 540, 109, 542, 544, 545, 1644, 548, 5537, - 0, 0, 533, 0, 331, 0, 500, 0, 555, 558, - 559, 564, 347, 0, 571, 582, 0, 0, 0, 0, - 367, 584, 379, 592, 594, 595, 141, 596, 402, 597, - 588, 611, 0, 0, 0, 0, 0, 0, 0, 0, - 617, 0, 0, 628, 385, 638, 640, 0, 593, -35, - -35, 644, 0, 649, 159, -35, -35, 0, -35, -35, - -35, -35, -35, 651, 650, 0, 141, 465, 5680, 0, - 0, 0, 0, 0, 0, 642, -1, 4, 643, 647, - 653, 0, 141, 465, 0, 5680, 0, 0, -35, -234, - 445, 14, 455, 654, 614, 1644, 678, -35, 38, 476, - 338, 682, -35, 688, 385, 690, -35, 109, 385, 109, - 1644, 424, 431, 0, 0, 694, 696, 1298, 0, 109, - 109, 5435, 0, 360, 704, 1644, 702, -35, -165, -83, - 429, 491, 703, -20, 433, 0, 707, -24, 708, -20, - -20, -20, -35, 709, 10, 109, -91, -19, -121, 0, - 0, 9, 9, 0, 45, 655, -254, 560, 0, 0, - 75, 148, 79, 79, 0, 0, 0, 0, -14, 0, - 1644, 711, 0, 0, 16, 25, 27, 29, 141, 465, - 22, -10, -28, 631, 427, 0, 0, 0, 501, 0, - 715, 137, 0, 719, 505, 459, 0, 0, 503, 0, - 0, 381, 499, 2, 0, 403, 508, 0, 0, 0, - 0, 721, 723, 109, 109, 662, 743, 748, 746, 749, - 0, 750, 5448, 0, 701, 0, 751, 752, 753, 0, - 0, 554, 536, 0, 0, 754, 0, 726, 0, 774, - 0, 0, 775, 579, 785, 0, -165, 0, 581, 796, - 583, 798, 800, 0, 802, 535, 0, 0, 0, 0, - 0, 804, 0, 591, 806, 807, 521, 598, 0, 810, - 385, 0, 811, -35, 0, 0, 465, 801, 815, 0, - 814, 0, 0, 0, 0, 604, -35, 0, -234, 0, - -21, 0, 824, 0, 57, 0, 98, 0, 23, 0, - 0, 0, 825, 621, 0, 0, 827, 0, 493, 839, - 0, 0, 0, 0, 0, 0, 0, 823, 826, 0, - 828, 0, 830, 0, 0, 832, 0, 0, 0, 0, - 0, 841, 0, 848, -121, 641, 0, 857, 590, 1644, - 0, -35, -35, 1644, 859, -35, 1644, 1644, 864, 861, - 0, -249, 648, -148, 652, 135, 586, 0, 867, -5, - 868, 528, 587, 0, -35, 870, -234, 871, 6, 72, - 385, 9, 0, 0, 141, 793, 1, 0, 560, 166, - 141, 465, 0, 0, 0, 32, 0, 33, 0, 35, - -165, 873, 0, 0, 0, -234, -35, -35, -35, 40, - 0, 5526, 0, 876, -35, 0, 880, 174, 686, 881, - -165, 569, 882, 883, -35, 685, 900, 852, 0, 0, - 0, 902, 691, 0, 693, 0, 110, 908, 0, 0, - 928, -184, 465, 716, 0, 717, 900, 0, 929, 0, - 0, 932, 90, 0, 0, 0, 385, 0, 57, 0, - 98, 0, 23, 0, 936, 722, 465, 0, 0, 0, - 0, 56, 0, 0, 0, -234, 0, 0, 0, 0, - 0, 920, 921, 924, 0, 0, 925, 0, 0, 0, - 465, 727, 0, 141, 0, 699, 0, -35, 0, 945, - 0, 0, 0, 481, 943, 59, 0, 0, 744, 957, - 965, 963, 6, -35, 0, 0, 967, 977, 982, 0, - -184, 767, -50, 971, 905, 90, 0, 0, 0, 0, - 0, 987, 724, 465, -35, -35, -35, -261, 0, 991, - 576, 0, -35, 777, 0, 0, 0, 989, 0, 385, - 992, 780, 0, 38, 900, 0, 0, 0, 781, 385, - 0, 0, 983, 0, 0, 0, 784, 0, 0, 0, - 0, 0, 916, 0, 0, 758, 0, 93, 1004, 59, - 0, 0, 788, 1006, 1007, 0, 1010, 0, 0, 5680, - 1009, -261, 1016, 675, 1020, 0, 0, 1025, 0, 0, - 385, 0, 5680, 0, -165, 0, 0, 0, 1023, 0, - 0, 0, 1024, 109, -149, 1026, 0, 0, 876, 109, - 1028, 0, 0, 0, -}; -short yyrindex[] = { 1071, - 0, 0, 0, 5225, 0, 1072, 0, 0, 0, 53, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 2985, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 3174, 0, 0, - 0, 0, 0, 0, 3331, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 182, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 5382, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1032, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3520, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 689, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1947, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1098, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 136, 0, 0, 0, 0, 0, 720, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 3677, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1033, 0, 241, 247, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3866, 4023, 0, 951, 0, 0, 0, 0, - 0, 0, 0, 984, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 2136, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 2293, - 0, 0, 0, 0, 0, 0, 0, 1037, 0, 0, - 0, 0, 374, 531, 0, 0, 0, 0, 0, 0, - 0, 553, 0, 0, 0, 0, 0, 0, 42, 49, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 689, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 4212, 0, 0, 1035, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 4369, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 4558, 0, 0, 0, - 1039, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 2482, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 958, 0, 0, 0, 0, 0, - 50, 52, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 4715, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 2639, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 4904, 0, 0, 0, 959, 0, 0, 0, - 0, 0, 961, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1255, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1444, 0, 0, 909, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 961, 0, 0, 0, 0, - 0, 0, 0, 1601, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 2828, 0, 5061, - 0, 0, 0, 0, 959, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1790, 0, 0, 0, 0, 128, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -69, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -69, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1043, 0, 0, 4715, 0, - 0, 0, 0, 0, -}; -short yygindex[] = { 0, - 410, 294, 0, 487, -329, -480, 0, 0, 438, 645, - 330, 0, 0, 0, 0, -474, 0, 0, 0, 0, - 0, -86, -287, 0, 0, 901, 0, 273, -629, 657, - 1047, -296, -297, -509, 264, -504, -494, 0, 0, 0, - 0, 0, 0, 0, 0, 242, -384, -137, 849, 0, - 0, 0, 0, 0, 0, 0, 0, 1046, 934, -371, - 0, 0, 0, 684, 710, 0, -48, 0, 0, 0, - 351, 0, 1100, 0, 0, 0, -133, 790, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -58, -130, -355, -375, 679, -84, 0, 0, 0, - 0, -167, 0, 345, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 949, 0, 0, 0, 0, - 975, 0, 0, 0, 792, 680, 504, 0, -}; -#define YYTABLESIZE 6091 -short yytable[] = { 186, - 181, 299, 211, 195, 177, 255, 252, 400, 237, 238, - 507, 518, 260, 261, 266, 499, 608, 177, 206, 273, - 514, 283, 284, 285, 282, 177, 206, 313, 296, 224, - 424, 423, 311, 309, 677, 310, 528, 312, 177, 639, - 302, 206, 637, 327, 59, 686, 519, 520, 518, 279, - 635, 332, 26, 439, 334, 26, 548, 760, 526, 537, - 231, 214, 518, 269, 267, 268, 188, 455, 539, 516, - 541, 459, 543, 755, 7, 699, 701, 550, 703, 224, - 214, 313, 297, 308, 292, 122, 311, 309, 8, 310, - 523, 312, 124, 123, 549, 125, 214, 286, 281, 812, - 335, 287, 288, 274, 275, 276, 9, 366, 367, 857, - 369, 313, 547, 773, 656, 313, 311, 309, 305, 310, - 311, 312, 189, 813, 317, 312, 333, 12, 756, 313, - 192, 263, 232, 406, 311, 270, 834, 224, 293, 312, - 538, 193, 194, 484, 545, 690, 603, 485, 206, 540, - 192, 542, 289, 544, 364, 365, 700, 702, 13, 704, - 705, 193, 194, 858, 669, 826, 122, 532, 14, 14, - 348, 670, 348, 124, 123, 643, 125, 313, 673, 131, - 740, 26, 311, 309, 313, 310, 234, 312, 132, 311, - 309, 235, 310, 770, 312, 313, 769, 430, 169, 410, - 311, 309, 327, 310, 768, 312, 643, 286, 444, 666, - 313, 287, 288, 15, 737, 311, 309, 736, 310, 510, - 312, 511, 176, 461, 458, 505, 460, 134, 471, 487, - 468, 488, 489, 623, 477, 176, 469, 470, 481, 304, - 533, 405, 135, 176, 633, 634, 222, 411, 412, 434, - 413, 414, 415, 416, 417, 653, 422, 528, 136, 562, - 304, 176, 509, 563, 564, 471, 692, 286, 305, 429, - 438, 287, 288, 26, 711, 26, 527, 262, 212, 471, - 435, 360, 137, 535, 360, 328, 138, 361, 498, 446, - 361, 201, 202, 513, 453, 139, 222, 212, 457, 201, - 202, 140, 223, 203, 204, 141, 26, 676, 142, 565, - 566, 567, 143, 212, 201, 202, 201, 202, 685, 483, - 579, 26, 26, 144, 568, 197, 198, 199, 200, 145, - 587, 588, 146, 691, 213, 495, 1, 2, 569, 570, - 147, 502, 503, 504, 785, 786, 787, 571, 572, 573, - 574, 575, 223, 213, 222, 447, 448, 307, 178, 179, - 317, 148, 205, 576, 853, 577, 149, 256, 257, 213, - 192, 178, 179, 347, 225, 474, 475, 205, 803, 178, - 179, 193, 194, 466, 688, 522, 207, 208, 192, 262, - 694, 695, 178, 179, 180, 226, 227, 178, 179, 193, - 194, 207, 208, 150, 201, 202, 215, 180, 632, 767, - 223, 347, 474, 475, 347, 180, 347, 347, 347, 347, - 176, 201, 202, 151, 225, 215, 203, 204, 180, 216, - 217, 180, 763, 180, 764, 152, 320, 153, 321, 154, - 155, 215, 322, 323, 324, 226, 227, 681, 216, 217, - 26, 26, 657, 156, 157, 158, 660, 159, 160, 663, - 664, 161, 162, 313, 347, 625, 347, 205, 311, 309, - 163, 310, 164, 312, 166, 201, 202, 167, 631, 708, - 709, 710, 225, 168, 205, 174, 683, 175, 183, 184, - 185, 207, 208, 191, 325, 313, 347, 279, 347, 300, - 311, 309, 821, 310, 301, 312, 303, 336, 207, 208, - 340, 306, 828, 339, 341, 707, 342, 313, 343, 552, - 344, 731, 311, 309, 26, 783, 26, 312, 347, 346, - 348, 348, 352, 658, 659, 313, 326, 662, 205, 349, - 311, 309, 353, 310, 313, 312, 350, 192, 356, 311, - 309, 558, 310, 851, 312, 358, 178, 179, 193, 194, - 357, 360, 207, 208, 256, 257, 361, 362, 348, 363, - 376, 348, 313, 348, 348, 348, 348, 311, 309, 368, - 310, 370, 312, 371, 372, 774, 796, 374, 377, 342, - 378, 561, 180, 342, 342, 342, 734, 342, 379, 342, - 583, 380, 381, 382, 383, 313, 744, 809, 810, 811, - 311, 309, 313, 310, 384, 312, 817, 311, 309, 816, - 310, 348, 312, 348, 313, 385, 386, 388, 601, 311, - 309, 396, 310, 347, 312, 390, 389, 391, 392, 393, - 395, 347, 347, 347, 347, 347, 347, 347, 347, 347, - 347, 347, 347, 348, 397, 348, 347, 347, 347, 394, - 398, 741, 347, 347, 347, 347, 347, 347, 347, 347, - 347, 399, 347, 347, 347, 347, 347, 347, 347, 781, - 347, 402, 63, 403, 65, 404, 67, 407, 69, 409, - 71, 418, 73, 419, 75, 347, 77, 442, 79, 421, - 431, 437, 347, 347, 432, 347, 443, 347, 347, 347, - 433, 441, 347, 347, 347, 347, 347, 347, 347, 307, - 856, 445, 313, 451, 818, 452, 863, 311, 309, 738, - 310, 454, 312, 456, 450, 462, 347, 464, 347, 465, - 347, 479, 463, 844, 480, 482, 494, 525, 493, 492, - 497, 501, 506, 496, 536, 551, 852, 553, 554, 556, - 347, 347, 557, 307, 585, 560, 586, 347, 347, 347, - 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, - 347, 347, 347, 347, 347, 589, 590, 582, 591, 592, - 348, 596, 593, 594, 597, 598, 599, 602, 348, 348, - 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, - 307, 600, 307, 348, 348, 348, 603, 604, 605, 348, - 348, 348, 348, 348, 348, 348, 348, 348, 607, 348, - 348, 348, 348, 348, 348, 348, 606, 348, 609, 610, - 611, 612, 307, 613, 307, 615, 616, 617, 618, 619, - 620, 621, 348, 622, 595, 628, 624, 629, 627, 348, - 348, 630, 348, 255, 348, 348, 348, 643, 641, 348, - 348, 348, 348, 348, 348, 348, 170, 642, 644, 645, - 646, 651, 62, 647, 64, 648, 66, 649, 68, 650, - 70, 652, 72, 348, 74, 348, 76, 348, 78, 654, - 655, 466, 661, 665, 666, 668, 674, 680, 370, 672, - 675, 673, 679, 682, 684, 693, 706, 348, 348, 732, - 735, 739, 742, 743, 348, 348, 348, 348, 348, 348, - 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, - 348, 348, 745, 746, 748, 749, 370, 61, 750, 370, - 751, 753, 370, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 754, 761, 758, 759, 762, 771, 775, 776, 307, - 772, 777, 778, 779, 780, 782, 784, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, 307, 370, - 792, 791, 307, 307, 307, 793, 794, 797, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 798, 307, 307, - 307, 307, 307, 307, 307, 799, 307, 802, 804, 805, - 807, 815, 820, 370, 819, 823, 808, 824, 827, 832, - 829, 307, 831, 833, 836, 838, 839, 840, 307, 307, - 842, 307, 845, 307, 307, 307, 847, 848, 307, 307, - 849, 307, 307, 307, 307, 850, 854, 855, 864, 860, - 1, 3, 364, 365, 172, 26, 315, 358, 188, 359, - 148, 284, 307, 16, 307, 139, 752, 825, 667, 728, - 801, 338, 837, 559, 165, 846, 373, 385, 555, 171, - 862, 298, 534, 795, 508, 11, 307, 307, 420, 546, - 806, 291, 221, 307, 307, 307, 307, 307, 307, 307, - 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, - 307, 436, 698, 581, 0, 0, 0, 0, 385, 0, - 0, 385, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 370, 0, - 0, 0, 0, 0, 0, 0, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 370, 385, 0, - 0, 370, 370, 370, 0, 0, 0, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 0, 370, 370, 370, - 370, 370, 370, 370, 0, 370, 0, 0, 0, 0, - 0, 0, 385, 0, 0, 0, 0, 0, 0, 0, - 370, 0, 0, 0, 0, 0, 0, 370, 370, 0, - 370, 0, 370, 370, 370, 0, 0, 370, 370, 0, - 370, 370, 370, 370, 233, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 370, 0, 370, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 370, 370, 0, 233, 0, - 0, 0, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 250, 0, 0, - 0, 0, 0, 0, 0, 233, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 385, 0, 0, - 0, 0, 0, 0, 0, 385, 385, 385, 385, 385, - 385, 385, 385, 385, 385, 385, 385, 233, 0, 233, - 385, 385, 385, 0, 0, 0, 385, 385, 385, 385, - 385, 385, 385, 385, 385, 0, 385, 385, 385, 385, - 385, 385, 385, 0, 385, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 385, - 0, 0, 0, 0, 0, 0, 385, 385, 0, 385, - 0, 385, 385, 385, 0, 0, 385, 385, 0, 385, - 385, 385, 385, 205, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 385, 0, 385, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 385, 385, 0, 205, 0, 0, - 0, 385, 385, 385, 385, 385, 385, 385, 385, 385, - 385, 385, 385, 385, 385, 385, 385, 385, 385, 0, - 0, 0, 0, 0, 233, 0, 0, 0, 0, 0, - 0, 0, 233, 233, 233, 233, 233, 233, 233, 233, - 233, 233, 233, 233, 205, 0, 0, 233, 233, 233, - 0, 0, 0, 233, 233, 233, 233, 233, 233, 233, - 233, 233, 0, 233, 233, 233, 233, 233, 233, 233, - 0, 233, 0, 0, 0, 0, 205, 0, 205, 0, - 0, 0, 0, 0, 0, 0, 233, 0, 0, 0, - 0, 0, 0, 233, 233, 0, 233, 0, 233, 233, - 233, 0, 0, 233, 233, 0, 233, 233, 233, 233, - 209, 0, 0, 0, 0, 0, 0, 0, 0, 466, - 201, 202, 0, 0, 0, 0, 0, 233, 0, 233, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 233, 233, 0, 209, 0, 0, 0, 233, 233, - 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, - 233, 233, 233, 233, 233, 233, 239, 240, 241, 242, - 243, 0, 244, 205, 245, 246, 247, 248, 249, 0, - 0, 0, 0, 250, 0, 0, 0, 0, 0, 0, - 0, 209, 0, 0, 0, 0, 0, 207, 208, 0, - 0, 0, 0, 205, 0, 0, 0, 251, 0, 0, - 0, 205, 205, 205, 205, 205, 205, 205, 205, 205, - 205, 205, 205, 209, 0, 209, 205, 205, 205, 0, - 0, 0, 205, 205, 205, 205, 205, 205, 205, 205, - 205, 0, 205, 205, 205, 205, 205, 205, 205, 0, - 205, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 205, 0, 0, 0, 0, - 0, 0, 205, 205, 0, 205, 0, 205, 205, 205, - 0, 0, 205, 205, 0, 205, 205, 205, 205, 221, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 205, 0, 205, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 205, 205, 0, 221, 0, 0, 0, 205, 205, 205, - 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, - 205, 205, 205, 205, 205, 0, 0, 0, 0, 0, - 209, 0, 0, 0, 0, 0, 0, 0, 209, 209, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, - 221, 0, 0, 209, 209, 209, 0, 0, 0, 209, - 209, 209, 209, 209, 209, 209, 209, 209, 0, 209, - 209, 209, 209, 209, 209, 209, 0, 209, 0, 0, - 0, 0, 221, 0, 221, 0, 0, 0, 0, 0, - 0, 0, 209, 0, 0, 0, 0, 0, 0, 209, - 209, 0, 209, 0, 209, 209, 209, 0, 0, 209, - 209, 0, 209, 209, 209, 209, 199, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 201, 202, 0, 0, - 0, 0, 0, 209, 0, 209, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 209, 209, 0, - 0, 0, 0, 0, 209, 209, 209, 209, 209, 209, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, - 209, 209, 239, 240, 241, 242, 243, 0, 244, 205, - 245, 246, 247, 248, 249, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 199, 0, 0, - 0, 0, 0, 207, 208, 0, 0, 0, 0, 221, - 0, 0, 0, 251, 0, 0, 0, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 200, - 0, 199, 221, 221, 221, 0, 0, 0, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 0, 221, 221, - 221, 221, 221, 221, 221, 0, 221, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 221, 0, 0, 0, 0, 0, 0, 221, 221, - 0, 221, 0, 221, 221, 221, 0, 0, 221, 221, - 0, 221, 221, 221, 221, 227, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 221, 0, 221, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 221, 221, 0, 0, - 0, 0, 0, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 0, 0, 0, 0, 0, 199, 0, 0, 0, - 0, 0, 0, 0, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 227, 0, 0, 199, - 199, 199, 0, 0, 0, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 0, 199, 199, 199, 199, 199, - 199, 199, 0, 199, 0, 0, 0, 0, 227, 0, - 227, 0, 0, 0, 0, 0, 0, 0, 199, 0, - 0, 0, 0, 0, 0, 199, 199, 0, 199, 0, - 199, 199, 199, 0, 0, 199, 199, 0, 199, 199, - 199, 199, 157, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 199, - 0, 199, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 199, 199, 0, 0, 0, 0, 0, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 199, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 157, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 227, 0, 0, 0, 0, - 0, 0, 0, 227, 227, 227, 227, 227, 227, 227, - 227, 227, 227, 227, 227, 0, 0, 157, 227, 227, - 227, 0, 0, 0, 227, 227, 227, 227, 227, 227, - 227, 227, 227, 0, 227, 227, 227, 227, 227, 227, - 227, 0, 227, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 227, 0, 0, - 0, 0, 0, 0, 227, 227, 0, 227, 0, 227, - 227, 227, 0, 0, 227, 227, 0, 227, 227, 227, - 227, 202, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 227, 0, - 227, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 227, 227, 0, 0, 0, 0, 0, 227, - 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, - 227, 227, 227, 227, 227, 227, 227, 0, 0, 0, - 0, 0, 157, 0, 0, 0, 0, 0, 0, 0, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 202, 0, 0, 157, 157, 157, 0, 0, - 0, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 0, 157, 157, 157, 157, 157, 157, 157, 0, 157, - 0, 0, 0, 0, 202, 0, 202, 0, 0, 0, - 0, 0, 0, 0, 157, 0, 0, 0, 0, 0, - 0, 157, 157, 158, 157, 0, 157, 157, 157, 0, - 0, 157, 157, 0, 157, 157, 157, 157, 284, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 157, 0, 157, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 157, - 157, 0, 0, 0, 0, 0, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 284, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 202, 0, 0, 0, 0, 0, 0, 0, 202, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - 202, 284, 0, 284, 202, 202, 202, 0, 0, 0, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 0, - 202, 202, 202, 202, 202, 202, 202, 0, 202, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 202, 0, 0, 0, 0, 0, 0, - 202, 202, 0, 202, 0, 202, 202, 202, 0, 0, - 202, 202, 0, 202, 202, 202, 202, 286, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 202, 0, 202, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 202, 202, - 0, 0, 0, 0, 0, 202, 202, 202, 202, 202, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - 202, 202, 202, 0, 0, 0, 0, 0, 284, 0, - 0, 0, 0, 0, 0, 0, 284, 284, 284, 284, - 284, 284, 284, 284, 284, 284, 284, 284, 286, 0, - 0, 284, 284, 284, 0, 0, 0, 284, 284, 284, - 284, 284, 284, 284, 284, 284, 0, 284, 284, 284, - 284, 284, 284, 284, 0, 284, 0, 0, 0, 0, - 286, 0, 286, 0, 0, 0, 0, 0, 0, 0, - 284, 0, 0, 0, 0, 0, 0, 284, 284, 0, - 284, 0, 284, 284, 284, 0, 0, 284, 284, 0, - 284, 284, 284, 284, 249, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 284, 0, 284, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 284, 284, 0, 0, 0, - 0, 0, 284, 284, 284, 284, 284, 284, 284, 284, - 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 249, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 286, 0, 0, - 0, 0, 0, 0, 0, 286, 286, 286, 286, 286, - 286, 286, 286, 286, 286, 286, 286, 0, 0, 249, - 286, 286, 286, 0, 0, 0, 286, 286, 286, 286, - 286, 286, 286, 286, 286, 0, 286, 286, 286, 286, - 286, 286, 286, 0, 286, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 286, - 0, 0, 0, 0, 0, 0, 286, 286, 0, 286, - 0, 286, 286, 286, 0, 0, 286, 286, 0, 286, - 286, 286, 286, 279, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 286, 0, 286, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 286, 286, 0, 0, 0, 0, - 0, 286, 286, 286, 286, 286, 286, 286, 286, 286, - 286, 286, 286, 286, 286, 286, 286, 286, 286, 0, - 0, 0, 0, 0, 249, 0, 0, 0, 0, 0, - 0, 0, 249, 249, 249, 249, 249, 249, 249, 249, - 249, 249, 249, 249, 279, 0, 0, 249, 249, 249, - 0, 0, 0, 249, 249, 249, 249, 249, 249, 249, - 249, 249, 0, 249, 249, 249, 249, 249, 249, 249, - 0, 249, 0, 0, 0, 0, 0, 0, 279, 0, - 0, 0, 0, 0, 0, 0, 249, 0, 0, 0, - 0, 0, 0, 249, 249, 0, 249, 0, 249, 249, - 249, 0, 0, 249, 249, 0, 249, 249, 249, 249, - 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 249, 0, 249, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 249, 249, 0, 0, 0, 0, 0, 249, 249, - 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, - 249, 249, 249, 249, 249, 249, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 161, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 279, 0, 0, 0, 0, 0, 0, - 0, 279, 279, 279, 279, 279, 279, 279, 279, 279, - 279, 279, 279, 0, 0, 161, 279, 279, 279, 0, - 0, 0, 279, 279, 279, 279, 279, 279, 279, 279, - 279, 0, 279, 279, 279, 279, 279, 279, 279, 0, - 279, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 279, 0, 0, 0, 0, - 0, 0, 279, 279, 0, 279, 0, 279, 279, 279, - 0, 0, 279, 279, 0, 279, 279, 279, 279, 160, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 279, 0, 279, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 279, 279, 0, 0, 0, 0, 0, 279, 279, 279, - 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, - 279, 279, 279, 279, 279, 0, 0, 0, 0, 0, - 161, 0, 0, 0, 0, 0, 0, 0, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 160, 0, 0, 161, 161, 161, 0, 0, 0, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 0, 161, - 161, 161, 161, 161, 161, 161, 0, 161, 0, 0, - 0, 0, 0, 0, 160, 0, 0, 0, 0, 0, - 0, 0, 161, 0, 0, 0, 0, 0, 0, 161, - 161, 0, 161, 0, 161, 161, 161, 0, 0, 161, - 161, 0, 161, 161, 161, 161, 275, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 161, 0, 161, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 161, 161, 0, - 0, 0, 0, 0, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 275, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, - 0, 0, 0, 0, 0, 0, 0, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, 160, 0, - 0, 275, 160, 160, 160, 0, 0, 0, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 0, 160, 160, - 160, 160, 160, 160, 160, 0, 160, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 160, 0, 0, 0, 0, 0, 0, 160, 160, - 0, 160, 0, 160, 160, 160, 0, 0, 160, 160, - 0, 160, 160, 160, 160, 97, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 160, 0, 160, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 160, 160, 0, 0, - 0, 0, 0, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, - 160, 0, 0, 0, 0, 0, 275, 0, 0, 0, - 0, 0, 0, 0, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 97, 0, 0, 275, - 275, 275, 0, 0, 0, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 0, 275, 275, 275, 275, 275, - 275, 275, 0, 275, 0, 0, 0, 0, 0, 0, - 97, 0, 0, 0, 0, 0, 0, 0, 275, 0, - 0, 0, 0, 0, 0, 275, 275, 0, 275, 0, - 275, 275, 275, 0, 0, 275, 275, 0, 275, 275, - 275, 275, 99, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 275, - 0, 275, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 275, 275, 0, 0, 0, 0, 0, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 99, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 97, 0, 0, 0, 0, - 0, 0, 0, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 0, 0, 99, 97, 97, - 97, 0, 0, 0, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, - 97, 0, 97, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 97, 0, 0, - 0, 0, 0, 0, 97, 97, 0, 97, 0, 97, - 97, 97, 0, 0, 97, 97, 0, 97, 97, 97, - 97, 247, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 97, 0, - 97, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 97, 97, 0, 0, 0, 0, 0, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 0, 0, 0, - 0, 0, 99, 0, 0, 0, 0, 0, 0, 0, - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 247, 0, 0, 99, 99, 99, 0, 0, - 0, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 0, 99, 99, 99, 99, 99, 99, 99, 0, 99, - 0, 0, 0, 0, 0, 0, 247, 0, 0, 0, - 0, 0, 0, 0, 99, 0, 0, 0, 0, 0, - 0, 99, 99, 0, 99, 0, 99, 99, 99, 0, - 0, 99, 99, 0, 99, 99, 99, 99, 257, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 99, 0, 99, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, - 99, 0, 0, 0, 0, 0, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 257, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 247, 0, 0, 0, 0, 0, 0, 0, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 0, 0, 257, 247, 247, 247, 0, 0, 0, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 0, - 247, 247, 247, 247, 247, 247, 247, 0, 247, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 247, 0, 0, 0, 0, 0, 0, - 247, 247, 0, 247, 0, 247, 247, 247, 0, 0, - 247, 247, 0, 247, 247, 247, 247, 273, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 247, 0, 247, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 247, 247, - 0, 0, 0, 0, 0, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 0, 0, 0, 0, 0, 257, 0, - 0, 0, 0, 0, 0, 0, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 273, 0, - 0, 257, 257, 257, 0, 0, 0, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 0, 257, 257, 257, - 257, 257, 257, 257, 0, 257, 0, 0, 0, 0, - 0, 0, 273, 0, 0, 0, 0, 0, 0, 0, - 257, 0, 0, 0, 0, 0, 0, 257, 257, 0, - 257, 0, 257, 257, 257, 0, 0, 257, 257, 0, - 257, 257, 257, 257, 18, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 257, 0, 257, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 257, 257, 0, 0, 0, - 0, 0, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 273, 0, 0, - 0, 0, 0, 0, 0, 273, 273, 273, 273, 273, - 273, 273, 273, 273, 273, 273, 273, 0, 0, 18, - 273, 273, 273, 0, 0, 0, 273, 273, 273, 273, - 273, 273, 273, 273, 273, 0, 273, 273, 273, 273, - 273, 273, 273, 0, 273, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 273, - 0, 0, 0, 0, 0, 0, 273, 273, 0, 273, - 0, 273, 273, 273, 0, 0, 273, 273, 0, 273, - 273, 273, 273, 277, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 273, 0, 273, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 273, 273, 0, 0, 0, 0, - 0, 273, 273, 273, 273, 273, 273, 273, 273, 273, - 273, 273, 273, 273, 273, 273, 273, 273, 273, 0, - 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, - 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 277, 0, 0, 18, 18, 18, - 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 0, 18, 18, 18, 18, 18, 18, 18, - 0, 18, 0, 0, 0, 0, 0, 0, 277, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, - 0, 0, 0, 18, 18, 0, 18, 0, 18, 18, - 18, 0, 0, 18, 18, 0, 18, 18, 18, 18, - 270, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 18, 0, 18, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 18, 18, 0, 0, 0, 0, 0, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 270, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 277, 0, 0, 0, 0, 0, 0, - 0, 277, 277, 277, 277, 277, 277, 277, 277, 277, - 277, 277, 277, 0, 0, 270, 277, 277, 277, 0, - 0, 0, 277, 277, 277, 277, 277, 277, 277, 277, - 277, 0, 277, 277, 277, 277, 277, 277, 277, 0, - 277, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 22, 277, 0, 0, 0, 0, - 0, 0, 277, 277, 0, 277, 0, 277, 277, 277, - 0, 0, 277, 277, 0, 277, 277, 277, 277, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 277, 0, 277, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 277, 277, 0, 0, 0, 0, 0, 277, 277, 277, - 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - 277, 277, 277, 277, 277, 22, 0, 0, 0, 0, - 270, 0, 0, 0, 0, 0, 0, 0, 270, 270, - 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - 0, 0, 0, 270, 270, 270, 0, 0, 0, 270, - 270, 270, 270, 270, 270, 270, 270, 270, 0, 270, - 270, 270, 270, 270, 270, 270, 0, 270, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 25, 270, 0, 0, 0, 0, 0, 0, 270, - 270, 0, 270, 0, 270, 270, 270, 0, 0, 270, - 270, 0, 270, 270, 270, 270, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 270, 0, 270, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 270, 270, 0, - 0, 0, 0, 0, 270, 270, 270, 270, 270, 270, - 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - 270, 270, 25, 0, 473, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 22, 0, 0, 250, 0, 0, - 0, 0, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 0, 0, 0, 22, 22, 22, - 0, 0, 0, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 0, 22, 22, 22, 22, 22, 22, 22, - 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, - 0, 0, 0, 22, 22, 0, 22, 0, 22, 22, - 22, 0, 0, 22, 22, 0, 22, 0, 22, 0, - 0, 0, 0, 0, 0, 0, 250, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 22, 0, 22, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 22, 22, 0, 0, 0, 0, 0, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 0, 0, 0, 0, - 0, 25, 0, 0, 0, 0, 0, 0, 0, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 0, 0, 0, 25, 25, 25, 0, 0, 0, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, - 25, 25, 25, 25, 25, 25, 25, 0, 25, 0, - 0, 471, 0, 0, 0, 472, 0, 0, 0, 0, - 0, 0, 0, 25, 595, 347, 0, 0, 0, 0, - 25, 25, 0, 25, 0, 25, 25, 25, 0, 0, - 25, 25, 0, 25, 0, 25, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 25, 0, 25, 201, 202, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 201, 202, 0, 0, 0, 0, 0, 0, 25, 25, - 59, 0, 0, 0, 0, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 0, 347, 0, 0, 0, 0, 0, - 0, 0, 0, 239, 240, 241, 242, 243, 0, 244, - 205, 245, 246, 247, 248, 249, 239, 240, 241, 242, - 243, 0, 244, 205, 245, 246, 247, 248, 249, 0, - 0, 0, 0, 0, 207, 208, 0, 0, 474, 475, - 712, 713, 0, 0, 251, 0, 0, 207, 208, 201, - 202, 714, 715, 716, 0, 0, 0, 251, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 717, 0, 718, 719, 720, 721, - 722, 723, 724, 725, 726, 727, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 239, 240, 241, 242, 243, - 192, 244, 205, 245, 246, 247, 248, 249, 0, 0, - 0, 193, 194, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 207, 208, 0, 15, - 0, 0, 0, 0, 0, 0, 251, 16, 0, 0, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, - 0, 0, 26, 27, 28, 0, 0, 0, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 0, 38, 39, - 40, 41, 42, 43, 44, 0, 45, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 46, 0, 0, 0, 0, 0, 0, 47, 48, - 0, 49, 0, 50, 51, 52, 0, 0, 53, 54, - 0, 55, 0, 56, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 57, 0, 58, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 60, 61, 0, 0, - 0, 0, 0, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, -}; -short yycheck[] = { 86, - 59, 169, 136, 134, 40, 40, 144, 295, 142, 143, - 395, 40, 146, 147, 148, 40, 497, 40, 40, 40, - 40, 159, 160, 161, 158, 40, 40, 37, 166, 40, - 328, 328, 42, 43, 40, 45, 408, 47, 40, 549, - 174, 40, 547, 40, 91, 40, 402, 403, 40, 40, - 545, 185, 0, 40, 185, 125, 432, 687, 313, 44, - 313, 40, 40, 313, 149, 150, 257, 355, 44, 399, - 44, 359, 44, 258, 58, 44, 44, 433, 44, 40, - 40, 37, 167, 93, 259, 44, 42, 43, 58, 45, - 46, 47, 44, 44, 123, 44, 40, 258, 157, 361, - 185, 262, 263, 152, 153, 154, 324, 241, 242, 259, - 244, 37, 123, 58, 589, 37, 42, 43, 177, 45, - 42, 47, 313, 385, 183, 47, 185, 385, 313, 37, - 385, 40, 385, 301, 42, 385, 44, 40, 313, 47, - 125, 396, 397, 309, 123, 620, 91, 313, 40, 125, - 385, 125, 313, 125, 239, 240, 125, 125, 385, 125, - 641, 396, 397, 313, 313, 795, 125, 93, 41, 58, - 43, 320, 45, 125, 125, 41, 125, 37, 44, 44, - 661, 0, 42, 43, 37, 45, 308, 47, 325, 42, - 43, 313, 45, 703, 47, 37, 701, 328, 91, 41, - 42, 43, 40, 45, 699, 47, 41, 258, 346, 44, - 37, 262, 263, 260, 41, 42, 43, 44, 45, 311, - 47, 313, 258, 361, 358, 393, 360, 58, 257, 313, - 368, 315, 316, 521, 372, 258, 370, 371, 376, 262, - 93, 300, 58, 258, 541, 543, 257, 306, 307, 336, - 309, 310, 311, 312, 313, 585, 258, 629, 58, 258, - 262, 258, 396, 262, 263, 257, 622, 258, 327, 328, - 257, 262, 263, 343, 650, 345, 407, 298, 257, 257, - 339, 41, 58, 421, 44, 123, 58, 41, 313, 348, - 44, 313, 314, 313, 353, 58, 257, 257, 357, 313, - 314, 58, 313, 317, 318, 58, 125, 313, 58, 308, - 309, 310, 58, 257, 313, 314, 313, 314, 313, 378, - 454, 269, 270, 58, 323, 264, 265, 266, 267, 58, - 464, 465, 58, 621, 313, 384, 269, 270, 337, 338, - 58, 390, 391, 392, 286, 287, 288, 346, 347, 348, - 349, 350, 313, 313, 257, 318, 319, 367, 394, 395, - 419, 58, 376, 362, 845, 364, 58, 402, 403, 313, - 385, 394, 395, 0, 385, 404, 405, 376, 763, 394, - 395, 396, 397, 312, 313, 341, 400, 401, 385, 298, - 390, 391, 394, 395, 430, 406, 407, 394, 395, 396, - 397, 400, 401, 58, 313, 314, 385, 430, 539, 697, - 313, 38, 404, 405, 41, 430, 43, 44, 45, 46, - 258, 313, 314, 58, 385, 385, 317, 318, 430, 408, - 409, 430, 343, 430, 345, 58, 274, 58, 276, 58, - 58, 385, 280, 281, 282, 406, 407, 615, 408, 409, - 269, 270, 590, 58, 58, 58, 594, 58, 58, 597, - 598, 58, 58, 37, 91, 524, 93, 376, 42, 43, - 58, 45, 58, 47, 58, 313, 314, 58, 537, 647, - 648, 649, 385, 58, 376, 58, 617, 387, 40, 58, - 61, 400, 401, 44, 332, 37, 123, 40, 125, 61, - 42, 43, 790, 45, 91, 47, 40, 123, 400, 401, - 46, 91, 800, 91, 44, 646, 44, 37, 44, 93, - 384, 652, 42, 43, 343, 45, 345, 47, 258, 40, - 0, 91, 257, 592, 593, 37, 374, 596, 376, 44, - 42, 43, 91, 45, 37, 47, 44, 385, 257, 42, - 43, 93, 45, 841, 47, 44, 394, 395, 396, 397, - 91, 44, 400, 401, 402, 403, 44, 44, 38, 44, - 38, 41, 37, 43, 44, 45, 46, 42, 43, 40, - 45, 40, 47, 40, 40, 716, 754, 40, 258, 37, - 91, 93, 430, 41, 42, 43, 655, 45, 44, 47, - 93, 44, 44, 40, 258, 37, 665, 775, 776, 777, - 42, 43, 37, 45, 44, 47, 41, 42, 43, 44, - 45, 91, 47, 93, 37, 44, 260, 44, 93, 42, - 43, 44, 45, 260, 47, 44, 258, 44, 44, 44, - 44, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, 123, 44, 125, 283, 284, 285, 258, - 44, 93, 289, 290, 291, 292, 293, 294, 295, 296, - 297, 44, 299, 300, 301, 302, 303, 304, 305, 738, - 307, 44, 395, 44, 397, 93, 399, 44, 401, 41, - 403, 41, 405, 44, 407, 322, 409, 44, 411, 58, - 58, 257, 329, 330, 58, 332, 93, 334, 335, 336, - 58, 257, 339, 340, 341, 342, 343, 344, 345, 0, - 854, 44, 37, 386, 783, 44, 860, 42, 43, 44, - 45, 44, 47, 44, 259, 312, 363, 44, 365, 44, - 367, 382, 312, 830, 41, 44, 44, 93, 258, 321, - 44, 44, 44, 321, 44, 125, 843, 257, 44, 41, - 387, 388, 258, 44, 44, 385, 44, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - 407, 408, 409, 410, 411, 124, 44, 385, 41, 44, - 260, 91, 44, 44, 44, 44, 44, 44, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 91, 258, 93, 283, 284, 285, 91, 44, 44, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 44, 299, - 300, 301, 302, 303, 304, 305, 258, 307, 258, 44, - 258, 44, 123, 44, 125, 44, 312, 44, 258, 44, - 44, 331, 322, 44, 257, 41, 46, 44, 58, 329, - 330, 258, 332, 40, 334, 335, 336, 41, 44, 339, - 340, 341, 342, 343, 344, 345, 388, 257, 386, 41, - 58, 41, 394, 58, 396, 58, 398, 58, 400, 58, - 402, 44, 404, 363, 406, 365, 408, 367, 410, 259, - 44, 312, 44, 40, 44, 258, 321, 321, 0, 258, - 44, 44, 385, 44, 44, 123, 44, 387, 388, 44, - 41, 41, 41, 41, 394, 395, 396, 397, 398, 399, - 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, - 410, 411, 258, 44, 93, 44, 38, 388, 258, 41, - 258, 44, 44, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, - 411, 44, 44, 258, 258, 44, 41, 58, 58, 260, - 259, 58, 58, 257, 286, 41, 44, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, 91, - 44, 258, 283, 284, 285, 41, 44, 41, 289, 290, - 291, 292, 293, 294, 295, 296, 297, 41, 299, 300, - 301, 302, 303, 304, 305, 44, 307, 261, 58, 125, - 44, 41, 44, 125, 258, 44, 313, 258, 258, 124, - 58, 322, 259, 286, 41, 258, 41, 41, 329, 330, - 41, 332, 44, 334, 335, 336, 41, 383, 339, 340, - 41, 342, 343, 344, 345, 41, 44, 44, 41, 44, - 0, 0, 41, 41, 386, 125, 93, 41, 44, 41, - 123, 123, 363, 41, 365, 125, 677, 794, 602, 652, - 761, 191, 820, 449, 48, 832, 248, 0, 442, 54, - 859, 168, 419, 753, 395, 6, 387, 388, 319, 431, - 766, 163, 138, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, - 411, 340, 629, 454, -1, -1, -1, -1, 41, -1, - -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 260, -1, - -1, -1, -1, -1, -1, -1, 268, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 91, -1, - -1, 283, 284, 285, -1, -1, -1, 289, 290, 291, - 292, 293, 294, 295, 296, 297, -1, 299, 300, 301, - 302, 303, 304, 305, -1, 307, -1, -1, -1, -1, - -1, -1, 125, -1, -1, -1, -1, -1, -1, -1, - 322, -1, -1, -1, -1, -1, -1, 329, 330, -1, - 332, -1, 334, 335, 336, -1, -1, 339, 340, -1, - 342, 343, 344, 345, 0, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 363, -1, 365, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 387, 388, -1, 44, -1, - -1, -1, 394, 395, 396, 397, 398, 399, 400, 401, - 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 40, -1, -1, - -1, -1, -1, -1, -1, 91, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 260, -1, -1, - -1, -1, -1, -1, -1, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 123, -1, 125, - 283, 284, 285, -1, -1, -1, 289, 290, 291, 292, - 293, 294, 295, 296, 297, -1, 299, 300, 301, 302, - 303, 304, 305, -1, 307, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 322, - -1, -1, -1, -1, -1, -1, 329, 330, -1, 332, - -1, 334, 335, 336, -1, -1, 339, 340, -1, 342, - 343, 344, 345, 0, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 363, -1, 365, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 387, 388, -1, 44, -1, -1, - -1, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 405, 406, 407, 408, 409, 410, 411, -1, - -1, -1, -1, -1, 260, -1, -1, -1, -1, -1, - -1, -1, 268, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, 91, -1, -1, 283, 284, 285, - -1, -1, -1, 289, 290, 291, 292, 293, 294, 295, - 296, 297, -1, 299, 300, 301, 302, 303, 304, 305, - -1, 307, -1, -1, -1, -1, 123, -1, 125, -1, - -1, -1, -1, -1, -1, -1, 322, -1, -1, -1, - -1, -1, -1, 329, 330, -1, 332, -1, 334, 335, - 336, -1, -1, 339, 340, -1, 342, 343, 344, 345, - 0, -1, -1, -1, -1, -1, -1, -1, -1, 312, - 313, 314, -1, -1, -1, -1, -1, 363, -1, 365, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 387, 388, -1, 44, -1, -1, -1, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, 369, 370, 371, 372, - 373, -1, 375, 376, 377, 378, 379, 380, 381, -1, - -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, - -1, 91, -1, -1, -1, -1, -1, 400, 401, -1, - -1, -1, -1, 260, -1, -1, -1, 410, -1, -1, - -1, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, 123, -1, 125, 283, 284, 285, -1, - -1, -1, 289, 290, 291, 292, 293, 294, 295, 296, - 297, -1, 299, 300, 301, 302, 303, 304, 305, -1, - 307, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 322, -1, -1, -1, -1, - -1, -1, 329, 330, -1, 332, -1, 334, 335, 336, - -1, -1, 339, 340, -1, 342, 343, 344, 345, 0, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 363, -1, 365, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 387, 388, -1, 44, -1, -1, -1, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - 407, 408, 409, 410, 411, -1, -1, -1, -1, -1, - 260, -1, -1, -1, -1, -1, -1, -1, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 91, -1, -1, 283, 284, 285, -1, -1, -1, 289, - 290, 291, 292, 293, 294, 295, 296, 297, -1, 299, - 300, 301, 302, 303, 304, 305, -1, 307, -1, -1, - -1, -1, 123, -1, 125, -1, -1, -1, -1, -1, - -1, -1, 322, -1, -1, -1, -1, -1, -1, 329, - 330, -1, 332, -1, 334, 335, 336, -1, -1, 339, - 340, -1, 342, 343, 344, 345, 0, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 313, 314, -1, -1, - -1, -1, -1, 363, -1, 365, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 387, 388, -1, - -1, -1, -1, -1, 394, 395, 396, 397, 398, 399, - 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, - 410, 411, 369, 370, 371, 372, 373, -1, 375, 376, - 377, 378, 379, 380, 381, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 91, -1, -1, - -1, -1, -1, 400, 401, -1, -1, -1, -1, 260, - -1, -1, -1, 410, -1, -1, -1, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, 123, - -1, 125, 283, 284, 285, -1, -1, -1, 289, 290, - 291, 292, 293, 294, 295, 296, 297, -1, 299, 300, - 301, 302, 303, 304, 305, -1, 307, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 322, -1, -1, -1, -1, -1, -1, 329, 330, - -1, 332, -1, 334, 335, 336, -1, -1, 339, 340, - -1, 342, 343, 344, 345, 0, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 363, -1, 365, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 387, 388, -1, -1, - -1, -1, -1, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, - 411, -1, -1, -1, -1, -1, 260, -1, -1, -1, - -1, -1, -1, -1, 268, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, 91, -1, -1, 283, - 284, 285, -1, -1, -1, 289, 290, 291, 292, 293, - 294, 295, 296, 297, -1, 299, 300, 301, 302, 303, - 304, 305, -1, 307, -1, -1, -1, -1, 123, -1, - 125, -1, -1, -1, -1, -1, -1, -1, 322, -1, - -1, -1, -1, -1, -1, 329, 330, -1, 332, -1, - 334, 335, 336, -1, -1, 339, 340, -1, 342, 343, - 344, 345, 0, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 363, - -1, 365, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 387, 388, -1, -1, -1, -1, -1, - 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, - 404, 405, 406, 407, 408, 409, 410, 411, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 91, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 260, -1, -1, -1, -1, - -1, -1, -1, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, -1, -1, 125, 283, 284, - 285, -1, -1, -1, 289, 290, 291, 292, 293, 294, - 295, 296, 297, -1, 299, 300, 301, 302, 303, 304, - 305, -1, 307, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 322, -1, -1, - -1, -1, -1, -1, 329, 330, -1, 332, -1, 334, - 335, 336, -1, -1, 339, 340, -1, 342, 343, 344, - 345, 0, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 363, -1, - 365, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 387, 388, -1, -1, -1, -1, -1, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 409, 410, 411, -1, -1, -1, - -1, -1, 260, -1, -1, -1, -1, -1, -1, -1, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 91, -1, -1, 283, 284, 285, -1, -1, - -1, 289, 290, 291, 292, 293, 294, 295, 296, 297, - -1, 299, 300, 301, 302, 303, 304, 305, -1, 307, - -1, -1, -1, -1, 123, -1, 125, -1, -1, -1, - -1, -1, -1, -1, 322, -1, -1, -1, -1, -1, - -1, 329, 330, 331, 332, -1, 334, 335, 336, -1, - -1, 339, 340, -1, 342, 343, 344, 345, 0, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 363, -1, 365, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 387, - 388, -1, -1, -1, -1, -1, 394, 395, 396, 397, - 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, - 408, 409, 410, 411, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 91, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 260, -1, -1, -1, -1, -1, -1, -1, 268, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, 123, -1, 125, 283, 284, 285, -1, -1, -1, - 289, 290, 291, 292, 293, 294, 295, 296, 297, -1, - 299, 300, 301, 302, 303, 304, 305, -1, 307, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 322, -1, -1, -1, -1, -1, -1, - 329, 330, -1, 332, -1, 334, 335, 336, -1, -1, - 339, 340, -1, 342, 343, 344, 345, 0, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 363, -1, 365, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 387, 388, - -1, -1, -1, -1, -1, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, - 409, 410, 411, -1, -1, -1, -1, -1, 260, -1, - -1, -1, -1, -1, -1, -1, 268, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 91, -1, - -1, 283, 284, 285, -1, -1, -1, 289, 290, 291, - 292, 293, 294, 295, 296, 297, -1, 299, 300, 301, - 302, 303, 304, 305, -1, 307, -1, -1, -1, -1, - 123, -1, 125, -1, -1, -1, -1, -1, -1, -1, - 322, -1, -1, -1, -1, -1, -1, 329, 330, -1, - 332, -1, 334, 335, 336, -1, -1, 339, 340, -1, - 342, 343, 344, 345, 0, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 363, -1, 365, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 387, 388, -1, -1, -1, - -1, -1, 394, 395, 396, 397, 398, 399, 400, 401, - 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 91, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 260, -1, -1, - -1, -1, -1, -1, -1, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, -1, -1, 125, - 283, 284, 285, -1, -1, -1, 289, 290, 291, 292, - 293, 294, 295, 296, 297, -1, 299, 300, 301, 302, - 303, 304, 305, -1, 307, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 322, - -1, -1, -1, -1, -1, -1, 329, 330, -1, 332, - -1, 334, 335, 336, -1, -1, 339, 340, -1, 342, - 343, 344, 345, 0, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 363, -1, 365, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 387, 388, -1, -1, -1, -1, - -1, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 405, 406, 407, 408, 409, 410, 411, -1, - -1, -1, -1, -1, 260, -1, -1, -1, -1, -1, - -1, -1, 268, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, 91, -1, -1, 283, 284, 285, - -1, -1, -1, 289, 290, 291, 292, 293, 294, 295, - 296, 297, -1, 299, 300, 301, 302, 303, 304, 305, - -1, 307, -1, -1, -1, -1, -1, -1, 125, -1, - -1, -1, -1, -1, -1, -1, 322, -1, -1, -1, - -1, -1, -1, 329, 330, -1, 332, -1, 334, 335, - 336, -1, -1, 339, 340, -1, 342, 343, 344, 345, - 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 363, -1, 365, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 387, 388, -1, -1, -1, -1, -1, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 91, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 260, -1, -1, -1, -1, -1, -1, - -1, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, -1, -1, 125, 283, 284, 285, -1, - -1, -1, 289, 290, 291, 292, 293, 294, 295, 296, - 297, -1, 299, 300, 301, 302, 303, 304, 305, -1, - 307, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 322, -1, -1, -1, -1, - -1, -1, 329, 330, -1, 332, -1, 334, 335, 336, - -1, -1, 339, 340, -1, 342, 343, 344, 345, 0, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 363, -1, 365, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 387, 388, -1, -1, -1, -1, -1, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - 407, 408, 409, 410, 411, -1, -1, -1, -1, -1, - 260, -1, -1, -1, -1, -1, -1, -1, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 91, -1, -1, 283, 284, 285, -1, -1, -1, 289, - 290, 291, 292, 293, 294, 295, 296, 297, -1, 299, - 300, 301, 302, 303, 304, 305, -1, 307, -1, -1, - -1, -1, -1, -1, 125, -1, -1, -1, -1, -1, - -1, -1, 322, -1, -1, -1, -1, -1, -1, 329, - 330, -1, 332, -1, 334, 335, 336, -1, -1, 339, - 340, -1, 342, 343, 344, 345, 0, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 363, -1, 365, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 387, 388, -1, - -1, -1, -1, -1, 394, 395, 396, 397, 398, 399, - 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, - 410, 411, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 91, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 260, - -1, -1, -1, -1, -1, -1, -1, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, -1, - -1, 125, 283, 284, 285, -1, -1, -1, 289, 290, - 291, 292, 293, 294, 295, 296, 297, -1, 299, 300, - 301, 302, 303, 304, 305, -1, 307, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 322, -1, -1, -1, -1, -1, -1, 329, 330, - -1, 332, -1, 334, 335, 336, -1, -1, 339, 340, - -1, 342, 343, 344, 345, 0, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 363, -1, 365, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 387, 388, -1, -1, - -1, -1, -1, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, - 411, -1, -1, -1, -1, -1, 260, -1, -1, -1, - -1, -1, -1, -1, 268, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, 91, -1, -1, 283, - 284, 285, -1, -1, -1, 289, 290, 291, 292, 293, - 294, 295, 296, 297, -1, 299, 300, 301, 302, 303, - 304, 305, -1, 307, -1, -1, -1, -1, -1, -1, - 125, -1, -1, -1, -1, -1, -1, -1, 322, -1, - -1, -1, -1, -1, -1, 329, 330, -1, 332, -1, - 334, 335, 336, -1, -1, 339, 340, -1, 342, 343, - 344, 345, 0, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 363, - -1, 365, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 387, 388, -1, -1, -1, -1, -1, - 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, - 404, 405, 406, 407, 408, 409, 410, 411, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 91, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 260, -1, -1, -1, -1, - -1, -1, -1, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, -1, -1, 125, 283, 284, - 285, -1, -1, -1, 289, 290, 291, 292, 293, 294, - 295, 296, 297, -1, 299, 300, 301, 302, 303, 304, - 305, -1, 307, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 322, -1, -1, - -1, -1, -1, -1, 329, 330, -1, 332, -1, 334, - 335, 336, -1, -1, 339, 340, -1, 342, 343, 344, - 345, 0, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 363, -1, - 365, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 387, 388, -1, -1, -1, -1, -1, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 409, 410, 411, -1, -1, -1, - -1, -1, 260, -1, -1, -1, -1, -1, -1, -1, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 91, -1, -1, 283, 284, 285, -1, -1, - -1, 289, 290, 291, 292, 293, 294, 295, 296, 297, - -1, 299, 300, 301, 302, 303, 304, 305, -1, 307, - -1, -1, -1, -1, -1, -1, 125, -1, -1, -1, - -1, -1, -1, -1, 322, -1, -1, -1, -1, -1, - -1, 329, 330, -1, 332, -1, 334, 335, 336, -1, - -1, 339, 340, -1, 342, 343, 344, 345, 0, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 363, -1, 365, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 387, - 388, -1, -1, -1, -1, -1, 394, 395, 396, 397, - 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, - 408, 409, 410, 411, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 91, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 260, -1, -1, -1, -1, -1, -1, -1, 268, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, -1, -1, 125, 283, 284, 285, -1, -1, -1, - 289, 290, 291, 292, 293, 294, 295, 296, 297, -1, - 299, 300, 301, 302, 303, 304, 305, -1, 307, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 322, -1, -1, -1, -1, -1, -1, - 329, 330, -1, 332, -1, 334, 335, 336, -1, -1, - 339, 340, -1, 342, 343, 344, 345, 0, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 363, -1, 365, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 387, 388, - -1, -1, -1, -1, -1, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, - 409, 410, 411, -1, -1, -1, -1, -1, 260, -1, - -1, -1, -1, -1, -1, -1, 268, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 91, -1, - -1, 283, 284, 285, -1, -1, -1, 289, 290, 291, - 292, 293, 294, 295, 296, 297, -1, 299, 300, 301, - 302, 303, 304, 305, -1, 307, -1, -1, -1, -1, - -1, -1, 125, -1, -1, -1, -1, -1, -1, -1, - 322, -1, -1, -1, -1, -1, -1, 329, 330, -1, - 332, -1, 334, 335, 336, -1, -1, 339, 340, -1, - 342, 343, 344, 345, 0, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 363, -1, 365, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 387, 388, -1, -1, -1, - -1, -1, 394, 395, 396, 397, 398, 399, 400, 401, - 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 91, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 260, -1, -1, - -1, -1, -1, -1, -1, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, -1, -1, 125, - 283, 284, 285, -1, -1, -1, 289, 290, 291, 292, - 293, 294, 295, 296, 297, -1, 299, 300, 301, 302, - 303, 304, 305, -1, 307, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 322, - -1, -1, -1, -1, -1, -1, 329, 330, -1, 332, - -1, 334, 335, 336, -1, -1, 339, 340, -1, 342, - 343, 344, 345, 0, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 363, -1, 365, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 387, 388, -1, -1, -1, -1, - -1, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 405, 406, 407, 408, 409, 410, 411, -1, - -1, -1, -1, -1, 260, -1, -1, -1, -1, -1, - -1, -1, 268, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, 91, -1, -1, 283, 284, 285, - -1, -1, -1, 289, 290, 291, 292, 293, 294, 295, - 296, 297, -1, 299, 300, 301, 302, 303, 304, 305, - -1, 307, -1, -1, -1, -1, -1, -1, 125, -1, - -1, -1, -1, -1, -1, -1, 322, -1, -1, -1, - -1, -1, -1, 329, 330, -1, 332, -1, 334, 335, - 336, -1, -1, 339, 340, -1, 342, 343, 344, 345, - 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 363, -1, 365, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 387, 388, -1, -1, -1, -1, -1, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 91, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 260, -1, -1, -1, -1, -1, -1, - -1, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, -1, -1, 125, 283, 284, 285, -1, - -1, -1, 289, 290, 291, 292, 293, 294, 295, 296, - 297, -1, 299, 300, 301, 302, 303, 304, 305, -1, - 307, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 0, 322, -1, -1, -1, -1, - -1, -1, 329, 330, -1, 332, -1, 334, 335, 336, - -1, -1, 339, 340, -1, 342, 343, 344, 345, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 363, -1, 365, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 387, 388, -1, -1, -1, -1, -1, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - 407, 408, 409, 410, 411, 91, -1, -1, -1, -1, - 260, -1, -1, -1, -1, -1, -1, -1, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - -1, -1, -1, 283, 284, 285, -1, -1, -1, 289, - 290, 291, 292, 293, 294, 295, 296, 297, -1, 299, - 300, 301, 302, 303, 304, 305, -1, 307, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 0, 322, -1, -1, -1, -1, -1, -1, 329, - 330, -1, 332, -1, 334, 335, 336, -1, -1, 339, - 340, -1, 342, 343, 344, 345, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 363, -1, 365, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 387, 388, -1, - -1, -1, -1, -1, 394, 395, 396, 397, 398, 399, - 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, - 410, 411, 91, -1, 40, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 260, -1, -1, 40, -1, -1, - -1, -1, 268, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, -1, -1, -1, 283, 284, 285, - -1, -1, -1, 289, 290, 291, 292, 293, 294, 295, - 296, 297, -1, 299, 300, 301, 302, 303, 304, 305, - -1, 307, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 322, -1, -1, -1, - -1, -1, -1, 329, 330, -1, 332, -1, 334, 335, - 336, -1, -1, 339, 340, -1, 342, -1, 344, -1, - -1, -1, -1, -1, -1, -1, 40, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 363, -1, 365, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 387, 388, -1, -1, -1, -1, -1, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 411, -1, -1, -1, -1, - -1, 260, -1, -1, -1, -1, -1, -1, -1, 268, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, -1, -1, -1, 283, 284, 285, -1, -1, -1, - 289, 290, 291, 292, 293, 294, 295, 296, 297, -1, - 299, 300, 301, 302, 303, 304, 305, -1, 307, -1, - -1, 257, -1, -1, -1, 261, -1, -1, -1, -1, - -1, -1, -1, 322, 257, 258, -1, -1, -1, -1, - 329, 330, -1, 332, -1, 334, 335, 336, -1, -1, - 339, 340, -1, 342, -1, 344, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 363, -1, 365, 313, 314, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 313, 314, -1, -1, -1, -1, -1, -1, 387, 388, - 91, -1, -1, -1, -1, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, - 409, 410, 411, -1, 258, -1, -1, -1, -1, -1, - -1, -1, -1, 369, 370, 371, 372, 373, -1, 375, - 376, 377, 378, 379, 380, 381, 369, 370, 371, 372, - 373, -1, 375, 376, 377, 378, 379, 380, 381, -1, - -1, -1, -1, -1, 400, 401, -1, -1, 404, 405, - 315, 316, -1, -1, 410, -1, -1, 400, 401, 313, - 314, 326, 327, 328, -1, -1, -1, 410, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 349, -1, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 369, 370, 371, 372, 373, - 385, 375, 376, 377, 378, 379, 380, 381, -1, -1, - -1, 396, 397, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 400, 401, -1, 260, - -1, -1, -1, -1, -1, -1, 410, 268, -1, -1, - 271, 272, 273, 274, 275, 276, 277, 278, 279, -1, - -1, -1, 283, 284, 285, -1, -1, -1, 289, 290, - 291, 292, 293, 294, 295, 296, 297, -1, 299, 300, - 301, 302, 303, 304, 305, -1, 307, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 322, -1, -1, -1, -1, -1, -1, 329, 330, - -1, 332, -1, 334, 335, 336, -1, -1, 339, 340, - -1, 342, -1, 344, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 363, -1, 365, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 387, 388, -1, -1, - -1, -1, -1, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, - 411, -}; -#define YYFINAL 3 -#ifndef YYDEBUG -#define YYDEBUG 0 -#endif -#define YYMAXTOKEN 430 -#if YYDEBUG -char *yyname[] = { -"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",0,0,0,0,0,0, -0,0,0,0,"':'",0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,"'['",0,"']'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'{'", -"'|'","'}'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"CHAR","INTEGER","BOOLEAN","PERCENT", -"SPERCENT","MINUS_INTEGER","PLUS_INTEGER","MAZE_GRID_ID","SOLID_FILL_ID", -"MINES_ID","ROGUELEV_ID","MESSAGE_ID","MAZE_ID","LEVEL_ID","LEV_INIT_ID", -"GEOMETRY_ID","NOMAP_ID","OBJECT_ID","COBJECT_ID","MONSTER_ID","TRAP_ID", -"DOOR_ID","DRAWBRIDGE_ID","object_ID","monster_ID","terrain_ID","MAZEWALK_ID", -"WALLIFY_ID","REGION_ID","FILLING","IRREGULAR","JOINED","ALTAR_ID","LADDER_ID", -"STAIR_ID","NON_DIGGABLE_ID","NON_PASSWALL_ID","ROOM_ID","PORTAL_ID", -"TELEPRT_ID","BRANCH_ID","LEV","MINERALIZE_ID","CORRIDOR_ID","GOLD_ID", -"ENGRAVING_ID","FOUNTAIN_ID","POOL_ID","SINK_ID","NONE","RAND_CORRIDOR_ID", -"DOOR_STATE","LIGHT_STATE","CURSE_TYPE","ENGRAVING_TYPE","DIRECTION", -"RANDOM_TYPE","RANDOM_TYPE_BRACKET","A_REGISTER","ALIGNMENT","LEFT_OR_RIGHT", -"CENTER","TOP_OR_BOT","ALTAR_TYPE","UP_OR_DOWN","SUBROOM_ID","NAME_ID", -"FLAGS_ID","FLAG_TYPE","MON_ATTITUDE","MON_ALERTNESS","MON_APPEARANCE", -"ROOMDOOR_ID","IF_ID","ELSE_ID","TERRAIN_ID","HORIZ_OR_VERT", -"REPLACE_TERRAIN_ID","EXIT_ID","SHUFFLE_ID","QUANTITY_ID","BURIED_ID","LOOP_ID", -"FOR_ID","TO_ID","SWITCH_ID","CASE_ID","BREAK_ID","DEFAULT_ID","ERODED_ID", -"TRAPPED_STATE","RECHARGED_ID","INVIS_ID","GREASED_ID","FEMALE_ID", -"CANCELLED_ID","REVIVED_ID","AVENGE_ID","FLEEING_ID","BLINDED_ID", -"PARALYZED_ID","STUNNED_ID","CONFUSED_ID","SEENTRAPS_ID","ALL_ID","MONTYPE_ID", -"GRAVE_ID","ERODEPROOF_ID","FUNCTION_ID","MSG_OUTPUT_TYPE","COMPARE_TYPE", -"UNKNOWN_TYPE","rect_ID","fillrect_ID","line_ID","randline_ID","grow_ID", -"selection_ID","flood_ID","rndcoord_ID","circle_ID","ellipse_ID","filter_ID", -"complement_ID","gradient_ID","GRADIENT_TYPE","LIMITED","HUMIDITY_TYPE", -"STRING","MAP_ID","NQSTRING","VARSTRING","CFUNC","CFUNC_INT","CFUNC_STR", -"CFUNC_COORD","CFUNC_REGION","VARSTRING_INT","VARSTRING_INT_ARRAY", -"VARSTRING_STRING","VARSTRING_STRING_ARRAY","VARSTRING_VAR", -"VARSTRING_VAR_ARRAY","VARSTRING_COORD","VARSTRING_COORD_ARRAY", -"VARSTRING_REGION","VARSTRING_REGION_ARRAY","VARSTRING_MAPCHAR", -"VARSTRING_MAPCHAR_ARRAY","VARSTRING_MONST","VARSTRING_MONST_ARRAY", -"VARSTRING_OBJ","VARSTRING_OBJ_ARRAY","VARSTRING_SEL","VARSTRING_SEL_ARRAY", -"METHOD_INT","METHOD_INT_ARRAY","METHOD_STRING","METHOD_STRING_ARRAY", -"METHOD_VAR","METHOD_VAR_ARRAY","METHOD_COORD","METHOD_COORD_ARRAY", -"METHOD_REGION","METHOD_REGION_ARRAY","METHOD_MAPCHAR","METHOD_MAPCHAR_ARRAY", -"METHOD_MONST","METHOD_MONST_ARRAY","METHOD_OBJ","METHOD_OBJ_ARRAY", -"METHOD_SEL","METHOD_SEL_ARRAY","DICE", -}; -char *yyrule[] = { -"$accept : file", -"file :", -"file : levels", -"levels : level", -"levels : level levels", -"level : level_def flags levstatements", -"level_def : LEVEL_ID ':' STRING", -"level_def : MAZE_ID ':' STRING ',' mazefiller", -"mazefiller : RANDOM_TYPE", -"mazefiller : CHAR", -"lev_init : LEV_INIT_ID ':' SOLID_FILL_ID ',' terrain_type", -"lev_init : LEV_INIT_ID ':' MAZE_GRID_ID ',' CHAR", -"lev_init : LEV_INIT_ID ':' ROGUELEV_ID", -"lev_init : LEV_INIT_ID ':' MINES_ID ',' CHAR ',' CHAR ',' BOOLEAN ',' BOOLEAN ',' light_state ',' walled opt_fillchar", -"opt_limited :", -"opt_limited : ',' LIMITED", -"opt_coord_or_var :", -"opt_coord_or_var : ',' coord_or_var", -"opt_fillchar :", -"opt_fillchar : ',' CHAR", -"walled : BOOLEAN", -"walled : RANDOM_TYPE", -"flags :", -"flags : FLAGS_ID ':' flag_list", -"flag_list : FLAG_TYPE ',' flag_list", -"flag_list : FLAG_TYPE", -"levstatements :", -"levstatements : levstatement levstatements", -"stmt_block : '{' levstatements '}'", -"levstatement : message", -"levstatement : lev_init", -"levstatement : altar_detail", -"levstatement : grave_detail", -"levstatement : branch_region", -"levstatement : corridor", -"levstatement : variable_define", -"levstatement : shuffle_detail", -"levstatement : diggable_detail", -"levstatement : door_detail", -"levstatement : drawbridge_detail", -"levstatement : engraving_detail", -"levstatement : mineralize", -"levstatement : fountain_detail", -"levstatement : gold_detail", -"levstatement : switchstatement", -"levstatement : forstatement", -"levstatement : loopstatement", -"levstatement : ifstatement", -"levstatement : chancestatement", -"levstatement : exitstatement", -"levstatement : breakstatement", -"levstatement : function_define", -"levstatement : function_call", -"levstatement : ladder_detail", -"levstatement : map_definition", -"levstatement : mazewalk_detail", -"levstatement : monster_detail", -"levstatement : object_detail", -"levstatement : passwall_detail", -"levstatement : pool_detail", -"levstatement : portal_region", -"levstatement : random_corridors", -"levstatement : region_detail", -"levstatement : room_def", -"levstatement : subroom_def", -"levstatement : sink_detail", -"levstatement : terrain_detail", -"levstatement : replace_terrain_detail", -"levstatement : stair_detail", -"levstatement : stair_region", -"levstatement : teleprt_region", -"levstatement : trap_detail", -"levstatement : wallify_detail", -"any_var_array : VARSTRING_INT_ARRAY", -"any_var_array : VARSTRING_STRING_ARRAY", -"any_var_array : VARSTRING_VAR_ARRAY", -"any_var_array : VARSTRING_COORD_ARRAY", -"any_var_array : VARSTRING_REGION_ARRAY", -"any_var_array : VARSTRING_MAPCHAR_ARRAY", -"any_var_array : VARSTRING_MONST_ARRAY", -"any_var_array : VARSTRING_OBJ_ARRAY", -"any_var_array : VARSTRING_SEL_ARRAY", -"any_var : VARSTRING_INT", -"any_var : VARSTRING_STRING", -"any_var : VARSTRING_VAR", -"any_var : VARSTRING_COORD", -"any_var : VARSTRING_REGION", -"any_var : VARSTRING_MAPCHAR", -"any_var : VARSTRING_MONST", -"any_var : VARSTRING_OBJ", -"any_var : VARSTRING_SEL", -"any_var_or_arr : any_var_array", -"any_var_or_arr : any_var", -"any_var_or_arr : VARSTRING", -"any_var_or_unk : VARSTRING", -"any_var_or_unk : any_var", -"shuffle_detail : SHUFFLE_ID ':' any_var_array", -"variable_define : any_var_or_arr '=' math_expr_var", -"variable_define : any_var_or_arr '=' selection_ID ':' ter_selection", -"variable_define : any_var_or_arr '=' string_expr", -"variable_define : any_var_or_arr '=' terrainid ':' mapchar_or_var", -"variable_define : any_var_or_arr '=' monsterid ':' monster_or_var", -"variable_define : any_var_or_arr '=' objectid ':' object_or_var", -"variable_define : any_var_or_arr '=' coord_or_var", -"variable_define : any_var_or_arr '=' region_or_var", -"variable_define : any_var_or_arr '=' '{' integer_list '}'", -"variable_define : any_var_or_arr '=' '{' encodecoord_list '}'", -"variable_define : any_var_or_arr '=' '{' encoderegion_list '}'", -"variable_define : any_var_or_arr '=' terrainid ':' '{' mapchar_list '}'", -"variable_define : any_var_or_arr '=' monsterid ':' '{' encodemonster_list '}'", -"variable_define : any_var_or_arr '=' objectid ':' '{' encodeobj_list '}'", -"variable_define : any_var_or_arr '=' '{' string_list '}'", -"encodeobj_list : encodeobj", -"encodeobj_list : encodeobj_list ',' encodeobj", -"encodemonster_list : encodemonster", -"encodemonster_list : encodemonster_list ',' encodemonster", -"mapchar_list : mapchar", -"mapchar_list : mapchar_list ',' mapchar", -"encoderegion_list : encoderegion", -"encoderegion_list : encoderegion_list ',' encoderegion", -"encodecoord_list : encodecoord", -"encodecoord_list : encodecoord_list ',' encodecoord", -"integer_list : math_expr_var", -"integer_list : integer_list ',' math_expr_var", -"string_list : string_expr", -"string_list : string_list ',' string_expr", -"$$1 :", -"$$2 :", -"function_define : FUNCTION_ID NQSTRING '(' $$1 func_params_list ')' $$2 stmt_block", -"function_call : NQSTRING '(' func_call_params_list ')'", -"exitstatement : EXIT_ID", -"opt_percent :", -"opt_percent : PERCENT", -"comparestmt : PERCENT", -"comparestmt : '[' math_expr_var COMPARE_TYPE math_expr_var ']'", -"comparestmt : '[' math_expr_var ']'", -"$$3 :", -"$$4 :", -"switchstatement : SWITCH_ID $$3 '[' integer_or_var ']' $$4 '{' switchcases '}'", -"switchcases :", -"switchcases : switchcase switchcases", -"$$5 :", -"switchcase : CASE_ID all_integers ':' $$5 levstatements", -"$$6 :", -"switchcase : DEFAULT_ID ':' $$6 levstatements", -"breakstatement : BREAK_ID", -"for_to_span : '.' '.'", -"for_to_span : TO_ID", -"forstmt_start : FOR_ID any_var_or_unk '=' math_expr_var for_to_span math_expr_var", -"$$7 :", -"forstatement : forstmt_start $$7 stmt_block", -"$$8 :", -"loopstatement : LOOP_ID '[' integer_or_var ']' $$8 stmt_block", -"$$9 :", -"chancestatement : comparestmt ':' $$9 levstatement", -"$$10 :", -"ifstatement : IF_ID comparestmt $$10 if_ending", -"if_ending : stmt_block", -"$$11 :", -"if_ending : stmt_block $$11 ELSE_ID stmt_block", -"message : MESSAGE_ID ':' string_expr", -"random_corridors : RAND_CORRIDOR_ID", -"random_corridors : RAND_CORRIDOR_ID ':' all_integers", -"random_corridors : RAND_CORRIDOR_ID ':' RANDOM_TYPE", -"corridor : CORRIDOR_ID ':' corr_spec ',' corr_spec", -"corridor : CORRIDOR_ID ':' corr_spec ',' all_integers", -"corr_spec : '(' INTEGER ',' DIRECTION ',' door_pos ')'", -"room_begin : room_type opt_percent ',' light_state", -"$$12 :", -"subroom_def : SUBROOM_ID ':' room_begin ',' subroom_pos ',' room_size optroomregionflags $$12 stmt_block", -"$$13 :", -"room_def : ROOM_ID ':' room_begin ',' room_pos ',' room_align ',' room_size optroomregionflags $$13 stmt_block", -"roomfill :", -"roomfill : ',' BOOLEAN", -"room_pos : '(' INTEGER ',' INTEGER ')'", -"room_pos : RANDOM_TYPE", -"subroom_pos : '(' INTEGER ',' INTEGER ')'", -"subroom_pos : RANDOM_TYPE", -"room_align : '(' h_justif ',' v_justif ')'", -"room_align : RANDOM_TYPE", -"room_size : '(' INTEGER ',' INTEGER ')'", -"room_size : RANDOM_TYPE", -"door_detail : ROOMDOOR_ID ':' secret ',' door_state ',' door_wall ',' door_pos", -"door_detail : DOOR_ID ':' door_state ',' ter_selection", -"secret : BOOLEAN", -"secret : RANDOM_TYPE", -"door_wall : dir_list", -"door_wall : RANDOM_TYPE", -"dir_list : DIRECTION", -"dir_list : DIRECTION '|' dir_list", -"door_pos : INTEGER", -"door_pos : RANDOM_TYPE", -"map_definition : NOMAP_ID", -"map_definition : GEOMETRY_ID ':' h_justif ',' v_justif roomfill MAP_ID", -"map_definition : GEOMETRY_ID ':' coord_or_var roomfill MAP_ID", -"h_justif : LEFT_OR_RIGHT", -"h_justif : CENTER", -"v_justif : TOP_OR_BOT", -"v_justif : CENTER", -"monster_detail : MONSTER_ID ':' monster_desc", -"$$14 :", -"monster_detail : MONSTER_ID ':' monster_desc $$14 stmt_block", -"monster_desc : monster_or_var ',' coord_or_var monster_infos", -"monster_infos :", -"monster_infos : monster_infos ',' monster_info", -"monster_info : string_expr", -"monster_info : MON_ATTITUDE", -"monster_info : MON_ALERTNESS", -"monster_info : alignment_prfx", -"monster_info : MON_APPEARANCE string_expr", -"monster_info : FEMALE_ID", -"monster_info : INVIS_ID", -"monster_info : CANCELLED_ID", -"monster_info : REVIVED_ID", -"monster_info : AVENGE_ID", -"monster_info : FLEEING_ID ':' integer_or_var", -"monster_info : BLINDED_ID ':' integer_or_var", -"monster_info : PARALYZED_ID ':' integer_or_var", -"monster_info : STUNNED_ID", -"monster_info : CONFUSED_ID", -"monster_info : SEENTRAPS_ID ':' seen_trap_mask", -"seen_trap_mask : STRING", -"seen_trap_mask : ALL_ID", -"seen_trap_mask : STRING '|' seen_trap_mask", -"object_detail : OBJECT_ID ':' object_desc", -"$$15 :", -"object_detail : COBJECT_ID ':' object_desc $$15 stmt_block", -"object_desc : object_or_var object_infos", -"object_infos :", -"object_infos : object_infos ',' object_info", -"object_info : CURSE_TYPE", -"object_info : MONTYPE_ID ':' monster_or_var", -"object_info : all_ints_push", -"object_info : NAME_ID ':' string_expr", -"object_info : QUANTITY_ID ':' integer_or_var", -"object_info : BURIED_ID", -"object_info : LIGHT_STATE", -"object_info : ERODED_ID ':' integer_or_var", -"object_info : ERODEPROOF_ID", -"object_info : DOOR_STATE", -"object_info : TRAPPED_STATE", -"object_info : RECHARGED_ID ':' integer_or_var", -"object_info : INVIS_ID", -"object_info : GREASED_ID", -"object_info : coord_or_var", -"trap_detail : TRAP_ID ':' trap_name ',' coord_or_var", -"drawbridge_detail : DRAWBRIDGE_ID ':' coord_or_var ',' DIRECTION ',' door_state", -"mazewalk_detail : MAZEWALK_ID ':' coord_or_var ',' DIRECTION", -"mazewalk_detail : MAZEWALK_ID ':' coord_or_var ',' DIRECTION ',' BOOLEAN opt_fillchar", -"wallify_detail : WALLIFY_ID", -"wallify_detail : WALLIFY_ID ':' ter_selection", -"ladder_detail : LADDER_ID ':' coord_or_var ',' UP_OR_DOWN", -"stair_detail : STAIR_ID ':' coord_or_var ',' UP_OR_DOWN", -"stair_region : STAIR_ID ':' lev_region ',' lev_region ',' UP_OR_DOWN", -"portal_region : PORTAL_ID ':' lev_region ',' lev_region ',' STRING", -"teleprt_region : TELEPRT_ID ':' lev_region ',' lev_region teleprt_detail", -"branch_region : BRANCH_ID ':' lev_region ',' lev_region", -"teleprt_detail :", -"teleprt_detail : ',' UP_OR_DOWN", -"fountain_detail : FOUNTAIN_ID ':' ter_selection", -"sink_detail : SINK_ID ':' ter_selection", -"pool_detail : POOL_ID ':' ter_selection", -"terrain_type : CHAR", -"terrain_type : '(' CHAR ',' light_state ')'", -"replace_terrain_detail : REPLACE_TERRAIN_ID ':' region_or_var ',' mapchar_or_var ',' mapchar_or_var ',' SPERCENT", -"terrain_detail : TERRAIN_ID ':' ter_selection ',' mapchar_or_var", -"diggable_detail : NON_DIGGABLE_ID ':' region_or_var", -"passwall_detail : NON_PASSWALL_ID ':' region_or_var", -"$$16 :", -"region_detail : REGION_ID ':' region_or_var ',' light_state ',' room_type optroomregionflags $$16 region_detail_end", -"region_detail_end :", -"region_detail_end : stmt_block", -"altar_detail : ALTAR_ID ':' coord_or_var ',' alignment ',' altar_type", -"grave_detail : GRAVE_ID ':' coord_or_var ',' string_expr", -"grave_detail : GRAVE_ID ':' coord_or_var ',' RANDOM_TYPE", -"grave_detail : GRAVE_ID ':' coord_or_var", -"gold_detail : GOLD_ID ':' math_expr_var ',' coord_or_var", -"engraving_detail : ENGRAVING_ID ':' coord_or_var ',' engraving_type ',' string_expr", -"mineralize : MINERALIZE_ID ':' integer_or_var ',' integer_or_var ',' integer_or_var ',' integer_or_var", -"mineralize : MINERALIZE_ID", -"trap_name : STRING", -"trap_name : RANDOM_TYPE", -"room_type : STRING", -"room_type : RANDOM_TYPE", -"optroomregionflags :", -"optroomregionflags : ',' roomregionflags", -"roomregionflags : roomregionflag", -"roomregionflags : roomregionflag ',' roomregionflags", -"roomregionflag : FILLING", -"roomregionflag : IRREGULAR", -"roomregionflag : JOINED", -"door_state : DOOR_STATE", -"door_state : RANDOM_TYPE", -"light_state : LIGHT_STATE", -"light_state : RANDOM_TYPE", -"alignment : ALIGNMENT", -"alignment : a_register", -"alignment : RANDOM_TYPE", -"alignment_prfx : ALIGNMENT", -"alignment_prfx : a_register", -"alignment_prfx : A_REGISTER ':' RANDOM_TYPE", -"altar_type : ALTAR_TYPE", -"altar_type : RANDOM_TYPE", -"a_register : A_REGISTER '[' INTEGER ']'", -"string_or_var : STRING", -"string_or_var : VARSTRING_STRING", -"string_or_var : VARSTRING_STRING_ARRAY '[' math_expr_var ']'", -"integer_or_var : math_expr_var", -"coord_or_var : encodecoord", -"coord_or_var : rndcoord_ID '(' ter_selection ')'", -"coord_or_var : VARSTRING_COORD", -"coord_or_var : VARSTRING_COORD_ARRAY '[' math_expr_var ']'", -"encodecoord : '(' INTEGER ',' INTEGER ')'", -"encodecoord : RANDOM_TYPE", -"encodecoord : RANDOM_TYPE_BRACKET humidity_flags ']'", -"humidity_flags : HUMIDITY_TYPE", -"humidity_flags : HUMIDITY_TYPE ',' humidity_flags", -"region_or_var : encoderegion", -"region_or_var : VARSTRING_REGION", -"region_or_var : VARSTRING_REGION_ARRAY '[' math_expr_var ']'", -"encoderegion : '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')'", -"mapchar_or_var : mapchar", -"mapchar_or_var : VARSTRING_MAPCHAR", -"mapchar_or_var : VARSTRING_MAPCHAR_ARRAY '[' math_expr_var ']'", -"mapchar : CHAR", -"mapchar : '(' CHAR ',' light_state ')'", -"monster_or_var : encodemonster", -"monster_or_var : VARSTRING_MONST", -"monster_or_var : VARSTRING_MONST_ARRAY '[' math_expr_var ']'", -"encodemonster : STRING", -"encodemonster : CHAR", -"encodemonster : '(' CHAR ',' STRING ')'", -"encodemonster : RANDOM_TYPE", -"object_or_var : encodeobj", -"object_or_var : VARSTRING_OBJ", -"object_or_var : VARSTRING_OBJ_ARRAY '[' math_expr_var ']'", -"encodeobj : STRING", -"encodeobj : CHAR", -"encodeobj : '(' CHAR ',' STRING ')'", -"encodeobj : RANDOM_TYPE", -"string_expr : string_or_var", -"string_expr : string_expr '.' string_or_var", -"math_expr_var : INTEGER", -"math_expr_var : dice", -"math_expr_var : '(' MINUS_INTEGER ')'", -"math_expr_var : VARSTRING_INT", -"math_expr_var : VARSTRING_INT_ARRAY '[' math_expr_var ']'", -"math_expr_var : math_expr_var '+' math_expr_var", -"math_expr_var : math_expr_var '-' math_expr_var", -"math_expr_var : math_expr_var '*' math_expr_var", -"math_expr_var : math_expr_var '/' math_expr_var", -"math_expr_var : math_expr_var '%' math_expr_var", -"math_expr_var : '(' math_expr_var ')'", -"func_param_type : CFUNC_INT", -"func_param_type : CFUNC_STR", -"func_param_part : any_var_or_arr ':' func_param_type", -"func_param_list : func_param_part", -"func_param_list : func_param_list ',' func_param_part", -"func_params_list :", -"func_params_list : func_param_list", -"func_call_param_part : math_expr_var", -"func_call_param_part : string_expr", -"func_call_param_list : func_call_param_part", -"func_call_param_list : func_call_param_list ',' func_call_param_part", -"func_call_params_list :", -"func_call_params_list : func_call_param_list", -"ter_selection_x : coord_or_var", -"ter_selection_x : rect_ID region_or_var", -"ter_selection_x : fillrect_ID region_or_var", -"ter_selection_x : line_ID coord_or_var ',' coord_or_var", -"ter_selection_x : randline_ID coord_or_var ',' coord_or_var ',' math_expr_var", -"ter_selection_x : grow_ID '(' ter_selection ')'", -"ter_selection_x : grow_ID '(' dir_list ',' ter_selection ')'", -"ter_selection_x : filter_ID '(' SPERCENT ',' ter_selection ')'", -"ter_selection_x : filter_ID '(' ter_selection ',' ter_selection ')'", -"ter_selection_x : filter_ID '(' mapchar_or_var ',' ter_selection ')'", -"ter_selection_x : flood_ID coord_or_var", -"ter_selection_x : circle_ID '(' coord_or_var ',' math_expr_var ')'", -"ter_selection_x : circle_ID '(' coord_or_var ',' math_expr_var ',' FILLING ')'", -"ter_selection_x : ellipse_ID '(' coord_or_var ',' math_expr_var ',' math_expr_var ')'", -"ter_selection_x : ellipse_ID '(' coord_or_var ',' math_expr_var ',' math_expr_var ',' FILLING ')'", -"ter_selection_x : gradient_ID '(' GRADIENT_TYPE ',' '(' math_expr_var '-' math_expr_var opt_limited ')' ',' coord_or_var opt_coord_or_var ')'", -"ter_selection_x : complement_ID ter_selection_x", -"ter_selection_x : VARSTRING_SEL", -"ter_selection_x : '(' ter_selection ')'", -"ter_selection : ter_selection_x", -"ter_selection : ter_selection_x '&' ter_selection", -"dice : DICE", -"all_integers : MINUS_INTEGER", -"all_integers : PLUS_INTEGER", -"all_integers : INTEGER", -"all_ints_push : MINUS_INTEGER", -"all_ints_push : PLUS_INTEGER", -"all_ints_push : INTEGER", -"all_ints_push : dice", -"objectid : object_ID", -"objectid : OBJECT_ID", -"monsterid : monster_ID", -"monsterid : MONSTER_ID", -"terrainid : terrain_ID", -"terrainid : TERRAIN_ID", -"engraving_type : ENGRAVING_TYPE", -"engraving_type : RANDOM_TYPE", -"lev_region : region", -"lev_region : LEV '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')'", -"region : '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')'", -}; -#endif -#ifdef YYSTACKSIZE -#undef YYMAXDEPTH -#define YYMAXDEPTH YYSTACKSIZE -#else -#ifdef YYMAXDEPTH -#define YYSTACKSIZE YYMAXDEPTH -#else -#define YYSTACKSIZE 500 -#define YYMAXDEPTH 500 -#endif -#endif -int yydebug; -int yynerrs; -int yyerrflag; -int yychar; -short *yyssp; -YYSTYPE *yyvsp; -YYSTYPE yyval; -YYSTYPE yylval; -short yyss[YYSTACKSIZE]; -YYSTYPE yyvs[YYSTACKSIZE]; -#define yystacksize YYSTACKSIZE - -/*lev_comp.y*/ -#define YYABORT goto yyabort -#define YYREJECT goto yyabort -#define YYACCEPT goto yyaccept -#define YYERROR goto yyerrlab -int -yyparse() -{ - register int yym, yyn, yystate; -#if YYDEBUG - register char *yys; - extern char *getenv(); - - if ((yys = getenv("YYDEBUG")) != 0) - { - yyn = *yys; - if (yyn >= '0' && yyn <= '9') - yydebug = yyn - '0'; - } -#endif - - yynerrs = 0; - yyerrflag = 0; - yychar = (-1); - - yyssp = yyss; - yyvsp = yyvs; - *yyssp = yystate = 0; - -yyloop: - if ((yyn = yydefred[yystate]) != 0) goto yyreduce; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, yystate, yychar, yys); - } -#endif - } - if ((yyn = yysindex[yystate]) != 0 && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, shifting to state %d\n", - YYPREFIX, yystate, yytable[yyn]); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - yychar = (-1); - if (yyerrflag > 0) --yyerrflag; - goto yyloop; - } - if ((yyn = yyrindex[yystate]) != 0 && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { - yyn = yytable[yyn]; - goto yyreduce; - } - if (yyerrflag) goto yyinrecovery; - goto yynewerror; -yynewerror: - yyerror("syntax error"); - goto yyerrlab; -yyerrlab: - ++yynerrs; -yyinrecovery: - if (yyerrflag < 3) - { - yyerrflag = 3; - for (;;) - { - if ((yyn = yysindex[*yyssp]) != 0 && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, error recovery shifting\ - to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - goto yyloop; - } - else - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: error recovery discarding state %d\n", - YYPREFIX, *yyssp); -#endif - if (yyssp <= yyss) goto yyabort; - --yyssp; - --yyvsp; - } - } - } - else - { - if (yychar == 0) goto yyabort; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, error recovery discards token %d (%s)\n", - YYPREFIX, yystate, yychar, yys); - } -#endif - yychar = (-1); - goto yyloop; - } -yyreduce: -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, reducing by rule %d (%s)\n", - YYPREFIX, yystate, yyn, yyrule[yyn]); -#endif - yym = yylen[yyn]; - yyval = yyvsp[1-yym]; - switch (yyn) - { -case 5: -{ - if (fatal_error > 0) { - (void) fprintf(stderr, - "%s: %d errors detected for level \"%s\". No output created!\n", - fname, fatal_error, yyvsp[-2].map); - fatal_error = 0; - got_errors++; - } else if (!got_errors) { - if (!write_level_file(yyvsp[-2].map, splev)) { - lc_error("Can't write output file for '%s'!", - yyvsp[-2].map); - exit(EXIT_FAILURE); - } - } - Free(yyvsp[-2].map); - Free(splev); - splev = NULL; - vardef_free_all(vardefs); - vardefs = NULL; - } -break; -case 6: -{ - start_level_def(&splev, yyvsp[0].map); - yyval.map = yyvsp[0].map; - } -break; -case 7: -{ - start_level_def(&splev, yyvsp[-2].map); - if (yyvsp[0].i == -1) { - add_opvars(splev, "iiiiiiiio", - VA_PASS9(LVLINIT_MAZEGRID, HWALL, 0,0, - 0,0,0,0, SPO_INITLEVEL)); - } else { - int bg = (int) what_map_char((char) yyvsp[0].i); - - add_opvars(splev, "iiiiiiiio", - VA_PASS9(LVLINIT_SOLIDFILL, bg, 0,0, - 0,0,0,0, SPO_INITLEVEL)); - } - add_opvars(splev, "io", - VA_PASS2(MAZELEVEL, SPO_LEVEL_FLAGS)); - max_x_map = COLNO-1; - max_y_map = ROWNO; - yyval.map = yyvsp[-2].map; - } -break; -case 8: -{ - yyval.i = -1; - } -break; -case 9: -{ - yyval.i = what_map_char((char) yyvsp[0].i); - } -break; -case 10: -{ - int filling = (int) yyvsp[0].terr.ter; - - if (filling == INVALID_TYPE || filling >= MAX_TYPE) - lc_error("INIT_MAP: Invalid fill char type."); - add_opvars(splev, "iiiiiiiio", - VA_PASS9(LVLINIT_SOLIDFILL, filling, - 0, (int) yyvsp[0].terr.lit, - 0,0,0,0, SPO_INITLEVEL)); - max_x_map = COLNO-1; - max_y_map = ROWNO; - } -break; -case 11: -{ - int filling = (int) what_map_char((char) yyvsp[0].i); - - if (filling == INVALID_TYPE || filling >= MAX_TYPE) - lc_error("INIT_MAP: Invalid fill char type."); - add_opvars(splev, "iiiiiiiio", - VA_PASS9(LVLINIT_MAZEGRID, filling, 0,0, - 0,0,0,0, SPO_INITLEVEL)); - max_x_map = COLNO-1; - max_y_map = ROWNO; - } -break; -case 12: -{ - add_opvars(splev, "iiiiiiiio", - VA_PASS9(LVLINIT_ROGUE,0,0,0, - 0,0,0,0, SPO_INITLEVEL)); - } -break; -case 13: -{ - int fg = (int) what_map_char((char) yyvsp[-11].i), - bg = (int) what_map_char((char) yyvsp[-9].i); - int smoothed = (int) yyvsp[-7].i, - joined = (int) yyvsp[-5].i, - lit = (int) yyvsp[-3].i, - walled = (int) yyvsp[-1].i, - filling = (int) yyvsp[0].i; - - if (fg == INVALID_TYPE || fg >= MAX_TYPE) - lc_error("INIT_MAP: Invalid foreground type."); - if (bg == INVALID_TYPE || bg >= MAX_TYPE) - lc_error("INIT_MAP: Invalid background type."); - if (joined && fg != CORR && fg != ROOM) - lc_error("INIT_MAP: Invalid foreground type for joined map."); - - if (filling == INVALID_TYPE) - lc_error("INIT_MAP: Invalid fill char type."); - - add_opvars(splev, "iiiiiiiio", - VA_PASS9(LVLINIT_MINES, filling, walled, lit, - joined, smoothed, bg, fg, - SPO_INITLEVEL)); - max_x_map = COLNO-1; - max_y_map = ROWNO; - } -break; -case 14: -{ - yyval.i = 0; - } -break; -case 15: -{ - yyval.i = yyvsp[0].i; - } -break; -case 16: -{ - add_opvars(splev, "o", VA_PASS1(SPO_COPY)); - yyval.i = 0; - } -break; -case 17: -{ - yyval.i = 1; - } -break; -case 18: -{ - yyval.i = -1; - } -break; -case 19: -{ - yyval.i = what_map_char((char) yyvsp[0].i); - } -break; -case 22: -{ - add_opvars(splev, "io", VA_PASS2(0, SPO_LEVEL_FLAGS)); - } -break; -case 23: -{ - add_opvars(splev, "io", - VA_PASS2((int) yyvsp[0].i, SPO_LEVEL_FLAGS)); - } -break; -case 24: -{ - yyval.i = (yyvsp[-2].i | yyvsp[0].i); - } -break; -case 25: -{ - yyval.i = yyvsp[0].i; - } -break; -case 26: -{ - yyval.i = 0; - } -break; -case 27: -{ - yyval.i = 1 + yyvsp[0].i; - } -break; -case 28: -{ - yyval.i = yyvsp[-1].i; - } -break; -case 96: -{ - struct lc_vardefs *vd; - - if ((vd = vardef_defined(vardefs, yyvsp[0].map, 1))) { - if (!(vd->var_type & SPOVAR_ARRAY)) - lc_error("Trying to shuffle non-array variable '%s'", - yyvsp[0].map); - } else - lc_error("Trying to shuffle undefined variable '%s'", - yyvsp[0].map); - add_opvars(splev, "so", VA_PASS2(yyvsp[0].map, SPO_SHUFFLE_ARRAY)); - Free(yyvsp[0].map); - } -break; -case 97: -{ - vardefs = add_vardef_type(vardefs, yyvsp[-2].map, SPOVAR_INT); - add_opvars(splev, "iso", VA_PASS3(0, yyvsp[-2].map, SPO_VAR_INIT)); - Free(yyvsp[-2].map); - } -break; -case 98: -{ - vardefs = add_vardef_type(vardefs, yyvsp[-4].map, SPOVAR_SEL); - add_opvars(splev, "iso", VA_PASS3(0, yyvsp[-4].map, SPO_VAR_INIT)); - Free(yyvsp[-4].map); - } -break; -case 99: -{ - vardefs = add_vardef_type(vardefs, yyvsp[-2].map, SPOVAR_STRING); - add_opvars(splev, "iso", VA_PASS3(0, yyvsp[-2].map, SPO_VAR_INIT)); - Free(yyvsp[-2].map); - } -break; -case 100: -{ - vardefs = add_vardef_type(vardefs, yyvsp[-4].map, SPOVAR_MAPCHAR); - add_opvars(splev, "iso", VA_PASS3(0, yyvsp[-4].map, SPO_VAR_INIT)); - Free(yyvsp[-4].map); - } -break; -case 101: -{ - vardefs = add_vardef_type(vardefs, yyvsp[-4].map, SPOVAR_MONST); - add_opvars(splev, "iso", VA_PASS3(0, yyvsp[-4].map, SPO_VAR_INIT)); - Free(yyvsp[-4].map); - } -break; -case 102: -{ - vardefs = add_vardef_type(vardefs, yyvsp[-4].map, SPOVAR_OBJ); - add_opvars(splev, "iso", VA_PASS3(0, yyvsp[-4].map, SPO_VAR_INIT)); - Free(yyvsp[-4].map); - } -break; -case 103: -{ - vardefs = add_vardef_type(vardefs, yyvsp[-2].map, SPOVAR_COORD); - add_opvars(splev, "iso", VA_PASS3(0, yyvsp[-2].map, SPO_VAR_INIT)); - Free(yyvsp[-2].map); - } -break; -case 104: -{ - vardefs = add_vardef_type(vardefs, yyvsp[-2].map, SPOVAR_REGION); - add_opvars(splev, "iso", VA_PASS3(0, yyvsp[-2].map, SPO_VAR_INIT)); - Free(yyvsp[-2].map); - } -break; -case 105: -{ - int n_items = (int) yyvsp[-1].i; - - vardefs = add_vardef_type(vardefs, yyvsp[-4].map, - SPOVAR_INT | SPOVAR_ARRAY); - add_opvars(splev, "iso", - VA_PASS3(n_items, yyvsp[-4].map, SPO_VAR_INIT)); - Free(yyvsp[-4].map); - } -break; -case 106: -{ - int n_items = (int) yyvsp[-1].i; - - vardefs = add_vardef_type(vardefs, yyvsp[-4].map, - SPOVAR_COORD | SPOVAR_ARRAY); - add_opvars(splev, "iso", - VA_PASS3(n_items, yyvsp[-4].map, SPO_VAR_INIT)); - Free(yyvsp[-4].map); - } -break; -case 107: -{ - int n_items = (int) yyvsp[-1].i; - - vardefs = add_vardef_type(vardefs, yyvsp[-4].map, - SPOVAR_REGION | SPOVAR_ARRAY); - add_opvars(splev, "iso", - VA_PASS3(n_items, yyvsp[-4].map, SPO_VAR_INIT)); - Free(yyvsp[-4].map); - } -break; -case 108: -{ - int n_items = (int) yyvsp[-1].i; - - vardefs = add_vardef_type(vardefs, yyvsp[-6].map, - SPOVAR_MAPCHAR | SPOVAR_ARRAY); - add_opvars(splev, "iso", - VA_PASS3(n_items, yyvsp[-6].map, SPO_VAR_INIT)); - Free(yyvsp[-6].map); - } -break; -case 109: -{ - int n_items = (int) yyvsp[-1].i; - - vardefs = add_vardef_type(vardefs, yyvsp[-6].map, - SPOVAR_MONST | SPOVAR_ARRAY); - add_opvars(splev, "iso", - VA_PASS3(n_items, yyvsp[-6].map, SPO_VAR_INIT)); - Free(yyvsp[-6].map); - } -break; -case 110: -{ - int n_items = (int) yyvsp[-1].i; - - vardefs = add_vardef_type(vardefs, yyvsp[-6].map, - SPOVAR_OBJ | SPOVAR_ARRAY); - add_opvars(splev, "iso", - VA_PASS3(n_items, yyvsp[-6].map, SPO_VAR_INIT)); - Free(yyvsp[-6].map); - } -break; -case 111: -{ - int n_items = (int) yyvsp[-1].i; - - vardefs = add_vardef_type(vardefs, yyvsp[-4].map, - SPOVAR_STRING | SPOVAR_ARRAY); - add_opvars(splev, "iso", - VA_PASS3(n_items, yyvsp[-4].map, SPO_VAR_INIT)); - Free(yyvsp[-4].map); - } -break; -case 112: -{ - add_opvars(splev, "O", VA_PASS1(yyvsp[0].i)); - yyval.i = 1; - } -break; -case 113: -{ - add_opvars(splev, "O", VA_PASS1(yyvsp[0].i)); - yyval.i = 1 + yyvsp[-2].i; - } -break; -case 114: -{ - add_opvars(splev, "M", VA_PASS1(yyvsp[0].i)); - yyval.i = 1; - } -break; -case 115: -{ - add_opvars(splev, "M", VA_PASS1(yyvsp[0].i)); - yyval.i = 1 + yyvsp[-2].i; - } -break; -case 116: -{ - add_opvars(splev, "m", VA_PASS1(yyvsp[0].i)); - yyval.i = 1; - } -break; -case 117: -{ - add_opvars(splev, "m", VA_PASS1(yyvsp[0].i)); - yyval.i = 1 + yyvsp[-2].i; - } -break; -case 118: -{ - yyval.i = 1; - } -break; -case 119: -{ - yyval.i = 1 + yyvsp[-2].i; - } -break; -case 120: -{ - add_opvars(splev, "c", VA_PASS1(yyvsp[0].i)); - yyval.i = 1; - } -break; -case 121: -{ - add_opvars(splev, "c", VA_PASS1(yyvsp[0].i)); - yyval.i = 1 + yyvsp[-2].i; - } -break; -case 122: -{ - yyval.i = 1; - } -break; -case 123: -{ - yyval.i = 1 + yyvsp[-2].i; - } -break; -case 124: -{ - yyval.i = 1; - } -break; -case 125: -{ - yyval.i = 1 + yyvsp[-2].i; - } -break; -case 126: -{ - struct lc_funcdefs *funcdef; - - if (in_function_definition) - lc_error("Recursively defined functions not allowed (function %s).", yyvsp[-1].map); - - in_function_definition++; - - if (funcdef_defined(function_definitions, yyvsp[-1].map, 1)) - lc_error("Function '%s' already defined once.", yyvsp[-1].map); - - funcdef = funcdef_new(-1, yyvsp[-1].map); - funcdef->next = function_definitions; - function_definitions = funcdef; - function_splev_backup = splev; - splev = &(funcdef->code); - Free(yyvsp[-1].map); - curr_function = funcdef; - function_tmp_var_defs = vardefs; - vardefs = NULL; - } -break; -case 127: -{ - /* nothing */ - } -break; -case 128: -{ - add_opvars(splev, "io", VA_PASS2(0, SPO_RETURN)); - splev = function_splev_backup; - in_function_definition--; - curr_function = NULL; - vardef_free_all(vardefs); - vardefs = function_tmp_var_defs; - } -break; -case 129: -{ - struct lc_funcdefs *tmpfunc; - - tmpfunc = funcdef_defined(function_definitions, yyvsp[-3].map, 1); - if (tmpfunc) { - int l; - int nparams = (int) strlen(yyvsp[-1].map); - char *fparamstr = funcdef_paramtypes(tmpfunc); - - if (strcmp(yyvsp[-1].map, fparamstr)) { - char *tmps = strdup(decode_parm_str(fparamstr)); - - lc_error("Function '%s' requires params '%s', got '%s' instead.", - yyvsp[-3].map, tmps, decode_parm_str(yyvsp[-1].map)); - Free(tmps); - } - Free(fparamstr); - Free(yyvsp[-1].map); - if (!(tmpfunc->n_called)) { - /* we haven't called the function yet, so insert it in the code */ - struct opvar *jmp = New(struct opvar); - - set_opvar_int(jmp, splev->n_opcodes+1); - add_opcode(splev, SPO_PUSH, jmp); - /* we must jump past it first, then CALL it, due to RETURN. */ - add_opcode(splev, SPO_JMP, NULL); - - tmpfunc->addr = splev->n_opcodes; - - { /* init function parameter variables */ - struct lc_funcdefs_parm *tfp = tmpfunc->params; - while (tfp) { - add_opvars(splev, "iso", - VA_PASS3(0, tfp->name, - SPO_VAR_INIT)); - tfp = tfp->next; - } - } - - splev_add_from(splev, &(tmpfunc->code)); - set_opvar_int(jmp, - splev->n_opcodes - jmp->vardata.l); - } - l = (int) (tmpfunc->addr - splev->n_opcodes - 2); - add_opvars(splev, "iio", - VA_PASS3(nparams, l, SPO_CALL)); - tmpfunc->n_called++; - } else { - lc_error("Function '%s' not defined.", yyvsp[-3].map); - } - Free(yyvsp[-3].map); - } -break; -case 130: -{ - add_opcode(splev, SPO_EXIT, NULL); - } -break; -case 131: -{ - yyval.i = 100; - } -break; -case 132: -{ - yyval.i = yyvsp[0].i; - } -break; -case 133: -{ - /* val > rn2(100) */ - add_opvars(splev, "iio", - VA_PASS3((int) yyvsp[0].i, 100, SPO_RN2)); - yyval.i = SPO_JG; - } -break; -case 134: -{ - yyval.i = yyvsp[-2].i; - } -break; -case 135: -{ - /* boolean, explicit foo != 0 */ - add_opvars(splev, "i", VA_PASS1(0)); - yyval.i = SPO_JNE; - } -break; -case 136: -{ - is_inconstant_number = 0; - } -break; -case 137: -{ - struct opvar *chkjmp; - - if (in_switch_statement > 0) - lc_error("Cannot nest switch-statements."); - - in_switch_statement++; - - n_switch_case_list = 0; - switch_default_case = NULL; - - if (!is_inconstant_number) - add_opvars(splev, "o", VA_PASS1(SPO_RN2)); - is_inconstant_number = 0; - - chkjmp = New(struct opvar); - set_opvar_int(chkjmp, splev->n_opcodes+1); - switch_check_jump = chkjmp; - add_opcode(splev, SPO_PUSH, chkjmp); - add_opcode(splev, SPO_JMP, NULL); - break_stmt_start(); - } -break; -case 138: -{ - struct opvar *endjump = New(struct opvar); - int i; - - set_opvar_int(endjump, splev->n_opcodes+1); - - add_opcode(splev, SPO_PUSH, endjump); - add_opcode(splev, SPO_JMP, NULL); - - set_opvar_int(switch_check_jump, - splev->n_opcodes - switch_check_jump->vardata.l); - - for (i = 0; i < n_switch_case_list; i++) { - add_opvars(splev, "oio", - VA_PASS3(SPO_COPY, - switch_case_value[i], SPO_CMP)); - set_opvar_int(switch_case_list[i], - switch_case_list[i]->vardata.l - splev->n_opcodes-1); - add_opcode(splev, SPO_PUSH, switch_case_list[i]); - add_opcode(splev, SPO_JE, NULL); - } - - if (switch_default_case) { - set_opvar_int(switch_default_case, - switch_default_case->vardata.l - splev->n_opcodes-1); - add_opcode(splev, SPO_PUSH, switch_default_case); - add_opcode(splev, SPO_JMP, NULL); - } - - set_opvar_int(endjump, splev->n_opcodes - endjump->vardata.l); - - break_stmt_end(splev); - - add_opcode(splev, SPO_POP, NULL); /* get rid of the value in stack */ - in_switch_statement--; - - - } -break; -case 141: -{ - if (n_switch_case_list < MAX_SWITCH_CASES) { - struct opvar *tmppush = New(struct opvar); - - set_opvar_int(tmppush, splev->n_opcodes); - switch_case_value[n_switch_case_list] = yyvsp[-1].i; - switch_case_list[n_switch_case_list++] = tmppush; - } else lc_error("Too many cases in a switch."); - } -break; -case 142: -{ - } -break; -case 143: -{ - struct opvar *tmppush = New(struct opvar); - - if (switch_default_case) - lc_error("Switch default case already used."); - - set_opvar_int(tmppush, splev->n_opcodes); - switch_default_case = tmppush; - } -break; -case 144: -{ - } -break; -case 145: -{ - if (!allow_break_statements) - lc_error("Cannot use BREAK outside a statement block."); - else { - break_stmt_new(splev, splev->n_opcodes); - } - } -break; -case 148: -{ - char buf[256], buf2[256]; - - if (n_forloops >= MAX_NESTED_IFS) { - lc_error("FOR: Too deeply nested loops."); - n_forloops = MAX_NESTED_IFS - 1; - } - - /* first, define a variable for the for-loop end value */ - Sprintf(buf, "%s end", yyvsp[-4].map); - /* the value of which is already in stack (the 2nd math_expr) */ - add_opvars(splev, "iso", VA_PASS3(0, buf, SPO_VAR_INIT)); - - vardefs = add_vardef_type(vardefs, yyvsp[-4].map, SPOVAR_INT); - /* define the for-loop variable. value is in stack (1st math_expr) */ - add_opvars(splev, "iso", VA_PASS3(0, yyvsp[-4].map, SPO_VAR_INIT)); - - /* calculate value for the loop "step" variable */ - Sprintf(buf2, "%s step", yyvsp[-4].map); - /* end - start */ - add_opvars(splev, "vvo", - VA_PASS3(buf, yyvsp[-4].map, SPO_MATH_SUB)); - /* sign of that */ - add_opvars(splev, "o", VA_PASS1(SPO_MATH_SIGN)); - /* save the sign into the step var */ - add_opvars(splev, "iso", - VA_PASS3(0, buf2, SPO_VAR_INIT)); - - forloop_list[n_forloops].varname = strdup(yyvsp[-4].map); - forloop_list[n_forloops].jmp_point = splev->n_opcodes; - - n_forloops++; - Free(yyvsp[-4].map); - } -break; -case 149: -{ - /* nothing */ - break_stmt_start(); - } -break; -case 150: -{ - int l; - char buf[256], buf2[256]; - - n_forloops--; - Sprintf(buf, "%s step", forloop_list[n_forloops].varname); - Sprintf(buf2, "%s end", forloop_list[n_forloops].varname); - /* compare for-loop var to end value */ - add_opvars(splev, "vvo", - VA_PASS3(forloop_list[n_forloops].varname, - buf2, SPO_CMP)); - /* var + step */ - add_opvars(splev, "vvo", - VA_PASS3(buf, forloop_list[n_forloops].varname, - SPO_MATH_ADD)); - /* for-loop var = (for-loop var + step) */ - add_opvars(splev, "iso", - VA_PASS3(0, forloop_list[n_forloops].varname, - SPO_VAR_INIT)); - /* jump back if compared values were not equal */ - l = (int) (forloop_list[n_forloops].jmp_point - - splev->n_opcodes - 1); - add_opvars(splev, "io", VA_PASS2(l, SPO_JNE)); - Free(forloop_list[n_forloops].varname); - break_stmt_end(splev); - } -break; -case 151: -{ - struct opvar *tmppush = New(struct opvar); - - if (n_if_list >= MAX_NESTED_IFS) { - lc_error("LOOP: Too deeply nested conditionals."); - n_if_list = MAX_NESTED_IFS - 1; - } - set_opvar_int(tmppush, splev->n_opcodes); - if_list[n_if_list++] = tmppush; - - add_opvars(splev, "o", VA_PASS1(SPO_DEC)); - break_stmt_start(); - } -break; -case 152: -{ - struct opvar *tmppush; - - add_opvars(splev, "oio", VA_PASS3(SPO_COPY, 0, SPO_CMP)); - - tmppush = (struct opvar *) if_list[--n_if_list]; - set_opvar_int(tmppush, - tmppush->vardata.l - splev->n_opcodes-1); - add_opcode(splev, SPO_PUSH, tmppush); - add_opcode(splev, SPO_JG, NULL); - add_opcode(splev, SPO_POP, NULL); /* discard count */ - break_stmt_end(splev); - } -break; -case 153: -{ - struct opvar *tmppush2 = New(struct opvar); - - if (n_if_list >= MAX_NESTED_IFS) { - lc_error("IF: Too deeply nested conditionals."); - n_if_list = MAX_NESTED_IFS - 1; - } - - add_opcode(splev, SPO_CMP, NULL); - - set_opvar_int(tmppush2, splev->n_opcodes+1); - - if_list[n_if_list++] = tmppush2; - - add_opcode(splev, SPO_PUSH, tmppush2); - - add_opcode(splev, reverse_jmp_opcode( yyvsp[-1].i ), NULL); - - } -break; -case 154: -{ - if (n_if_list > 0) { - struct opvar *tmppush; - - tmppush = (struct opvar *) if_list[--n_if_list]; - set_opvar_int(tmppush, - splev->n_opcodes - tmppush->vardata.l); - } else lc_error("IF: Huh?! No start address?"); - } -break; -case 155: -{ - struct opvar *tmppush2 = New(struct opvar); - - if (n_if_list >= MAX_NESTED_IFS) { - lc_error("IF: Too deeply nested conditionals."); - n_if_list = MAX_NESTED_IFS - 1; - } - - add_opcode(splev, SPO_CMP, NULL); - - set_opvar_int(tmppush2, splev->n_opcodes+1); - - if_list[n_if_list++] = tmppush2; - - add_opcode(splev, SPO_PUSH, tmppush2); - - add_opcode(splev, reverse_jmp_opcode( yyvsp[0].i ), NULL); - - } -break; -case 156: -{ - /* do nothing */ - } -break; -case 157: -{ - if (n_if_list > 0) { - struct opvar *tmppush; - - tmppush = (struct opvar *) if_list[--n_if_list]; - set_opvar_int(tmppush, - splev->n_opcodes - tmppush->vardata.l); - } else lc_error("IF: Huh?! No start address?"); - } -break; -case 158: -{ - if (n_if_list > 0) { - struct opvar *tmppush = New(struct opvar); - struct opvar *tmppush2; - - set_opvar_int(tmppush, splev->n_opcodes+1); - add_opcode(splev, SPO_PUSH, tmppush); - - add_opcode(splev, SPO_JMP, NULL); - - tmppush2 = (struct opvar *) if_list[--n_if_list]; - - set_opvar_int(tmppush2, - splev->n_opcodes - tmppush2->vardata.l); - if_list[n_if_list++] = tmppush; - } else lc_error("IF: Huh?! No else-part address?"); - } -break; -case 159: -{ - if (n_if_list > 0) { - struct opvar *tmppush; - tmppush = (struct opvar *) if_list[--n_if_list]; - set_opvar_int(tmppush, splev->n_opcodes - tmppush->vardata.l); - } else lc_error("IF: Huh?! No end address?"); - } -break; -case 160: -{ - add_opvars(splev, "o", VA_PASS1(SPO_MESSAGE)); - } -break; -case 161: -{ - add_opvars(splev, "iiiiiio", - VA_PASS7(-1, 0, -1, -1, -1, -1, SPO_CORRIDOR)); - } -break; -case 162: -{ - add_opvars(splev, "iiiiiio", - VA_PASS7(-1, yyvsp[0].i, -1, -1, -1, -1, SPO_CORRIDOR)); - } -break; -case 163: -{ - add_opvars(splev, "iiiiiio", - VA_PASS7(-1, -1, -1, -1, -1, -1, SPO_CORRIDOR)); - } -break; -case 164: -{ - add_opvars(splev, "iiiiiio", - VA_PASS7(yyvsp[-2].corpos.room, yyvsp[-2].corpos.door, yyvsp[-2].corpos.wall, - yyvsp[0].corpos.room, yyvsp[0].corpos.door, yyvsp[0].corpos.wall, - SPO_CORRIDOR)); - } -break; -case 165: -{ - add_opvars(splev, "iiiiiio", - VA_PASS7(yyvsp[-2].corpos.room, yyvsp[-2].corpos.door, yyvsp[-2].corpos.wall, - -1, -1, (long)yyvsp[0].i, - SPO_CORRIDOR)); - } -break; -case 166: -{ - yyval.corpos.room = yyvsp[-5].i; - yyval.corpos.wall = yyvsp[-3].i; - yyval.corpos.door = yyvsp[-1].i; - } -break; -case 167: -{ - if ((yyvsp[-2].i < 100) && (yyvsp[-3].i == OROOM)) - lc_error("Only typed rooms can have a chance."); - else { - add_opvars(splev, "iii", - VA_PASS3((long)yyvsp[-3].i, (long)yyvsp[-2].i, (long)yyvsp[0].i)); - } - } -break; -case 168: -{ - long rflags = yyvsp[0].i; - - if (rflags == -1) rflags = (1 << 0); - add_opvars(splev, "iiiiiiio", - VA_PASS8(rflags, ERR, ERR, - yyvsp[-3].crd.x, yyvsp[-3].crd.y, yyvsp[-1].sze.width, yyvsp[-1].sze.height, - SPO_SUBROOM)); - break_stmt_start(); - } -break; -case 169: -{ - break_stmt_end(splev); - add_opcode(splev, SPO_ENDROOM, NULL); - } -break; -case 170: -{ - long rflags = yyvsp[-2].i; - - if (rflags == -1) rflags = (1 << 0); - add_opvars(splev, "iiiiiiio", - VA_PASS8(rflags, - yyvsp[-3].crd.x, yyvsp[-3].crd.y, yyvsp[-5].crd.x, yyvsp[-5].crd.y, - yyvsp[-1].sze.width, yyvsp[-1].sze.height, SPO_ROOM)); - break_stmt_start(); - } -break; -case 171: -{ - break_stmt_end(splev); - add_opcode(splev, SPO_ENDROOM, NULL); - } -break; -case 172: -{ - yyval.i = 1; - } -break; -case 173: -{ - yyval.i = yyvsp[0].i; - } -break; -case 174: -{ - if ( yyvsp[-3].i < 1 || yyvsp[-3].i > 5 || - yyvsp[-1].i < 1 || yyvsp[-1].i > 5 ) { - lc_error("Room positions should be between 1-5: (%li,%li)!", yyvsp[-3].i, yyvsp[-1].i); - } else { - yyval.crd.x = yyvsp[-3].i; - yyval.crd.y = yyvsp[-1].i; - } - } -break; -case 175: -{ - yyval.crd.x = yyval.crd.y = ERR; - } -break; -case 176: -{ - if ( yyvsp[-3].i < 0 || yyvsp[-1].i < 0) { - lc_error("Invalid subroom position (%li,%li)!", yyvsp[-3].i, yyvsp[-1].i); - } else { - yyval.crd.x = yyvsp[-3].i; - yyval.crd.y = yyvsp[-1].i; - } - } -break; -case 177: -{ - yyval.crd.x = yyval.crd.y = ERR; - } -break; -case 178: -{ - yyval.crd.x = yyvsp[-3].i; - yyval.crd.y = yyvsp[-1].i; - } -break; -case 179: -{ - yyval.crd.x = yyval.crd.y = ERR; - } -break; -case 180: -{ - yyval.sze.width = yyvsp[-3].i; - yyval.sze.height = yyvsp[-1].i; - } -break; -case 181: -{ - yyval.sze.height = yyval.sze.width = ERR; - } -break; -case 182: -{ - /* ERR means random here */ - if (yyvsp[-2].i == ERR && yyvsp[0].i != ERR) { - lc_error("If the door wall is random, so must be its pos!"); - } else { - add_opvars(splev, "iiiio", - VA_PASS5((long)yyvsp[0].i, (long)yyvsp[-4].i, (long)yyvsp[-6].i, - (long)yyvsp[-2].i, SPO_ROOM_DOOR)); - } - } -break; -case 183: -{ - add_opvars(splev, "io", VA_PASS2((long)yyvsp[-2].i, SPO_DOOR)); - } -break; -case 188: -{ - yyval.i = yyvsp[0].i; - } -break; -case 189: -{ - yyval.i = (yyvsp[-2].i | yyvsp[0].i); - } -break; -case 192: -{ - add_opvars(splev, "ciisiio", - VA_PASS7(0, 0, 1, (char *) 0, 0, 0, SPO_MAP)); - max_x_map = COLNO-1; - max_y_map = ROWNO; - } -break; -case 193: -{ - add_opvars(splev, "cii", - VA_PASS3(SP_COORD_PACK((yyvsp[-4].i), (yyvsp[-2].i)), - 1, (int) yyvsp[-1].i)); - scan_map(yyvsp[0].map, splev); - Free(yyvsp[0].map); - } -break; -case 194: -{ - add_opvars(splev, "ii", VA_PASS2(2, (int) yyvsp[-1].i)); - scan_map(yyvsp[0].map, splev); - Free(yyvsp[0].map); - } -break; -case 199: -{ - add_opvars(splev, "io", VA_PASS2(0, SPO_MONSTER)); - } -break; -case 200: -{ - add_opvars(splev, "io", VA_PASS2(1, SPO_MONSTER)); - in_container_obj++; - break_stmt_start(); - } -break; -case 201: -{ - break_stmt_end(splev); - in_container_obj--; - add_opvars(splev, "o", VA_PASS1(SPO_END_MONINVENT)); - } -break; -case 202: -{ - /* nothing */ - } -break; -case 203: -{ - struct opvar *stopit = New(struct opvar); - - set_opvar_int(stopit, SP_M_V_END); - add_opcode(splev, SPO_PUSH, stopit); - yyval.i = 0x0000; - } -break; -case 204: -{ - if (( yyvsp[-2].i & yyvsp[0].i )) - lc_error("MONSTER extra info defined twice."); - yyval.i = ( yyvsp[-2].i | yyvsp[0].i ); - } -break; -case 205: -{ - add_opvars(splev, "i", VA_PASS1(SP_M_V_NAME)); - yyval.i = 0x0001; - } -break; -case 206: -{ - add_opvars(splev, "ii", - VA_PASS2((int) yyvsp[0].i, SP_M_V_PEACEFUL)); - yyval.i = 0x0002; - } -break; -case 207: -{ - add_opvars(splev, "ii", - VA_PASS2((int) yyvsp[0].i, SP_M_V_ASLEEP)); - yyval.i = 0x0004; - } -break; -case 208: -{ - add_opvars(splev, "ii", - VA_PASS2((int) yyvsp[0].i, SP_M_V_ALIGN)); - yyval.i = 0x0008; - } -break; -case 209: -{ - add_opvars(splev, "ii", - VA_PASS2((int) yyvsp[-1].i, SP_M_V_APPEAR)); - yyval.i = 0x0010; - } -break; -case 210: -{ - add_opvars(splev, "ii", VA_PASS2(1, SP_M_V_FEMALE)); - yyval.i = 0x0020; - } -break; -case 211: -{ - add_opvars(splev, "ii", VA_PASS2(1, SP_M_V_INVIS)); - yyval.i = 0x0040; - } -break; -case 212: -{ - add_opvars(splev, "ii", VA_PASS2(1, SP_M_V_CANCELLED)); - yyval.i = 0x0080; - } -break; -case 213: -{ - add_opvars(splev, "ii", VA_PASS2(1, SP_M_V_REVIVED)); - yyval.i = 0x0100; - } -break; -case 214: -{ - add_opvars(splev, "ii", VA_PASS2(1, SP_M_V_AVENGE)); - yyval.i = 0x0200; - } -break; -case 215: -{ - add_opvars(splev, "i", VA_PASS1(SP_M_V_FLEEING)); - yyval.i = 0x0400; - } -break; -case 216: -{ - add_opvars(splev, "i", VA_PASS1(SP_M_V_BLINDED)); - yyval.i = 0x0800; - } -break; -case 217: -{ - add_opvars(splev, "i", VA_PASS1(SP_M_V_PARALYZED)); - yyval.i = 0x1000; - } -break; -case 218: -{ - add_opvars(splev, "ii", VA_PASS2(1, SP_M_V_STUNNED)); - yyval.i = 0x2000; - } -break; -case 219: -{ - add_opvars(splev, "ii", VA_PASS2(1, SP_M_V_CONFUSED)); - yyval.i = 0x4000; - } -break; -case 220: -{ - add_opvars(splev, "ii", - VA_PASS2((int) yyvsp[0].i, SP_M_V_SEENTRAPS)); - yyval.i = 0x8000; - } -break; -case 221: -{ - int token = get_trap_type(yyvsp[0].map); - - if (token == ERR || token == 0) - lc_error("Unknown trap type '%s'!", yyvsp[0].map); - Free(yyvsp[0].map); - yyval.i = (1L << (token - 1)); - } -break; -case 222: -{ - yyval.i = (long) ~0; - } -break; -case 223: -{ - int token = get_trap_type(yyvsp[-2].map); - if (token == ERR || token == 0) - lc_error("Unknown trap type '%s'!", yyvsp[-2].map); - - if ((1L << (token - 1)) & yyvsp[0].i) - lc_error("Monster seen_traps, trap '%s' listed twice.", yyvsp[-2].map); - Free(yyvsp[-2].map); - yyval.i = ((1L << (token - 1)) | yyvsp[0].i); - } -break; -case 224: -{ - int cnt = 0; - - if (in_container_obj) - cnt |= SP_OBJ_CONTENT; - add_opvars(splev, "io", VA_PASS2(cnt, SPO_OBJECT)); - } -break; -case 225: -{ - int cnt = SP_OBJ_CONTAINER; - - if (in_container_obj) - cnt |= SP_OBJ_CONTENT; - add_opvars(splev, "io", VA_PASS2(cnt, SPO_OBJECT)); - in_container_obj++; - break_stmt_start(); - } -break; -case 226: -{ - break_stmt_end(splev); - in_container_obj--; - add_opcode(splev, SPO_POP_CONTAINER, NULL); - } -break; -case 227: -{ - if (( yyvsp[0].i & 0x4000) && in_container_obj) - lc_error("Object cannot have a coord when contained."); - else if (!( yyvsp[0].i & 0x4000) && !in_container_obj) - lc_error("Object needs a coord when not contained."); - } -break; -case 228: -{ - struct opvar *stopit = New(struct opvar); - set_opvar_int(stopit, SP_O_V_END); - add_opcode(splev, SPO_PUSH, stopit); - yyval.i = 0x00; - } -break; -case 229: -{ - if (( yyvsp[-2].i & yyvsp[0].i )) - lc_error("OBJECT extra info '%s' defined twice.", curr_token); - yyval.i = ( yyvsp[-2].i | yyvsp[0].i ); - } -break; -case 230: -{ - add_opvars(splev, "ii", - VA_PASS2((int) yyvsp[0].i, SP_O_V_CURSE)); - yyval.i = 0x0001; - } -break; -case 231: -{ - add_opvars(splev, "i", VA_PASS1(SP_O_V_CORPSENM)); - yyval.i = 0x0002; - } -break; -case 232: -{ - add_opvars(splev, "i", VA_PASS1(SP_O_V_SPE)); - yyval.i = 0x0004; - } -break; -case 233: -{ - add_opvars(splev, "i", VA_PASS1(SP_O_V_NAME)); - yyval.i = 0x0008; - } -break; -case 234: -{ - add_opvars(splev, "i", VA_PASS1(SP_O_V_QUAN)); - yyval.i = 0x0010; - } -break; -case 235: -{ - add_opvars(splev, "ii", VA_PASS2(1, SP_O_V_BURIED)); - yyval.i = 0x0020; - } -break; -case 236: -{ - add_opvars(splev, "ii", VA_PASS2((int) yyvsp[0].i, SP_O_V_LIT)); - yyval.i = 0x0040; - } -break; -case 237: -{ - add_opvars(splev, "i", VA_PASS1(SP_O_V_ERODED)); - yyval.i = 0x0080; - } -break; -case 238: -{ - add_opvars(splev, "ii", VA_PASS2(-1, SP_O_V_ERODED)); - yyval.i = 0x0080; - } -break; -case 239: -{ - if (yyvsp[0].i == D_LOCKED) { - add_opvars(splev, "ii", VA_PASS2(1, SP_O_V_LOCKED)); - yyval.i = 0x0100; - } else if (yyvsp[0].i == D_BROKEN) { - add_opvars(splev, "ii", VA_PASS2(1, SP_O_V_BROKEN)); - yyval.i = 0x0200; - } else - lc_error("DOOR state can only be locked or broken."); - } -break; -case 240: -{ - add_opvars(splev, "ii", - VA_PASS2((int) yyvsp[0].i, SP_O_V_TRAPPED)); - yyval.i = 0x0400; - } -break; -case 241: -{ - add_opvars(splev, "i", VA_PASS1(SP_O_V_RECHARGED)); - yyval.i = 0x0800; - } -break; -case 242: -{ - add_opvars(splev, "ii", VA_PASS2(1, SP_O_V_INVIS)); - yyval.i = 0x1000; - } -break; -case 243: -{ - add_opvars(splev, "ii", VA_PASS2(1, SP_O_V_GREASED)); - yyval.i = 0x2000; - } -break; -case 244: -{ - add_opvars(splev, "i", VA_PASS1(SP_O_V_COORD)); - yyval.i = 0x4000; - } -break; -case 245: -{ - add_opvars(splev, "io", VA_PASS2((int) yyvsp[-2].i, SPO_TRAP)); - } -break; -case 246: -{ - long dir, state = 0; - - /* convert dir from a DIRECTION to a DB_DIR */ - dir = yyvsp[-2].i; - switch (dir) { - case W_NORTH: dir = DB_NORTH; break; - case W_SOUTH: dir = DB_SOUTH; break; - case W_EAST: dir = DB_EAST; break; - case W_WEST: dir = DB_WEST; break; - default: - lc_error("Invalid drawbridge direction."); - break; - } - - if ( yyvsp[0].i == D_ISOPEN ) - state = 1; - else if ( yyvsp[0].i == D_CLOSED ) - state = 0; - else if ( yyvsp[0].i == -1 ) - state = -1; - else - lc_error("A drawbridge can only be open, closed or random!"); - add_opvars(splev, "iio", - VA_PASS3(state, dir, SPO_DRAWBRIDGE)); - } -break; -case 247: -{ - add_opvars(splev, "iiio", - VA_PASS4((int) yyvsp[0].i, 1, 0, SPO_MAZEWALK)); - } -break; -case 248: -{ - add_opvars(splev, "iiio", - VA_PASS4((int) yyvsp[-3].i, (int) yyvsp[-1].i, - (int) yyvsp[0].i, SPO_MAZEWALK)); - } -break; -case 249: -{ - add_opvars(splev, "rio", - VA_PASS3(SP_REGION_PACK(-1,-1,-1,-1), - 0, SPO_WALLIFY)); - } -break; -case 250: -{ - add_opvars(splev, "io", VA_PASS2(1, SPO_WALLIFY)); - } -break; -case 251: -{ - add_opvars(splev, "io", - VA_PASS2((int) yyvsp[0].i, SPO_LADDER)); - } -break; -case 252: -{ - add_opvars(splev, "io", - VA_PASS2((int) yyvsp[0].i, SPO_STAIR)); - } -break; -case 253: -{ - add_opvars(splev, "iiiii iiiii iiso", - VA_PASS14(yyvsp[-4].lregn.x1, yyvsp[-4].lregn.y1, yyvsp[-4].lregn.x2, yyvsp[-4].lregn.y2, yyvsp[-4].lregn.area, - yyvsp[-2].lregn.x1, yyvsp[-2].lregn.y1, yyvsp[-2].lregn.x2, yyvsp[-2].lregn.y2, yyvsp[-2].lregn.area, - (long) ((yyvsp[0].i) ? LR_UPSTAIR : LR_DOWNSTAIR), - 0, (char *) 0, SPO_LEVREGION)); - } -break; -case 254: -{ - add_opvars(splev, "iiiii iiiii iiso", - VA_PASS14(yyvsp[-4].lregn.x1, yyvsp[-4].lregn.y1, yyvsp[-4].lregn.x2, yyvsp[-4].lregn.y2, yyvsp[-4].lregn.area, - yyvsp[-2].lregn.x1, yyvsp[-2].lregn.y1, yyvsp[-2].lregn.x2, yyvsp[-2].lregn.y2, yyvsp[-2].lregn.area, - LR_PORTAL, 0, yyvsp[0].map, SPO_LEVREGION)); - Free(yyvsp[0].map); - } -break; -case 255: -{ - long rtyp = 0; - switch(yyvsp[0].i) { - case -1: rtyp = LR_TELE; break; - case 0: rtyp = LR_DOWNTELE; break; - case 1: rtyp = LR_UPTELE; break; - } - add_opvars(splev, "iiiii iiiii iiso", - VA_PASS14(yyvsp[-3].lregn.x1, yyvsp[-3].lregn.y1, yyvsp[-3].lregn.x2, yyvsp[-3].lregn.y2, yyvsp[-3].lregn.area, - yyvsp[-1].lregn.x1, yyvsp[-1].lregn.y1, yyvsp[-1].lregn.x2, yyvsp[-1].lregn.y2, yyvsp[-1].lregn.area, - rtyp, 0, (char *)0, SPO_LEVREGION)); - } -break; -case 256: -{ - add_opvars(splev, "iiiii iiiii iiso", - VA_PASS14(yyvsp[-2].lregn.x1, yyvsp[-2].lregn.y1, yyvsp[-2].lregn.x2, yyvsp[-2].lregn.y2, yyvsp[-2].lregn.area, - yyvsp[0].lregn.x1, yyvsp[0].lregn.y1, yyvsp[0].lregn.x2, yyvsp[0].lregn.y2, yyvsp[0].lregn.area, - (long) LR_BRANCH, 0, - (char *) 0, SPO_LEVREGION)); - } -break; -case 257: -{ - yyval.i = -1; - } -break; -case 258: -{ - yyval.i = yyvsp[0].i; - } -break; -case 259: -{ - add_opvars(splev, "o", VA_PASS1(SPO_FOUNTAIN)); - } -break; -case 260: -{ - add_opvars(splev, "o", VA_PASS1(SPO_SINK)); - } -break; -case 261: -{ - add_opvars(splev, "o", VA_PASS1(SPO_POOL)); - } -break; -case 262: -{ - yyval.terr.lit = -2; - yyval.terr.ter = what_map_char((char) yyvsp[0].i); - } -break; -case 263: -{ - yyval.terr.lit = yyvsp[-1].i; - yyval.terr.ter = what_map_char((char) yyvsp[-3].i); - } -break; -case 264: -{ - add_opvars(splev, "io", - VA_PASS2(yyvsp[0].i, SPO_REPLACETERRAIN)); - } -break; -case 265: -{ - add_opvars(splev, "o", VA_PASS1(SPO_TERRAIN)); - } -break; -case 266: -{ - add_opvars(splev, "o", VA_PASS1(SPO_NON_DIGGABLE)); - } -break; -case 267: -{ - add_opvars(splev, "o", VA_PASS1(SPO_NON_PASSWALL)); - } -break; -case 268: -{ - long irr; - long rt = yyvsp[-1].i; - long rflags = yyvsp[0].i; - - if (rflags == -1) rflags = (1 << 0); - if (!(rflags & 1)) rt += MAXRTYPE+1; - irr = ((rflags & 2) != 0); - add_opvars(splev, "iiio", - VA_PASS4((long)yyvsp[-3].i, rt, rflags, SPO_REGION)); - yyval.i = (irr || (rflags & 1) || rt != OROOM); - break_stmt_start(); - } -break; -case 269: -{ - break_stmt_end(splev); - if ( yyvsp[-1].i ) { - add_opcode(splev, SPO_ENDROOM, NULL); - } else if ( yyvsp[0].i ) - lc_error("Cannot use lev statements in non-permanent REGION"); - } -break; -case 270: -{ - yyval.i = 0; - } -break; -case 271: -{ - yyval.i = yyvsp[0].i; - } -break; -case 272: -{ - add_opvars(splev, "iio", - VA_PASS3((long)yyvsp[0].i, (long)yyvsp[-2].i, SPO_ALTAR)); - } -break; -case 273: -{ - add_opvars(splev, "io", VA_PASS2(2, SPO_GRAVE)); - } -break; -case 274: -{ - add_opvars(splev, "sio", - VA_PASS3((char *)0, 1, SPO_GRAVE)); - } -break; -case 275: -{ - add_opvars(splev, "sio", - VA_PASS3((char *)0, 0, SPO_GRAVE)); - } -break; -case 276: -{ - add_opvars(splev, "o", VA_PASS1(SPO_GOLD)); - } -break; -case 277: -{ - add_opvars(splev, "io", - VA_PASS2((long)yyvsp[-2].i, SPO_ENGRAVING)); - } -break; -case 278: -{ - add_opvars(splev, "o", VA_PASS1(SPO_MINERALIZE)); - } -break; -case 279: -{ - add_opvars(splev, "iiiio", - VA_PASS5(-1L, -1L, -1L, -1L, SPO_MINERALIZE)); - } -break; -case 280: -{ - int token = get_trap_type(yyvsp[0].map); - if (token == ERR) - lc_error("Unknown trap type '%s'!", yyvsp[0].map); - yyval.i = token; - Free(yyvsp[0].map); - } -break; -case 282: -{ - int token = get_room_type(yyvsp[0].map); - if (token == ERR) { - lc_warning("Unknown room type \"%s\"! Making ordinary room...", yyvsp[0].map); - yyval.i = OROOM; - } else - yyval.i = token; - Free(yyvsp[0].map); - } -break; -case 284: -{ - yyval.i = -1; - } -break; -case 285: -{ - yyval.i = yyvsp[0].i; - } -break; -case 286: -{ - yyval.i = yyvsp[0].i; - } -break; -case 287: -{ - yyval.i = yyvsp[-2].i | yyvsp[0].i; - } -break; -case 288: -{ - yyval.i = (yyvsp[0].i << 0); - } -break; -case 289: -{ - yyval.i = (yyvsp[0].i << 1); - } -break; -case 290: -{ - yyval.i = (yyvsp[0].i << 2); - } -break; -case 297: -{ - yyval.i = - MAX_REGISTERS - 1; - } -break; -case 300: -{ - yyval.i = - MAX_REGISTERS - 1; - } -break; -case 303: -{ - if ( yyvsp[-1].i >= 3 ) - lc_error("Register Index overflow!"); - else - yyval.i = - yyvsp[-1].i - 1; - } -break; -case 304: -{ - add_opvars(splev, "s", VA_PASS1(yyvsp[0].map)); - Free(yyvsp[0].map); - } -break; -case 305: -{ - check_vardef_type(vardefs, yyvsp[0].map, SPOVAR_STRING); - vardef_used(vardefs, yyvsp[0].map); - add_opvars(splev, "v", VA_PASS1(yyvsp[0].map)); - Free(yyvsp[0].map); - } -break; -case 306: -{ - check_vardef_type(vardefs, yyvsp[-3].map, - SPOVAR_STRING | SPOVAR_ARRAY); - vardef_used(vardefs, yyvsp[-3].map); - add_opvars(splev, "v", VA_PASS1(yyvsp[-3].map)); - Free(yyvsp[-3].map); - } -break; -case 307: -{ - /* nothing */ - } -break; -case 308: -{ - add_opvars(splev, "c", VA_PASS1(yyvsp[0].i)); - } -break; -case 309: -{ - add_opvars(splev, "o", VA_PASS1(SPO_SEL_RNDCOORD)); - } -break; -case 310: -{ - check_vardef_type(vardefs, yyvsp[0].map, SPOVAR_COORD); - vardef_used(vardefs, yyvsp[0].map); - add_opvars(splev, "v", VA_PASS1(yyvsp[0].map)); - Free(yyvsp[0].map); - } -break; -case 311: -{ - check_vardef_type(vardefs, yyvsp[-3].map, - SPOVAR_COORD | SPOVAR_ARRAY); - vardef_used(vardefs, yyvsp[-3].map); - add_opvars(splev, "v", VA_PASS1(yyvsp[-3].map)); - Free(yyvsp[-3].map); - } -break; -case 312: -{ - if (yyvsp[-3].i < 0 || yyvsp[-1].i < 0 || yyvsp[-3].i >= COLNO || yyvsp[-1].i >= ROWNO) - lc_error("Coordinates (%li,%li) out of map range!", - yyvsp[-3].i, yyvsp[-1].i); - yyval.i = SP_COORD_PACK(yyvsp[-3].i, yyvsp[-1].i); - } -break; -case 313: -{ - yyval.i = SP_COORD_PACK_RANDOM(0); - } -break; -case 314: -{ - yyval.i = SP_COORD_PACK_RANDOM(yyvsp[-1].i); - } -break; -case 315: -{ - yyval.i = yyvsp[0].i; - } -break; -case 316: -{ - if ((yyvsp[-2].i & yyvsp[0].i)) - lc_warning("Humidity flag used twice."); - yyval.i = (yyvsp[-2].i | yyvsp[0].i); - } -break; -case 317: -{ - /* nothing */ - } -break; -case 318: -{ - check_vardef_type(vardefs, yyvsp[0].map, SPOVAR_REGION); - vardef_used(vardefs, yyvsp[0].map); - add_opvars(splev, "v", VA_PASS1(yyvsp[0].map)); - Free(yyvsp[0].map); - } -break; -case 319: -{ - check_vardef_type(vardefs, yyvsp[-3].map, - SPOVAR_REGION | SPOVAR_ARRAY); - vardef_used(vardefs, yyvsp[-3].map); - add_opvars(splev, "v", VA_PASS1(yyvsp[-3].map)); - Free(yyvsp[-3].map); - } -break; -case 320: -{ - long r = SP_REGION_PACK(yyvsp[-7].i, yyvsp[-5].i, yyvsp[-3].i, yyvsp[-1].i); - - if (yyvsp[-7].i > yyvsp[-3].i || yyvsp[-5].i > yyvsp[-1].i) - lc_error("Region start > end: (%ld,%ld,%ld,%ld)!", - yyvsp[-7].i, yyvsp[-5].i, yyvsp[-3].i, yyvsp[-1].i); - - add_opvars(splev, "r", VA_PASS1(r)); - yyval.i = r; - } -break; -case 321: -{ - add_opvars(splev, "m", VA_PASS1(yyvsp[0].i)); - } -break; -case 322: -{ - check_vardef_type(vardefs, yyvsp[0].map, SPOVAR_MAPCHAR); - vardef_used(vardefs, yyvsp[0].map); - add_opvars(splev, "v", VA_PASS1(yyvsp[0].map)); - Free(yyvsp[0].map); - } -break; -case 323: -{ - check_vardef_type(vardefs, yyvsp[-3].map, - SPOVAR_MAPCHAR | SPOVAR_ARRAY); - vardef_used(vardefs, yyvsp[-3].map); - add_opvars(splev, "v", VA_PASS1(yyvsp[-3].map)); - Free(yyvsp[-3].map); - } -break; -case 324: -{ - if (what_map_char((char) yyvsp[0].i) != INVALID_TYPE) - yyval.i = SP_MAPCHAR_PACK(what_map_char((char) yyvsp[0].i), -2); - else { - lc_error("Unknown map char type '%c'!", yyvsp[0].i); - yyval.i = SP_MAPCHAR_PACK(STONE, -2); - } - } -break; -case 325: -{ - if (what_map_char((char) yyvsp[-3].i) != INVALID_TYPE) - yyval.i = SP_MAPCHAR_PACK(what_map_char((char) yyvsp[-3].i), yyvsp[-1].i); - else { - lc_error("Unknown map char type '%c'!", yyvsp[-3].i); - yyval.i = SP_MAPCHAR_PACK(STONE, yyvsp[-1].i); - } - } -break; -case 326: -{ - add_opvars(splev, "M", VA_PASS1(yyvsp[0].i)); - } -break; -case 327: -{ - check_vardef_type(vardefs, yyvsp[0].map, SPOVAR_MONST); - vardef_used(vardefs, yyvsp[0].map); - add_opvars(splev, "v", VA_PASS1(yyvsp[0].map)); - Free(yyvsp[0].map); - } -break; -case 328: -{ - check_vardef_type(vardefs, yyvsp[-3].map, - SPOVAR_MONST | SPOVAR_ARRAY); - vardef_used(vardefs, yyvsp[-3].map); - add_opvars(splev, "v", VA_PASS1(yyvsp[-3].map)); - Free(yyvsp[-3].map); - } -break; -case 329: -{ - long m = get_monster_id(yyvsp[0].map, (char)0); - if (m == ERR) { - lc_error("Unknown monster \"%s\"!", yyvsp[0].map); - yyval.i = -1; - } else - yyval.i = SP_MONST_PACK(m, - def_monsyms[(int) mons[m].mlet].sym); - Free(yyvsp[0].map); - } -break; -case 330: -{ - if (check_monster_char((char) yyvsp[0].i)) - yyval.i = SP_MONST_PACK(-1, yyvsp[0].i); - else { - lc_error("Unknown monster class '%c'!", yyvsp[0].i); - yyval.i = -1; - } - } -break; -case 331: -{ - long m = get_monster_id(yyvsp[-1].map, (char) yyvsp[-3].i); - if (m == ERR) { - lc_error("Unknown monster ('%c', \"%s\")!", yyvsp[-3].i, yyvsp[-1].map); - yyval.i = -1; - } else - yyval.i = SP_MONST_PACK(m, yyvsp[-3].i); - Free(yyvsp[-1].map); - } -break; -case 332: -{ - yyval.i = -1; - } -break; -case 333: -{ - add_opvars(splev, "O", VA_PASS1(yyvsp[0].i)); - } -break; -case 334: -{ - check_vardef_type(vardefs, yyvsp[0].map, SPOVAR_OBJ); - vardef_used(vardefs, yyvsp[0].map); - add_opvars(splev, "v", VA_PASS1(yyvsp[0].map)); - Free(yyvsp[0].map); - } -break; -case 335: -{ - check_vardef_type(vardefs, yyvsp[-3].map, - SPOVAR_OBJ | SPOVAR_ARRAY); - vardef_used(vardefs, yyvsp[-3].map); - add_opvars(splev, "v", VA_PASS1(yyvsp[-3].map)); - Free(yyvsp[-3].map); - } -break; -case 336: -{ - long m = get_object_id(yyvsp[0].map, (char)0); - if (m == ERR) { - lc_error("Unknown object \"%s\"!", yyvsp[0].map); - yyval.i = -1; - } else - /* obj class != 0 to force generation of a specific item */ - yyval.i = SP_OBJ_PACK(m, 1); - Free(yyvsp[0].map); - } -break; -case 337: -{ - if (check_object_char((char) yyvsp[0].i)) - yyval.i = SP_OBJ_PACK(-1, yyvsp[0].i); - else { - lc_error("Unknown object class '%c'!", yyvsp[0].i); - yyval.i = -1; - } - } -break; -case 338: -{ - long m = get_object_id(yyvsp[-1].map, (char) yyvsp[-3].i); - if (m == ERR) { - lc_error("Unknown object ('%c', \"%s\")!", yyvsp[-3].i, yyvsp[-1].map); - yyval.i = -1; - } else - yyval.i = SP_OBJ_PACK(m, yyvsp[-3].i); - Free(yyvsp[-1].map); - } -break; -case 339: -{ - yyval.i = -1; - } -break; -case 340: -{ } -break; -case 341: -{ - add_opvars(splev, "o", VA_PASS1(SPO_MATH_ADD)); - } -break; -case 342: -{ - add_opvars(splev, "i", VA_PASS1(yyvsp[0].i)); - } -break; -case 343: -{ - is_inconstant_number = 1; - } -break; -case 344: -{ - add_opvars(splev, "i", VA_PASS1(yyvsp[-1].i)); - } -break; -case 345: -{ - check_vardef_type(vardefs, yyvsp[0].map, SPOVAR_INT); - vardef_used(vardefs, yyvsp[0].map); - add_opvars(splev, "v", VA_PASS1(yyvsp[0].map)); - Free(yyvsp[0].map); - is_inconstant_number = 1; - } -break; -case 346: -{ - check_vardef_type(vardefs, yyvsp[-3].map, - SPOVAR_INT | SPOVAR_ARRAY); - vardef_used(vardefs, yyvsp[-3].map); - add_opvars(splev, "v", VA_PASS1(yyvsp[-3].map)); - Free(yyvsp[-3].map); - is_inconstant_number = 1; - } -break; -case 347: -{ - add_opvars(splev, "o", VA_PASS1(SPO_MATH_ADD)); - } -break; -case 348: -{ - add_opvars(splev, "o", VA_PASS1(SPO_MATH_SUB)); - } -break; -case 349: -{ - add_opvars(splev, "o", VA_PASS1(SPO_MATH_MUL)); - } -break; -case 350: -{ - add_opvars(splev, "o", VA_PASS1(SPO_MATH_DIV)); - } -break; -case 351: -{ - add_opvars(splev, "o", VA_PASS1(SPO_MATH_MOD)); - } -break; -case 352: -{ } -break; -case 353: -{ - if (!strcmp("int", yyvsp[0].map) || !strcmp("integer", yyvsp[0].map)) { - yyval.i = (int)'i'; - } else - lc_error("Unknown function parameter type '%s'", yyvsp[0].map); - } -break; -case 354: -{ - if (!strcmp("str", yyvsp[0].map) || !strcmp("string", yyvsp[0].map)) { - yyval.i = (int)'s'; - } else - lc_error("Unknown function parameter type '%s'", yyvsp[0].map); - } -break; -case 355: -{ - struct lc_funcdefs_parm *tmp = New(struct lc_funcdefs_parm); - - if (!curr_function) { - lc_error("Function parameters outside function definition."); - } else if (!tmp) { - lc_error("Could not alloc function params."); - } else { - long vt = SPOVAR_NULL; - - tmp->name = strdup(yyvsp[-2].map); - tmp->parmtype = (char) yyvsp[0].i; - tmp->next = curr_function->params; - curr_function->params = tmp; - curr_function->n_params++; - switch (tmp->parmtype) { - case 'i': - vt = SPOVAR_INT; - break; - case 's': - vt = SPOVAR_STRING; - break; - default: - lc_error("Unknown func param conversion."); - break; - } - vardefs = add_vardef_type( vardefs, yyvsp[-2].map, vt); - } - Free(yyvsp[-2].map); - } -break; -case 360: -{ - yyval.i = (int)'i'; - } -break; -case 361: -{ - yyval.i = (int)'s'; - } -break; -case 362: -{ - char tmpbuf[2]; - tmpbuf[0] = (char) yyvsp[0].i; - tmpbuf[1] = '\0'; - yyval.map = strdup(tmpbuf); - } -break; -case 363: -{ - long len = strlen( yyvsp[-2].map ); - char *tmp = (char *) alloc(len + 2); - sprintf(tmp, "%c%s", (char) yyvsp[0].i, yyvsp[-2].map ); - Free( yyvsp[-2].map ); - yyval.map = tmp; - } -break; -case 364: -{ - yyval.map = strdup(""); - } -break; -case 365: -{ - char *tmp = strdup( yyvsp[0].map ); - Free( yyvsp[0].map ); - yyval.map = tmp; - } -break; -case 366: -{ - add_opvars(splev, "o", VA_PASS1(SPO_SEL_POINT)); - } -break; -case 367: -{ - add_opvars(splev, "o", VA_PASS1(SPO_SEL_RECT)); - } -break; -case 368: -{ - add_opvars(splev, "o", VA_PASS1(SPO_SEL_FILLRECT)); - } -break; -case 369: -{ - add_opvars(splev, "o", VA_PASS1(SPO_SEL_LINE)); - } -break; -case 370: -{ - /* randline (x1,y1),(x2,y2), roughness */ - add_opvars(splev, "o", VA_PASS1(SPO_SEL_RNDLINE)); - } -break; -case 371: -{ - add_opvars(splev, "io", VA_PASS2(W_ANY, SPO_SEL_GROW)); - } -break; -case 372: -{ - add_opvars(splev, "io", VA_PASS2(yyvsp[-3].i, SPO_SEL_GROW)); - } -break; -case 373: -{ - add_opvars(splev, "iio", - VA_PASS3(yyvsp[-3].i, SPOFILTER_PERCENT, SPO_SEL_FILTER)); - } -break; -case 374: -{ - add_opvars(splev, "io", - VA_PASS2(SPOFILTER_SELECTION, SPO_SEL_FILTER)); - } -break; -case 375: -{ - add_opvars(splev, "io", - VA_PASS2(SPOFILTER_MAPCHAR, SPO_SEL_FILTER)); - } -break; -case 376: -{ - add_opvars(splev, "o", VA_PASS1(SPO_SEL_FLOOD)); - } -break; -case 377: -{ - add_opvars(splev, "oio", - VA_PASS3(SPO_COPY, 1, SPO_SEL_ELLIPSE)); - } -break; -case 378: -{ - add_opvars(splev, "oio", - VA_PASS3(SPO_COPY, yyvsp[-1].i, SPO_SEL_ELLIPSE)); - } -break; -case 379: -{ - add_opvars(splev, "io", VA_PASS2(1, SPO_SEL_ELLIPSE)); - } -break; -case 380: -{ - add_opvars(splev, "io", VA_PASS2(yyvsp[-1].i, SPO_SEL_ELLIPSE)); - } -break; -case 381: -{ - add_opvars(splev, "iio", - VA_PASS3(yyvsp[-5].i, yyvsp[-11].i, SPO_SEL_GRADIENT)); - } -break; -case 382: -{ - add_opvars(splev, "o", VA_PASS1(SPO_SEL_COMPLEMENT)); - } -break; -case 383: -{ - check_vardef_type(vardefs, yyvsp[0].map, SPOVAR_SEL); - vardef_used(vardefs, yyvsp[0].map); - add_opvars(splev, "v", VA_PASS1(yyvsp[0].map)); - Free(yyvsp[0].map); - } -break; -case 384: -{ - /* nothing */ - } -break; -case 385: -{ - /* nothing */ - } -break; -case 386: -{ - add_opvars(splev, "o", VA_PASS1(SPO_SEL_ADD)); - } -break; -case 387: -{ - add_opvars(splev, "iio", - VA_PASS3(yyvsp[0].dice.num, yyvsp[0].dice.die, SPO_DICE)); - } -break; -case 391: -{ - add_opvars(splev, "i", VA_PASS1(yyvsp[0].i)); - } -break; -case 392: -{ - add_opvars(splev, "i", VA_PASS1(yyvsp[0].i)); - } -break; -case 393: -{ - add_opvars(splev, "i", VA_PASS1(yyvsp[0].i)); - } -break; -case 394: -{ - /* nothing */ - } -break; -case 403: -{ - yyval.lregn = yyvsp[0].lregn; - } -break; -case 404: -{ - if (yyvsp[-7].i <= 0 || yyvsp[-7].i >= COLNO) - lc_error( - "Region (%ld,%ld,%ld,%ld) out of level range (x1)!", - yyvsp[-7].i, yyvsp[-5].i, yyvsp[-3].i, yyvsp[-1].i); - else if (yyvsp[-5].i < 0 || yyvsp[-5].i >= ROWNO) - lc_error( - "Region (%ld,%ld,%ld,%ld) out of level range (y1)!", - yyvsp[-7].i, yyvsp[-5].i, yyvsp[-3].i, yyvsp[-1].i); - else if (yyvsp[-3].i <= 0 || yyvsp[-3].i >= COLNO) - lc_error( - "Region (%ld,%ld,%ld,%ld) out of level range (x2)!", - yyvsp[-7].i, yyvsp[-5].i, yyvsp[-3].i, yyvsp[-1].i); - else if (yyvsp[-1].i < 0 || yyvsp[-1].i >= ROWNO) - lc_error( - "Region (%ld,%ld,%ld,%ld) out of level range (y2)!", - yyvsp[-7].i, yyvsp[-5].i, yyvsp[-3].i, yyvsp[-1].i); - yyval.lregn.x1 = yyvsp[-7].i; - yyval.lregn.y1 = yyvsp[-5].i; - yyval.lregn.x2 = yyvsp[-3].i; - yyval.lregn.y2 = yyvsp[-1].i; - yyval.lregn.area = 1; - } -break; -case 405: -{ -/* This series of if statements is a hack for MSC 5.1. It seems that its - tiny little brain cannot compile if these are all one big if statement. */ - if (yyvsp[-7].i < 0 || yyvsp[-7].i > (int) max_x_map) - lc_error( - "Region (%ld,%ld,%ld,%ld) out of map range (x1)!", - yyvsp[-7].i, yyvsp[-5].i, yyvsp[-3].i, yyvsp[-1].i); - else if (yyvsp[-5].i < 0 || yyvsp[-5].i > (int) max_y_map) - lc_error( - "Region (%ld,%ld,%ld,%ld) out of map range (y1)!", - yyvsp[-7].i, yyvsp[-5].i, yyvsp[-3].i, yyvsp[-1].i); - else if (yyvsp[-3].i < 0 || yyvsp[-3].i > (int) max_x_map) - lc_error( - "Region (%ld,%ld,%ld,%ld) out of map range (x2)!", - yyvsp[-7].i, yyvsp[-5].i, yyvsp[-3].i, yyvsp[-1].i); - else if (yyvsp[-1].i < 0 || yyvsp[-1].i > (int) max_y_map) - lc_error( - "Region (%ld,%ld,%ld,%ld) out of map range (y2)!", - yyvsp[-7].i, yyvsp[-5].i, yyvsp[-3].i, yyvsp[-1].i); - yyval.lregn.area = 0; - yyval.lregn.x1 = yyvsp[-7].i; - yyval.lregn.y1 = yyvsp[-5].i; - yyval.lregn.x2 = yyvsp[-3].i; - yyval.lregn.y2 = yyvsp[-1].i; - } -break; - } - yyssp -= yym; - yystate = *yyssp; - yyvsp -= yym; - yym = yylhs[yyn]; - if (yystate == 0 && yym == 0) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state 0 to\ - state %d\n", YYPREFIX, YYFINAL); -#endif - yystate = YYFINAL; - *++yyssp = YYFINAL; - *++yyvsp = yyval; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, YYFINAL, yychar, yys); - } -#endif - } - if (yychar == 0) goto yyaccept; - goto yyloop; - } - if ((yyn = yygindex[yym]) != 0 && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) - yystate = yytable[yyn]; - else - yystate = yydgoto[yym]; -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state %d \ -to state %d\n", YYPREFIX, *yyssp, yystate); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate; - *++yyvsp = yyval; - goto yyloop; -yyoverflow: - yyerror("yacc stack overflow"); -yyabort: - return (1); -yyaccept: - return (0); -} diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index 83649856a..55ca1cc98 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -7,7 +7,6 @@ #include "hack.h" #include "dlb.h" -#include "sfproto.h" #ifndef NO_SIGNAL #include @@ -15,13 +14,11 @@ #include -#if !defined(AMIGA) && !defined(GNUDOS) +#if !defined(AMIGA) && !defined(__DJGPP__) #include #else -#ifdef GNUDOS #include #endif -#endif #ifdef __DJGPP__ #include /* for getcwd() prototype */ @@ -452,8 +449,6 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ g.hackpid = 1; if (nhfp->structlevel) write(nhfp->fd, (genericptr_t) &g.hackpid, sizeof(g.hackpid)); - if (nhfp->fieldlevel) - sfi_int(nhfp, &g.hackpid, "locking", "g.hackpid", 1); close_nhfile(nhfp); } #ifdef MFLOPPY diff --git a/sys/share/tclib.c b/sys/share/tclib.c index c158741e5..b47f41815 100644 --- a/sys/share/tclib.c +++ b/sys/share/tclib.c @@ -27,7 +27,7 @@ int FDECL(tgetnum, (const char *)); char *FDECL(tgetstr, (const char *, char **)); char *FDECL(tgoto, (const char *, int, int)); char *FDECL(tparam, (const char *, char *, int, int, int, int, int)); -void FDECL(tputs, (const char *, int, int (*)())); +void FDECL(tputs, (const char *, int, int (*)(int))); /* local support data */ static char *tc_entry; @@ -502,9 +502,10 @@ int row, col, row2, col2; /* send a string to the terminal, possibly padded with trailing NULs */ void tputs(string, range, output_func) -const char *string; /* characters to output */ -int range; /* number of lines affected, used for `*' delays */ -int (*output_func)(); /* actual output routine; return value ignored */ +const char *string; /* characters to output */ +int range; /* number of lines affected, used for `*' delays */ +int FDECL((*output_func),(int)); /* actual output routine; + * return value ignored */ { register int c, num = 0; register const char *p = string; diff --git a/sys/share/unixtty.c b/sys/share/unixtty.c index dafbc8f44..3196f3b3d 100644 --- a/sys/share/unixtty.c +++ b/sys/share/unixtty.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 unixtty.c $NHDT-Date: 1548372343 2019/01/24 23:25:43 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.25 $ */ +/* NetHack 3.6 unixtty.c $NHDT-Date: 1570652308 2019/10/09 20:18:28 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.26 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -243,6 +243,7 @@ const char *s; iflags.cbreak = (CBRKON(inittyb.cbrkflgs & CBRKMASK)) ? ON : OFF; curttyb.inputflags |= STRIPHI; setioctls(); + settty_needed = FALSE; } void @@ -471,6 +472,9 @@ VA_DECL(const char *, s) { VA_START(s); VA_INIT(s, const char *); + + if (iflags.window_inited) + exit_nhwindows((char *) 0); /* for tty, will call settty() */ if (settty_needed) settty((char *) 0); Vprintf(s, VA_ARGS); diff --git a/sys/unix/Makefile.dat b/sys/unix/Makefile.dat index 466a14f63..e60e2fd06 100644 --- a/sys/unix/Makefile.dat +++ b/sys/unix/Makefile.dat @@ -9,19 +9,13 @@ NHSROOT=.. # SHELL=E:/GEMINI2/MUPFEL.TTP # UUDECODE=uudecode -VARDAT = bogusmon data engrave epitaph rumors quest.dat oracles options +VARDAT = bogusmon data engrave epitaph rumors oracles options -all: $(VARDAT) spec_levs quest_levs dungeon +all: $(VARDAT) spec_levs quest_levs ../util/makedefs: (cd ../util ; $(MAKE) makedefs) -../util/dgn_comp: - (cd ../util ; $(MAKE) dgn_comp) - -../util/lev_comp: - (cd ../util ; $(MAKE) lev_comp) - ../util/tile2x11: (cd ../util ; $(MAKE) tile2x11) @@ -71,11 +65,11 @@ rip.xpm: ../win/X11/rip.xpm mapbg.xpm: ../win/gnome/mapbg.xpm cp ../win/gnome/mapbg.xpm mapbg.xpm -nhsplash.xpm: ../win/Qt/nhsplash.xpm - cp ../win/Qt/nhsplash.xpm nhsplash.xpm +nhsplash.xpm: ../win/share/nhsplash.xpm + cp ../win/share/nhsplash.xpm nhsplash.xpm -nethack.icns: ../win/Qt/nhicns.uu - $(UUDECODE) ../win/Qt/nhicns.uu +nethack.icns: ../win/share/nhicns.uu + $(UUDECODE) ../win/share/nhicns.uu Info.plist: ../win/Qt/Info.pli cp ../win/Qt/Info.pli Info.plist @@ -106,9 +100,6 @@ data: data.base ../util/makedefs rumors: rumors.tru rumors.fal ../util/makedefs ../util/makedefs -r -quest.dat: quest.txt ../util/makedefs - ../util/makedefs -q - oracles: oracles.txt ../util/makedefs ../util/makedefs -h @@ -126,47 +117,14 @@ options: ../util/makedefs ../util/makedefs -v -spec_levs: ../util/lev_comp \ - bigroom.des castle.des endgame.des gehennom.des knox.des medusa.des \ - mines.des oracle.des sokoban.des tower.des yendor.des - ../util/lev_comp bigroom.des - ../util/lev_comp castle.des - ../util/lev_comp endgame.des - ../util/lev_comp gehennom.des - ../util/lev_comp knox.des - ../util/lev_comp medusa.des - ../util/lev_comp mines.des - ../util/lev_comp oracle.des - ../util/lev_comp sokoban.des - ../util/lev_comp tower.des - ../util/lev_comp yendor.des +spec_levs: touch spec_levs -quest_levs: ../util/lev_comp \ - Arch.des Barb.des Caveman.des Healer.des Knight.des Monk.des \ - Priest.des Ranger.des Rogue.des Samurai.des Tourist.des Valkyrie.des \ - Wizard.des - ../util/lev_comp Arch.des - ../util/lev_comp Barb.des - ../util/lev_comp Caveman.des - ../util/lev_comp Healer.des - ../util/lev_comp Knight.des - ../util/lev_comp Monk.des - ../util/lev_comp Priest.des - ../util/lev_comp Ranger.des - ../util/lev_comp Rogue.des - ../util/lev_comp Samurai.des - ../util/lev_comp Tourist.des - ../util/lev_comp Valkyrie.des - ../util/lev_comp Wizard.des +quest_levs: touch quest_levs -dungeon: dungeon.def ../util/makedefs ../util/dgn_comp - ../util/makedefs -e - ../util/dgn_comp dungeon.pdf - spotless: - -rm -f spec_levs quest_levs *.lev $(VARDAT) dungeon dungeon.pdf + -rm -f spec_levs quest_levs *.lev $(VARDAT) -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 diff --git a/sys/unix/Makefile.doc b/sys/unix/Makefile.doc index 1d2f53532..2d2a2dd03 100644 --- a/sys/unix/Makefile.doc +++ b/sys/unix/Makefile.doc @@ -67,29 +67,23 @@ MANEXT = 6 # manual installation for most BSD-style systems GAMEMANCREATE = cat nethack.6 | $(NHGREP) > -LEVMANCREATE = cat lev_comp.6 | $(NHGREP) > -DGNMANCREATE = cat dgn_comp.6 | $(NHGREP) > RCVRMANCREATE = cat recover.6 | $(NHGREP) > DLBMANCREATE = cat dlb.6 | $(NHGREP) > MDMANCREATE = cat makedefs.6 | $(NHGREP) > # manual installation for most SYSV-style systems # GAMEMANCREATE = cat nethack.6 | $(NHGREP) | nroff -man - > -# LEVMANCREATE = cat lev_comp.6 | $(NHGREP) | nroff -man - > -# DGNMANCREATE = cat dgn_comp.6 | $(NHGREP) | nroff -man - > # RCVRMANCREATE = cat recover.6 | $(NHGREP) | nroff -man - > # DLBMANCREATE = cat dlb.6 | $(NHGREP) | nroff -man - > # MDMANCREATE = cat makedefs.6 | $(NHGREP) | nroff -man - > manpages: -$(GAMEMANCREATE) $(MANDIR)/$(GAME).$(MANEXT) - -$(LEVMANCREATE) $(MANDIR)/lev_comp.$(MANEXT) - -$(DGNMANCREATE) $(MANDIR)/dgn_comp.$(MANEXT) -$(RCVRMANCREATE) $(MANDIR)/recover.$(MANEXT) -$(DLBMANCREATE) $(MANDIR)/dlb.$(MANEXT) -$(MDMANCREATE) $(MANDIR)/makedefs.$(MANEXT) # manual creation for distribution -DISTRIB = Guidebook.txt nethack.txt lev_comp.txt dgn_comp.txt recover.txt \ +DISTRIB = Guidebook.txt nethack.txt recover.txt \ dlb.txt makedefs.txt distrib: $(DISTRIB) @@ -100,10 +94,6 @@ Guidebook.txt : Guidebook.mn tmac.n tmac.nh MAN2TXT = $(NHGREP) | nroff -man - | $(COLCMD) nethack.txt : nethack.6 cat nethack.6 | $(MAN2TXT) > nethack.txt -lev_comp.txt : lev_comp.6 - cat lev_comp.6 | $(MAN2TXT) > lev_comp.txt -dgn_comp.txt : dgn_comp.6 - cat dgn_comp.6 | $(MAN2TXT) > dgn_comp.txt recover.txt : recover.6 cat recover.6 | $(MAN2TXT) > recover.txt dlb.txt : dlb.6 diff --git a/sys/unix/Makefile.src b/sys/unix/Makefile.src index 0162bdaf0..7af0bba60 100644 --- a/sys/unix/Makefile.src +++ b/sys/unix/Makefile.src @@ -1,5 +1,5 @@ # NetHack Makefile. -# NetHack 3.6 Makefile.src $NHDT-Date: 1550876124 2019/02/22 22:55:24 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.70 $ +# NetHack 3.6 Makefile.src $NHDT-Date: 1575932543 2019/12/09 23:02:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.87 $ # Copyright (c) 2018 by Pasi Kallinen # NetHack may be freely redistributed. See license for details. @@ -49,7 +49,7 @@ SHELL=/bin/sh # for UNIX systems SYSSRC = ../sys/share/ioctl.c ../sys/share/unixtty.c ../sys/unix/unixmain.c \ ../sys/unix/unixunix.c ../sys/unix/unixres.c -SYSOBJ = ioctl.o unixmain.o unixtty.o unixunix.o unixres.o +SYSOBJ = ioctl.o unixmain.o unixtty.o unixunix.o unixres.o ../lib/lua/liblua.a # # for Systos # SYSSRC = ../sys/atari/tos.c ../sys/share/pcmain.c ../sys/share/pcsys.c \ @@ -171,7 +171,10 @@ GNOMEINC=-I/usr/lib/glib/include -I/usr/lib/gnome-libs/include -I../win/gnome # CFLAGS = -g -I../include #CFLAGS = -O -I../include -#LFLAGS = +#LFLAGS = + +# -lm required by lua +LIBS += -lm # 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 @@ -221,26 +224,27 @@ WINX11SRC = ../win/X11/Window.c ../win/X11/dialogs.c ../win/X11/winX.c \ WINX11OBJ = Window.o dialogs.o winX.o winmap.o winmenu.o winmesg.o \ winmisc.o winstat.o wintext.o winval.o tile.o # -# Files for a Qt port +# Files for a Qt 3 port (renamed since nethack 3.6.x) # -WINQTSRC = ../win/Qt/qt_win.cpp ../win/Qt/qt_clust.cpp ../win/Qt/qttableview.cpp -WINQTOBJ = qt_win.o qt_clust.o qttableview.o tile.o +WINQT3SRC = ../win/Qt3/qt3_win.cpp ../win/Qt3/qt3_clust.cpp \ + ../win/Qt3/qt3tableview.cpp +WINQT3OBJ = qt3_win.o qt3_clust.o qt3tableview.o tile.o # # Files for a Qt 4 or 5 port # -WINQT4SRC = ../win/Qt4/qt4bind.cpp ../win/Qt4/qt4click.cpp \ - ../win/Qt4/qt4clust.cpp ../win/Qt4/qt4delay.cpp \ - ../win/Qt4/qt4glyph.cpp ../win/Qt4/qt4icon.cpp ../win/Qt4/qt4inv.cpp \ - ../win/Qt4/qt4key.cpp ../win/Qt4/qt4line.cpp ../win/Qt4/qt4main.cpp \ - ../win/Qt4/qt4map.cpp ../win/Qt4/qt4menu.cpp ../win/Qt4/qt4msg.cpp \ - ../win/Qt4/qt4plsel.cpp ../win/Qt4/qt4rip.cpp ../win/Qt4/qt4set.cpp \ - ../win/Qt4/qt4stat.cpp ../win/Qt4/qt4str.cpp ../win/Qt4/qt4streq.cpp \ - ../win/Qt4/qt4svsel.cpp ../win/Qt4/qt4win.cpp ../win/Qt4/qt4xcmd.cpp \ - ../win/Qt4/qt4yndlg.cpp -WINQT4OBJ = qt4bind.o qt4click.o qt4clust.o qt4delay.o qt4glyph.o qt4icon.o \ - qt4inv.o qt4key.o qt4line.o qt4main.o qt4map.o qt4menu.o qt4msg.o \ - qt4plsel.o qt4rip.o qt4set.o qt4stat.o qt4str.o qt4streq.o qt4svsel.o \ - qt4win.o qt4xcmd.o qt4yndlg.o tile.o +WINQTSRC = ../win/Qt/qt_bind.cpp ../win/Qt/qt_click.cpp \ + ../win/Qt/qt_clust.cpp ../win/Qt/qt_delay.cpp \ + ../win/Qt/qt_glyph.cpp ../win/Qt/qt_icon.cpp ../win/Qt/qt_inv.cpp \ + ../win/Qt/qt_key.cpp ../win/Qt/qt_line.cpp ../win/Qt/qt_main.cpp \ + ../win/Qt/qt_map.cpp ../win/Qt/qt_menu.cpp ../win/Qt/qt_msg.cpp \ + ../win/Qt/qt_plsel.cpp ../win/Qt/qt_rip.cpp ../win/Qt/qt_set.cpp \ + ../win/Qt/qt_stat.cpp ../win/Qt/qt_str.cpp ../win/Qt/qt_streq.cpp \ + ../win/Qt/qt_svsel.cpp ../win/Qt/qt_win.cpp ../win/Qt/qt_xcmd.cpp \ + ../win/Qt/qt_yndlg.cpp +WINQTOBJ = qt_bind.o qt_click.o qt_clust.o qt_delay.o qt_glyph.o qt_icon.o \ + qt_inv.o qt_key.o qt_line.o qt_main.o qt_map.o qt_menu.o qt_msg.o \ + qt_plsel.o qt_rip.o qt_set.o qt_stat.o qt_str.o qt_streq.o qt_svsel.o \ + qt_win.o qt_xcmd.o qt_yndlg.o tile.o # # Files for a Gnome port # @@ -299,12 +303,12 @@ WINBEOBJ = # # # libraries for Qt 3 -WINQTLIB = -L$(QTDIR)/lib -lqt +WINQT3LIB = -L$(QTDIR)/lib -lqt # # libraries for Qt 4 WINQT4LIB = `pkg-config QtGui --libs` # -# libraries for Qt 5 (use with WINQT4SRC and WINQT4OBJ) +# libraries for Qt 5 (use with WINQTSRC and WINQTOBJ) WINQT5LIB = `pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs` # # libraries for KDE (with Qt) @@ -316,7 +320,7 @@ WINGNOMELIB = -lgnomeui -lgnome -lart_lgpl -lgtk -lgdk -lpopt # libraries for Gem port WINGEMLIB = -le_gem -lgem # -# libraries for BeOS +# libraries for BeOS WINBELIB = -lbe # # libraries for curses port @@ -360,7 +364,7 @@ WINCURSESLIB = -lncurses # If ZLIB_COMP is defined in config.h this is necessary to link with zlib. # LIBS = -lz # -LIBS = +# LIBS = # make NetHack GAME = nethack @@ -442,14 +446,13 @@ HACKCSRC = allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.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 extralev.c \ files.c fountain.c hack.c hacklib.c invent.c isaac64.c light.c \ - lock.c mail.c makemon.c mapglyph.c mcastu.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 o_init.c objects.c objnam.c \ + lock.c mail.c makemon.c mapglyph.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 \ + nhlua.c nhlsel.c nhlobj.c o_init.c objects.c objnam.c \ options.c pager.c pickup.c pline.c polyself.c potion.c pray.c \ priest.c quest.c questpgr.c read.c rect.c region.c restore.c \ rip.c rnd.c role.c rumors.c save.c sfstruct.c \ - sfbase.c sfdata.c sfascii.c sflendian.c \ shk.c shknam.c sit.c sounds.c \ sp_lev.c spell.c steal.c steed.c sys.c teleport.c timeout.c \ topten.c track.c trap.c u_init.c \ @@ -466,12 +469,12 @@ SYSCSRC = ../sys/atari/tos.c ../sys/share/pcmain.c ../sys/share/pcsys.c \ SYSCXXSRC = ../sys/share/cppregex.cpp # generated source files (tile.c is handled separately via WINxxxSRC) -GENCSRC = vis_tab.c sfdata.c #tile.c +GENCSRC = vis_tab.c #tile.c # all windowing-system-dependent .c (for dependencies and such) WINCSRC = $(WINTTYSRC) $(WINCURSESSRC) $(WINX11SRC) $(WINGNOMESRC) $(WINGEMSRC) # all windowing-system-dependent .cpp (for dependencies and such) -WINCXXSRC = $(WINQTSRC) $(WINQT4SRC) $(WINBESRC) +WINCXXSRC = $(WINQTSRC) $(WINQT3SRC) $(WINBESRC) # Files for window system chaining. Requires SYSCF; include via HINTSRC/HINTOBJ CHAINSRC = ../win/chain/wc_chainin.c ../win/chain/wc_chainout.c \ @@ -487,12 +490,12 @@ CSOURCES = $(HACKCSRC) $(SYSCSRC) $(WINCSRC) $(CHAINSRC) $(GENCSRC) # all .h files except date.h, onames.h, pm.h, and vis_tab.h which would # cause dependency loops if run through "make depend" -# and dgn_comp.h, dgn_file.h, lev_comp.h, special level & dungeon files. +# and dgn_file.h, special level & dungeon files. # HACKINCL = align.h amiconf.h artifact.h artilist.h attrib.h beconf.h botl.h \ color.h config.h config1.h context.h coord.h decl.h def_os2.h \ display.h dlb.h dungeon.h engrave.h extern.h flag.h func_tab.h \ - global.h hack.h lev.h lint.h macconf.h mextra.h mfndpos.h micro.h \ + global.h hack.h lint.h macconf.h mextra.h mfndpos.h micro.h \ mkroom.h \ monattk.h mondata.h monflag.h monst.h monsym.h obj.h objclass.h \ os2conf.h patchlevel.h pcconf.h permonst.h prop.h rect.h region.h \ @@ -500,8 +503,7 @@ HACKINCL = align.h amiconf.h artifact.h artilist.h attrib.h beconf.h botl.h \ tradstdc.h trampoli.h trap.h unixconf.h vision.h vmsconf.h wintty.h \ wincurs.h winX.h winprocs.h wintype.h you.h youprop.h -HSOURCES = $(HACKINCL) date.h onames.h pm.h vis_tab.h \ - lev_comp.h dgn_comp.h dgn_file.h +HSOURCES = $(HACKINCL) date.h onames.h pm.h vis_tab.h dgn_file.h # the following .o's _must_ be made before any others (for makedefs) FIRSTOBJ = monst.o objects.o @@ -511,14 +513,13 @@ HOBJ = $(FIRSTOBJ) allmain.o alloc.o apply.o artifact.o attrib.o ball.o \ do.o do_name.o do_wear.o dog.o dogmove.o dokick.o dothrow.o \ drawing.o dungeon.o eat.o end.o engrave.o exper.o explode.o \ extralev.o files.o fountain.o hack.o hacklib.o invent.o isaac64.o \ - light.o lock.o mail.o makemon.o mapglyph.o mcastu.o mhitm.o mhitu.o \ - minion.o mklev.o mkmap.o \ - mkmaze.o mkobj.o mkroom.o mon.o mondata.o monmove.o \ - mplayer.o mthrowu.o muse.o music.o o_init.o objnam.o options.o \ + light.o lock.o mail.o makemon.o mapglyph.o mcastu.o mdlib.o mhitm.o \ + mhitu.o minion.o mklev.o mkmap.o mkmaze.o mkobj.o mkroom.o mon.o \ + mondata.o monmove.o mplayer.o mthrowu.o muse.o music.o \ + nhlua.o nhlsel.o nhlobj.o o_init.o objnam.o options.o \ pager.o pickup.o pline.o polyself.o potion.o pray.o priest.o \ quest.o questpgr.o read.o rect.o region.o restore.o rip.o rnd.o \ role.o rumors.o save.o sfstruct.o \ - sfbase.o sfdata.o sfascii.o sflendian.o \ shk.o shknam.o sit.o sounds.o sp_lev.o spell.o sys.o \ steal.o steed.o teleport.o timeout.o topten.o track.o trap.o u_init.o \ uhitm.o vault.o vision.o vis_tab.o weapon.o were.o wield.o windows.o \ @@ -526,6 +527,10 @@ HOBJ = $(FIRSTOBJ) allmain.o alloc.o apply.o artifact.o attrib.o ball.o \ $(REGEXOBJ) $(RANDOBJ) $(SYSOBJ) $(WINOBJ) $(HINTOBJ) version.o # the .o files from the HACKCSRC, SYSSRC, and WINSRC lists +# first target is also the default target for 'make' without any arguments +all: $(GAME) + @echo "" + $(GAME): $(SYSTEM) @echo "$(GAME) is up to date." @@ -581,8 +586,8 @@ DUMB.Setup: ../include/extern.h cp ../include/extern.DUMB ../include/extern.h @touch DUMB.Setup -all: $(GAME) - +../lib/lua/liblua.a ../include/nhlua.h: + @( cd .. ; $(MAKE) lua_support ) # dependencies for makedefs and its outputs, which the util # Makefile is responsible for keeping up to date @@ -599,44 +604,43 @@ objects.o: @rm -f $(MAKEDEFS) # Qt 3 windowport meta-object-compiler output -qt_kde0.moc: ../include/qt_kde0.h - $(QTDIR)/bin/moc -o qt_kde0.moc ../include/qt_kde0.h - -qt_win.moc: ../include/qt_win.h - $(QTDIR)/bin/moc -o qt_win.moc ../include/qt_win.h - -qttableview.moc: ../include/qttableview.h - $(QTDIR)/bin/moc -o qttableview.moc ../include/qttableview.h +qt3_kde0.moc: ../win/Qt3/qt3_kde0.h + $(QTDIR)/bin/moc -o qt3kde0.moc ../win/Qt3/qt3_kde0.h +qt3_win.moc: ../win/Qt3/qt3_win.h + $(QTDIR)/bin/moc -o qt3win.moc ../win/Qt3/qt3_win.h +qt3tableview.moc: ../win/Qt3/qt3tableview.h + $(QTDIR)/bin/moc -o qt3tableview.moc ../win/Qt/qt3tableview.h # Qt 4 windowport meta-object-compiler output -qt4kde0.moc : ../win/Qt4/qt4kde0.h - $(QTDIR)/bin/$(MOC) -o qt4kde0.moc ../win/Qt4/qt4kde0.h -qt4main.moc : ../win/Qt4/qt4main.h - $(QTDIR)/bin/$(MOC) -o qt4main.moc ../win/Qt4/qt4main.h -qt4map.moc : ../win/Qt4/qt4map.h - $(QTDIR)/bin/$(MOC) -o qt4map.moc ../win/Qt4/qt4map.h -qt4menu.moc : ../win/Qt4/qt4menu.h - $(QTDIR)/bin/$(MOC) -o qt4menu.moc ../win/Qt4/qt4menu.h -qt4msg.moc : ../win/Qt4/qt4msg.h - $(QTDIR)/bin/$(MOC) -o qt4msg.moc ../win/Qt4/qt4msg.h -qt4plsel.moc : ../win/Qt4/qt4plsel.h - $(QTDIR)/bin/$(MOC) -o qt4plsel.moc ../win/Qt4/qt4plsel.h -qt4set.moc : ../win/Qt4/qt4set.h - $(QTDIR)/bin/$(MOC) -o qt4set.moc ../win/Qt4/qt4set.h -qt4stat.moc : ../win/Qt4/qt4stat.h - $(QTDIR)/bin/$(MOC) -o qt4stat.moc ../win/Qt4/qt4stat.h -qt4xcmd.moc : ../win/Qt4/qt4xcmd.h - $(QTDIR)/bin/$(MOC) -o qt4xcmd.moc ../win/Qt4/qt4xcmd.h -qt4yndlg.moc : ../win/Qt4/qt4yndlg.h - $(QTDIR)/bin/$(MOC) -o qt4yndlg.moc ../win/Qt4/qt4yndlg.h +qt_kde0.moc : ../win/Qt/qt_kde0.h + $(QTDIR)/bin/$(MOC) -o qt_kde0.moc ../win/Qt/qt_kde0.h +qt_main.moc : ../win/Qt/qt_main.h + $(QTDIR)/bin/$(MOC) -o qt_main.moc ../win/Qt/qt_main.h +qt_map.moc : ../win/Qt/qt_map.h + $(QTDIR)/bin/$(MOC) -o qt_map.moc ../win/Qt/qt_map.h +qt_menu.moc : ../win/Qt/qt_menu.h + $(QTDIR)/bin/$(MOC) -o qt_menu.moc ../win/Qt/qt_menu.h +qt_msg.moc : ../win/Qt/qt_msg.h + $(QTDIR)/bin/$(MOC) -o qt_msg.moc ../win/Qt/qt_msg.h +qt_plsel.moc : ../win/Qt/qt_plsel.h + $(QTDIR)/bin/$(MOC) -o qt_plsel.moc ../win/Qt/qt_plsel.h +qt_set.moc : ../win/Qt/qt_set.h + $(QTDIR)/bin/$(MOC) -o qt_set.moc ../win/Qt/qt_set.h +qt_stat.moc : ../win/Qt/qt_stat.h + $(QTDIR)/bin/$(MOC) -o qt_stat.moc ../win/Qt/qt_stat.h +qt_xcmd.moc : ../win/Qt/qt_xcmd.h + $(QTDIR)/bin/$(MOC) -o qt_xcmd.moc ../win/Qt/qt_xcmd.h +qt_yndlg.moc : ../win/Qt/qt_yndlg.h + $(QTDIR)/bin/$(MOC) -o qt_yndlg.moc ../win/Qt/qt_yndlg.h # build monst.o and objects.o before executing '$(MAKE) makedefs' $(MAKEDEFS): $(FIRSTOBJ) \ - ../util/makedefs.c $(CONFIG_H) ../include/permonst.h \ + ../util/makedefs.c ../src/mdlib.c $(CONFIG_H) \ + ../include/permonst.h \ ../include/objclass.h ../include/monsym.h \ ../include/artilist.h ../include/dungeon.h ../include/obj.h \ ../include/monst.h ../include/you.h ../include/flag.h \ - ../include/dlb.h ../include/patchlevel.h ../include/qtext.h + ../include/dlb.h ../include/patchlevel.h @( cd ../util ; $(MAKE) makedefs ) # Source files created by 'makedefs' at build time. @@ -661,26 +665,7 @@ tile.c: ../win/share/tilemap.c $(HACK_H) ../win/gnome/gn_rip.h: ../win/X11/rip.xpm cp ../win/X11/rip.xpm ../win/gnome/gn_rip.h -# readtags dependencies -# -# sfstruct.o: sfstruct.c $(HACK_H) -sfbase.o: sfbase.c $(HACK_H) ../include/sfproto.h ../include/sfprocs.h -sfascii.o: sfascii.c $(HACK_H) ../include/sfprocs.h -sflendian.o: sflendian.c $(HACK_H) ../include/sfprocs.h -sfdata.o: sfdata.c $(HACK_H) ../include/sfprocs.h - -#../util/readtags: -# @( cd ../util ; $(MAKE) readtags ) -# -#../util/nethack.tags: -# @( cd ../util ; $(MAKE) nethack.tags ) -# -#sfdata.c: ../util/readtags ../util/nethack.tags -# @( cd ../util ; ./readtags ) -# -#../include/sfproto.h: ../util/readtags ../util/nethack.tags -# @( cd ../util ; ./readtags ) # date.h should be remade any time any of the source or include code # is modified. Unfortunately, this would make the contents of this @@ -716,6 +701,7 @@ clean: spotless: clean -rm -f a.out core $(GAME) Sys* + -rm -f ../lib/lua/liblua.a ../include/nhlua.h -rm -f ../include/date.h ../include/onames.h ../include/pm.h -rm -f ../include/vis_tab.h vis_tab.c tile.c *.moc -rm -f ../win/gnome/gn_rip.h @@ -724,7 +710,7 @@ spotless: clean depend: ../sys/unix/depend.awk \ $(SYSCSRC) $(WINCSRC) $(SYSCXXSRC) $(WINCXXSRC) \ $(CHAINSRC) $(GENCSRC) $(HACKCSRC) - $(AWK) -f ../sys/unix/depend.awk ../include/*.h \ + $(AWK) -f ../sys/unix/depend.awk ../include/*.h ../win/*/*.h \ $(SYSCSRC) $(WINCSRC) $(SYSCXXSRC) $(WINCXXSRC) \ $(CHAINSRC) $(GENCSRC) $(HACKCSRC) >makedep @echo '/^# DO NOT DELETE THIS LINE OR CHANGE ANYTHING BEYOND IT/+2,$$d' >eddep @@ -744,10 +730,10 @@ depend: ../sys/unix/depend.awk \ # config.h timestamp $(CONFIG_H): ../include/config.h ../include/config1.h ../include/tradstdc.h \ ../include/global.h ../include/coord.h ../include/vmsconf.h \ - ../include/system.h ../include/unixconf.h ../include/os2conf.h \ - ../include/micro.h ../include/pcconf.h ../include/tosconf.h \ - ../include/amiconf.h ../include/macconf.h ../include/beconf.h \ - ../include/wceconf.h ../include/ntconf.h + ../include/system.h ../include/nhlua.h ../include/unixconf.h \ + ../include/os2conf.h ../include/micro.h ../include/pcconf.h \ + ../include/tosconf.h ../include/amiconf.h ../include/macconf.h \ + ../include/beconf.h ../include/wceconf.h ../include/ntconf.h touch $(CONFIG_H) # hack.h timestamp $(HACK_H): ../include/hack.h $(CONFIG_H) ../include/lint.h ../include/align.h \ @@ -755,15 +741,16 @@ $(HACK_H): ../include/hack.h $(CONFIG_H) ../include/lint.h ../include/align.h \ ../include/objclass.h ../include/youprop.h ../include/prop.h \ ../include/permonst.h ../include/monattk.h \ ../include/monflag.h ../include/mondata.h ../include/pm.h \ - ../include/wintype.h ../include/context.h ../include/decl.h \ - ../include/quest.h ../include/spell.h ../include/color.h \ - ../include/obj.h ../include/you.h ../include/attrib.h \ - ../include/monst.h ../include/mextra.h ../include/skills.h \ - ../include/onames.h ../include/timeout.h ../include/trap.h \ - ../include/flag.h ../include/rm.h ../include/vision.h \ - ../include/display.h ../include/engrave.h ../include/rect.h \ - ../include/region.h ../include/winprocs.h ../include/botl.h \ - ../include/sys.h ../include/wintty.h ../include/trampoli.h + ../include/wintype.h ../include/context.h ../include/rm.h \ + ../include/botl.h ../include/rect.h \ + ../include/region.h ../include/decl.h ../include/quest.h \ + ../include/spell.h ../include/color.h ../include/obj.h \ + ../include/you.h ../include/attrib.h ../include/monst.h \ + ../include/mextra.h ../include/skills.h ../include/onames.h \ + ../include/timeout.h ../include/trap.h ../include/flag.h \ + ../include/vision.h ../include/display.h ../include/engrave.h \ + ../include/winprocs.h ../include/sys.h ../include/wintty.h \ + ../include/trampoli.h touch $(HACK_H) # tos.o: ../sys/atari/tos.c $(HACK_H) ../include/tcap.h @@ -855,44 +842,82 @@ tile.o: tile.c $(HACK_H) gnaskstr.o: ../win/gnome/gnaskstr.c ../win/gnome/gnaskstr.h \ ../win/gnome/gnmain.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnaskstr.c -gnbind.o: ../win/gnome/gnbind.c ../win/gnome/gnbind.h ../win/gnome/gnmain.h \ - ../win/gnome/gnmenu.h ../win/gnome/gnaskstr.h \ - ../win/gnome/gnyesno.h +gnbind.o: ../win/gnome/gnbind.c ../win/gnome/gnbind.h ../win/gnome/gnomeprv.h \ + $(HACK_H) ../include/dlb.h ../include/patchlevel.h \ + ../include/winGnome.h ../win/gnome/gnmain.h \ + ../win/gnome/gnmap.h ../win/gnome/gnmenu.h \ + ../win/gnome/gnplayer.h ../win/gnome/gnsignal.h \ + ../win/gnome/gnglyph.h ../win/gnome/gnstatus.h \ + ../win/gnome/gntext.h ../win/gnome/gnmesg.h \ + ../win/gnome/gnyesno.h ../win/gnome/gnworn.h \ + ../win/gnome/gnaskstr.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnbind.c -gnglyph.o: ../win/gnome/gnglyph.c ../win/gnome/gnglyph.h ../include/tile2x11.h +gnglyph.o: ../win/gnome/gnglyph.c ../win/gnome/gnglyph.h $(CONFIG_H) \ + ../include/tile2x11.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnglyph.c gnmain.o: ../win/gnome/gnmain.c ../win/gnome/gnmain.h ../win/gnome/gnsignal.h \ - ../win/gnome/gnbind.h ../win/gnome/gnopts.h $(HACK_H) \ - ../include/date.h + ../win/gnome/gnomeprv.h $(HACK_H) ../include/dlb.h \ + ../include/patchlevel.h ../include/winGnome.h \ + ../win/gnome/gnglyph.h ../win/gnome/gnbind.h \ + ../win/gnome/gnmap.h ../win/gnome/gnmenu.h \ + ../win/gnome/gnplayer.h ../win/gnome/gnstatus.h \ + ../win/gnome/gntext.h ../win/gnome/gnmesg.h \ + ../win/gnome/gnyesno.h ../win/gnome/gnworn.h \ + ../win/gnome/gnopts.h ../include/date.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnmain.c -gnmap.o: ../win/gnome/gnmap.c ../win/gnome/gnmap.h ../win/gnome/gnglyph.h \ - ../win/gnome/gnsignal.h $(HACK_H) +gnmap.o: ../win/gnome/gnmap.c ../win/gnome/gnmap.h $(CONFIG_H) \ + ../win/gnome/gnglyph.h ../win/gnome/gnsignal.h \ + ../win/gnome/gnomeprv.h $(HACK_H) ../include/dlb.h \ + ../include/patchlevel.h ../include/winGnome.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnmap.c -gnmenu.o: ../win/gnome/gnmenu.c ../win/gnome/gnmenu.h ../win/gnome/gnmain.h \ - ../win/gnome/gnbind.h ../include/func_tab.h +gnmenu.o: ../win/gnome/gnmenu.c ../win/gnome/gnmenu.h $(CONFIG_H) \ + ../win/gnome/gnomeprv.h $(HACK_H) ../include/dlb.h \ + ../include/patchlevel.h ../include/winGnome.h \ + ../win/gnome/gnmain.h ../win/gnome/gnbind.h \ + ../win/gnome/gnmap.h ../win/gnome/gnplayer.h \ + ../win/gnome/gnsignal.h ../win/gnome/gnglyph.h \ + ../win/gnome/gnstatus.h ../win/gnome/gntext.h \ + ../win/gnome/gnmesg.h ../win/gnome/gnyesno.h \ + ../win/gnome/gnworn.h ../include/func_tab.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnmenu.c -gnmesg.o: ../win/gnome/gnmesg.c ../win/gnome/gnmesg.h ../win/gnome/gnsignal.h +gnmesg.o: ../win/gnome/gnmesg.c ../win/gnome/gnmesg.h $(CONFIG_H) \ + ../win/gnome/gnsignal.h ../win/gnome/gnomeprv.h $(HACK_H) \ + ../include/dlb.h ../include/patchlevel.h ../include/winGnome.h \ + ../win/gnome/gnglyph.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnmesg.c gnopts.o: ../win/gnome/gnopts.c ../win/gnome/gnopts.h ../win/gnome/gnglyph.h \ - ../win/gnome/gnmain.h ../win/gnome/gnmap.h $(HACK_H) + $(CONFIG_H) ../win/gnome/gnmain.h ../win/gnome/gnmap.h $(HACK_H) $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnopts.c gnplayer.o: ../win/gnome/gnplayer.c ../win/gnome/gnplayer.h \ ../win/gnome/gnmain.h $(HACK_H) $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnplayer.c gnsignal.o: ../win/gnome/gnsignal.c ../win/gnome/gnsignal.h \ - ../win/gnome/gnmain.h + ../win/gnome/gnomeprv.h $(HACK_H) ../include/dlb.h \ + ../include/patchlevel.h ../include/winGnome.h \ + ../win/gnome/gnglyph.h ../win/gnome/gnmain.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnsignal.c -gnstatus.o: ../win/gnome/gnstatus.c ../win/gnome/gnstatus.h \ - ../win/gnome/gnsignal.h ../win/gnome/gn_xpms.h \ - ../win/gnome/gnomeprv.h +gnstatus.o: ../win/gnome/gnstatus.c ../win/gnome/gnstatus.h $(CONFIG_H) \ + ../win/gnome/gnsignal.h ../win/gnome/gnomeprv.h $(HACK_H) \ + ../include/dlb.h ../include/patchlevel.h ../include/winGnome.h \ + ../win/gnome/gnglyph.h ../win/gnome/gn_xpms.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnstatus.c -gntext.o: ../win/gnome/gntext.c ../win/gnome/gntext.h ../win/gnome/gnmain.h \ - ../win/gnome/gn_rip.h +gntext.o: ../win/gnome/gntext.c ../win/gnome/gntext.h $(CONFIG_H) \ + ../win/gnome/gnmain.h ../win/gnome/gn_rip.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gntext.c -gnyesno.o: ../win/gnome/gnyesno.c ../win/gnome/gnbind.h ../win/gnome/gnyesno.h +gnyesno.o: ../win/gnome/gnyesno.c ../win/gnome/gnbind.h \ + ../win/gnome/gnomeprv.h $(HACK_H) ../include/dlb.h \ + ../include/patchlevel.h ../include/winGnome.h \ + ../win/gnome/gnmain.h ../win/gnome/gnmap.h \ + ../win/gnome/gnmenu.h ../win/gnome/gnplayer.h \ + ../win/gnome/gnsignal.h ../win/gnome/gnglyph.h \ + ../win/gnome/gnstatus.h ../win/gnome/gntext.h \ + ../win/gnome/gnmesg.h ../win/gnome/gnyesno.h \ + ../win/gnome/gnworn.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnyesno.c -gnworn.o: ../win/gnome/gnworn.c ../win/gnome/gnworn.h ../win/gnome/gnglyph.h \ - ../win/gnome/gnsignal.h ../win/gnome/gnomeprv.h +gnworn.o: ../win/gnome/gnworn.c ../win/gnome/gnworn.h $(CONFIG_H) \ + ../win/gnome/gnglyph.h ../win/gnome/gnsignal.h \ + ../win/gnome/gnomeprv.h $(HACK_H) ../include/dlb.h \ + ../include/patchlevel.h ../include/winGnome.h $(CC) $(CFLAGS) $(GNOMEINC) -c -o $@ ../win/gnome/gnworn.c wingem.o: ../win/gem/wingem.c $(HACK_H) ../include/func_tab.h ../include/dlb.h \ ../include/patchlevel.h ../include/wingem.h @@ -907,92 +932,105 @@ gr_rect.o: ../win/gem/gr_rect.c ../include/gr_rect.h tile.o: tile.c $(HACK_H) cppregex.o: ../sys/share/cppregex.cpp $(CXX) $(CXXFLAGS) -c -o $@ ../sys/share/cppregex.cpp -qt_win.o: ../win/Qt/qt_win.cpp $(HACK_H) ../include/func_tab.h \ - ../include/dlb.h ../include/patchlevel.h ../include/tile2x11.h \ - ../include/qt_win.h ../include/qt_clust.h ../include/qt_kde0.h \ - ../include/qt_xpms.h qt_win.moc qt_kde0.moc qttableview.moc - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_win.cpp -qt_clust.o: ../win/Qt/qt_clust.cpp ../include/qt_clust.h +qt_bind.o: ../win/Qt/qt_bind.cpp $(HACK_H) ../win/Qt/qt_bind.h \ + ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_click.h \ + ../win/Qt/qt_delay.h ../win/Qt/qt_xcmd.h ../win/Qt/qt_key.h \ + ../win/Qt/qt_map.h ../win/Qt/qt_win.h ../win/Qt/qt_clust.h \ + ../win/Qt/qt_menu.h ../win/Qt/qt_rip.h ../win/Qt/qt_msg.h \ + ../win/Qt/qt_plsel.h ../win/Qt/qt_svsel.h ../win/Qt/qt_set.h \ + ../win/Qt/qt_stat.h ../win/Qt/qt_icon.h ../win/Qt/qt_streq.h \ + ../win/Qt/qt_line.h ../win/Qt/qt_yndlg.h ../win/Qt/qt_str.h \ + ../include/dlb.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_bind.cpp +qt_click.o: ../win/Qt/qt_click.cpp $(HACK_H) ../win/Qt/qt_click.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_click.cpp +qt_clust.o: ../win/Qt/qt_clust.cpp ../win/Qt/qt_clust.h $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_clust.cpp -qttableview.o: ../win/Qt/qttableview.cpp ../include/qttableview.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qttableview.cpp -qt4bind.o: ../win/Qt4/qt4bind.cpp $(HACK_H) ../win/Qt4/qt4bind.h \ - ../win/Qt4/qt4click.h ../win/Qt4/qt4delay.h \ - ../win/Qt4/qt4xcmd.h ../win/Qt4/qt4key.h ../win/Qt4/qt4map.h \ - ../win/Qt4/qt4menu.h ../win/Qt4/qt4msg.h ../win/Qt4/qt4plsel.h \ - ../win/Qt4/qt4svsel.h ../win/Qt4/qt4set.h ../win/Qt4/qt4stat.h \ - ../win/Qt4/qt4streq.h ../win/Qt4/qt4yndlg.h \ - ../win/Qt4/qt4str.h ../include/dlb.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4bind.cpp -qt4click.o: ../win/Qt4/qt4click.cpp $(HACK_H) ../win/Qt4/qt4click.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4click.cpp -qt4clust.o: ../win/Qt4/qt4clust.cpp ../win/Qt4/qt4clust.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4clust.cpp -qt4delay.o: ../win/Qt4/qt4delay.cpp $(HACK_H) ../win/Qt4/qt4delay.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4delay.cpp -qt4glyph.o: ../win/Qt4/qt4glyph.cpp $(HACK_H) ../include/tile2x11.h \ - ../win/Qt4/qt4glyph.h ../win/Qt4/qt4set.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4glyph.cpp -qt4icon.o: ../win/Qt4/qt4icon.cpp $(HACK_H) ../win/Qt4/qt4icon.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4icon.cpp -qt4inv.o: ../win/Qt4/qt4inv.cpp $(HACK_H) ../win/Qt4/qt4inv.h \ - ../win/Qt4/qt4glyph.h ../win/Qt4/qt4set.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4inv.cpp -qt4key.o: ../win/Qt4/qt4key.cpp $(HACK_H) ../win/Qt4/qt4key.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4key.cpp -qt4line.o: ../win/Qt4/qt4line.cpp $(HACK_H) ../win/Qt4/qt4line.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4line.cpp -qt4main.o: ../win/Qt4/qt4main.cpp $(HACK_H) ../include/patchlevel.h \ - ../win/Qt4/qt4main.h qt4main.moc ../win/Qt4/qt4bind.h \ - ../win/Qt4/qt4glyph.h ../win/Qt4/qt4inv.h ../win/Qt4/qt4key.h \ - ../win/Qt4/qt4map.h ../win/Qt4/qt4msg.h ../win/Qt4/qt4set.h \ - ../win/Qt4/qt4stat.h ../win/Qt4/qt4str.h qt4kde0.moc - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4main.cpp -qt4map.o: ../win/Qt4/qt4map.cpp $(HACK_H) ../win/Qt4/qt4map.h qt4map.moc \ - ../win/Qt4/qt4click.h ../win/Qt4/qt4glyph.h \ - ../include/qt_xpms.h ../win/Qt4/qt4set.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4map.cpp -qt4menu.o: ../win/Qt4/qt4menu.cpp $(HACK_H) ../win/Qt4/qt4menu.h qt4menu.moc \ - ../win/Qt4/qt4glyph.h ../win/Qt4/qt4set.h \ - ../win/Qt4/qt4streq.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4menu.cpp -qt4msg.o: ../win/Qt4/qt4msg.cpp $(HACK_H) ../win/Qt4/qt4msg.h qt4msg.moc \ - ../win/Qt4/qt4map.h ../win/Qt4/qt4set.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4msg.cpp -qt4plsel.o: ../win/Qt4/qt4plsel.cpp $(HACK_H) ../win/Qt4/qt4plsel.h \ - qt4plsel.moc ../win/Qt4/qt4bind.h ../win/Qt4/qt4glyph.h \ - ../win/Qt4/qt4set.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4plsel.cpp -qt4rip.o: ../win/Qt4/qt4rip.cpp $(HACK_H) ../win/Qt4/qt4rip.h \ - ../win/Qt4/qt4bind.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4rip.cpp -qt4set.o: ../win/Qt4/qt4set.cpp $(HACK_H) ../win/Qt4/qt4set.h qt4set.moc \ - ../win/Qt4/qt4glyph.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4set.cpp -qt4stat.o: ../win/Qt4/qt4stat.cpp $(HACK_H) ../win/Qt4/qt4stat.h qt4stat.moc \ - ../win/Qt4/qt4set.h ../win/Qt4/qt4str.h ../include/qt_xpms.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4stat.cpp -qt4str.o: ../win/Qt4/qt4str.cpp ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4str.cpp -qt4streq.o: ../win/Qt4/qt4streq.cpp $(HACK_H) ../win/Qt4/qt4streq.h \ - ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4streq.cpp -qt4svsel.o: ../win/Qt4/qt4svsel.cpp $(HACK_H) ../win/Qt4/qt4svsel.h \ - ../win/Qt4/qt4bind.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4svsel.cpp -qt4win.o: ../win/Qt4/qt4win.cpp $(HACK_H) ../win/Qt4/qt4win.h \ - ../win/Qt4/qt4bind.h ../win/Qt4/qt4click.h \ - ../win/Qt4/qt4glyph.h ../win/Qt4/qt4inv.h ../win/Qt4/qt4key.h \ - ../win/Qt4/qt4icon.h ../win/Qt4/qt4map.h ../win/Qt4/qt4menu.h \ - ../win/Qt4/qt4msg.h ../win/Qt4/qt4set.h ../win/Qt4/qt4clust.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4win.cpp -qt4xcmd.o: ../win/Qt4/qt4xcmd.cpp $(HACK_H) ../include/func_tab.h \ - ../win/Qt4/qt4xcmd.h qt4xcmd.moc ../win/Qt4/qt4bind.h \ - ../win/Qt4/qt4set.h ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4xcmd.cpp -qt4yndlg.o: ../win/Qt4/qt4yndlg.cpp $(HACK_H) ../win/Qt4/qt4yndlg.h \ - qt4yndlg.moc ../win/Qt4/qt4str.h - $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt4/qt4yndlg.cpp +qt_delay.o: ../win/Qt/qt_delay.cpp $(HACK_H) ../win/Qt/qt_delay.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_delay.cpp +qt_glyph.o: ../win/Qt/qt_glyph.cpp $(HACK_H) ../include/tile2x11.h \ + ../win/Qt/qt_glyph.h ../win/Qt/qt_set.h ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_glyph.cpp +qt_icon.o: ../win/Qt/qt_icon.cpp $(HACK_H) ../win/Qt/qt_icon.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_icon.cpp +qt_inv.o: ../win/Qt/qt_inv.cpp $(HACK_H) ../win/Qt/qt_inv.h \ + ../win/Qt/qt_glyph.h ../win/Qt/qt_set.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_inv.cpp +qt_key.o: ../win/Qt/qt_key.cpp $(HACK_H) ../win/Qt/qt_key.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_key.cpp +qt_line.o: ../win/Qt/qt_line.cpp $(HACK_H) ../win/Qt/qt_line.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_line.cpp +qt_main.o: ../win/Qt/qt_main.cpp $(HACK_H) ../include/patchlevel.h \ + ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h qt_main.moc \ + ../win/Qt/qt_bind.h ../win/Qt/qt_glyph.h ../win/Qt/qt_inv.h \ + ../win/Qt/qt_key.h ../win/Qt/qt_map.h ../win/Qt/qt_win.h \ + ../win/Qt/qt_clust.h ../win/Qt/qt_msg.h ../win/Qt/qt_set.h \ + ../win/Qt/qt_stat.h ../win/Qt/qt_icon.h ../win/Qt/qt_str.h \ + qt_kde0.moc + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_main.cpp +qt_map.o: ../win/Qt/qt_map.cpp $(HACK_H) ../win/Qt/qt_map.h ../win/Qt/qt_win.h \ + ../win/Qt/qt_clust.h qt_map.moc ../win/Qt/qt_click.h \ + ../win/Qt/qt_glyph.h ../win/Qt/qt_xpms.h ../win/Qt/qt_set.h \ + ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_map.cpp +qt_menu.o: ../win/Qt/qt_menu.cpp $(HACK_H) ../win/Qt/qt_menu.h \ + ../win/Qt/qt_win.h ../win/Qt/qt_rip.h qt_menu.moc \ + ../win/Qt/qt_glyph.h ../win/Qt/qt_set.h ../win/Qt/qt_streq.h \ + ../win/Qt/qt_line.h ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_menu.cpp +qt_msg.o: ../win/Qt/qt_msg.cpp $(HACK_H) ../win/Qt/qt_msg.h ../win/Qt/qt_win.h \ + qt_msg.moc ../win/Qt/qt_map.h ../win/Qt/qt_clust.h \ + ../win/Qt/qt_set.h ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_msg.cpp +qt_plsel.o: ../win/Qt/qt_plsel.cpp $(HACK_H) ../win/Qt/qt_plsel.h qt_plsel.moc \ + ../win/Qt/qt_bind.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \ + ../win/Qt/qt_glyph.h ../win/Qt/qt_set.h ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_plsel.cpp +qt_rip.o: ../win/Qt/qt_rip.cpp $(HACK_H) ../win/Qt/qt_rip.h \ + ../win/Qt/qt_bind.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \ + ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_rip.cpp +qt_set.o: ../win/Qt/qt_set.cpp $(HACK_H) ../win/Qt/qt_set.h qt_set.moc \ + ../win/Qt/qt_glyph.h ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_set.cpp +qt_stat.o: ../win/Qt/qt_stat.cpp $(HACK_H) ../win/Qt/qt_stat.h \ + ../win/Qt/qt_win.h ../win/Qt/qt_icon.h qt_stat.moc \ + ../win/Qt/qt_set.h ../win/Qt/qt_str.h ../win/Qt/qt_xpms.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_stat.cpp +qt_str.o: ../win/Qt/qt_str.cpp ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_str.cpp +qt_streq.o: ../win/Qt/qt_streq.cpp $(HACK_H) ../win/Qt/qt_streq.h \ + ../win/Qt/qt_line.h ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_streq.cpp +qt_svsel.o: ../win/Qt/qt_svsel.cpp $(HACK_H) ../win/Qt/qt_svsel.h \ + ../win/Qt/qt_bind.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \ + ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_svsel.cpp +qt_win.o: ../win/Qt/qt_win.cpp $(HACK_H) ../win/Qt/qt_win.h \ + ../win/Qt/qt_bind.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \ + ../win/Qt/qt_click.h ../win/Qt/qt_glyph.h ../win/Qt/qt_inv.h \ + ../win/Qt/qt_key.h ../win/Qt/qt_icon.h ../win/Qt/qt_map.h \ + ../win/Qt/qt_clust.h ../win/Qt/qt_menu.h ../win/Qt/qt_rip.h \ + ../win/Qt/qt_msg.h ../win/Qt/qt_set.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_win.cpp +qt_xcmd.o: ../win/Qt/qt_xcmd.cpp $(HACK_H) ../include/func_tab.h \ + ../win/Qt/qt_xcmd.h qt_xcmd.moc ../win/Qt/qt_bind.h \ + ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_set.h \ + ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_xcmd.cpp +qt_yndlg.o: ../win/Qt/qt_yndlg.cpp $(HACK_H) ../win/Qt/qt_yndlg.h qt_yndlg.moc \ + ../win/Qt/qt_str.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt/qt_yndlg.cpp +qt3_win.o: ../win/Qt3/qt3_win.cpp $(HACK_H) ../include/func_tab.h \ + ../include/dlb.h ../include/patchlevel.h ../include/tile2x11.h \ + ../win/Qt3/qt3_win.h ../win/Qt3/qt3_clust.h \ + ../win/Qt3/qt3_kde0.h ../win/Qt3/qt3_xpms.h qt3_win.moc \ + qt3_kde0.moc qt3tableview.moc + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt3/qt3_win.cpp +qt3_clust.o: ../win/Qt3/qt3_clust.cpp ../win/Qt3/qt3_clust.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt3/qt3_clust.cpp +qt3tableview.o: ../win/Qt3/qt3tableview.cpp ../win/Qt3/qt3tableview.h + $(CXX) $(CXXFLAGS) -c -o $@ ../win/Qt3/qt3tableview.cpp wc_chainin.o: ../win/chain/wc_chainin.c $(HACK_H) $(CC) $(CFLAGS) -c -o $@ ../win/chain/wc_chainin.c wc_chainout.o: ../win/chain/wc_chainout.c $(HACK_H) @@ -1006,16 +1044,16 @@ apply.o: apply.c $(HACK_H) artifact.o: artifact.c $(HACK_H) ../include/artifact.h ../include/artilist.h attrib.o: attrib.c $(HACK_H) ball.o: ball.c $(HACK_H) -bones.o: bones.c $(HACK_H) ../include/lev.h +bones.o: bones.c $(HACK_H) botl.o: botl.c $(HACK_H) -cmd.o: cmd.c $(HACK_H) ../include/lev.h ../include/func_tab.h +cmd.o: cmd.c $(HACK_H) ../include/func_tab.h dbridge.o: dbridge.c $(HACK_H) decl.o: decl.c $(HACK_H) detect.o: detect.c $(HACK_H) ../include/artifact.h dig.o: dig.c $(HACK_H) display.o: display.c $(HACK_H) -dlb.o: dlb.c $(CONFIG_H) ../include/dlb.h -do.o: do.c $(HACK_H) ../include/lev.h +dlb.o: dlb.c $(CONFIG_H) ../include/dlb.h ../include/patchlevel.h +do.o: do.c $(HACK_H) do_name.o: do_name.c $(HACK_H) do_wear.o: do_wear.c $(HACK_H) dog.o: dog.c $(HACK_H) @@ -1023,11 +1061,10 @@ dogmove.o: dogmove.c $(HACK_H) ../include/mfndpos.h dokick.o: dokick.c $(HACK_H) dothrow.o: dothrow.c $(HACK_H) drawing.o: drawing.c $(HACK_H) ../include/tcap.h -dungeon.o: dungeon.c $(HACK_H) ../include/dgn_file.h ../include/dlb.h \ - ../include/lev.h +dungeon.o: dungeon.c $(HACK_H) ../include/dgn_file.h ../include/dlb.h eat.o: eat.c $(HACK_H) -end.o: end.c $(HACK_H) ../include/lev.h ../include/dlb.h -engrave.o: engrave.c $(HACK_H) ../include/lev.h +end.o: end.c $(HACK_H) ../include/dlb.h +engrave.o: engrave.c $(HACK_H) exper.o: exper.c $(HACK_H) explode.o: explode.c $(HACK_H) extralev.o: extralev.c $(HACK_H) @@ -1036,19 +1073,27 @@ fountain.o: fountain.c $(HACK_H) hack.o: hack.c $(HACK_H) hacklib.o: hacklib.c $(HACK_H) invent.o: invent.c $(HACK_H) -isaac64.o: isaac64.c $(CONFIG_H) ../include/isaac64.h ../include/integer.h -light.o: light.c $(HACK_H) ../include/lev.h +isaac64.o: isaac64.c $(CONFIG_H) ../include/isaac64.h +light.o: light.c $(HACK_H) lock.o: lock.c $(HACK_H) mail.o: mail.c $(HACK_H) ../include/mail.h makemon.o: makemon.c $(HACK_H) mapglyph.o: mapglyph.c $(HACK_H) mcastu.o: mcastu.c $(HACK_H) +mdlib.o: mdlib.c $(CONFIG_H) ../include/permonst.h ../include/align.h \ + ../include/monattk.h ../include/monflag.h \ + ../include/objclass.h ../include/monsym.h \ + ../include/artilist.h ../include/dungeon.h ../include/obj.h \ + ../include/monst.h ../include/mextra.h ../include/you.h \ + ../include/attrib.h ../include/prop.h ../include/skills.h \ + ../include/context.h ../include/flag.h ../include/dlb.h \ + ../include/patchlevel.h mhitm.o: mhitm.c $(HACK_H) ../include/artifact.h mhitu.o: mhitu.c $(HACK_H) ../include/artifact.h minion.o: minion.c $(HACK_H) mklev.o: mklev.c $(HACK_H) mkmap.o: mkmap.c $(HACK_H) ../include/sp_lev.h -mkmaze.o: mkmaze.c $(HACK_H) ../include/sp_lev.h ../include/lev.h +mkmaze.o: mkmaze.c $(HACK_H) ../include/sp_lev.h mkobj.o: mkobj.c $(HACK_H) mkroom.o: mkroom.c $(HACK_H) mon.o: mon.c $(HACK_H) ../include/mfndpos.h @@ -1060,8 +1105,10 @@ monst.o: monst.c $(CONFIG_H) ../include/permonst.h ../include/align.h \ mplayer.o: mplayer.c $(HACK_H) mthrowu.o: mthrowu.c $(HACK_H) muse.o: muse.c $(HACK_H) -music.o: music.c $(HACK_H) #interp.c -o_init.o: o_init.c $(HACK_H) ../include/lev.h +music.o: music.c $(HACK_H) +nhlua.o: nhlua.c $(HACK_H) ../include/dlb.h +nhlsel.o: nhlsel.c $(HACK_H) ../include/sp_lev.h +o_init.o: o_init.c $(HACK_H) objects.o: objects.c $(CONFIG_H) ../include/obj.h ../include/objclass.h \ ../include/prop.h ../include/skills.h ../include/color.h objnam.o: objnam.c $(HACK_H) @@ -1074,28 +1121,29 @@ polyself.o: polyself.c $(HACK_H) potion.o: potion.c $(HACK_H) pray.o: pray.c $(HACK_H) priest.o: priest.c $(HACK_H) ../include/mfndpos.h -quest.o: quest.c $(HACK_H) ../include/qtext.h -questpgr.o: questpgr.c $(HACK_H) ../include/dlb.h ../include/qtext.h +quest.o: quest.c $(HACK_H) +questpgr.o: questpgr.c $(HACK_H) ../include/dlb.h read.o: read.c $(HACK_H) rect.o: rect.c $(HACK_H) -region.o: region.c $(HACK_H) ../include/lev.h -restore.o: restore.c $(HACK_H) ../include/lev.h ../include/tcap.h +region.o: region.c $(HACK_H) +restore.o: restore.c $(HACK_H) ../include/tcap.h rip.o: rip.c $(HACK_H) -rnd.o: rnd.c $(HACK_H) +rnd.o: rnd.c $(HACK_H) ../include/isaac64.h role.o: role.c $(HACK_H) -rumors.o: rumors.c $(HACK_H) ../include/lev.h ../include/dlb.h -save.o: save.c $(HACK_H) ../include/lev.h +rumors.o: rumors.c $(HACK_H) ../include/dlb.h +save.o: save.c $(HACK_H) +sfstruct.o: sfstruct.c $(HACK_H) shk.o: shk.c $(HACK_H) shknam.o: shknam.c $(HACK_H) sit.o: sit.c $(HACK_H) ../include/artifact.h sounds.o: sounds.c $(HACK_H) -sp_lev.o: sp_lev.c $(HACK_H) ../include/dlb.h ../include/sp_lev.h +sp_lev.o: sp_lev.c $(HACK_H) ../include/sp_lev.h spell.o: spell.c $(HACK_H) steal.o: steal.c $(HACK_H) steed.o: steed.c $(HACK_H) sys.o: sys.c $(HACK_H) teleport.o: teleport.c $(HACK_H) -timeout.o: timeout.c $(HACK_H) ../include/lev.h +timeout.o: timeout.c $(HACK_H) topten.o: topten.c $(HACK_H) ../include/dlb.h ../include/patchlevel.h track.o: track.c $(HACK_H) trap.o: trap.c $(HACK_H) @@ -1109,8 +1157,8 @@ weapon.o: weapon.c $(HACK_H) were.o: were.c $(HACK_H) wield.o: wield.c $(HACK_H) windows.o: windows.c $(HACK_H) ../include/wingem.h ../include/winGnome.h -wizard.o: wizard.c $(HACK_H) ../include/qtext.h -worm.o: worm.c $(HACK_H) ../include/lev.h +wizard.o: wizard.c $(HACK_H) +worm.o: worm.c $(HACK_H) worn.o: worn.c $(HACK_H) write.o: write.c $(HACK_H) zap.o: zap.c $(HACK_H) diff --git a/sys/unix/Makefile.top b/sys/unix/Makefile.top index 5aea4e8d6..dc7c2bc0b 100644 --- a/sys/unix/Makefile.top +++ b/sys/unix/Makefile.top @@ -1,5 +1,5 @@ # NetHack Top-level Makefile. -# NetHack 3.6 Makefile.top $NHDT-Date: 1524689449 2018/04/25 20:50:49 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.36 $ +# NetHack 3.6 Makefile.top $NHDT-Date: 1575932543 2019/12/09 23:02:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.44 $ # Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland # NetHack may be freely redistributed. See license for details. @@ -57,7 +57,7 @@ DIRPERM = 0755 # for Gnome # VARDATND = x11tiles pet_mark.xbm pilemark.xbm rip.xpm mapbg.xpm -VARDATD = bogusmon data engrave epitaph oracles options quest.dat rumors +VARDATD = bogusmon data engrave epitaph oracles options quest.lua rumors VARDAT = $(VARDATD) $(VARDATND) # Some versions of make use the SHELL environment variable as the shell @@ -74,30 +74,50 @@ VARDAT = $(VARDATD) $(VARDATND) #CHOWN = chown #CHGRP = chgrp +# Lua version +LUA_VERSION = 5.3.5 + # # end of configuration # DATHELP = help hh cmdhelp keyhelp history opthelp wizhelp -SPEC_LEVS = asmodeus.lev baalz.lev bigrm-*.lev castle.lev fakewiz?.lev \ - juiblex.lev knox.lev medusa-?.lev minend-?.lev minefill.lev \ - minetn-?.lev oracle.lev orcus.lev sanctum.lev soko?-?.lev \ - tower?.lev valley.lev wizard?.lev \ - astral.lev air.lev earth.lev fire.lev water.lev -QUEST_LEVS = ???-goal.lev ???-fil?.lev ???-loca.lev ???-strt.lev +SPEC_LEVS = asmodeus.lua baalz.lua bigrm-*.lua castle.lua fakewiz?.lua \ + juiblex.lua knox.lua medusa-?.lua minend-?.lua minefill.lua \ + minetn-?.lua oracle.lua orcus.lua sanctum.lua soko?-?.lua \ + tower?.lua valley.lua wizard?.lua nhlib.lua \ + astral.lua air.lua earth.lua fire.lua water.lua +QUEST_LEVS = ???-goal.lua ???-fil?.lua ???-loca.lua ???-strt.lua DATNODLB = $(VARDATND) license symbols -DATDLB = $(DATHELP) dungeon tribute $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD) +DATDLB = $(DATHELP) dungeon.lua tribute $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD) DAT = $(DATNODLB) $(DATDLB) -$(GAME): - ( cd src ; $(MAKE) ) - -all: $(GAME) recover Guidebook $(VARDAT) dungeon spec_levs check-dlb +# first target is also the default target for 'make' without any arguments +all: $(GAME) recover Guidebook $(VARDAT) spec_levs check-dlb true; $(MOREALL) @echo "Done." +$(GAME): lua_support + ( cd src ; $(MAKE) $(GAME) ) + +lua_support: lib/lua/liblua.a include/nhlua.h + @true +lib/lua-$(LUA_VERSION)/src/liblua.a: lib/lua-$(LUA_VERSION)/src/lua.h + ( cd lib/lua-$(LUA_VERSION)/src ; make a ; cd ../../.. ) +lib/lua/liblua.a: lib/lua-$(LUA_VERSION)/src/liblua.a + @( if [ ! -d lib/lua ] ; then mkdir -p lib/lua ; fi ) + cp lib/lua-$(LUA_VERSION)/src/liblua.a $@ +include/nhlua.h: lib/lua/liblua.a + echo '/* nhlua.h - generated by top Makefile */' > $@ + @echo '#include "../lib/lua-$(LUA_VERSION)/src/lua.h"' >> $@ + @sed -e '/(lua_error)/!d' -e '/(lua_error)/s/;/ NORETURN;/1' \ + < lib/lua-$(LUA_VERSION)/src/lua.h >> $@ + @echo '#include "../lib/lua-$(LUA_VERSION)/src/lualib.h"' >> $@ + @echo '#include "../lib/lua-$(LUA_VERSION)/src/lauxlib.h"' >> $@ + @echo '/*nhlua.h*/' >> $@ + # Note: many of the dependencies below are here to allow parallel make # to generate valid output @@ -129,18 +149,12 @@ oracles: $(GAME) options: $(GAME) ( cd dat ; $(MAKE) options ) -quest.dat: $(GAME) - ( cd dat ; $(MAKE) quest.dat ) +quest.lua: $(GAME) -spec_levs: dungeon - ( cd util ; $(MAKE) lev_comp ) +spec_levs: ( cd dat ; $(MAKE) spec_levs ) ( cd dat ; $(MAKE) quest_levs ) -dungeon: $(GAME) - ( cd util ; $(MAKE) dgn_comp ) - ( cd dat ; $(MAKE) dungeon ) - nhtiles.bmp: $(GAME) ( cd dat ; $(MAKE) nhtiles.bmp ) @@ -236,13 +250,20 @@ dofiles-nodlb: -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) $(DAT) ; \ $(CHGRP) $(GAMEGRP) $(DAT) ; \ chmod $(FILEPERM) $(DAT) ) +# +# This is not part of the dependency build hierarchy. +# It requires an explicit "make fetch-Lua". +fetch-lua: fetch-Lua + @true -update: $(GAME) recover $(VARDAT) dungeon spec_levs +fetch-Lua: + ( mkdir -p lib ; cd lib ; \ + curl -R -O http://www.lua.org/ftp/lua-$(LUA_VERSION).tar.gz ; \ + tar zxf lua-$(LUA_VERSION).tar.gz ; rm -f lua-$(LUA_VERSION).tar.gz ) + +update: $(GAME) recover $(VARDAT) spec_levs # (don't yank the old version out from under people who're playing it) -mv $(INSTDIR)/$(GAME) $(INSTDIR)/$(GAME).old -# quest.dat is also kept open and has the same problems over NFS -# (quest.dat may be inside nhdat if dlb is in use) - -mv $(INSTDIR)/quest.dat $(INSTDIR)/quest.dat.old -mv $(INSTDIR)/nhdat $(INSTDIR)/nhdat.old # set up new versions of the game files ( $(MAKE) dofiles ) @@ -256,7 +277,7 @@ update: $(GAME) recover $(VARDAT) dungeon spec_levs rootcheck: @true; $(ROOTCHECK) -install: rootcheck $(GAME) recover $(VARDAT) dungeon spec_levs +install: rootcheck $(GAME) recover $(VARDAT) spec_levs true; $(PREINSTALL) # set up the directories # not all mkdirs have -p; those that don't will create a -p directory @@ -288,6 +309,7 @@ clean: ( cd src ; $(MAKE) clean ) ( cd util ; $(MAKE) clean ) ( cd doc ; $(MAKE) clean ) + ( cd lib/lua-$(LUA_VERSION)/src && $(MAKE) clean ) # 'make spotless' returns the source tree to near-distribution condition. # it removes .o files, executables, and compiled data files diff --git a/sys/unix/Makefile.utl b/sys/unix/Makefile.utl index 9c7896266..53a0805fb 100644 --- a/sys/unix/Makefile.utl +++ b/sys/unix/Makefile.utl @@ -1,5 +1,5 @@ # Makefile for NetHack's utility programs. -# NetHack 3.6 Makefile.utl $NHDT-Date: 1539968067 2018/10/19 16:54:27 $ $NHDT-Branch: keni-makedefsm $:$NHDT-Revision: 1.38 $ +# NetHack 3.6 Makefile.utl $NHDT-Date: 1574646950 2019/11/25 01:55:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.44 $ # Copyright (c) 2018 by Robert Patrick Rankin # NetHack may be freely redistributed. See license for details. @@ -97,6 +97,9 @@ NHSROOT=.. #CFLAGS = -O -I../include #LFLAGS = +CFLAGS += -I../lib/lua-$(LUA_VERSION)/src +LFLAGS += -lm + # we specify C preprocessor flags via CFLAGS; files built with default rules # might include $(CPPFLAGS) which could get a value from user's environment; # we avoid that by forcing it empty rather than by overriding default rules @@ -126,11 +129,6 @@ LEXYYC = lex.yy.c # YTABH = y_tab.h # LEXYYC = lexyy.c -# This is the universal ctags utility which produces the tags in the -# format that util/readtags requires. -# https://github.com/universal-ctags/ctags.git -CTAGSCMD = universal-ctags - # if you change this to 1, feedback while building will omit -Dthis -Wthat # -Isomewhere so that each file being compiled is listed on one short line; # it requires support for '$<' in rules with more than one prerequisite @@ -182,13 +180,10 @@ CONFIG_H = ../src/config.h-t HACK_H = ../src/hack.h-t # utility .c files -MAKESRC = makedefs.c -SPLEVSRC = lev_yacc.c lev_lex.c lev_main.c -DGNCOMPSRC = dgn_yacc.c dgn_lex.c dgn_main.c +MAKESRC = makedefs.c ../src/mdlib.c RECOVSRC = recover.c DLBSRC = dlb_main.c -UTILSRCS = $(MAKESRC) panic.c $(SPLEVSRC) $(DGNCOMPSRC) $(RECOVSRC) $(DLBSRC) -READTAGSSRC = readtags.c +UTILSRCS = $(MAKESRC) panic.c $(DGNCOMPSRC) $(RECOVSRC) $(DLBSRC) # files that define all monsters and objects CMONOBJ = ../src/monst.c ../src/objects.c @@ -203,21 +198,12 @@ OALLOC = $(OBJDIR)/alloc.o panic.o # object files for makedefs MAKEOBJS = makedefs.o $(OMONOBJ) -# object files for special levels compiler -SPLEVOBJS = lev_yacc.o lev_lex.o lev_main.o $(OALLOC) $(ONAMING) - -# object files for dungeon compiler -DGNCOMPOBJS = dgn_yacc.o dgn_lex.o dgn_main.o $(OALLOC) - # object files for recovery utility RECOVOBJS = recover.o # object files for the data librarian DLBOBJS = dlb_main.o $(OBJDIR)/dlb.o $(OALLOC) -# object files for readtags -READTAGSOBJS = readtags.o - # flags for creating distribution versions of sys/share/*_lex.c, using # a more portable flex skeleton, which is not included in the distribution. # hopefully keeping this out of the section to be edited will keep too @@ -236,11 +222,11 @@ YACCDIST = makedefs: $(MAKEOBJS) mdgrep.h $(CC) $(LFLAGS) -o makedefs $(MAKEOBJS) -makedefs.o: makedefs.c $(CONFIG_H) ../include/permonst.h \ +makedefs.o: makedefs.c ../src/mdlib.c $(CONFIG_H) ../include/permonst.h \ ../include/objclass.h ../include/monsym.h \ ../include/artilist.h ../include/dungeon.h ../include/obj.h \ ../include/monst.h ../include/you.h ../include/flag.h \ - ../include/dlb.h ../include/patchlevel.h ../include/qtext.h + ../include/dlb.h ../include/patchlevel.h # Don't require perl to build; that is why mdgrep.h is spelled wrong below. mdgreph: mdgrep.pl @@ -268,81 +254,6 @@ lintdefs: panic.o: panic.c $(CONFIG_H) -# dependencies for lev_comp -# -lev_comp: $(SPLEVOBJS) - $(CC) $(LFLAGS) -o lev_comp $(SPLEVOBJS) $(LIBS) - -lev_yacc.o: lev_yacc.c $(HACK_H) ../include/sp_lev.h -lev_main.o: lev_main.c $(HACK_H) ../include/sp_lev.h ../include/tcap.h \ - ../include/date.h - -# see lev_comp.l for WEIRD_LEX discussion -# egrep will return failure if it doesn't find anything, but we know there -# is one "_cplusplus" inside a comment -lev_lex.o: lev_lex.c $(HACK_H) ../include/lev_comp.h ../include/sp_lev.h - $(CC) -c $(CFLAGS) -DWEIRD_LEX=`egrep -c _cplusplus lev_lex.c` lev_lex.c - -# '$(YACC) -d' generates both $(YTABC) and $(YTABH) in one run -../include/lev_comp.h: lev_yacc.c - -lev_yacc.c: lev_comp.y - $(YACC) $(YACCDIST) -d lev_comp.y - sed -e 's#"$(YTABC)"#"$@"#' -e 's#$(YTABC):#$@:#' $(YTABC) > $@ \ - && rm $(YTABC) - sed -e 's#"$(YTABH)"#"lev_comp.h"#' $(YTABH) > ../include/lev_comp.h \ - && rm $(YTABH) - -lev_lex.c: lev_comp.l - $(LEX) $(FLEXDIST) lev_comp.l - sed -e 's#"$(LEXYYC)"#"$@"#' -e 's# *$$##' \ - -e 's#static void yyunput#void yyunput#' $(LEXYYC) > $@ \ - && rm $(LEXYYC) -# note: flex code construction using m4 macros results in some trailing -# spaces; is basic RE substitute for -# and we don't bother stripping trailing tabs because that gets messy; -# make expands into which is RE end-of-line. -# flex also creates yyunput() as a static routine, but lev_comp doesn't -# use it so compiler complaints can ensue; recent flex versions honor -# NO_YY_UNPUT to suppress it, but older ones don't; making it global to -# avoid an "unused function" warning is simpler than trying to remove -# the whole thing (although full 'lint' may still complain). - -# with all of extern.h's functions to complain about, we drown in -# 'defined but not used' without -u -lintlev: - @lint -axhu -I../include -DLINT $(SPLEVSRC) $(CALLOC) $(CNAMING) | sed '/_flsbuf/d' - - -# dependencies for dgn_comp -# -dgn_comp: $(DGNCOMPOBJS) - $(CC) $(LFLAGS) -o dgn_comp $(DGNCOMPOBJS) $(LIBS) - -dgn_yacc.o: dgn_yacc.c $(CONFIG_H) ../include/dgn_file.h ../include/date.h -dgn_main.o: dgn_main.c $(CONFIG_H) ../include/dlb.h - -# see dgn_comp.l for WEIRD_LEX discussion -dgn_lex.o: dgn_lex.c $(CONFIG_H) ../include/dgn_comp.h ../include/dgn_file.h - $(CC) -c $(CFLAGS) -DWEIRD_LEX=`egrep -c _cplusplus dgn_lex.c` dgn_lex.c - -# '$(YACC) -d' generates both $(YTABC) and $(YTABH) in one run -../include/dgn_comp.h: dgn_yacc.c - -dgn_yacc.c: dgn_comp.y - $(YACC) $(YACCDIST) -d dgn_comp.y - sed -e 's#"$(YTABC)"#"$@"#' -e 's#$(YTABC):#$@:#' $(YTABC) > $@ \ - && rm $(YTABC) - sed -e 's#"$(YTABH)"#"dgn_comp.h"#' $(YTABH) > ../include/dgn_comp.h \ - && rm $(YTABH) - -dgn_lex.c: dgn_comp.l - $(LEX) $(FLEXDIST) dgn_comp.l - sed -e 's#"$(LEXYYC)"#"$@"#' -e 's# *$$##' \ - -e 's#static void yyunput#void yyunput#' $(LEXYYC) > $@ \ - && rm $(LEXYYC) -# note: is basic RE substitute for - # with all of extern.h's functions to complain about, we drown in # 'defined but not used' without -u lintdgn: @@ -449,73 +360,6 @@ tileedit: tileedit.cpp $(TEXT_IO) $(CC) -o tileedit -I../include -I$(QTDIR)/include -L$(QTDIR)/lib \ tileedit.cpp $(TEXT_IO) -lqt -# dependencies for readtags -# -CTAGDEP = ../include/align.h ../include/artifact.h ../src/artifact.c \ - ../include/artilist.h ../include/attrib.h ../src/bones.c \ - ../include/context.h ../include/coord.h ../include/decl.h \ - ../src/decl.c ../include/dungeon.h ../include/engrave.h \ - ../src/engrave.c ../include/flag.h ../include/func_tab.h \ - ../include/global.h ../include/hack.h ../include/lev.h \ - ../include/mextra.h ../include/mkroom.h ../include/monst.h \ - ../include/monsym.h ../include/obj.h ../include/objclass.h \ - ../include/prop.h ../include/quest.h ../include/rect.h \ - ../include/region.h ../include/rm.h ../include/skills.h \ - ../include/spell.h ../include/sys.h ../include/timeout.h \ - ../include/trap.h ../include/you.h ../include/onames.h \ - ../include/wintype.h -# ../include/permonst.h -CTAGSOPT = --language-force=c --sort=no -D"Bitfield(x,n)=unsigned x : n" --excmd=pattern - -readtags: $(READTAGSOBJS) - $(CC) $(LFLAGS) -o readtags $(READTAGSOBJS) $(LIBS) - -readtags.o: readtags.c $(HACK_H) - $(CC) $(CFLAGS) -c readtags.c - -nethack.tags: $(CTAGDEP) -# -# tested with universal ctags from https://github.com/universal-ctags/ctags.git -# - $(CTAGSCMD) $(CTAGSOPT) -f nethack.tags ../include/align.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/artifact.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../src/artifact.c - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/artilist.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/attrib.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../src/bones.c - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/context.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/coord.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/decl.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../src/decl.c - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/dungeon.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/engrave.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../src/engrave.c - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/flag.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/func_tab.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/global.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/hack.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/lev.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/mextra.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/mkroom.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/monst.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/monsym.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/obj.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/objclass.h -# $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/permonst.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/prop.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/quest.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/rect.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/region.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/rm.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/skills.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/spell.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/sys.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/timeout.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/trap.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/you.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/onames.h - $(CTAGSCMD) $(CTAGSOPT) -a -f nethack.tags ../include/wintype.h - # using dependencies like # ../src/foo:: # @( cd ../src ; $(MAKE) foo ) @@ -548,24 +392,7 @@ $(HACK_H): $(CONFIG_H) $(CONFIG_H): ../include/config.h @( cd ../src ; $(MAKE) $(CONFIG_H) ) -# 'make dist' => put generated lex and yacc sources into place for distribution SYSSHARE=../sys/share/ -$(SYSSHARE)lev_lex.c: lev_lex.c - cp lev_lex.c $@ -$(SYSSHARE)lev_yacc.c: lev_yacc.c - cp lev_yacc.c $@ -$(SYSSHARE)lev_comp.h: ../include/lev_comp.h - cp ../include/lev_comp.h $@ -$(SYSSHARE)dgn_lex.c: dgn_lex.c - cp dgn_lex.c $@ -$(SYSSHARE)dgn_yacc.c: dgn_yacc.c - cp dgn_yacc.c $@ -$(SYSSHARE)dgn_comp.h: ../include/dgn_comp.h - cp ../include/dgn_comp.h $@ - -dist: $(SYSSHARE)lev_lex.c $(SYSSHARE)lev_yacc.c $(SYSSHARE)lev_comp.h \ - $(SYSSHARE)dgn_lex.c $(SYSSHARE)dgn_yacc.c $(SYSSHARE)dgn_comp.h - @echo 'pre-generated lex and yacc sources are in place in sys/share' tags: $(UTILSRCS) @ctags -tw $(UTILSRCS) @@ -574,9 +401,7 @@ clean: -rm -f *.o spotless: clean - -rm -f lev_lex.c lev_yacc.c dgn_lex.c dgn_yacc.c - -rm -f ../include/lev_comp.h ../include/dgn_comp.h -rm -f ../include/tile.h tiletxt.c - -rm -f makedefs lev_comp dgn_comp recover dlb + -rm -f makedefs recover dlb -rm -f gif2txt txt2ppm tile2x11 tile2img.ttp xpm2img.ttp \ tilemap tileedit tile2bmp diff --git a/sys/unix/NetHack.xcodeproj/project.pbxproj b/sys/unix/NetHack.xcodeproj/project.pbxproj index 19e24bee6..c09de805f 100644 --- a/sys/unix/NetHack.xcodeproj/project.pbxproj +++ b/sys/unix/NetHack.xcodeproj/project.pbxproj @@ -7,8 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 3192867C21A3ACAC00325BEB /* lev_comp.y in Sources */ = {isa = PBXBuildFile; fileRef = 3192867B21A3ACAB00325BEB /* lev_comp.y */; }; - 3192867E21A3ACB800325BEB /* lev_comp.l in Sources */ = {isa = PBXBuildFile; fileRef = 3192867D21A3ACB800325BEB /* lev_comp.l */; }; 31B8A30C21A20D8B0055BD01 /* makedefs.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A30B21A20D8B0055BD01 /* makedefs.c */; }; 31B8A30F21A20DC10055BD01 /* objects.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A30D21A20DC10055BD01 /* objects.c */; }; 31B8A31021A20DC10055BD01 /* monst.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A30E21A20DC10055BD01 /* monst.c */; }; @@ -139,89 +137,21 @@ 31B8A41721A243E80055BD01 /* libncurses.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 31B8A41521A243CC0055BD01 /* libncurses.tbd */; }; 31B8A41821A2448C0055BD01 /* monst.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A30E21A20DC10055BD01 /* monst.c */; }; 31B8A41921A244940055BD01 /* objects.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A30D21A20DC10055BD01 /* objects.c */; }; - 31B8A42921A267E60055BD01 /* lev_yacc.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A42521A267E60055BD01 /* lev_yacc.c */; }; - 31B8A42A21A267E60055BD01 /* lev_lex.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A42621A267E60055BD01 /* lev_lex.c */; }; - 31B8A42B21A267E60055BD01 /* panic.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A42721A267E60055BD01 /* panic.c */; }; - 31B8A42C21A267E60055BD01 /* lev_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A42821A267E60055BD01 /* lev_main.c */; }; - 31B8A42D21A267F50055BD01 /* alloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A36521A238040055BD01 /* alloc.c */; }; - 31B8A42E21A2680B0055BD01 /* drawing.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A33621A238010055BD01 /* drawing.c */; }; - 31B8A42F21A2681E0055BD01 /* decl.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A34621A238020055BD01 /* decl.c */; }; - 31B8A43021A268370055BD01 /* monst.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A30E21A20DC10055BD01 /* monst.c */; }; - 31B8A43121A268420055BD01 /* objects.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A30D21A20DC10055BD01 /* objects.c */; }; - 31B8A44321A269EA0055BD01 /* dgn_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A44221A269EA0055BD01 /* dgn_main.c */; }; - 31B8A44421A26A020055BD01 /* panic.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A42721A267E60055BD01 /* panic.c */; }; - 31B8A44521A26A0A0055BD01 /* alloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A36521A238040055BD01 /* alloc.c */; }; 31B8A45221A26A750055BD01 /* recover.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A45121A26A750055BD01 /* recover.c */; }; 31B8A45E21A26ACF0055BD01 /* dlb.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A3E321A238B30055BD01 /* dlb.c */; }; 31B8A46021A26AE70055BD01 /* dlb_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A45F21A26AE70055BD01 /* dlb_main.c */; }; 31B8A46121A26AF60055BD01 /* panic.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A42721A267E60055BD01 /* panic.c */; }; 31B8A46221A26B020055BD01 /* alloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A36521A238040055BD01 /* alloc.c */; }; - 31B8A46621A2820F0055BD01 /* dgn_comp.y in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A46421A278AC0055BD01 /* dgn_comp.y */; }; - 31B8A46921A288770055BD01 /* dgn_comp.l in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A46821A288770055BD01 /* dgn_comp.l */; }; + 544768AB239949FA004B9739 /* sfstruct.c in Sources */ = {isa = PBXBuildFile; fileRef = 544768A8239949FA004B9739 /* sfstruct.c */; }; + 544768AE23994A17004B9739 /* nhlsel.c in Sources */ = {isa = PBXBuildFile; fileRef = 544768AC23994A17004B9739 /* nhlsel.c */; }; + 544768AF23994A17004B9739 /* nhlua.c in Sources */ = {isa = PBXBuildFile; fileRef = 544768AD23994A17004B9739 /* nhlua.c */; }; + 544768B123994A2C004B9739 /* mdlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 544768B023994A2C004B9739 /* mdlib.c */; }; + 544768BA23995BB7004B9739 /* liblua.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 544768B923995BB7004B9739 /* liblua.a */; }; + 544768BC23A53C9F004B9739 /* nhlobj.c in Sources */ = {isa = PBXBuildFile; fileRef = 544768BB23A53C9F004B9739 /* nhlobj.c */; }; 54FCE8292223261F00F393C8 /* isaac64.c in Sources */ = {isa = PBXBuildFile; fileRef = 54FCE8282223261F00F393C8 /* isaac64.c */; }; /* End PBXBuildFile section */ -/* Begin PBXBuildRule section */ - 317E7C5221A3774F00F6E4E5 /* PBXBuildRule */ = { - isa = PBXBuildRule; - compilerSpec = com.apple.compilers.proxy.script; - fileType = sourcecode.yacc; - isEditable = 1; - outputFiles = ( - "$(NH_INC_DIR)/lev_comp.h", - "$(NH_UTIL_DIR)/lev_yacc.c", - ); - script = "cd ${NH_UTIL_DIR}\nbison -o lev_yacc.c -d lev_comp.y\nmv lev_yacc.h ${NH_INC_DIR}/lev_comp.h \n"; - }; - 317E7C5321A3796200F6E4E5 /* PBXBuildRule */ = { - isa = PBXBuildRule; - compilerSpec = com.apple.compilers.proxy.script; - fileType = sourcecode.lex; - isEditable = 1; - outputFiles = ( - "$(NH_UTIL_DIR)/lev_lex.c", - ); - script = "cd ${NH_UTIL_DIR}\nlex -o lev_lex.c lev_comp.l\nsed -e 's# *$$##' -e 's#static void yyunput#void yyunput#' lev_lex.c > lev_lex.x\nmv lev_lex.x lev_lex.c\n"; - }; - 31B8A46321A270680055BD01 /* PBXBuildRule */ = { - isa = PBXBuildRule; - compilerSpec = com.apple.compilers.proxy.script; - filePatterns = dgn_comp.y; - fileType = sourcecode.yacc; - isEditable = 1; - outputFiles = ( - "$(NH_UTIL_DIR)/dgn_yacc.c", - "$(NH_INC_DIR)/dgn_comp.h", - ); - script = "cd ${NH_UTIL_DIR}\nbison -o dgn_yacc.c -d dgn_comp.y\nmv dgn_yacc.h ${NH_INC_DIR}/dgn_comp.h \n"; - }; - 31B8A46721A286E70055BD01 /* PBXBuildRule */ = { - isa = PBXBuildRule; - compilerSpec = com.apple.compilers.proxy.script; - fileType = sourcecode.lex; - isEditable = 1; - outputFiles = ( - "$(NH_UTIL_DIR)/dgn_lex.c", - ); - script = "cd ${NH_UTIL_DIR}\nlex -o dgn_lex.c dgn_comp.l\nsed -e 's# *$$##' -e 's#static void yyunput#void yyunput#' dgn_lex.c > dgn_lex.x\nmv dgn_lex.x dgn_lex.c\n"; - }; -/* End PBXBuildRule section */ - /* Begin PBXContainerItemProxy section */ - 316B91C621A3BD5000EC3E81 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 3189576921A1FCC100FB2ABE /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3189577E21A1FDA400FB2ABE; - remoteInfo = makedefs; - }; - 316B91C821A3BD5C00EC3E81 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 3189576921A1FCC100FB2ABE /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3189577E21A1FDA400FB2ABE; - remoteInfo = makedefs; - }; 316B91CA21A3BD7C00EC3E81 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 3189576921A1FCC100FB2ABE /* Project object */; @@ -250,20 +180,6 @@ remoteGlobalIDString = 31B8A45621A26A970055BD01; remoteInfo = dlb; }; - 3192867721A3AB0400325BEB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 3189576921A1FCC100FB2ABE /* Project object */; - proxyType = 1; - remoteGlobalIDString = 31B8A43521A268DF0055BD01; - remoteInfo = dgn_comp; - }; - 3192867921A3AB0800325BEB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 3189576921A1FCC100FB2ABE /* Project object */; - proxyType = 1; - remoteGlobalIDString = 31B8A41D21A2669A0055BD01; - remoteInfo = lev_comp; - }; 31B8A31321A2355C0055BD01 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 3189576921A1FCC100FB2ABE /* Project object */; @@ -292,24 +208,6 @@ ); runOnlyForDeploymentPostprocessing = 1; }; - 31B8A41C21A2669A0055BD01 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; - 31B8A43421A268DF0055BD01 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; 31B8A44821A26A4B0055BD01 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -369,7 +267,6 @@ 3186A38F21A4B0FC0052BF02 /* monflag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = monflag.h; path = ../../include/monflag.h; sourceTree = ""; }; 3186A39021A4B0FC0052BF02 /* lev_comp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lev_comp.h; path = ../../include/lev_comp.h; sourceTree = ""; }; 3186A39121A4B0FC0052BF02 /* micro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = micro.h; path = ../../include/micro.h; sourceTree = ""; }; - 3186A39221A4B0FC0052BF02 /* qtext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = qtext.h; path = ../../include/qtext.h; sourceTree = ""; }; 3186A39321A4B0FC0052BF02 /* xwindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = xwindow.h; path = ../../include/xwindow.h; sourceTree = ""; }; 3186A39421A4B0FC0052BF02 /* tileset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tileset.h; path = ../../include/tileset.h; sourceTree = ""; }; 3186A39521A4B0FC0052BF02 /* obj.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = obj.h; path = ../../include/obj.h; sourceTree = ""; }; @@ -430,7 +327,6 @@ 3186A3CC21A4B0FE0052BF02 /* gem_rsc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gem_rsc.h; path = ../../include/gem_rsc.h; sourceTree = ""; }; 3186A3CD21A4B0FE0052BF02 /* trap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = trap.h; path = ../../include/trap.h; sourceTree = ""; }; 3186A3CE21A4B0FE0052BF02 /* winGnome.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = winGnome.h; path = ../../include/winGnome.h; sourceTree = ""; }; - 3186A3CF21A4B0FE0052BF02 /* lev.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lev.h; path = ../../include/lev.h; sourceTree = ""; }; 3186A3D021A4B0FE0052BF02 /* decl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = decl.h; path = ../../include/decl.h; sourceTree = ""; }; 3186A3D321A4B14B0052BF02 /* cursstat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cursstat.h; path = ../../win/curses/cursstat.h; sourceTree = ""; }; 3186A3D421A4B14B0052BF02 /* cursdial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cursdial.h; path = ../../win/curses/cursdial.h; sourceTree = ""; }; @@ -572,12 +468,10 @@ 31B8A40921A23EEB0055BD01 /* cursstat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cursstat.c; path = ../../win/curses/cursstat.c; sourceTree = ""; }; 31B8A40A21A23EEB0055BD01 /* curswins.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = curswins.c; path = ../../win/curses/curswins.c; sourceTree = ""; }; 31B8A41521A243CC0055BD01 /* libncurses.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libncurses.tbd; path = usr/lib/libncurses.tbd; sourceTree = SDKROOT; }; - 31B8A41E21A2669A0055BD01 /* lev_comp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = lev_comp; sourceTree = BUILT_PRODUCTS_DIR; }; 31B8A42521A267E60055BD01 /* lev_yacc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lev_yacc.c; path = ../../util/lev_yacc.c; sourceTree = ""; }; 31B8A42621A267E60055BD01 /* lev_lex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lev_lex.c; path = ../../util/lev_lex.c; sourceTree = ""; }; 31B8A42721A267E60055BD01 /* panic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = panic.c; path = ../../util/panic.c; sourceTree = ""; }; 31B8A42821A267E60055BD01 /* lev_main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lev_main.c; path = ../../util/lev_main.c; sourceTree = ""; }; - 31B8A43621A268DF0055BD01 /* dgn_comp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = dgn_comp; sourceTree = BUILT_PRODUCTS_DIR; }; 31B8A43D21A2699B0055BD01 /* dgn_yacc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dgn_yacc.c; path = ../../util/dgn_yacc.c; sourceTree = ""; }; 31B8A44021A269C80055BD01 /* dgn_lex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dgn_lex.c; path = ../../util/dgn_lex.c; sourceTree = ""; }; 31B8A44221A269EA0055BD01 /* dgn_main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dgn_main.c; path = ../../util/dgn_main.c; sourceTree = ""; }; @@ -587,6 +481,14 @@ 31B8A45F21A26AE70055BD01 /* dlb_main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dlb_main.c; path = ../../util/dlb_main.c; sourceTree = ""; }; 31B8A46421A278AC0055BD01 /* dgn_comp.y */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.yacc; name = dgn_comp.y; path = ../../util/dgn_comp.y; sourceTree = ""; }; 31B8A46821A288770055BD01 /* dgn_comp.l */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lex; name = dgn_comp.l; path = ../../util/dgn_comp.l; sourceTree = ""; }; + 544768A8239949FA004B9739 /* sfstruct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sfstruct.c; path = ../../src/sfstruct.c; sourceTree = ""; }; + 544768AC23994A17004B9739 /* nhlsel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = nhlsel.c; path = ../../src/nhlsel.c; sourceTree = ""; }; + 544768AD23994A17004B9739 /* nhlua.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = nhlua.c; path = ../../src/nhlua.c; sourceTree = ""; }; + 544768B023994A2C004B9739 /* mdlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mdlib.c; path = ../../src/mdlib.c; sourceTree = ""; }; + 544768B423995447004B9739 /* isaac64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = isaac64.h; path = ../../include/isaac64.h; sourceTree = ""; }; + 544768B523995488004B9739 /* nhlua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = nhlua.h; path = ../../include/nhlua.h; sourceTree = ""; }; + 544768B923995BB7004B9739 /* liblua.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblua.a; path = ../../lib/lua/liblua.a; sourceTree = ""; }; + 544768BB23A53C9F004B9739 /* nhlobj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = nhlobj.c; path = ../../src/nhlobj.c; sourceTree = ""; }; 54FCE8282223261F00F393C8 /* isaac64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = isaac64.c; path = ../../src/isaac64.c; sourceTree = ""; }; /* End PBXFileReference section */ @@ -596,6 +498,7 @@ buildActionMask = 2147483647; files = ( 31B8A41721A243E80055BD01 /* libncurses.tbd in Frameworks */, + 544768BA23995BB7004B9739 /* liblua.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -606,20 +509,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 31B8A41B21A2669A0055BD01 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 31B8A43321A268DF0055BD01 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 31B8A44721A26A4B0055BD01 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -641,6 +530,7 @@ isa = PBXGroup; children = ( 2A953FB221A3F404007906E5 /* XCode.xcconfig */, + 544768BB23A53C9F004B9739 /* nhlobj.c */, 31B8A3F821A23E490055BD01 /* win */, 31B8A3E921A23CC40055BD01 /* sys */, 3189579621A2046700FB2ABE /* include */, @@ -656,8 +546,6 @@ children = ( 3189577121A1FCC100FB2ABE /* NetHack */, 3189577F21A1FDA400FB2ABE /* makedefs */, - 31B8A41E21A2669A0055BD01 /* lev_comp */, - 31B8A43621A268DF0055BD01 /* dgn_comp */, 31B8A44A21A26A4B0055BD01 /* recover */, 31B8A45721A26A970055BD01 /* dlb */, ); @@ -667,6 +555,10 @@ 3189578C21A1FF8200FB2ABE /* src */ = { isa = PBXGroup; children = ( + 544768B023994A2C004B9739 /* mdlib.c */, + 544768AC23994A17004B9739 /* nhlsel.c */, + 544768AD23994A17004B9739 /* nhlua.c */, + 544768A8239949FA004B9739 /* sfstruct.c */, 31B8A35521A238030055BD01 /* allmain.c */, 31B8A36521A238040055BD01 /* alloc.c */, 31B8A35E21A238040055BD01 /* apply.c */, @@ -804,6 +696,8 @@ 3189579621A2046700FB2ABE /* include */ = { isa = PBXGroup; children = ( + 544768B523995488004B9739 /* nhlua.h */, + 544768B423995447004B9739 /* isaac64.h */, 3186A3B721A4B0FD0052BF02 /* align.h */, 3186A38021A4B0FB0052BF02 /* amiconf.h */, 3186A38821A4B0FB0052BF02 /* artifact.h */, @@ -834,7 +728,6 @@ 3186A3A521A4B0FD0052BF02 /* hack.h */, 3186A37A21A4B0FA0052BF02 /* integer.h */, 3186A39021A4B0FC0052BF02 /* lev_comp.h */, - 3186A3CF21A4B0FE0052BF02 /* lev.h */, 3186A3BC21A4B0FD0052BF02 /* lint.h */, 3186A39921A4B0FD0052BF02 /* load_img.h */, 3186A3A421A4B0FD0052BF02 /* mac-carbon.h */, @@ -869,7 +762,6 @@ 3186A37821A4B0FA0052BF02 /* qt_kde0.h */, 3186A3B421A4B0FD0052BF02 /* qt_win.h */, 3186A3BD21A4B0FD0052BF02 /* qt_xpms.h */, - 3186A39221A4B0FC0052BF02 /* qtext.h */, 3186A3C421A4B0FE0052BF02 /* qttableview.h */, 3186A39E21A4B0FD0052BF02 /* quest.h */, 3186A37C21A4B0FA0052BF02 /* rect.h */, @@ -983,6 +875,7 @@ 31B8A41421A243CB0055BD01 /* Frameworks */ = { isa = PBXGroup; children = ( + 544768B923995BB7004B9739 /* liblua.a */, 31B8A41521A243CC0055BD01 /* libncurses.tbd */, ); name = Frameworks; @@ -1007,8 +900,6 @@ ); dependencies = ( 31B8A31421A2355C0055BD01 /* PBXTargetDependency */, - 3192867A21A3AB0800325BEB /* PBXTargetDependency */, - 3192867821A3AB0400325BEB /* PBXTargetDependency */, 3192867621A3AAFE00325BEB /* PBXTargetDependency */, 3192867421A3AAFA00325BEB /* PBXTargetDependency */, ); @@ -1021,14 +912,15 @@ isa = PBXNativeTarget; buildConfigurationList = 3189578321A1FDA400FB2ABE /* Build configuration list for PBXNativeTarget "makedefs" */; buildPhases = ( + 544768B223995106004B9739 /* Build nhlua header */, 3189577B21A1FDA400FB2ABE /* Sources */, 3189577C21A1FDA400FB2ABE /* Frameworks */, 3189577D21A1FDA400FB2ABE /* CopyFiles */, 317E7C4B21A35F0500F6E4E5 /* Copy makedefs */, 319CBA3821A3458100150830 /* Build data */, 317E7C4521A3548F00F6E4E5 /* Build rumors */, - 317E7C4621A355E700F6E4E5 /* Build quest.dat */, 317E7C4E21A3697300F6E4E5 /* Build options and headers */, + 544768B8239954B9004B9739 /* Build Lua library */, 317E7C4F21A36A5700F6E4E5 /* Build engrave, epitaph and bogusmon */, 3192867F21A3AF8000325BEB /* Build oracles */, ); @@ -1041,51 +933,6 @@ productReference = 3189577F21A1FDA400FB2ABE /* makedefs */; productType = "com.apple.product-type.tool"; }; - 31B8A41D21A2669A0055BD01 /* lev_comp */ = { - isa = PBXNativeTarget; - buildConfigurationList = 31B8A42221A2669A0055BD01 /* Build configuration list for PBXNativeTarget "lev_comp" */; - buildPhases = ( - 31B8A41A21A2669A0055BD01 /* Sources */, - 31B8A41B21A2669A0055BD01 /* Frameworks */, - 31B8A41C21A2669A0055BD01 /* CopyFiles */, - 317E7C4C21A3625000F6E4E5 /* Copy lev_comp */, - 317E7C4A21A35E9400F6E4E5 /* Build special levels */, - 317E7C4D21A3649B00F6E4E5 /* Build quest levels */, - ); - buildRules = ( - 317E7C5321A3796200F6E4E5 /* PBXBuildRule */, - 317E7C5221A3774F00F6E4E5 /* PBXBuildRule */, - ); - dependencies = ( - 316B91C921A3BD5C00EC3E81 /* PBXTargetDependency */, - ); - name = lev_comp; - productName = lev_comp; - productReference = 31B8A41E21A2669A0055BD01 /* lev_comp */; - productType = "com.apple.product-type.tool"; - }; - 31B8A43521A268DF0055BD01 /* dgn_comp */ = { - isa = PBXNativeTarget; - buildConfigurationList = 31B8A43A21A268E00055BD01 /* Build configuration list for PBXNativeTarget "dgn_comp" */; - buildPhases = ( - 31B8A43221A268DF0055BD01 /* Sources */, - 31B8A43321A268DF0055BD01 /* Frameworks */, - 31B8A43421A268DF0055BD01 /* CopyFiles */, - 317E7C5021A3735300F6E4E5 /* Copy dgn_comp */, - 317E7C5121A373E100F6E4E5 /* Build dungeon */, - ); - buildRules = ( - 31B8A46721A286E70055BD01 /* PBXBuildRule */, - 31B8A46321A270680055BD01 /* PBXBuildRule */, - ); - dependencies = ( - 316B91C721A3BD5000EC3E81 /* PBXTargetDependency */, - ); - name = dgn_comp; - productName = dgn_comp; - productReference = 31B8A43621A268DF0055BD01 /* dgn_comp */; - productType = "com.apple.product-type.tool"; - }; 31B8A44921A26A4B0055BD01 /* recover */ = { isa = PBXNativeTarget; buildConfigurationList = 31B8A44E21A26A4B0055BD01 /* Build configuration list for PBXNativeTarget "recover" */; @@ -1129,7 +976,7 @@ 3189576921A1FCC100FB2ABE /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1010; + LastUpgradeCheck = 1120; ORGANIZATIONNAME = "Bart House"; TargetAttributes = { 3189577021A1FCC100FB2ABE = { @@ -1138,12 +985,6 @@ 3189577E21A1FDA400FB2ABE = { CreatedOnToolsVersion = 10.1; }; - 31B8A41D21A2669A0055BD01 = { - CreatedOnToolsVersion = 10.1; - }; - 31B8A43521A268DF0055BD01 = { - CreatedOnToolsVersion = 10.1; - }; 31B8A44921A26A4B0055BD01 = { CreatedOnToolsVersion = 10.1; }; @@ -1167,8 +1008,6 @@ targets = ( 3189577021A1FCC100FB2ABE /* NetHack */, 3189577E21A1FDA400FB2ABE /* makedefs */, - 31B8A41D21A2669A0055BD01 /* lev_comp */, - 31B8A43521A268DF0055BD01 /* dgn_comp */, 31B8A44921A26A4B0055BD01 /* recover */, 31B8A45621A26A970055BD01 /* dlb */, ); @@ -1198,57 +1037,6 @@ shellPath = /bin/sh; shellScript = "cd ${NH_DAT_DIR}\n${NH_UTIL_DIR}/makedefs -r\n"; }; - 317E7C4621A355E700F6E4E5 /* Build quest.dat */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "$(NH_DAT_DIR)/quest.txt", - "$(NH_UTIL_DIR)/makedefs", - ); - name = "Build quest.dat"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(NH_DAT_DIR)/quest.dat", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "cd ${NH_DAT_DIR}\n${NH_UTIL_DIR}/makedefs -q\n\n"; - }; - 317E7C4A21A35E9400F6E4E5 /* Build special levels */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "$(NH_UTIL_DIR)/lev_comp", - "$(NH_DAT_DIR)/bigroom.des", - "$(NH_DAT_DIR)/castle.des", - "$(NH_DAT_DIR)/endgame.des", - "$(NH_DAT_DIR)/knox.des", - "$(NH_DAT_DIR)/medusa.des", - "$(NH_DAT_DIR)/mines.des", - "$(NH_DAT_DIR)/oracle.des", - "$(NH_DAT_DIR)/sokoban.des", - "$(NH_DAT_DIR)/tower.des", - "$(NH_DAT_DIR)/yendor.des", - ); - name = "Build special levels"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(NH_DAT_DIR)/spec_levs", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "cd ${NH_DAT_DIR}\n${NH_UTIL_DIR}/lev_comp bigroom.des\n${NH_UTIL_DIR}/lev_comp castle.des\n${NH_UTIL_DIR}/lev_comp endgame.des\n${NH_UTIL_DIR}/lev_comp gehennom.des\n${NH_UTIL_DIR}/lev_comp knox.des\n${NH_UTIL_DIR}/lev_comp medusa.des\n${NH_UTIL_DIR}/lev_comp mines.des\n${NH_UTIL_DIR}/lev_comp oracle.des\n${NH_UTIL_DIR}/lev_comp sokoban.des\n${NH_UTIL_DIR}/lev_comp tower.des\n${NH_UTIL_DIR}/lev_comp yendor.des\ntouch spec_levs\n"; - }; 317E7C4B21A35F0500F6E4E5 /* Copy makedefs */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -1269,59 +1057,6 @@ shellPath = /bin/sh; shellScript = "cp ${BUILT_PRODUCTS_DIR}/makedefs ${NH_UTIL_DIR}/makedefs\n"; }; - 317E7C4C21A3625000F6E4E5 /* Copy lev_comp */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "$(BUILT_PRODUCTS_DIR)/lev_comp", - ); - name = "Copy lev_comp"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(NH_UTIL_DIR)/lev_comp", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "cp ${BUILT_PRODUCTS_DIR}/lev_comp ${NH_UTIL_DIR}/lev_comp\n"; - }; - 317E7C4D21A3649B00F6E4E5 /* Build quest levels */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "$(NH_UTIL_DIR)/lev_comp", - "$(NH_DAT_DIR)/Arch.des", - "$(NH_DAT_DIR)/Barb.des", - "$(NH_DAT_DIR)/Caveman.des", - "$(NH_DAT_DIR)/Healer.des", - "$(NH_DAT_DIR)/Knight.des", - "$(NH_DAT_DIR)/Monk.des", - "$(NH_DAT_DIR)/Priest.des", - "$(NH_DAT_DIR)/Ranger.des", - "$(NH_DAT_DIR)/Rogue.des", - "$(NH_DAT_DIR)/Samurai.des", - "$(NH_DAT_DIR)/Tourist.des", - "$(NH_DAT_DIR)/Valkyrie.des", - "$(NH_DAT_DIR)/Wizard.des", - ); - name = "Build quest levels"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(NH_DAT_DIR)/quest_levs", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "cd ${NH_DAT_DIR}\n${NH_UTIL_DIR}/lev_comp Arch.des\n${NH_UTIL_DIR}/lev_comp Barb.des\n${NH_UTIL_DIR}/lev_comp Caveman.des\n${NH_UTIL_DIR}/lev_comp Healer.des\n${NH_UTIL_DIR}/lev_comp Knight.des\n${NH_UTIL_DIR}/lev_comp Monk.des\n${NH_UTIL_DIR}/lev_comp Priest.des\n${NH_UTIL_DIR}/lev_comp Ranger.des\n${NH_UTIL_DIR}/lev_comp Rogue.des\n${NH_UTIL_DIR}/lev_comp Samurai.des\n${NH_UTIL_DIR}/lev_comp Tourist.des\n${NH_UTIL_DIR}/lev_comp Valkyrie.des\n${NH_UTIL_DIR}/lev_comp Wizard.des\ntouch quest_levs\n"; - }; 317E7C4E21A3697300F6E4E5 /* Build options and headers */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -1339,7 +1074,6 @@ "$(NH_UTIL_DIR)/options", "$(NH_INC_DIR)/date.h", "$(NH_INC_DIR)/onames.h", - "$(NH_INC_DIR)/pm.h", "$(NH_INC_DIR)/vis_tab.h", "$(NH_SRC_DIR)/vis_tab.c", ); @@ -1371,48 +1105,6 @@ shellPath = /bin/sh; shellScript = "cd ${NH_DAT_DIR}\n${NH_UTIL_DIR}/makedefs -s\n"; }; - 317E7C5021A3735300F6E4E5 /* Copy dgn_comp */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "$(BUILT_PRODUCTS_DIR)/dgn_comp", - ); - name = "Copy dgn_comp"; - outputFileListPaths = ( - ); - outputPaths = ( - "${NH_UTIL_DIR}/dgn_comp", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "cp ${BUILT_PRODUCTS_DIR}/dgn_comp ${NH_UTIL_DIR}/dgn_comp\n"; - }; - 317E7C5121A373E100F6E4E5 /* Build dungeon */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "$(NH_UTIL_DIR)/makedefs", - "$(NH_UTIL_DIR)/dgn_comp", - "$(NH_DAT_DIR)/dungeon.pdf", - ); - name = "Build dungeon"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(NH_DAT_DIR)/dungeon", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "cd ${NH_DAT_DIR}\n${NH_UTIL_DIR}/makedefs -e\n${NH_UTIL_DIR}/dgn_comp dungeon.pdf\n"; - }; 317E7C5421A3804400F6E4E5 /* Build Guidebook */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -1444,142 +1136,142 @@ inputFileListPaths = ( ); inputPaths = ( - "$(NH_DAT_DIR)/Arc-fila.lev", - "$(NH_DAT_DIR)/Arc-filb.lev", - "$(NH_DAT_DIR)/Arc-goal.lev", - "$(NH_DAT_DIR)/Arc-loca.lev", - "$(NH_DAT_DIR)/Arc-strt.lev", - "$(NH_DAT_DIR)/Bar-fila.lev", - "$(NH_DAT_DIR)/Bar-filb.lev", - "$(NH_DAT_DIR)/Bar-goal.lev", - "$(NH_DAT_DIR)/Bar-loca.lev", - "$(NH_DAT_DIR)/Bar-strt.lev", - "$(NH_DAT_DIR)/Cav-fila.lev", - "$(NH_DAT_DIR)/Cav-filb.lev", - "$(NH_DAT_DIR)/Cav-goal.lev", - "$(NH_DAT_DIR)/Cav-loca.lev", - "$(NH_DAT_DIR)/Cav-strt.lev", - "$(NH_DAT_DIR)/Hea-fila.lev", - "$(NH_DAT_DIR)/Hea-filb.lev", - "$(NH_DAT_DIR)/Hea-goal.lev", - "$(NH_DAT_DIR)/Hea-loca.lev", - "$(NH_DAT_DIR)/Hea-strt.lev", - "$(NH_DAT_DIR)/Kni-fila.lev", - "$(NH_DAT_DIR)/Kni-filb.lev", - "$(NH_DAT_DIR)/Kni-goal.lev", - "$(NH_DAT_DIR)/Kni-loca.lev", - "$(NH_DAT_DIR)/Kni-strt.lev", - "$(NH_DAT_DIR)/Mon-fila.lev", - "$(NH_DAT_DIR)/Mon-filb.lev", - "$(NH_DAT_DIR)/Mon-goal.lev", - "$(NH_DAT_DIR)/Mon-loca.lev", - "$(NH_DAT_DIR)/Mon-strt.lev", - "$(NH_DAT_DIR)/Pri-fila.lev", - "$(NH_DAT_DIR)/Pri-filb.lev", - "$(NH_DAT_DIR)/Pri-goal.lev", - "$(NH_DAT_DIR)/Pri-loca.lev", - "$(NH_DAT_DIR)/Pri-strt.lev", - "$(NH_DAT_DIR)/Ran-fila.lev", - "$(NH_DAT_DIR)/Ran-filb.lev", - "$(NH_DAT_DIR)/Ran-goal.lev", - "$(NH_DAT_DIR)/Ran-loca.lev", - "$(NH_DAT_DIR)/Ran-strt.lev", - "$(NH_DAT_DIR)/Rog-fila.lev", - "$(NH_DAT_DIR)/Rog-filb.lev", - "$(NH_DAT_DIR)/Rog-goal.lev", - "$(NH_DAT_DIR)/Rog-loca.lev", - "$(NH_DAT_DIR)/Rog-strt.lev", - "$(NH_DAT_DIR)/Sam-fila.lev", - "$(NH_DAT_DIR)/Sam-filb.lev", - "$(NH_DAT_DIR)/Sam-goal.lev", - "$(NH_DAT_DIR)/Sam-loca.lev", - "$(NH_DAT_DIR)/Sam-strt.lev", - "$(NH_DAT_DIR)/Tou-fila.lev", - "$(NH_DAT_DIR)/Tou-filb.lev", - "$(NH_DAT_DIR)/Tou-goal.lev", - "$(NH_DAT_DIR)/Tou-loca.lev", - "$(NH_DAT_DIR)/Tou-strt.lev", - "$(NH_DAT_DIR)/Val-fila.lev", - "$(NH_DAT_DIR)/Val-filb.lev", - "$(NH_DAT_DIR)/Val-goal.lev", - "$(NH_DAT_DIR)/Val-loca.lev", - "$(NH_DAT_DIR)/Val-strt.lev", - "$(NH_DAT_DIR)/Wiz-fila.lev", - "$(NH_DAT_DIR)/Wiz-filb.lev", - "$(NH_DAT_DIR)/Wiz-goal.lev", - "$(NH_DAT_DIR)/Wiz-loca.lev", - "$(NH_DAT_DIR)/Wiz-strt.lev", - "$(NH_DAT_DIR)/air.lev", - "$(NH_DAT_DIR)/asmodeus.lev", - "$(NH_DAT_DIR)/astral.lev", - "$(NH_DAT_DIR)/baalz.lev", - "$(NH_DAT_DIR)/bigrm-1.lev", - "$(NH_DAT_DIR)/bigrm-10.lev", - "$(NH_DAT_DIR)/bigrm-2.lev", - "$(NH_DAT_DIR)/bigrm-3.lev", - "$(NH_DAT_DIR)/bigrm-4.lev", - "$(NH_DAT_DIR)/bigrm-5.lev", - "$(NH_DAT_DIR)/bigrm-6.lev", - "$(NH_DAT_DIR)/bigrm-7.lev", - "$(NH_DAT_DIR)/bigrm-8.lev", - "$(NH_DAT_DIR)/bigrm-9.lev", + "$(NH_DAT_DIR)/Arc-fila.lua", + "$(NH_DAT_DIR)/Arc-filb.lua", + "$(NH_DAT_DIR)/Arc-goal.lua", + "$(NH_DAT_DIR)/Arc-loca.lua", + "$(NH_DAT_DIR)/Arc-strt.lua", + "$(NH_DAT_DIR)/Bar-fila.lua", + "$(NH_DAT_DIR)/Bar-filb.lua", + "$(NH_DAT_DIR)/Bar-goal.lua", + "$(NH_DAT_DIR)/Bar-loca.lua", + "$(NH_DAT_DIR)/Bar-strt.lua", + "$(NH_DAT_DIR)/Cav-fila.lua", + "$(NH_DAT_DIR)/Cav-filb.lua", + "$(NH_DAT_DIR)/Cav-goal.lua", + "$(NH_DAT_DIR)/Cav-loca.lua", + "$(NH_DAT_DIR)/Cav-strt.lua", + "$(NH_DAT_DIR)/Hea-fila.lua", + "$(NH_DAT_DIR)/Hea-filb.lua", + "$(NH_DAT_DIR)/Hea-goal.lua", + "$(NH_DAT_DIR)/Hea-loca.lua", + "$(NH_DAT_DIR)/Hea-strt.lua", + "$(NH_DAT_DIR)/Kni-fila.lua", + "$(NH_DAT_DIR)/Kni-filb.lua", + "$(NH_DAT_DIR)/Kni-goal.lua", + "$(NH_DAT_DIR)/Kni-loca.lua", + "$(NH_DAT_DIR)/Kni-strt.lua", + "$(NH_DAT_DIR)/Mon-fila.lua", + "$(NH_DAT_DIR)/Mon-filb.lua", + "$(NH_DAT_DIR)/Mon-goal.lua", + "$(NH_DAT_DIR)/Mon-loca.lua", + "$(NH_DAT_DIR)/Mon-strt.lua", + "$(NH_DAT_DIR)/Pri-fila.lua", + "$(NH_DAT_DIR)/Pri-filb.lua", + "$(NH_DAT_DIR)/Pri-goal.lua", + "$(NH_DAT_DIR)/Pri-loca.lua", + "$(NH_DAT_DIR)/Pri-strt.lua", + "$(NH_DAT_DIR)/Ran-fila.lua", + "$(NH_DAT_DIR)/Ran-filb.lua", + "$(NH_DAT_DIR)/Ran-goal.lua", + "$(NH_DAT_DIR)/Ran-loca.lua", + "$(NH_DAT_DIR)/Ran-strt.lua", + "$(NH_DAT_DIR)/Rog-fila.lua", + "$(NH_DAT_DIR)/Rog-filb.lua", + "$(NH_DAT_DIR)/Rog-goal.lua", + "$(NH_DAT_DIR)/Rog-loca.lua", + "$(NH_DAT_DIR)/Rog-strt.lua", + "$(NH_DAT_DIR)/Sam-fila.lua", + "$(NH_DAT_DIR)/Sam-filb.lua", + "$(NH_DAT_DIR)/Sam-goal.lua", + "$(NH_DAT_DIR)/Sam-loca.lua", + "$(NH_DAT_DIR)/Sam-strt.lua", + "$(NH_DAT_DIR)/Tou-fila.lua", + "$(NH_DAT_DIR)/Tou-filb.lua", + "$(NH_DAT_DIR)/Tou-goal.lua", + "$(NH_DAT_DIR)/Tou-loca.lua", + "$(NH_DAT_DIR)/Tou-strt.lua", + "$(NH_DAT_DIR)/Val-fila.lua", + "$(NH_DAT_DIR)/Val-filb.lua", + "$(NH_DAT_DIR)/Val-goal.lua", + "$(NH_DAT_DIR)/Val-loca.lua", + "$(NH_DAT_DIR)/Val-strt.lua", + "$(NH_DAT_DIR)/Wiz-fila.lua", + "$(NH_DAT_DIR)/Wiz-filb.lua", + "$(NH_DAT_DIR)/Wiz-goal.lua", + "$(NH_DAT_DIR)/Wiz-loca.lua", + "$(NH_DAT_DIR)/Wiz-strt.lua", + "$(NH_DAT_DIR)/air.lua", + "$(NH_DAT_DIR)/asmodeus.lua", + "$(NH_DAT_DIR)/astral.lua", + "$(NH_DAT_DIR)/baalz.lua", + "$(NH_DAT_DIR)/bigrm-1.lua", + "$(NH_DAT_DIR)/bigrm-10.lua", + "$(NH_DAT_DIR)/bigrm-2.lua", + "$(NH_DAT_DIR)/bigrm-3.lua", + "$(NH_DAT_DIR)/bigrm-4.lua", + "$(NH_DAT_DIR)/bigrm-5.lua", + "$(NH_DAT_DIR)/bigrm-6.lua", + "$(NH_DAT_DIR)/bigrm-7.lua", + "$(NH_DAT_DIR)/bigrm-8.lua", + "$(NH_DAT_DIR)/bigrm-9.lua", "$(NH_DAT_DIR)/bogusmon", - "$(NH_DAT_DIR)/castle.lev", + "$(NH_DAT_DIR)/castle.lua", "$(NH_DAT_DIR)/cmdhelp", "$(NH_DAT_DIR)/data", - "$(NH_DAT_DIR)/dungeon", - "$(NH_DAT_DIR)/earth.lev", + "$(NH_DAT_DIR)/dungeon.lua", + "$(NH_DAT_DIR)/earth.lua", "$(NH_DAT_DIR)/engrave", "$(NH_DAT_DIR)/epitaph", - "$(NH_DAT_DIR)/fakewiz1.lev", - "$(NH_DAT_DIR)/fakewiz2.lev", - "$(NH_DAT_DIR)/fire.lev", + "$(NH_DAT_DIR)/fakewiz1.lua", + "$(NH_DAT_DIR)/fakewiz2.lua", + "$(NH_DAT_DIR)/fire.lua", "$(NH_DAT_DIR)/help", "$(NH_DAT_DIR)/hh", "$(NH_DAT_DIR)/history", - "$(NH_DAT_DIR)/juiblex.lev", + "$(NH_DAT_DIR)/juiblex.lua", "$(NH_DAT_DIR)/keyhelp", - "$(NH_DAT_DIR)/knox.lev", - "$(NH_DAT_DIR)/medusa-1.lev", - "$(NH_DAT_DIR)/medusa-2.lev", - "$(NH_DAT_DIR)/medusa-3.lev", - "$(NH_DAT_DIR)/medusa-4.lev", - "$(NH_DAT_DIR)/minefill.lev", - "$(NH_DAT_DIR)/minend-1.lev", - "$(NH_DAT_DIR)/minend-2.lev", - "$(NH_DAT_DIR)/minend-3.lev", - "$(NH_DAT_DIR)/minetn-1.lev", - "$(NH_DAT_DIR)/minetn-2.lev", - "$(NH_DAT_DIR)/minetn-3.lev", - "$(NH_DAT_DIR)/minetn-4.lev", - "$(NH_DAT_DIR)/minetn-5.lev", - "$(NH_DAT_DIR)/minetn-6.lev", - "$(NH_DAT_DIR)/minetn-7.lev", + "$(NH_DAT_DIR)/knox.lua", + "$(NH_DAT_DIR)/medusa-1.lua", + "$(NH_DAT_DIR)/medusa-2.lua", + "$(NH_DAT_DIR)/medusa-3.lua", + "$(NH_DAT_DIR)/medusa-4.lua", + "$(NH_DAT_DIR)/minefill.lua", + "$(NH_DAT_DIR)/minend-1.lua", + "$(NH_DAT_DIR)/minend-2.lua", + "$(NH_DAT_DIR)/minend-3.lua", + "$(NH_DAT_DIR)/minetn-1.lua", + "$(NH_DAT_DIR)/minetn-2.lua", + "$(NH_DAT_DIR)/minetn-3.lua", + "$(NH_DAT_DIR)/minetn-4.lua", + "$(NH_DAT_DIR)/minetn-5.lua", + "$(NH_DAT_DIR)/minetn-6.lua", + "$(NH_DAT_DIR)/minetn-7.lua", "$(NH_DAT_DIR)/opthelp", "$(NH_DAT_DIR)/options", - "$(NH_DAT_DIR)/oracle.lev", + "$(NH_DAT_DIR)/oracle.lua", "$(NH_DAT_DIR)/oracles", - "$(NH_DAT_DIR)/orcus.lev", - "$(NH_DAT_DIR)/quest.dat", + "$(NH_DAT_DIR)/orcus.lua", + "$(NH_DAT_DIR)/quest.lua", "$(NH_DAT_DIR)/rumors", - "$(NH_DAT_DIR)/sanctum.lev", - "$(NH_DAT_DIR)/soko1-1.lev", - "$(NH_DAT_DIR)/soko1-2.lev", - "$(NH_DAT_DIR)/soko2-1.lev", - "$(NH_DAT_DIR)/soko2-2.lev", - "$(NH_DAT_DIR)/soko3-1.lev", - "$(NH_DAT_DIR)/soko3-2.lev", - "$(NH_DAT_DIR)/soko4-1.lev", - "$(NH_DAT_DIR)/soko4-2.lev", - "$(NH_DAT_DIR)/tower1.lev", - "$(NH_DAT_DIR)/tower2.lev", - "$(NH_DAT_DIR)/tower3.lev", + "$(NH_DAT_DIR)/sanctum.lua", + "$(NH_DAT_DIR)/soko1-1.lua", + "$(NH_DAT_DIR)/soko1-2.lua", + "$(NH_DAT_DIR)/soko2-1.lua", + "$(NH_DAT_DIR)/soko2-2.lua", + "$(NH_DAT_DIR)/soko3-1.lua", + "$(NH_DAT_DIR)/soko3-2.lua", + "$(NH_DAT_DIR)/soko4-1.lua", + "$(NH_DAT_DIR)/soko4-2.lua", + "$(NH_DAT_DIR)/tower1.lua", + "$(NH_DAT_DIR)/tower2.lua", + "$(NH_DAT_DIR)/tower3.lua", "$(NH_DAT_DIR)/tribute", - "$(NH_DAT_DIR)/valley.lev", - "$(NH_DAT_DIR)/water.lev", - "$(NH_DAT_DIR)/wizard1.lev", - "$(NH_DAT_DIR)/wizard2.lev", - "$(NH_DAT_DIR)/wizard3.lev", + "$(NH_DAT_DIR)/valley.lua", + "$(NH_DAT_DIR)/water.lua", + "$(NH_DAT_DIR)/wizard1.lua", + "$(NH_DAT_DIR)/wizard2.lua", + "$(NH_DAT_DIR)/wizard3.lua", "$(NH_DAT_DIR)/wizhelp", ); name = "Build nhdat"; @@ -1590,11 +1282,11 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cd ${NH_DAT_DIR}\n${NH_UTIL_DIR}/dlb cf nhdat help hh cmdhelp keyhelp history opthelp wizhelp dungeon tribute asmodeus.lev baalz.lev bigrm-*.lev castle.lev fakewiz?.lev juiblex.lev knox.lev medusa-?.lev minend-?.lev minefill.lev minetn-?.lev oracle.lev orcus.lev sanctum.lev soko?-?.lev tower?.lev valley.lev wizard?.lev astral.lev air.lev earth.lev fire.lev water.lev ???-goal.lev ???-fil?.lev ???-loca.lev ???-strt.lev bogusmon data engrave epitaph oracles options quest.dat rumors\n\n"; + shellScript = "cd ${NH_DAT_DIR}\n${NH_UTIL_DIR}/dlb cf nhdat help hh cmdhelp keyhelp history opthelp wizhelp dungeon.lua tribute asmodeus.lua baalz.lua bigrm-*.lua castle.lua fakewiz?.lua juiblex.lua knox.lua medusa-?.lua minend-?.lua minefill.lua minetn-?.lua oracle.lua orcus.lua sanctum.lua soko?-?.lua tower?.lua valley.lua wizard?.lua astral.lua air.lua earth.lua fire.lua water.lua ???-goal.lua ???-fil?.lua ???-loca.lua ???-strt.lua bogusmon data engrave epitaph oracles options quest.lua rumors\n\n"; }; 3192867021A39F6A00325BEB /* Install */ = { isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; + buildActionMask = 12; files = ( ); inputFileListPaths = ( @@ -1621,7 +1313,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "mkdir -p ${NH_INSTALL_DIR}/save\ncd ${NH_DAT_DIR}\ncp nhdat license symbols ${NH_INSTALL_DIR}\ncp ${NH_SRC_DIR}/nethack ${NH_INSTALL_DIR}\ncp ${NH_UTIL_DIR}/recover ${NH_INSTALL_DIR}\ntouch ${NH_INSTALL_DIR}/perm\ntouch ${NH_INSTALL_DIR}/record\ntouch ${NH_INSTALL_DIR}/logfile\ntouch ${NH_INSTALL_DIR}/xlogfile\ncd ${NH_ROOT_DIR}\nsys/unix/hints/macosx.sh editsysconf sys/unix/sysconf ${NH_INSTALL_DIR}/sysconf\n"; + shellScript = "mkdir -p ${NH_INSTALL_DIR}/save\ncd ${NH_DAT_DIR}\ncp nhdat license symbols ${NH_INSTALL_DIR}\ncp ${NH_SRC_DIR}/nethack ${NH_INSTALL_DIR}\ncp ${NH_UTIL_DIR}/recover ${NH_INSTALL_DIR}\ntouch ${NH_INSTALL_DIR}/perm\ntouch ${NH_INSTALL_DIR}/record\ntouch ${NH_INSTALL_DIR}/logfile\ntouch ${NH_INSTALL_DIR}/xlogfile\ncd ${NH_UNIX_DIR}\nsh hints/macosx.sh editsysconf sysconf ${NH_INSTALL_DIR}/sysconf\n"; }; 3192867121A3A2D500325BEB /* Copy nethack */ = { isa = PBXShellScriptBuildPhase; @@ -1704,6 +1396,44 @@ shellPath = /bin/sh; shellScript = "# make data from data.base\ncd ${NH_DAT_DIR}\n${NH_UTIL_DIR}/makedefs -d\n"; }; + 544768B223995106004B9739 /* Build nhlua header */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Build nhlua header"; + outputFileListPaths = ( + ); + outputPaths = ( + "${NH_INC_DIR}/nhlua.h", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Type a script or drag a script file from your workspace to insert its path.\ncd ${NH_INC_DIR}\necho '/* nhlua.h - generated by Xcode script */' > nhlua.h\necho '#include \"../lib/lua-5.3.5/src/lua.h\"' >> nhlua.h\nsed -e '/(lua_error)/!d' -e '/(lua_error)/s/;/ NORETURN;/1' < ${NH_LIB_DIR}/lua-5.3.5/src/lua.h >> nhlua.h\necho '#include \"../lib/lua-5.3.5/src/lualib.h\"' >> nhlua.h\necho '#include \"../lib/lua-5.3.5/src/lauxlib.h\"' >> nhlua.h\necho '/*nhlua.h*/' >> nhlua.h\n"; + }; + 544768B8239954B9004B9739 /* Build Lua library */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Build Lua library"; + outputFileListPaths = ( + ); + outputPaths = ( + "${NH_LIB_DIR}/lua/liblua.a", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Type a script or drag a script file from your workspace to insert its path.\ncd ${NH_LIB_DIR}\nmkdir -p lua\ncd ${NH_LIB_DIR}/lua-5.3.5/src\nmake a\ncp liblua.a ../../lua\ncd ../../..\n\n"; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -1713,6 +1443,7 @@ files = ( 31B8A3BC21A238060055BD01 /* eat.c in Sources */, 31B8A3A921A238060055BD01 /* music.c in Sources */, + 544768B123994A2C004B9739 /* mdlib.c in Sources */, 31B8A3D221A238060055BD01 /* engrave.c in Sources */, 31B8A3A021A238060055BD01 /* exper.c in Sources */, 31B8A38A21A238060055BD01 /* priest.c in Sources */, @@ -1745,18 +1476,21 @@ 31B8A3C321A238060055BD01 /* steed.c in Sources */, 31B8A39D21A238060055BD01 /* artifact.c in Sources */, 31B8A3FF21A23E6E0055BD01 /* topl.c in Sources */, + 544768AF23994A17004B9739 /* nhlua.c in Sources */, 31B8A3C021A238060055BD01 /* dig.c in Sources */, 31B8A3CB21A238060055BD01 /* alloc.c in Sources */, 31B8A39821A238060055BD01 /* mail.c in Sources */, 31B8A3C821A238060055BD01 /* options.c in Sources */, 31B8A3CD21A238060055BD01 /* write.c in Sources */, 31B8A40F21A23EEC0055BD01 /* cursmesg.c in Sources */, + 544768BC23A53C9F004B9739 /* nhlobj.c in Sources */, 31B8A3DF21A238060055BD01 /* end.c in Sources */, 31B8A38921A238060055BD01 /* mklev.c in Sources */, 31B8A3D721A238060055BD01 /* muse.c in Sources */, 31B8A40121A23E6E0055BD01 /* wintty.c in Sources */, 31B8A3FE21A23E6E0055BD01 /* termcap.c in Sources */, 31B8A39621A238060055BD01 /* attrib.c in Sources */, + 544768AE23994A17004B9739 /* nhlsel.c in Sources */, 31B8A40C21A23EEC0055BD01 /* cursdial.c in Sources */, 31B8A3A321A238060055BD01 /* mhitm.c in Sources */, 31B8A3DC21A238060055BD01 /* polyself.c in Sources */, @@ -1770,6 +1504,7 @@ 31B8A3AD21A238060055BD01 /* uhitm.c in Sources */, 31B8A3B321A238060055BD01 /* track.c in Sources */, 31B8A41221A23EEC0055BD01 /* curswins.c in Sources */, + 544768AB239949FA004B9739 /* sfstruct.c in Sources */, 31B8A3A721A238060055BD01 /* minion.c in Sources */, 31B8A3F021A23D420055BD01 /* unixtty.c in Sources */, 31B8A37F21A238060055BD01 /* extralev.c in Sources */, @@ -1851,36 +1586,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 31B8A41A21A2669A0055BD01 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3192867C21A3ACAC00325BEB /* lev_comp.y in Sources */, - 31B8A42B21A267E60055BD01 /* panic.c in Sources */, - 31B8A43021A268370055BD01 /* monst.c in Sources */, - 31B8A42921A267E60055BD01 /* lev_yacc.c in Sources */, - 31B8A42C21A267E60055BD01 /* lev_main.c in Sources */, - 31B8A42D21A267F50055BD01 /* alloc.c in Sources */, - 31B8A42E21A2680B0055BD01 /* drawing.c in Sources */, - 3192867E21A3ACB800325BEB /* lev_comp.l in Sources */, - 31B8A42A21A267E60055BD01 /* lev_lex.c in Sources */, - 31B8A43121A268420055BD01 /* objects.c in Sources */, - 31B8A42F21A2681E0055BD01 /* decl.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 31B8A43221A268DF0055BD01 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 31B8A46921A288770055BD01 /* dgn_comp.l in Sources */, - 31B8A46621A2820F0055BD01 /* dgn_comp.y in Sources */, - 31B8A44321A269EA0055BD01 /* dgn_main.c in Sources */, - 31B8A44521A26A0A0055BD01 /* alloc.c in Sources */, - 31B8A44421A26A020055BD01 /* panic.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 31B8A44621A26A4B0055BD01 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1903,16 +1608,6 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 316B91C721A3BD5000EC3E81 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3189577E21A1FDA400FB2ABE /* makedefs */; - targetProxy = 316B91C621A3BD5000EC3E81 /* PBXContainerItemProxy */; - }; - 316B91C921A3BD5C00EC3E81 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3189577E21A1FDA400FB2ABE /* makedefs */; - targetProxy = 316B91C821A3BD5C00EC3E81 /* PBXContainerItemProxy */; - }; 316B91CB21A3BD7C00EC3E81 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 3189577E21A1FDA400FB2ABE /* makedefs */; @@ -1933,16 +1628,6 @@ target = 31B8A45621A26A970055BD01 /* dlb */; targetProxy = 3192867521A3AAFE00325BEB /* PBXContainerItemProxy */; }; - 3192867821A3AB0400325BEB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 31B8A43521A268DF0055BD01 /* dgn_comp */; - targetProxy = 3192867721A3AB0400325BEB /* PBXContainerItemProxy */; - }; - 3192867A21A3AB0800325BEB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 31B8A41D21A2669A0055BD01 /* lev_comp */; - targetProxy = 3192867921A3AB0800325BEB /* PBXContainerItemProxy */; - }; 31B8A31421A2355C0055BD01 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 3189577E21A1FDA400FB2ABE /* makedefs */; @@ -2012,6 +1697,7 @@ NH_DOC_DIR = "$(NH_ROOT_DIR)/doc"; NH_INC_DIR = "$(NH_ROOT_DIR)/include"; NH_INSTALL_DIR = "$(HOME)/nethackdir"; + NH_LIB_DIR = "$(NH_ROOT_DIR)/sys/unix/../../lib"; NH_ROOT_DIR = "$(SOURCE_ROOT)/../.."; NH_SRC_DIR = "$(NH_ROOT_DIR)/src"; NH_UNIX_DIR = "$(NH_ROOT_DIR)/sys/unix"; @@ -2088,6 +1774,7 @@ NH_DOC_DIR = "$(NH_ROOT_DIR)/doc"; NH_INC_DIR = "$(NH_ROOT_DIR)/include"; NH_INSTALL_DIR = "$(HOME)/nethackdir"; + NH_LIB_DIR = "$(NH_ROOT_DIR)/sys/unix/../../lib"; NH_ROOT_DIR = "$(SOURCE_ROOT)/../.."; NH_SRC_DIR = "$(NH_ROOT_DIR)/src"; NH_UNIX_DIR = "$(NH_ROOT_DIR)/sys/unix"; @@ -2111,8 +1798,11 @@ 3189577921A1FCC100FB2ABE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; GCC_C_LANGUAGE_STANDARD = c99; + INSTALL_PATH = "$(NH_INSTALL_DIR)"; + "OTHER_LDFLAGS[arch=*]" = "-L${NH_LIB_DIR}/lua"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -2120,8 +1810,11 @@ 3189577A21A1FCC100FB2ABE /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; GCC_C_LANGUAGE_STANDARD = c99; + INSTALL_PATH = "$(NH_INSTALL_DIR)"; + "OTHER_LDFLAGS[arch=*]" = "-L${NH_LIB_DIR}/lua"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; @@ -2129,6 +1822,7 @@ 3189578421A1FDA400FB2ABE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2137,52 +1831,16 @@ 3189578521A1FDA400FB2ABE /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; - 31B8A42321A2669A0055BD01 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Automatic; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 31B8A42421A2669A0055BD01 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Automatic; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - 31B8A43B21A268E00055BD01 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_STYLE = Automatic; - GCC_C_LANGUAGE_STANDARD = gnu11; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 31B8A43C21A268E00055BD01 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_STYLE = Automatic; - GCC_C_LANGUAGE_STANDARD = gnu11; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; 31B8A44F21A26A4B0055BD01 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2191,6 +1849,7 @@ 31B8A45021A26A4B0055BD01 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2199,6 +1858,7 @@ 31B8A45C21A26A970055BD01 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2207,6 +1867,7 @@ 31B8A45D21A26A970055BD01 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2242,24 +1903,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 31B8A42221A2669A0055BD01 /* Build configuration list for PBXNativeTarget "lev_comp" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 31B8A42321A2669A0055BD01 /* Debug */, - 31B8A42421A2669A0055BD01 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 31B8A43A21A268E00055BD01 /* Build configuration list for PBXNativeTarget "dgn_comp" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 31B8A43B21A268E00055BD01 /* Debug */, - 31B8A43C21A268E00055BD01 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 31B8A44E21A26A4B0055BD01 /* Build configuration list for PBXNativeTarget "recover" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/sys/unix/NetHack.xcodeproj/xcshareddata/xcschemes/NetHack.xcscheme b/sys/unix/NetHack.xcodeproj/xcshareddata/xcschemes/NetHack.xcscheme index 92558e275..c67695cf6 100644 --- a/sys/unix/NetHack.xcodeproj/xcshareddata/xcschemes/NetHack.xcscheme +++ b/sys/unix/NetHack.xcodeproj/xcshareddata/xcschemes/NetHack.xcscheme @@ -1,6 +1,6 @@ - - - - + + - - - - - - + + - - - - - - + + - - + if (incl ~ "curses\.h") + incl = "" # skip "curses.h"; it should be + else if (incl ~ /^..\/lib\/lua-.*\/src\/l/) + incl = "" # skip lua headers else if (incl ~ /^curs/) # curses special case incl = "../win/curses/" incl - else if (incl ~ /^qt4/) # Qt v4 special case - incl = "../win/Qt4/" incl - else if (incl ~ /^gn/) # gnomehack special case + else if (incl ~ /^qt/) { # Qt special cases + # qtext.h is a core header that accidentally matches... + if (incl ~ /^qtext.h/) # ...the Qt exception + incl = "../include/" incl + # Qt v3 headers are in ../win/Qt3 + # Qt v4/v5 headers are in ../win/Qt + else if (FILENAME ~ /^\.\.\/win\/Qt3\/.*/) + incl = "../win/Qt3/" incl + else # Qt v4 + incl = "../win/Qt/" incl + } else if (incl ~ /^gn/) # gnomehack special case incl = "../win/gnome/" incl else incl = "../include/" incl @@ -100,7 +111,7 @@ function output_specials( i, sp, alt_sp) # write a target and its dependency list in pretty-printed format; # if target's primary source file has a path prefix, also write build command # -function format_dep(target, source, n, i, list) +function format_dep(target, source, col, n, i, list) { split("", done) #``for (x in done) delete done[x]'' printf("%s:", target); col = length(target) + 1 diff --git a/sys/unix/hints/linux b/sys/unix/hints/linux index 1d9c45509..862915053 100644 --- a/sys/unix/hints/linux +++ b/sys/unix/hints/linux @@ -20,7 +20,8 @@ VARDIR = $(HACKDIR) POSTINSTALL=cp -n sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf; -CFLAGS=-g -O -I../include -DNOTPARMDECL -DDLB +CFLAGS=-g -O -I../include -DNOTPARMDECL +CFLAGS+=-DDLB CFLAGS+=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\" CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE CFLAGS+=-DTIMED_DELAY @@ -33,7 +34,6 @@ CFLAGS+=-DCURSES_GRAPHICS #CFLAGS+=-DSCORE_ON_BOTL #CFLAGS+=-DMSGHANDLER #CFLAGS+=-DTTY_TILES_ESCCODES -#CFLAGS+=-DDLB LINK=$(CC) # Only needed for GLIBC stack trace: @@ -47,7 +47,7 @@ WINLIB = $(WINTTYLIB) $(WINCURSESLIB) #WINSRC += tile.c #WINOBJ += tile.o -WINTTYLIB=-lcurses +WINTTYLIB=-lncurses -ltinfo CHOWN=true CHGRP=true diff --git a/sys/unix/hints/linux-chroot b/sys/unix/hints/linux-chroot index eb4fc2733..e5bb767fb 100644 --- a/sys/unix/hints/linux-chroot +++ b/sys/unix/hints/linux-chroot @@ -39,7 +39,7 @@ WINSRC = $(WINTTYSRC) WINOBJ = $(WINTTYOBJ) WINLIB = $(WINTTYLIB) -WINTTYLIB=-lcurses +WINTTYLIB=-lncurses -ltinfo CHOWN=true CHGRP=true diff --git a/sys/unix/hints/linux-minimal b/sys/unix/hints/linux-minimal index 6c2638ae3..256332cc7 100644 --- a/sys/unix/hints/linux-minimal +++ b/sys/unix/hints/linux-minimal @@ -21,7 +21,7 @@ WINSRC = $(WINTTYSRC) WINOBJ = $(WINTTYOBJ) WINLIB = $(WINTTYLIB) -WINTTYLIB=-lcurses +WINTTYLIB=-lncurses -ltinfo CHOWN=true CHGRP=true diff --git a/sys/unix/hints/linux-qt5 b/sys/unix/hints/linux-qt5 index c1b13d890..bcf1a06ef 100644 --- a/sys/unix/hints/linux-qt5 +++ b/sys/unix/hints/linux-qt5 @@ -33,8 +33,8 @@ CFLAGS+=`pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags` -fPIC LINK=g++ CXX=g++ -std=gnu++11 -WINSRC = $(WINQT4SRC) -WINOBJ = $(WINQT4OBJ) +WINSRC = $(WINQTSRC) +WINOBJ = $(WINQTOBJ) WINLIB = $(WINQT5LIB) #MOC = moc MOC = moc-qt5 diff --git a/sys/unix/hints/macosx10.14 b/sys/unix/hints/macosx10.14 index 751ba7774..e43b5f19d 100644 --- a/sys/unix/hints/macosx10.14 +++ b/sys/unix/hints/macosx10.14 @@ -1,5 +1,5 @@ # -# NetHack 3.6 macosx10.14 $NHDT-Date: 1566346605 2019/08/21 00:16:45 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.59 $ +# NetHack 3.6 macosx10.14 $NHDT-Date: 1573841535 2019/11/15 18:12:15 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.60 $ # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. # NetHack may be freely redistributed. See license for details. # @@ -229,12 +229,12 @@ ifdef MAKEFILE_TOP # Notes: # 1) The Apple developer utilities must be installed in the default location. # 2) Do a normal build before trying to package the game. -# 3) This matches the 3.4.3 Term package, but there are some things that should -# be changed. +# 3) This matches the 3.4.3 Term package, but there are some things that +# should be changed. # -# Packages that are being distributed must be signed by a Developer ID Installer -# certificate. Set DEVELOPER_CERT to the name of the certificate if you wish -# for your package to be signed for distribution. +# Packages that are being distributed must be signed by a Developer ID +# Installer certificate. Set DEVELOPER_CERT to the name of the certificate +# if you wish for your package to be signed for distribution. # # If building a package for signing, you must use sudo approriately. # the binaries and package using sudo but you DO NOT use sudo to sign the @@ -242,7 +242,7 @@ ifdef MAKEFILE_TOP # # sudo make all # sudo make build_tty_pkg -# sudo sign_tty_pkg +# make sign_tty_pkg # diff --git a/sys/unix/sysconf b/sys/unix/sysconf index 5986f54a5..b8bfbcb9a 100644 --- a/sys/unix/sysconf +++ b/sys/unix/sysconf @@ -1,4 +1,4 @@ -# NetHack 3.6 sysconf $NHDT-Date: 1524689450 2018/04/25 20:50:50 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.27 $ +# NetHack 3.6 sysconf $NHDT-Date: 1575245127 2019/12/02 00:05:27 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.32 $ # Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland # NetHack may be freely redistributed. See license for details. # @@ -61,6 +61,11 @@ MAXPLAYERS=10 # incubi to use nymphs' charm behavior rather than their own seduce behavior. #SEDUCE=0 +# Uncomment the next line to enable some accessibility features such +# as S_hero_override and S_pet_override symbols for screen readers +# in the user config file. +#ACCESSIBILITY=1 + # Uncomment to disable savefile UID checking. #CHECK_SAVE_UID=0 @@ -90,7 +95,7 @@ MAXPLAYERS=10 # Only available if NetHack was compiled with DUMPLOG # Allows following placeholders: # %% literal '%' -# %v version (eg. "3.6.2-0") +# %v version (eg. "3.6.4-0") # %u game UID # %t game start time, UNIX timestamp format # %T current time, UNIX timestamp format diff --git a/sys/unix/unixmain.c b/sys/unix/unixmain.c index 23d6d55e9..372895c70 100644 --- a/sys/unix/unixmain.c +++ b/sys/unix/unixmain.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 unixmain.c $NHDT-Date: 1562187898 2019/07/03 21:04:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.78 $ */ +/* NetHack 3.6 unixmain.c $NHDT-Date: 1570408210 2019/10/07 00:30:10 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.70 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -114,11 +114,20 @@ char *argv[]; if (argcheck(argc, argv, ARG_VERSION) == 2) exit(EXIT_SUCCESS); + if (argcheck(argc, argv, ARG_SHOWPATHS) == 2) { +#ifdef CHDIR + chdirx((char *) 0, 0); +#endif + iflags.initoptions_noterminate = TRUE; + initoptions(); + iflags.initoptions_noterminate = FALSE; + reveal_paths(); + exit(EXIT_SUCCESS); + } if (argcheck(argc, argv, ARG_DEBUG) == 1) { argc--; argv++; - } - + } if (argc > 1 && !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 @@ -262,7 +271,7 @@ char *argv[]; * First, try to find and restore a save file for specified character. * We'll return here if new game player_selection() renames the hero. */ -attempt_restore: + attempt_restore: /* * getlock() complains and quits if there is already a game @@ -489,12 +498,13 @@ boolean wr; #ifdef VAR_PLAYGROUND int len = strlen(VAR_PLAYGROUND); - fqn_prefix[SCOREPREFIX] = (char *) alloc(len + 2); - Strcpy(fqn_prefix[SCOREPREFIX], VAR_PLAYGROUND); - if (fqn_prefix[SCOREPREFIX][len - 1] != '/') { - fqn_prefix[SCOREPREFIX][len] = '/'; - fqn_prefix[SCOREPREFIX][len + 1] = '\0'; + g.fqn_prefix[SCOREPREFIX] = (char *) alloc(len + 2); + Strcpy(g.fqn_prefix[SCOREPREFIX], VAR_PLAYGROUND); + if (g.fqn_prefix[SCOREPREFIX][len - 1] != '/') { + g.fqn_prefix[SCOREPREFIX][len] = '/'; + g.fqn_prefix[SCOREPREFIX][len + 1] = '\0'; } + #endif } @@ -514,11 +524,11 @@ boolean wr; */ if (wr) { #ifdef VAR_PLAYGROUND - fqn_prefix[LEVELPREFIX] = fqn_prefix[SCOREPREFIX]; - fqn_prefix[SAVEPREFIX] = fqn_prefix[SCOREPREFIX]; - fqn_prefix[BONESPREFIX] = fqn_prefix[SCOREPREFIX]; - fqn_prefix[LOCKPREFIX] = fqn_prefix[SCOREPREFIX]; - fqn_prefix[TROUBLEPREFIX] = fqn_prefix[SCOREPREFIX]; + g.fqn_prefix[LEVELPREFIX] = g.fqn_prefix[SCOREPREFIX]; + g.fqn_prefix[SAVEPREFIX] = g.fqn_prefix[SCOREPREFIX]; + g.fqn_prefix[BONESPREFIX] = g.fqn_prefix[SCOREPREFIX]; + g.fqn_prefix[LOCKPREFIX] = g.fqn_prefix[SCOREPREFIX]; + g.fqn_prefix[TROUBLEPREFIX] = g.fqn_prefix[SCOREPREFIX]; #endif check_recordfile(dir); } @@ -531,8 +541,8 @@ whoami() { /* * Who am i? Algorithm: 1. Use name as specified in NETHACKOPTIONS - * 2. Use $USER or $LOGNAME (if 1. fails) - * 3. Use getlogin() (if 2. fails) + * 2. Use $USER or $LOGNAME (if 1. fails) + * 3. Use getlogin() (if 2. fails) * The resulting name is overridden by command line options. * If everything fails, or if the resulting name is some generic * account like "games", "play", "player", "hack" then eventually @@ -651,20 +661,20 @@ boolean check_user_string(optstr) char *optstr; { - struct passwd *pw = get_unix_pw(); + struct passwd *pw; int pwlen; char *eop, *w; - char *pwname; + char *pwname = 0; if (optstr[0] == '*') return TRUE; /* allow any user */ - if (!pw) - return FALSE; if (sysopt.check_plname) pwname = g.plname; - else + else if ((pw = get_unix_pw()) != 0) pwname = pw->pw_name; - pwlen = strlen(pwname); + if (!pwname || !*pwname) + return FALSE; + pwlen = (int) strlen(pwname); eop = eos(optstr); w = optstr; while (w + pwlen <= eop) { @@ -722,7 +732,6 @@ get_login_name() struct passwd *pw = get_unix_pw(); buf[0] = '\0'; - if (pw) (void)strcpy(buf, pw->pw_name); @@ -739,31 +748,33 @@ 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; + 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--; + 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 (len != fwrite(buf, 1, len, PB)) { + errfmt = "Error sending data to pbcopy (%d)\n"; + goto error; } - if(pclose(PB)!=-1){ - return; + if (pclose(PB) != -1) { + return; } errfmt = "Error finishing pbcopy (%d)\n"; -error: - raw_printf(errfmt,strerror(errno)); + error: + raw_printf(errfmt, strerror(errno)); } -#endif +#endif /* __APPLE__ */ unsigned long sys_random_seed() diff --git a/sys/vms/Install.vms b/sys/vms/Install.vms index 057f73f9f..dc6b11e2d 100644 --- a/sys/vms/Install.vms +++ b/sys/vms/Install.vms @@ -16,39 +16,40 @@ structure. You should set up a directory--referred to as "top" below and in some of the assorted files, but which may be a subdirectory-- that has these subdirectories - [.dat] -- data files - [.doc] -- documentation files - [.include] -- C header files - [.src] -- primary source files - [.sys] -- parent for [.sys.*] - [.sys .share] -- files shared by several ports, including VMS - [.sys .vms] -- VMS-specific source and support files - [.util] -- sources for essential utility programs - [.win] -- parent for [.win.*] - [.win .tty] -- "window" routines for ordinary terminals + [.dat] -- data files + [.doc] -- documentation files + [.include] -- C header files + [.lib .lua535] -- Lua distribution from https://www.lua.org/ + [.src] -- primary source files + [.sys] -- parent for [.sys.*] + [.sys .share] -- files shared by several ports, including VMS + [.sys .vms] -- VMS-specific source and support files + [.util] -- sources for essential utility programs + [.win] -- parent for [.win.*] + [.win .tty] -- "window" routines for ordinary terminals (including terminal windows on workstations) The following subdirectories may be present, but are not useful for building NetHack on VMS and are not required: - [.sys .amiga] -- AmigaDOS - [.sys .atari] -- Atari TOS - [.sys .be] -- BeBox BeOS - [.sys .mac] -- Macintosh - [.sys .msdos] -- MSDOS for IBM PCs and compatibles - [.sys .os2] -- OS/2 + [.sys .amiga] -- AmigaDOS + [.sys .atari] -- Atari TOS + [.sys .be] -- BeBox BeOS + [.sys .mac] -- Macintosh + [.sys .msdos] -- MSDOS for IBM PCs and compatibles + [.sys .os2] -- OS/2 [.sys .share .sounds] -- AIFF format audio files - [.sys .unix] -- guess :-) + [.sys .unix] -- guess :-) [.sys .unit .hints] -- configuration data for setup.sh - [.sys .wince] -- Windows CE + [.sys .wince] -- Windows CE [.sys .wince .ceinc] -- more WinCE [.sys .wince .ceinc .sys] -- ditto - [.sys .winnt] -- Windows NT - [.win .gem] -- window routines for Atari/GEM - [.win .gnome] -- window routines for Unix/GNOME - [.win .Qt] -- window routines for Qt - [.win .share] -- "tile" graphic support - [.win .win32] -- Windows NT and Windows CE - [.win .X11] -- window routines for X-Windows; requires X11R4 - or later and MIT's Athena Widget set + [.sys .winnt] -- Windows NT + [.win .gem] -- window routines for Atari/GEM + [.win .gnome] -- window routines for Unix/GNOME + [.win .Qt] -- window routines for Qt + [.win .share] -- "tile" graphic support + [.win .win32] -- Windows NT and Windows CE + [.win .X11] -- window routines for X-Windows; requires X11R4 + or later and MIT's Athena Widget set You must arrange things in this structure or the supplied procedures and instructions in this file will not work properly. Several DCL command files are present in the [.sys.vms] subdirectory and will not @@ -506,6 +507,6 @@ Notes: minimally updated 9-NOV-2015... and again 5-MAY-2019... -# NetHack 3.6 Install.vms $NHDT-Date: 1557701798 2019/05/12 22:56:38 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.15 $ +# NetHack 3.7 Install.vms $NHDT-Date: 1575245132 2019/12/02 00:05:32 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.16 $ # Copyright (c) 2003 by Robert Patrick Rankin # NetHack may be freely redistributed. See license for details. diff --git a/sys/vms/Makefile.dat b/sys/vms/Makefile.dat index e74eb95be..11e7e41c6 100644 --- a/sys/vms/Makefile.dat +++ b/sys/vms/Makefile.dat @@ -18,35 +18,36 @@ WINSHR = [-.win.share] WINX11 = [-.win.X11] # utilities; must match Makefile.utl in spelling and punctuation MAKEDEFS = $(UTL)makedefs.exe; -LEVCOMP = $(UTL)lev_comp.exe; -DGNCOMP = $(UTL)dgn_comp.exe; +#LEVCOMP = $(UTL)lev_comp.exe; +#DGNCOMP = $(UTL)dgn_comp.exe; DLB = $(UTL)dlb.exe; TILE2X11 = $(UTL)tile2x11.exe; UTILMARKER = $(UTL)util.timestamp; # note: filespecs have enough punctuation to satisfy DELETE -MARKERS = spec_levs.timestamp;,quest_levs.timestamp; +#MARKERS = spec_levs.timestamp;,quest_levs.timestamp; VARDAT = data.;,rumors.;,quest.dat;,oracles.;,options.;,\ engrave.;,epitaph.;,bogusmon.; -DUNGEON = dungeon.; +#DUNGEON = dungeon.; X11TILES= x11tiles.; # note: the level lists need to be space separated for use as-is by $(LEVCOMP) -QUESTLEVS = Arch.des Barb.des Caveman.des Healer.des Knight.des \ - Monk.des Priest.des Ranger.des Rogue.des Samurai.des Tourist.des \ - Valkyrie.des Wizard.des -SPECLEVS = bigroom.des castle.des endgame.des gehennom.des knox.des \ - medusa.des mines.des oracle.des sokoban.des tower.des yendor.des +#QUESTLEVS = Arch.des Barb.des Caveman.des Healer.des Knight.des \ +# Monk.des Priest.des Ranger.des Rogue.des Samurai.des Tourist.des \ +# Valkyrie.des Wizard.des +#SPECLEVS = bigroom.des castle.des endgame.des gehennom.des knox.des \ +# medusa.des mines.des oracle.des sokoban.des tower.des yendor.des -all : $(VARDAT) $(DUNGEON) $(MARKERS) $(DLB) +#all : $(VARDAT) $(DUNGEON) $(MARKERS) $(DLB) +all : $(VARDAT) $(DLB) @ $(ECHO) "data files are up to date." # these are convenience targets for "manual" interactive use -spec_levs : spev_levs.timestamp - @ $(ECHO) "special levels are up to date." -quest_levs : quest_levs.timestamp - @ $(ECHO) "quest levels are up to date." -dungeon : $(DUNGEON) - @ $(ECHO) "dungeon is up to date." +#spec_levs : spev_levs.timestamp +# @ $(ECHO) "special levels are up to date." +#quest_levs : quest_levs.timestamp +# @ $(ECHO) "quest levels are up to date." +#dungeon : $(DUNGEON) +# @ $(ECHO) "dungeon is up to date." data : data.; @ $(NOOP) rumors : rumors.; @@ -71,15 +72,15 @@ $(MAKEDEFS) : $(UTILMARKER) $(MAKE)$(MAKEFLAGS) $(MAKEDEFS) @ $(CD) $(DAT) -$(DGNCOMP) : $(UTILMARKER) - $(CD) $(UTL) - $(MAKE)$(MAKEFLAGS) $(DGNCOMP) - @ $(CD) $(DAT) +#$(DGNCOMP) : $(UTILMARKER) +# $(CD) $(UTL) +# $(MAKE)$(MAKEFLAGS) $(DGNCOMP) +# @ $(CD) $(DAT) -$(LEVCOMP) : $(UTILMARKER) - $(CD) $(UTL) - $(MAKE)$(MAKEFLAGS) $(LEVCOMP) - @ $(CD) $(DAT) +#$(LEVCOMP) : $(UTILMARKER) +# $(CD) $(UTL) +# $(MAKE)$(MAKEFLAGS) $(LEVCOMP) +# @ $(CD) $(DAT) $(DLB) : $(UTILMARKER) $(CD) $(UTL) @@ -122,27 +123,27 @@ oracles.; : oracles.txt $(MAKEDEFS) options.; : $(MAKEDEFS) $(RUN) $(MAKEDEFS) -v -spec_levs.timestamp; : $(SPECLEVS) $(LEVCOMP) - $(RUN) $(LEVCOMP) $(SPECLEVS) - $(TOUCH) spec_levs.timestamp; +#spec_levs.timestamp; : $(SPECLEVS) $(LEVCOMP) +# $(RUN) $(LEVCOMP) $(SPECLEVS) +# $(TOUCH) spec_levs.timestamp; -quest_levs.timestamp; : $(QUESTLEVS) $(LEVCOMP) - $(RUN) $(LEVCOMP) $(QUESTLEVS) - $(TOUCH) quest_levs.timestamp; +#quest_levs.timestamp; : $(QUESTLEVS) $(LEVCOMP) +# $(RUN) $(LEVCOMP) $(QUESTLEVS) +# $(TOUCH) quest_levs.timestamp; -$(DUNGEON) : dungeon.def $(MAKEDEFS) $(DGNCOMP) - $(RUN) $(MAKEDEFS) -e !dungeon.def -> dungeon.pdf - $(RUN) $(DGNCOMP) dungeon.pdf !dungeon.pdr -> dungeon +#$(DUNGEON) : dungeon.def $(MAKEDEFS) $(DGNCOMP) +# $(RUN) $(MAKEDEFS) -e !dungeon.def -> dungeon.pdf +# $(RUN) $(DGNCOMP) dungeon.pdf !dungeon.pdr -> dungeon clean : - if f$search("*.*;-1").nes."" then purge - - if f$search("dungeon.pdf").nes."" then delete dungeon.pdf; - - if f$search("*.timestamp").nes."" then delete $(MARKERS) +# - if f$search("dungeon.pdf").nes."" then delete dungeon.pdf; +# - if f$search("*.timestamp").nes."" then delete $(MARKERS) spotless : clean - delete $(VARDAT) - - if f$search("$(DUNGEON)").nes."" then delete $(DUNGEON) - - if f$search("*.lev").nes."" then delete *.lev; +# - if f$search("$(DUNGEON)").nes."" then delete $(DUNGEON) +# - if f$search("*.lev").nes."" then delete *.lev; - if f$search("$(X11TILES)").nes."" then delete $(X11TILES) - if f$search("*.x%m").nes."" then delete *.x%m; !*.xbm,*.xpm - if f$search("nh*.dlb").nes."" then delete nh*.dlb; diff --git a/sys/vms/Makefile.src b/sys/vms/Makefile.src index 679ecf540..559f974c0 100644 --- a/sys/vms/Makefile.src +++ b/sys/vms/Makefile.src @@ -1,5 +1,5 @@ # NetHack Makefile (VMS) - for building nethack itself. -# NetHack 3.6 Makefile.src $NHDT-Date: 1557701798 2019/05/12 22:56:38 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.36 $ +# NetHack 3.6 Makefile.src $NHDT-Date: 1573165004 2019/11/07 22:16:44 $ $NHDT-Branch: paxed-lua-v2-merged $:$NHDT-Revision: 1.38 $ # Copyright (c) 2011 by Robert Patrick Rankin # NetHack may be freely redistributed. See license for details. @@ -28,7 +28,8 @@ UTL = [-.util] VMS = [-.sys.vms] WINSHR = [-.win.share] X11 = [-.win.X11] - +#LUA source tree parallel to NetHack tree in lua535 directory +LUA = [-.-.lua535.src] MAKEFILE= $(SRC)Makefile. # if you are using gcc as your compiler: @@ -37,8 +38,8 @@ MAKEFILE= $(SRC)Makefile. # set option flags for C compiler and linker # -CFLAGS = /Prefix=All/Incl=$(INC)/noList # DECC in native mode -#CFLAGS = /Include=$(INC)/noList # VAXC or GNUC +CFLAGS = /Prefix=All/Incl=$(INC),$(LUA)/noList # DECC in native mode +#CFLAGS = /Include=$(INC),$(LUA)/noList # VAXC or GNUC #LFLAGS = /Debug/Map/Cross_Ref # for development #LFLAGS = /noTraceback/noMap # for installing w/ privs LFLAGS = /noMap @@ -174,7 +175,7 @@ VERSOURCES = $(HACKCSRC) $(SYSSRC) $(WINSRC) $(RANDSRC) $(GENCSRC) HACKINCL = align.h amiconf.h artifact.h artilist.h attrib.h beconf.h color.h \ config.h config1.h context.h coord.h decl.h def_os2.h display.h \ dlb.h dungeon.h engrave.h extern.h flag.h func_tab.h global.h \ - hack.h lev.h macconf.h mextra.h mfndpos.h micro.h mkroom.h \ + hack.h macconf.h mextra.h mfndpos.h micro.h mkroom.h \ monattk.h mondata.h monflag.h monst.h monsym.h obj.h objclass.h \ os2conf.h patchlevel.h pcconf.h permonst.h prop.h rect.h \ region.h rm.h sp_lev.h spell.h sys.h system.h tcap.h timeout.h \ @@ -210,6 +211,29 @@ HOBJ6 = u_init.obj,uhitm.obj,vault.obj,vision.obj,vis_tab.obj,weapon.obj, \ HOBJ = $(FIRSTOBJ) $(SYSOBJ) $(WINOBJ) $(RANDOBJ) \ $(HOBJ1) $(HOBJ2) $(HOBJ3) $(HOBJ4) $(HOBJ5) $(HOBJ6) +LUAOBJ = nhlua.o,nhlsel.o +LUALIBSRC = $(LUA)lapi.c $(LUA)lauxlib.c $(LUA)lbaselib.c \ + $(LUA)lbitlib.c $(LUA)lcode.c $(LUA)lcorolib.c \ + $(LUA)lctype.c $(LUA)ldblib.c $(LUA)ldebug.c \ + $(LUA)ldo.c $(LUA)ldump.c $(LUA)lfunc.c $(LUA)lgc.c \ + $(LUA)linit.c $(LUA)liolib.c $(LUA)llex.c \ + $(LUA)lmathlib.c $(LUA)lmem.c $(LUA)loadlib.c \ + $(LUA)lobject.c $(LUA)lopcodes.c $(LUA)loslib.c \ + $(LUA)lparser.c $(LUA)lstate.c $(LUA)lstring.c \ + $(LUA)lstrlib.c $(LUA)ltable.c $(LUA)ltablib.c \ + $(LUA)ltm.c $(LUA)lundump.c $(LUA)lutf8lib.c \ + $(LUA)lvm.c $(LUA)lzio.c + +LUALIBOBJ1 = lapi.obj,lauxlib.obj,lbaselib.obj,lbitlib.obj, \ + lcode.obj,lcorolib.obj,lctype.obj,ldblib.obj +LUALIBOBJ2 = ldebug.obj,ldo.obj,ldump.obj,lfunc.obj, \ + lgc.obj,linit.obj,liolib.obj,llex.obj +LUALIBOBJ3 = lmathlib.obj,lmem.obj,loadlib.obj,lobject.obj, \ + lopcodes.obj,loslib.obj,lparser.obj,lstate.obj +LUALIBOBJ4 = lstring.obj,lstrlib.obj,ltable.obj,ltablib.obj, \ + ltm.obj,lundump.obj,lutf8lib.obj,lvm.obj,lzio.obj +LUALIBOBJ = $(LUALIBOBJ1) $(LUALIBOBJ2) $(LUALIBOBJ3) $(LUALIBOBJ4) + # simpler target name nethack : $(GAME) @ $(ECHO) "nethack is up to date." @@ -217,7 +241,7 @@ nethack : $(GAME) $(GAME) : $(SYSTEM) @ $(NOOP) -$(SYSTEM) : $(LIBOPT) $(ID_OPT) $(HOBJ) nethack.opt +$(SYSTEM) : $(LIBOPT) $(ID_OPT) $(HOBJ) $(LUAOBJ) $(LUALIBOBJ) nethack.opt @ $(ECHO) "Linking ..." $(LINK)/Exe=$(GAME) $(LFLAGS) nethack.opt/Opt,$(LIBOPT)/Opt,$(ID_OPT)/Opt $(TOUCH) $(SYSTEM) @@ -239,6 +263,11 @@ nethack.opt : $(MAKEFILE) # this file @ write f f$edit("$(HOBJ4)","COLLAPSE") @ write f f$edit("$(HOBJ5)","COLLAPSE") @ write f f$edit("$(HOBJ6)","COLLAPSE") + @ write f f$edit("$(LUAOBJ)","COLLAPSE") + @ write f f$edit("$(LUALIBOBJ1)","COLLAPSE") + @ write f f$edit("$(LUALIBOBJ2)","COLLAPSE") + @ write f f$edit("$(LUALIBOBJ3)","COLLAPSE") + @ write f f$edit("$(LUALIBOBJ4)","COLLAPSE") @ write f "sys$library:starlet.olb/Include=(lib$initialize) @ write f "! psect_attributes Usr, noPic, and Long removed" @ write f "psect_attr=lib$initialize, Con,Rel,Gbl,noShr,noExe,Rd,noWrt" @@ -284,7 +313,7 @@ $(MAKEDEFS) : $(FIRSTOBJ) $(UTL)makedefs.c \ $(CONFIG_H) $(INC)permonst.h $(INC)objclass.h \ $(INC)monsym.h $(INC)artilist.h $(INC)dungeon.h \ $(INC)obj.h $(INC)monst.h $(INC)you.h $(INC)flag.h \ - $(INC)dlb.h $(INC)patchlevel.h $(INC)qtext.h \ + $(INC)dlb.h $(INC)patchlevel.h \ $(LIBOPT) $(ID_OPT) $(CD) $(UTL) $(MAKE)$(MAKEFLAGS) $(MAKEDEFS) @@ -420,6 +449,41 @@ wintext.obj : $(X11)wintext.c $(HACK_H) $(INC)winX.h $(INC)xwindow.h winval.obj : $(X11)winval.c $(HACK_H) $(INC)winX.h tile.obj : $(SRC)tile.c $(HACK_H) vis_tab.obj : vis_tab.c $(CONFIG_H) $(INC)vis_tab.h +# lua 5.3.5 code +lapi.obj : $(LUA)lapi.c +lauxlib.obj : $(LUA)lauxlib.c +lbaselib.obj : $(LUA)lbaselib.c +lbitlib.obj : $(LUA)lbitlib.c +lcode.obj : $(LUA)lcode.c +lcorolib.obj : $(LUA)lcorolib.c +lctype.obj : $(LUA)lctype.c +ldblib.obj : $(LUA)ldblib.c +ldebug.obj : $(LUA)ldebug. +ldo.obj : $(LUA)ldo.c +ldump.obj : $(LUA)ldump.c +lfunc.obj : $(LUA)lfunc.c +lgc.obj : $(LUA)lgc.c +linit.obj : $(LUA)linit.c +liolib.obj : $(LUA)liolib.c +llex.obj : $(LUA)llex.c +lmathlib.obj : $(LUA)lmathlib.c +lmem.obj : $(LUA)lmem.c +loadlib.obj : $(LUA)loadlib.c +lobject.obj : $(LUA)lobject.c +lopcodes.obj : $(LUA)lopcodes.c +loslib.obj : $(LUA)loslib.c +lparser.obj : $(LUA)lparser.c +lstate.obj : $(LUA)lstate.c +lstring.obj : $(LUA)lstring.c +lstrlib.obj : $(LUA)lstrlib.c +ltable.obj : $(LUA)ltable.c +ltablib.obj : $(LUA)ltablib.c +ltm.obj : $(LUA)ltm.c +lundump.obj : $(LUA)lundump.c +lutf8lib.obj : $(LUA)lutf8lib.c +lvm.obj : $(LUA)lvm.c +lzio.obj : $(LUA)lzio.c + # general code allmain.obj : allmain.c $(HACK_H) alloc.obj : alloc.c $(CONFIG_H) @@ -427,16 +491,16 @@ apply.obj : apply.c $(HACK_H) artifact.obj : artifact.c $(HACK_H) $(INC)artifact.h $(INC)artilist.h attrib.obj : attrib.c $(HACK_H) ball.obj : ball.c $(HACK_H) -bones.obj : bones.c $(HACK_H) $(INC)lev.h +bones.obj : bones.c $(HACK_H) botl.obj : botl.c $(HACK_H) -cmd.obj : cmd.c $(HACK_H) $(INC)lev.h $(INC)func_tab.h +cmd.obj : cmd.c $(HACK_H) $(INC)func_tab.h dbridge.obj : dbridge.c $(HACK_H) decl.obj : decl.c $(HACK_H) detect.obj : detect.c $(HACK_H) $(INC)artifact.h dig.obj : dig.c $(HACK_H) display.obj : display.c $(HACK_H) dlb.obj : dlb.c $(CONFIG_H) $(INC)dlb.h -do.obj : do.c $(HACK_H) $(INC)lev.h +do.obj : do.c $(HACK_H) do_name.obj : do_name.c $(HACK_H) do_wear.obj : do_wear.c $(HACK_H) dog.obj : dog.c $(HACK_H) @@ -444,10 +508,10 @@ dogmove.obj : dogmove.c $(HACK_H) $(INC)mfndpos.h dokick.obj : dokick.c $(HACK_H) dothrow.obj : dothrow.c $(HACK_H) drawing.obj : drawing.c $(HACK_H) $(INC)tcap.h -dungeon.obj : dungeon.c $(HACK_H) $(INC)dgn_file.h $(INC)dlb.h $(INC)lev.h +dungeon.obj : dungeon.c $(HACK_H) $(INC)dgn_file.h $(INC)dlb.h eat.obj : eat.c $(HACK_H) -end.obj : end.c $(HACK_H) $(INC)lev.h $(INC)dlb.h -engrave.obj : engrave.c $(HACK_H) $(INC)lev.h +end.obj : end.c $(HACK_H) $(INC)dlb.h +engrave.obj : engrave.c $(HACK_H) exper.obj : exper.c $(HACK_H) explode.obj : explode.c $(HACK_H) extralev.obj : extralev.c $(HACK_H) @@ -456,7 +520,7 @@ fountain.obj : fountain.c $(HACK_H) hack.obj : hack.c $(HACK_H) hacklib.obj : hacklib.c $(HACK_H) invent.obj : invent.c $(HACK_H) -light.obj : light.c $(HACK_H) $(INC)lev.h +light.obj : light.c $(HACK_H) lock.obj : lock.c $(HACK_H) mail.obj : mail.c $(HACK_H) $(INC)mail.h makemon.obj : makemon.c $(HACK_H) @@ -467,7 +531,7 @@ mhitu.obj : mhitu.c $(HACK_H) $(INC)artifact.h minion.obj : minion.c $(HACK_H) mklev.obj : mklev.c $(HACK_H) mkmap.obj : mkmap.c $(HACK_H) $(INC)sp_lev.h -mkmaze.obj : mkmaze.c $(HACK_H) $(INC)sp_lev.h $(INC)lev.h +mkmaze.obj : mkmaze.c $(HACK_H) $(INC)sp_lev.h mkobj.obj : mkobj.c $(HACK_H) mkroom.obj : mkroom.c $(HACK_H) mon.obj : mon.c $(HACK_H) $(INC)mfndpos.h @@ -480,7 +544,7 @@ mplayer.obj : mplayer.c $(HACK_H) mthrowu.obj : mthrowu.c $(HACK_H) muse.obj : muse.c $(HACK_H) music.obj : music.c $(HACK_H) #interp.c -o_init.obj : o_init.c $(HACK_H) $(INC)lev.h +o_init.obj : o_init.c $(HACK_H) objects.obj : objects.c $(CONFIG_H) $(INC)obj.h $(INC)objclass.h \ $(INC)prop.h $(INC)skills.h $(INC)color.h objnam.obj : objnam.c $(HACK_H) @@ -493,17 +557,17 @@ polyself.obj : polyself.c $(HACK_H) potion.obj : potion.c $(HACK_H) pray.obj : pray.c $(HACK_H) priest.obj : priest.c $(HACK_H) $(INC)mfndpos.h -quest.obj : quest.c $(HACK_H) $(INC)qtext.h -questpgr.obj : questpgr.c $(HACK_H) $(INC)dlb.h $(INC)qtext.h +quest.obj : quest.c $(HACK_H) +questpgr.obj : questpgr.c $(HACK_H) $(INC)dlb.h read.obj : read.c $(HACK_H) rect.obj : rect.c $(HACK_H) -region.obj : region.c $(HACK_H) $(INC)lev.h -restore.obj : restore.c $(HACK_H) $(INC)lev.h $(INC)tcap.h +region.obj : region.c $(HACK_H) +restore.obj : restore.c $(HACK_H) $(INC)tcap.h rip.obj : rip.c $(HACK_H) rnd.obj : rnd.c $(HACK_H) role.obj : role.c $(HACK_H) -rumors.obj : rumors.c $(HACK_H) $(INC)lev.h $(INC)dlb.h -save.obj : save.c $(HACK_H) $(INC)lev.h +rumors.obj : rumors.c $(HACK_H) $(INC)dlb.h +save.obj : save.c $(HACK_H) shk.obj : shk.c $(HACK_H) shknam.obj : shknam.c $(HACK_H) sit.obj : sit.c $(HACK_H) $(INC)artifact.h @@ -514,7 +578,7 @@ steal.obj : steal.c $(HACK_H) steed.obj : steed.c $(HACK_H) sys.obj : sys.c $(HACK_H) teleport.obj : teleport.c $(HACK_H) -timeout.obj : timeout.c $(HACK_H) $(INC)lev.h +timeout.obj : timeout.c $(HACK_H) topten.obj : topten.c $(HACK_H) $(INC)dlb.h $(INC)patchlevel.h track.obj : track.c $(HACK_H) trap.obj : trap.c $(HACK_H) @@ -527,8 +591,8 @@ weapon.obj : weapon.c $(HACK_H) were.obj : were.c $(HACK_H) wield.obj : wield.c $(HACK_H) windows.obj : windows.c $(HACK_H) $(INC)wingem.h $(INC)winGnome.h -wizard.obj : wizard.c $(HACK_H) $(INC)qtext.h -worm.obj : worm.c $(HACK_H) $(INC)lev.h +wizard.obj : wizard.c $(HACK_H) +worm.obj : worm.c $(HACK_H) worn.obj : worn.c $(HACK_H) write.obj : write.c $(HACK_H) zap.obj : zap.c $(HACK_H) diff --git a/sys/vms/Makefile.utl b/sys/vms/Makefile.utl index 88ff37c29..713a37995 100644 --- a/sys/vms/Makefile.utl +++ b/sys/vms/Makefile.utl @@ -27,8 +27,8 @@ WINSHR = [-.win.share] WINX11 = [-.win.X11] # targets, with enough punctuation to keep MCR and DELETE happy MAKEDEFS= $(UTL)makedefs.exe; -LEVCOMP = $(UTL)lev_comp.exe; -DGNCOMP = $(UTL)dgn_comp.exe; +#LEVCOMP = $(UTL)lev_comp.exe; +#DGNCOMP = $(UTL)dgn_comp.exe; DLB = $(UTL)dlb.exe; RECOVER = $(UTL)recover.exe; # used by $(DAT)Makefile for synchronization @@ -62,17 +62,17 @@ LINK = link # # yacc/lex programs to use to generate *_comp.c, *_comp.h, and *_lex.c. # choose xxxOUT that matches xxx tool's output -YACC = bison /Define -LEX = flex +#YACC = bison /Define +#LEX = flex #YACC = yacc -d #LEX = lex #YACC = posix/Run posix$bin:yacc. "-d #LEX = posix/Run posix$bin:lex. " # blank means foo.y -> foo_tab.c & foo_tab.h -YACCOUT = # bison +#YACCOUT = # bison #YACCOUT = ytab # VMS POSIX #YACCOUT = y_tab # DEC/Shell -LEXOUT = lexyy # flex +#LEXOUT = lexyy # flex #LEXOUT = lex_yy # VMS POSIX @@ -88,8 +88,8 @@ HACK_H = $(SRC)hack.h-t # utility .c files MAKESRC = makedefs.c -SPLEVSRC = lev_yacc.c lev_lex.c lev_main.c -DGNCOMPSRC = dgn_yacc.c dgn_lex.c dgn_main.c +#SPLEVSRC = lev_yacc.c lev_lex.c lev_main.c +#DGNCOMPSRC = dgn_yacc.c dgn_lex.c dgn_main.c RECOVSRC = recover.c DLBSRC = dlb_main.c UTILSRCS = $(MAKESRC) $(SPLEVSRC) $(DGNCOMPSRC) $(RECOVSRC) $(DLBSRC) panic.c @@ -105,11 +105,11 @@ NAMEOBJS = $(NAMEOBJ1),$(NAMEOBJ2) MAKEOBJS = makedefs.obj,$(NAMEOBJ1) # object files for special levels compiler -SPLEVOBJS = lev_main.obj,lev_yacc.obj,lev_lex.obj,panic.obj,\ - $(SRC)alloc.obj,$(NAMEOBJS) +#SPLEVOBJS = lev_main.obj,lev_yacc.obj,lev_lex.obj,panic.obj,\ +# $(SRC)alloc.obj,$(NAMEOBJS) # object files for dungeon compiler -DGNCOMPOBJS = dgn_main.obj,dgn_yacc.obj,dgn_lex.obj,panic.obj,$(SRC)alloc.obj +#DGNCOMPOBJS = dgn_main.obj,dgn_yacc.obj,dgn_lex.obj,panic.obj,$(SRC)alloc.obj # object files for recovery utility RECOVOBJS = recover.obj @@ -138,10 +138,10 @@ no_lex : # alternate target names for possible interactive use makedefs : $(MAKEDEFS) @ $(ECHO) "makedefs is up to date." -lev_comp : $(LEVCOMP) - @ $(ECHO) "lev_comp is up to date." -dgn_comp : $(DGNCOMP) - @ $(ECHO) "dgn_comp is up to date." +#lev_comp : $(LEVCOMP) +# @ $(ECHO) "lev_comp is up to date." +#dgn_comp : $(DGNCOMP) +# @ $(ECHO) "dgn_comp is up to date." recover : $(RECOVER) @ $(ECHO) "recover is up to date." dlb : $(DLB) @@ -167,7 +167,7 @@ makedefs.obj : makedefs.c \ $(CONFIG_H) $(INC)permonst.h $(INC)objclass.h \ $(INC)monsym.h $(INC)artilist.h $(INC)dungeon.h \ $(INC)obj.h $(INC)monst.h $(INC)you.h $(INC)flag.h \ - $(INC)dlb.h $(INC)patchlevel.h $(INC)qtext.h + $(INC)dlb.h $(INC)patchlevel.h $(INC)onames.h : $(MAKEDEFS) $(RUN) $(MAKEDEFS) -o @@ -187,66 +187,66 @@ $(INC)date.h : $(MAKEDEFS) # dependencies for lev_comp # -$(LEVCOMP) : $(SPLEVOBJS) $(VMSOBJS) $(LIBOPT) $(ID_OPT) - $(LINK)/Exe=$(LEVCOMP) $(LFLAGS) $(SPLEVOBJS),$(VMSOBJS),$(LIBS) - -lev_yacc.obj : $(HACK_H) $(INC)sp_lev.h lev_yacc.c - $(CC) $(CFLAGS) lev_yacc.c -lev_lex.obj : $(HACK_H) $(INC)lev_comp.h $(INC)sp_lev.h lev_lex.c - @ if f$search("lev_lex.h").nes."" then $(MOVE) lev_lex.h stdio.h - $(CC) $(CFLAGS) lev_lex.c - @ if f$search("stdio.h").nes."" then $(MOVE) stdio.h lev_lex.h -lev_main.obj : $(HACK_H) $(INC)sp_lev.h $(INC)tcap.h $(INC)date.h lev_main.c - $(CC) $(CFLAGS) lev_main.c +#$(LEVCOMP) : $(SPLEVOBJS) $(VMSOBJS) $(LIBOPT) $(ID_OPT) +# $(LINK)/Exe=$(LEVCOMP) $(LFLAGS) $(SPLEVOBJS),$(VMSOBJS),$(LIBS) +# +#lev_yacc.obj : $(HACK_H) $(INC)sp_lev.h lev_yacc.c +# $(CC) $(CFLAGS) lev_yacc.c +#lev_lex.obj : $(HACK_H) $(INC)lev_comp.h $(INC)sp_lev.h lev_lex.c +# @ if f$search("lev_lex.h").nes."" then $(MOVE) lev_lex.h stdio.h +# $(CC) $(CFLAGS) lev_lex.c +# @ if f$search("stdio.h").nes."" then $(MOVE) stdio.h lev_lex.h +#lev_main.obj : $(HACK_H) $(INC)sp_lev.h $(INC)tcap.h $(INC)date.h lev_main.c +# $(CC) $(CFLAGS) lev_main.c panic.obj : $(CONFIG_H) $(CC) $(CFLAGS) panic.c -$(INC)lev_comp.h : lev_yacc.c - $(TOUCH) $(INC)lev_comp.h - -lev_yacc.c : lev_comp.y - $(YACC) lev_comp.y - $(MUNG) 'f$parse("$(YACCOUT)","lev_comp_tab.c")' "#module" /Outp=lev_yacc.c - @ if f$search("''f$parse("$(YACCOUT)","lev_comp_tab.c")'").nes."" then \ - $(RM) 'f$parse("$(YACCOUT)","lev_comp_tab.c")' - $(MOVE) 'f$parse("$(YACCOUT)","lev_comp_tab.h")' $(INC)lev_comp.h - -lev_lex.c : lev_comp.l - $(LEX) lev_comp.l - $(MUNG) 'f$parse("$(LEXOUT)","lev_comp_lex.c")' "#module" /Outp=lev_lex.c - @ if f$search("''f$parse("$(LEXOUT)","lev_comp_lex.c")'").nes."" then \ - $(RM) 'f$parse("$(LEXOUT)","lev_comp_lex.c")' - +#$(INC)lev_comp.h : lev_yacc.c +# $(TOUCH) $(INC)lev_comp.h +#lev_yacc.c : lev_comp.y +# $(YACC) lev_comp.y +# $(MUNG) 'f$parse("$(YACCOUT)","lev_comp_tab.c")' "#module" /Outp=lev_yacc.c +# @ if f$search("''f$parse("$(YACCOUT)","lev_comp_tab.c")'").nes."" then \ +# $(RM) 'f$parse("$(YACCOUT)","lev_comp_tab.c")' +# $(MOVE) 'f$parse("$(YACCOUT)","lev_comp_tab.h")' $(INC)lev_comp.h +# +#lev_lex.c : lev_comp.l +# $(LEX) lev_comp.l +# $(MUNG) 'f$parse("$(LEXOUT)","lev_comp_lex.c")' "#module" /Outp=lev_lex.c +# @ if f$search("''f$parse("$(LEXOUT)","lev_comp_lex.c")'").nes."" then \ +# $(RM) 'f$parse("$(LEXOUT)","lev_comp_lex.c")' +# +# # dependencies for dgn_comp # -$(DGNCOMP) : $(DGNCOMPOBJS) $(VMSOBJS) $(LIBOPT) $(ID_OPT) - $(LINK)/Exe=$(DGNCOMP) $(LFLAGS) $(DGNCOMPOBJS),$(VMSOBJS),$(LIBS) - -dgn_yacc.obj : $(CONFIG_H) $(INC)dgn_file.h $(INC)date.h dgn_yacc.c - $(CC) $(CFLAGS) dgn_yacc.c -dgn_lex.obj : $(CONFIG_H) $(INC)dgn_comp.h $(INC)dgn_file.h dgn_lex.c - @ if f$search("lev_lex.h").nes."" then $(MOVE) lev_lex.h stdio.h - $(CC) $(CFLAGS) dgn_lex.c - @ if f$search("stdio.h").nes."" then $(MOVE) stdio.h lev_lex.h -dgn_main.obj : $(CONFIG_H) dgn_main.c - $(CC) $(CFLAGS) dgn_main.c - -$(INC)dgn_comp.h : dgn_yacc.c - $(TOUCH) $(INC)dgn_comp.h - -dgn_yacc.c : dgn_comp.y - $(YACC) dgn_comp.y - $(MUNG) 'f$parse("$(YACCOUT)","dgn_comp_tab.c")' "#module" /Outp=dgn_yacc.c - @ if f$search("''f$parse("$(YACCOUT)","dgn_comp_tab.c")'").nes."" then \ - $(RM) 'f$parse("$(YACCOUT)","dgn_comp_tab.c")' - $(MOVE) 'f$parse("$(YACCOUT)","dgn_comp_tab.h")' $(INC)dgn_comp.h - -dgn_lex.c : dgn_comp.l - $(LEX) dgn_comp.l - $(MUNG) 'f$parse("$(LEXOUT)","dgn_comp_lex.c")' "#module" /Outp=dgn_lex.c - @ if f$search("''f$parse("$(LEXOUT)","dgn_comp_lex.c")'").nes."" then \ - $(RM) 'f$parse("$(LEXOUT)","dgn_comp_lex.c")' +#$(DGNCOMP) : $(DGNCOMPOBJS) $(VMSOBJS) $(LIBOPT) $(ID_OPT) +# $(LINK)/Exe=$(DGNCOMP) $(LFLAGS) $(DGNCOMPOBJS),$(VMSOBJS),$(LIBS) +# +#dgn_yacc.obj : $(CONFIG_H) $(INC)dgn_file.h $(INC)date.h dgn_yacc.c +# $(CC) $(CFLAGS) dgn_yacc.c +#dgn_lex.obj : $(CONFIG_H) $(INC)dgn_comp.h $(INC)dgn_file.h dgn_lex.c +# @ if f$search("lev_lex.h").nes."" then $(MOVE) lev_lex.h stdio.h +# $(CC) $(CFLAGS) dgn_lex.c +# @ if f$search("stdio.h").nes."" then $(MOVE) stdio.h lev_lex.h +#dgn_main.obj : $(CONFIG_H) dgn_main.c +# $(CC) $(CFLAGS) dgn_main.c +# +#$(INC)dgn_comp.h : dgn_yacc.c +# $(TOUCH) $(INC)dgn_comp.h +# +#dgn_yacc.c : dgn_comp.y +# $(YACC) dgn_comp.y +# $(MUNG) 'f$parse("$(YACCOUT)","dgn_comp_tab.c")' "#module" /Outp=dgn_yacc.c +# @ if f$search("''f$parse("$(YACCOUT)","dgn_comp_tab.c")'").nes."" then \ +# $(RM) 'f$parse("$(YACCOUT)","dgn_comp_tab.c")' +# $(MOVE) 'f$parse("$(YACCOUT)","dgn_comp_tab.h")' $(INC)dgn_comp.h +# +#dgn_lex.c : dgn_comp.l +# $(LEX) dgn_comp.l +# $(MUNG) 'f$parse("$(LEXOUT)","dgn_comp_lex.c")' "#module" /Outp=dgn_lex.c +# @ if f$search("''f$parse("$(LEXOUT)","dgn_comp_lex.c")'").nes."" then \ +# $(RM) 'f$parse("$(LEXOUT)","dgn_comp_lex.c")' # dependencies for recover @@ -363,13 +363,13 @@ clean : - if f$search("*.obj") .nes."" then $(RM) *.obj; spotless : clean - - if f$search("%%%_lex.c") .nes."" then $(RM) %%%_lex.c; - - if f$search("%%%_yacc.c").nes."" then $(RM) %%%_yacc.c; - - if f$search("$(INC)%%%_comp.h").nes."" then $(RM) $(INC)%%%_comp.h;* +# - if f$search("%%%_lex.c") .nes."" then $(RM) %%%_lex.c; +# - if f$search("%%%_yacc.c").nes."" then $(RM) %%%_yacc.c; +# - if f$search("$(INC)%%%_comp.h").nes."" then $(RM) $(INC)%%%_comp.h;* - if f$search("$(INC)tile.h").nes."" then $(RM) $(INC)tile.h;* - - if f$search("lev_lex.h") .nes."" then $(RM) lev_lex.h; +# - if f$search("lev_lex.h") .nes."" then $(RM) lev_lex.h; - if f$search("*tab.c") .nes."" then $(RM) *tab.c; - if f$search("*.exe").nes."" then \ - $(RM) $(MAKEDEFS),$(LEVCOMP),$(DGNCOMP),$(RECOVER),$(DLB) + $(RM) $(MAKEDEFS),$(RECOVER),$(DLB) - if f$search("*.exe").nes."" then $(RM) $(TILEUTILS) - if f$search("$(MARKER)").nes."" then $(RM) $(MARKER) diff --git a/sys/vms/install.com b/sys/vms/install.com index eecbca319..076d16db8 100755 --- a/sys/vms/install.com +++ b/sys/vms/install.com @@ -1,9 +1,9 @@ $ ! vms/install.com -- set up nethack 'playground' -$! $NHDT-Date: 1542388600 2018/11/16 17:16:40 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.11 $ +$! $NHDT-Date: 1573172443 2019/11/08 00:20:43 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.12 $ $! Copyright (c) 2016 by Robert Patrick Rankin $! NetHack may be freely redistributed. See license for details. $ ! -$ ! $NHDT-Date: 1542388600 2018/11/16 17:16:40 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.11 $ +$ ! $NHDT-Date: 1573172452 2019/11/08 00:20:52 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.12 $ $ ! $ ! Use vmsbuild.com to create nethack.exe, makedefs, and lev_comp *first*. $ ! @@ -35,21 +35,31 @@ $ sysconf_file = "[.sys.vms]sysconf" $ guidebook = "[.doc]Guidebook.txt" $ invoc_proc = "[.sys.vms]nethack.com" $ trmcp_file = "[.sys.share]termcap" -$ spec_files = "AIR.LEV,ASMODEUS.LEV,ASTRAL.LEV,BAALZ.LEV,BIGRM-%.LEV," - - + "CASTLE.LEV,EARTH.LEV,FAKEWIZ%.LEV,FIRE.LEV," - - + "JUIBLEX.LEV,KNOX.LEV,MEDUSA-%.LEV,MINEFILL.LEV," - - + "MINETN-%.LEV,MINEND-%.LEV,ORACLE.LEV,ORCUS.LEV," - - + "SANCTUM.LEV,SOKO%-%.LEV,TOWER%.LEV,VALLEY.LEV," - - + "WATER.LEV,WIZARD%.LEV" -$ spec_input = "bigroom.des castle.des endgame.des " - - + "gehennom.des knox.des medusa.des mines.des " - - + "oracle.des sokoban.des tower.des yendor.des" -$ qstl_files = "%%%-GOAL.LEV,%%%-FIL%.LEV,%%%-LOCA.LEV,%%%-STRT.LEV" -$ qstl_input = "Arch.des Barb.des Caveman.des Healer.des " - - + "Knight.des Monk.des Priest.des Ranger.des Rogue.des " - - + "Samurai.des Tourist.des Wizard.des Valkyrie.des" -$ dngn_files = "DUNGEON." -$ dngn_input = "dungeon.pdf" +$ spec_files = "air.lua,asmodeus.lua,astral.lua,baalz.lua," - + + "bigrm-*.lua,castle.lua,earth.lua,fakewiz%.lua," - + + "fire.lua,juiblex.lua,knox.lua,medusa-%.lua," - + + "minefill.lua,minetn-%.lua,minend-%.lua,nhlib.lua," - + + "oracle.lua,orcus.lua,sanctum.lua,soko%-%.lua," - + + "tower%.lua,valley.lua,water.lua,wizard%.lua" +$ qstl_files = "%%%-goal.lua,%%%-fil%.lua,%%%-loca.lua,%%%-strt.lua" +$ dngn_files = "dungeon.lua" +$! +$! spec_files = "AIR.LEV,ASMODEUS.LEV,ASTRAL.LEV,BAALZ.LEV,BIGRM-%.LEV," - +$! + "CASTLE.LEV,EARTH.LEV,FAKEWIZ%.LEV,FIRE.LEV," - +$! + "JUIBLEX.LEV,KNOX.LEV,MEDUSA-%.LEV,MINEFILL.LEV," - +$! + "MINETN-%.LEV,MINEND-%.LEV,ORACLE.LEV,ORCUS.LEV," - +$! + "SANCTUM.LEV,SOKO%-%.LEV,TOWER%.LEV,VALLEY.LEV," - +$! + "WATER.LEV,WIZARD%.LEV" +$! spec_input = "bigroom.des castle.des endgame.des " - +$! + "gehennom.des knox.des medusa.des mines.des " - +$! + "oracle.des sokoban.des tower.des yendor.des" +$! qstl_files = "%%%-GOAL.LEV,%%%-FIL%.LEV,%%%-LOCA.LEV,%%%-STRT.LEV" +$! qstl_input = "Arch.des Barb.des Caveman.des Healer.des " - +$! + "Knight.des Monk.des Priest.des Ranger.des Rogue.des " - +$! + "Samurai.des Tourist.des Wizard.des Valkyrie.des" +$! dngn_files = "DUNGEON." +$! dngn_input = "dungeon.pdf" +$! $ dlb_files = help_files + "," + data_files + "," - + spec_files + "," + qstl_files + "," + dngn_files $ data_libry = "nh-data.dlb" @@ -91,15 +101,15 @@ $ makedefs -h !oracles.txt -> oracles $ milestone "(dungeon preprocess)" $ makedefs -s $ milestone "(engrave, epitaph, bogusmon)" -$ makedefs -e !dungeon.def -> dungeon.pdf -$ milestone "(quest text)" +$! makedefs -e !dungeon.def -> dungeon.pdf +$! milestone "(quest text)" $ makedefs -q !quest.txt -> quest.dat $ milestone "(special levels)" -$ lev_comp 'spec_input' !special levels -$ milestone "(quest levels)" -$ lev_comp 'qstl_input' !quest levels -$ milestone "(dungeon compile)" -$ dgn_comp 'dngn_input' !dungeon database +$! lev_comp 'spec_input' !special levels +$! milestone "(quest levels)" +$! lev_comp 'qstl_input' !quest levels +$! milestone "(dungeon compile)" +$! dgn_comp 'dngn_input' !dungeon database $ set default [-] !move up $ if p3.nes."" .and. f$edit(p3,"UPCASE").nes."DATA_PLUS_DLB" then exit $ diff --git a/sys/vms/vmsbuild.com b/sys/vms/vmsbuild.com index 788838ba2..0ab402d1a 100755 --- a/sys/vms/vmsbuild.com +++ b/sys/vms/vmsbuild.com @@ -1,4 +1,4 @@ -$ ! vms/vmsbuild.com -- compile and link NetHack 3.6.* [pr] +$ ! vms/vmsbuild.com -- compile and link NetHack 3.7.* [pr] $ version_number = "3.7.0" $ ! $NHDT-Date: 1557701799 2019/05/12 22:56:39 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.23 $ $ ! Copyright (c) 2018 by Robert Patrick Rankin @@ -34,7 +34,8 @@ $ gnuc_ = "GCC" $ if f$type(gcc).eqs."STRING" then gnuc_ = gcc $ gnulib = "gnu_cc:[000000]gcclib/Library" !(not used w/ vaxc) $ ! common CC options (/obj=file doesn't work for GCC 1.36, use rename instead) -$ c_c_ = "/INCLUDE=[-.INCLUDE]" +$ ! c_c_ = "/INCLUDE=([-.INCLUDE],[-.LIB.LUA535.SRC])/DEFINE=(""LUA_USE_C89"",""LUA_32BITS"")" +$ c_c_ = "/INCLUDE=([-.INCLUDE],[-.LIB.LUA535.SRC])/DEFINE=(""LUA_USE_C89"")" $ veryold_vms = f$extract(1,1,f$getsyi("VERSION")).eqs."4" - .and. f$extract(3,3,f$getsyi("VERSION")).lts."6" $ if veryold_vms then c_c_ = c_c_ + "/DEFINE=(""VERYOLD_VMS"")" @@ -250,6 +251,20 @@ $ interface = ttysrc !default $ if p5.eqs."CURSES" then interface = cursessrc $ if p5.eqs."TTY+CURSES" then interface = ttysrc + "," + cursessrc $ if p5.eqs."CURSES+TTY" then interface = cursessrc + "," + ttysrc + +$ if f$search("[-.include]nhlua.h").eqs."" +$ then +$ create [-.include]nhlua.h !empty +$ set file/att=(RFM:STM) [-.include]nhlua.h +$ open/Append f [-.include]nhlua.h +$ write f "/* nhlua.h - generated by vmsbuild.com */" +$ write f "#include ""[-.lib.lua535.src]lua.h""" +$ write f "LUA_API int (lua_error) (lua_State *L) NORETURN;" +$ write f "#include ""[-.lib.lua535.src]lualib.h""" +$ write f "#include ""[-.lib.lua535.src]lauxlib.h""" +$ write f "/*nhlua.h*/" +$ close f +$ endif $! $! create object library $! @@ -303,6 +318,28 @@ $ c_list = "uhitm,vault,vision,vis_tab,weapon,were,wield,windows" - + ",wizard,worm,worn,write,zap" $ gosub compile_list $! +$! Files added in 3.7 +$! +$ c_list = "sfstruct,nhlua,nhlsel" +$ gosub compile_list +$! +$! 3.7 runtime LUA level parser/loader +$! +$ c_list = "[-.lib.lua535.src]lapi,[-.lib.lua535.src]lauxlib,[-.lib.lua535.src]lbaselib" - + + ",[-.lib.lua535.src]lbitlib,[-.lib.lua535.src]lcode,[-.lib.lua535.src]lcorolib" - + + ",[-.lib.lua535.src]lctype,[-.lib.lua535.src]ldblib,[-.lib.lua535.src]ldebug" - + + ",[-.lib.lua535.src]ldo,[-.lib.lua535.src]ldump,[-.lib.lua535.src]lfunc" - + + ",[-.lib.lua535.src]lgc,[-.lib.lua535.src]linit,[-.lib.lua535.src]liolib" - + + ",[-.lib.lua535.src]llex" +$ gosub compile_list +$ c_list = "[-.lib.lua535.src]lmathlib,[-.lib.lua535.src]lmem,[-.lib.lua535.src]loadlib" - + + ",[-.lib.lua535.src]lobject,[-.lib.lua535.src]lopcodes,[-.lib.lua535.src]loslib" - + + ",[-.lib.lua535.src]lparser,[-.lib.lua535.src]lstate,[-.lib.lua535.src]lstring" - + + ",[-.lib.lua535.src]lstrlib,[-.lib.lua535.src]ltable,[-.lib.lua535.src]ltablib" - + + ",[-.lib.lua535.src]ltm,[-.lib.lua535.src]lundump,[-.lib.lua535.src]lutf8lib" - + + ",[-.lib.lua535.src]lvm,[-.lib.lua535.src]lzio" +$ gosub compile_list +$! $link: $ milestone "" $ link/Exe=nethack.exe nethack.opt/Options,ident.opt/Options,crtl.opt/Options @@ -313,19 +350,19 @@ $! $! build special level and dungeon compilers $! $ set default [-.util] -$ c_list = "#panic,#lev_main,#lev_yacc,#dgn_main,#dgn_yacc" -$ if c_opt.eq.o_SPCL then c_list = "[-.sys.vms]vmsfiles," + c_list -$ gosub compile_list -$ c_list = "#lev_lex,#dgn_lex" -$ copy [-.sys.vms]lev_lex.h stdio.*/Prot=(s:rwd,o:rwd) -$ gosub compile_list -$ rename stdio.h lev_lex.* -$ link/exe=lev_comp.exe lev_main.obj,lev_yacc.obj,lev_lex.obj,- - panic.obj,'nethacklib'/Lib,[-.src]ident.opt/Opt,[-.src]crtl.opt/Opt -$ milestone "lev_comp" -$ link/exe=dgn_comp.exe dgn_main.obj,dgn_yacc.obj,dgn_lex.obj,- - panic.obj,'nethacklib'/Lib,[-.src]ident.opt/Opt,[-.src]crtl.opt/Opt -$ milestone "dgn_comp" +$! c_list = "#panic,#lev_main,#lev_yacc,#dgn_main,#dgn_yacc" +$! if c_opt.eq.o_SPCL then c_list = "[-.sys.vms]vmsfiles," + c_list +$! gosub compile_list +$! c_list = "#lev_lex,#dgn_lex" +$! copy [-.sys.vms]lev_lex.h stdio.*/Prot=(s:rwd,o:rwd) +$! gosub compile_list +$! rename stdio.h lev_lex.* +$! link/exe=lev_comp.exe lev_main.obj,lev_yacc.obj,lev_lex.obj,- +$! panic.obj,'nethacklib'/Lib,[-.src]ident.opt/Opt,[-.src]crtl.opt/Opt +$! milestone "lev_comp" +$! link/exe=dgn_comp.exe dgn_main.obj,dgn_yacc.obj,dgn_lex.obj,- +$! panic.obj,'nethacklib'/Lib,[-.src]ident.opt/Opt,[-.src]crtl.opt/Opt +$! milestone "dgn_comp" $! $ c_list = "#dlb_main,#recover" $ gosub compile_list diff --git a/sys/vms/vmsmain.c b/sys/vms/vmsmain.c index f9df5d926..f4631557c 100644 --- a/sys/vms/vmsmain.c +++ b/sys/vms/vmsmain.c @@ -32,7 +32,7 @@ main(argc, argv) int argc; char *argv[]; { - register int fd; + NHFILE *nhfp; #ifdef CHDIR register char *dir; #endif @@ -49,7 +49,7 @@ char *argv[]; atexit(byebye); g.hname = argv[0]; g.hname = vms_basename(g.hname); /* name used in 'usage' type messages */ - hackpid = getpid(); + g.hackpid = getpid(); (void) umask(0); choose_windows(DEFAULT_WINDOW_SYS); @@ -67,8 +67,25 @@ char *argv[]; dir = nh_getenv("HACKDIR"); #endif if (argc > 1) { + if (argcheck(argc, argv, ARG_VERSION) == 2) + exit(EXIT_SUCCESS); + + if (argcheck(argc, argv, ARG_SHOWPATHS) == 2) { #ifdef CHDIR - if (!strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') { + chdirx((char *) 0, 0); +#endif + iflags.initoptions_noterminate = TRUE; + initoptions(); + iflags.initoptions_noterminate = FALSE; + reveal_paths(); + exit(EXIT_SUCCESS); + } + if (argcheck(argc, argv, ARG_DEBUG) == 1) { + argc--; + argv++; + } +#ifdef CHDIR + if (argc > 1 && !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 */ @@ -175,7 +192,7 @@ char *argv[]; * We'll return here if new game player_selection() renames the hero. */ attempt_restore: - if ((fd = restore_saved_game()) >= 0) { + if ((nhfp = restore_saved_game()) != 0) { const char *fq_save = fqname(g.SAVEF, SAVEPREFIX, 1); (void) chmod(fq_save, 0); /* disallow parallel restores */ @@ -188,7 +205,7 @@ attempt_restore: #endif pline("Restoring save file..."); mark_synch(); /* flush output */ - if (dorecover(fd)) { + if (dorecover(nhfp)) { resuming = TRUE; /* not starting new game */ wd_message(); if (discover || wizard) { diff --git a/sys/vms/vmsunix.c b/sys/vms/vmsunix.c index 81e71efeb..2eec83b01 100644 --- a/sys/vms/vmsunix.c +++ b/sys/vms/vmsunix.c @@ -110,7 +110,7 @@ getlock() 'a','b',&c below; override the default and use if we aren't restricting the number of simultaneous games */ if (!g.locknum) - Sprintf(g.lock, "_%u%s", (unsigned) getuid(), plname); + Sprintf(g.lock, "_%u%s", (unsigned) getuid(), g.plname); regularize(g.lock); set_levelfile_name(g.lock, 0); diff --git a/sys/wince/.gitattributes b/sys/wince/.gitattributes index b3d2a6646..70924b994 100644 --- a/sys/wince/.gitattributes +++ b/sys/wince/.gitattributes @@ -1,4 +1,4 @@ *.ce NHSUBST *.mak NHSUBST *.bat NHSUBST -* NH_filestag=(file%s_for_Windows_CE_and_PocketPC_-_untested_for_3.6.2) +* NH_filestag=(file%s_for_Windows_CE_and_PocketPC_-_untested_for_3.6.4) diff --git a/sys/wince/bootstrp.mak b/sys/wince/bootstrp.mak index 5d92dc760..35cb62595 100644 --- a/sys/wince/bootstrp.mak +++ b/sys/wince/bootstrp.mak @@ -202,7 +202,6 @@ HACK_H = $(INCL)\hack.h $(CONFIG_H) $(INCL)\align.h \ $(INCL)\rect.h $(INCL)\region.h $(INCL)\winprocs.h \ $(INCL)\wintty.h $(INCL)\trampoli.h -LEV_H = $(INCL)\lev.h DGN_FILE_H = $(INCL)\dgn_file.h LEV_COMP_H = $(INCL)\lev_comp.h SP_LEV_H = $(INCL)\sp_lev.h @@ -291,7 +290,7 @@ $(U)makedefs.exe: $(MAKEOBJS) $(link) $(LFLAGSU) -out:$@ $(MAKEOBJS) $(O)makedefs.o: $(CONFIG_H) $(INCL)\monattk.h $(INCL)\monflag.h $(INCL)\objclass.h \ - $(INCL)\monsym.h $(INCL)\qtext.h $(INCL)\patchlevel.h \ + $(INCL)\monsym.h $(INCL)\patchlevel.h \ $(U)makedefs.c if not exist $(OBJ)\*.* echo creating directory $(OBJ) if not exist $(OBJ)\*.* mkdir $(OBJ) @@ -768,7 +767,7 @@ $(O)apply.o: $(SRC)\apply.c $(HACK_H) $(O)artifact.o: $(SRC)\artifact.c $(HACK_H) $(INCL)\artifact.h $(INCL)\artilist.h $(O)attrib.o: $(SRC)\attrib.c $(HACK_H) $(INCL)\artifact.h $(O)ball.o: $(SRC)\ball.c $(HACK_H) -$(O)bones.o: $(SRC)\bones.c $(HACK_H) $(INCL)\lev.h +$(O)bones.o: $(SRC)\bones.c $(HACK_H) $(O)botl.o: $(SRC)\botl.c $(HACK_H) $(O)cmd.o: $(SRC)\cmd.c $(HACK_H) $(INCL)\func_tab.h $(O)dbridge.o: $(SRC)\dbridge.c $(HACK_H) @@ -777,7 +776,7 @@ $(O)detect.o: $(SRC)\detect.c $(HACK_H) $(INCL)\artifact.h $(O)dig.o: $(SRC)\dig.c $(HACK_H) $(O)display.o: $(SRC)\display.c $(HACK_H) $(O)dlb.o: $(SRC)\dlb.c $(CONFIG_H) $(INCL)\dlb.h -$(O)do.o: $(SRC)\do.c $(HACK_H) $(INCL)\lev.h +$(O)do.o: $(SRC)\do.c $(HACK_H) $(O)do_name.o: $(SRC)\do_name.c $(HACK_H) $(O)do_wear.o: $(SRC)\do_wear.c $(HACK_H) $(O)dog.o: $(SRC)\dog.c $(HACK_H) @@ -787,8 +786,8 @@ $(O)dothrow.o: $(SRC)\dothrow.c $(HACK_H) $(O)drawing.o: $(SRC)\drawing.c $(HACK_H) $(INCL)\tcap.h $(O)dungeon.o: $(SRC)\dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h $(O)eat.o: $(SRC)\eat.c $(HACK_H) -$(O)end.o: $(SRC)\end.c $(HACK_H) $(INCL)\lev.h $(INCL)\dlb.h -$(O)engrave.o: $(SRC)\engrave.c $(HACK_H) $(INCL)\lev.h +$(O)end.o: $(SRC)\end.c $(HACK_H) $(INCL)\dlb.h +$(O)engrave.o: $(SRC)\engrave.c $(HACK_H) $(O)exper.o: $(SRC)\exper.c $(HACK_H) $(O)explode.o: $(SRC)\explode.c $(HACK_H) $(O)extralev.o: $(SRC)\extralev.c $(HACK_H) @@ -797,7 +796,7 @@ $(O)fountain.o: $(SRC)\fountain.c $(HACK_H) $(O)hack.o: $(SRC)\hack.c $(HACK_H) $(O)hacklib.o: $(SRC)\hacklib.c $(HACK_H) $(O)invent.o: $(SRC)\invent.c $(HACK_H) $(INCL)\artifact.h -$(O)light.o: $(SRC)\light.c $(HACK_H) $(INCL)\lev.h +$(O)light.o: $(SRC)\light.c $(HACK_H) $(O)lock.o: $(SRC)\lock.c $(HACK_H) $(O)mail.o: $(SRC)\mail.c $(HACK_H) $(INCL)\mail.h $(O)makemon.o: $(SRC)\makemon.c $(HACK_H) @@ -808,7 +807,7 @@ $(O)mhitu.o: $(SRC)\mhitu.c $(HACK_H) $(INCL)\artifact.h $(O)minion.o: $(SRC)\minion.c $(HACK_H) $(O)mklev.o: $(SRC)\mklev.c $(HACK_H) $(O)mkmap.o: $(SRC)\mkmap.c $(HACK_H) $(INCL)\sp_lev.h -$(O)mkmaze.o: $(SRC)\mkmaze.c $(HACK_H) $(INCL)\sp_lev.h $(INCL)\lev.h +$(O)mkmaze.o: $(SRC)\mkmaze.c $(HACK_H) $(INCL)\sp_lev.h $(O)mkobj.o: $(SRC)\mkobj.c $(HACK_H) $(INCL)\artifact.h $(O)mkroom.o: $(SRC)\mkroom.c $(HACK_H) $(O)mon.o: $(SRC)\mon.c $(HACK_H) $(INCL)\mfndpos.h @@ -821,7 +820,7 @@ $(O)mplayer.o: $(SRC)\mplayer.c $(HACK_H) $(O)mthrowu.o: $(SRC)\mthrowu.c $(HACK_H) $(O)muse.o: $(SRC)\muse.c $(HACK_H) $(O)music.o: $(SRC)\music.c $(HACK_H) #interp.c -$(O)o_init.o: $(SRC)\o_init.c $(HACK_H) $(INCL)\lev.h +$(O)o_init.o: $(SRC)\o_init.c $(HACK_H) $(O)objects.o: $(SRC)\objects.c $(CONFIG_H) $(INCL)\obj.h $(INCL)\objclass.h \ $(INCL)\prop.h $(INCL)\skills.h $(INCL)\color.h $(O)objnam.o: $(SRC)\objnam.c $(HACK_H) @@ -834,17 +833,17 @@ $(O)polyself.o: $(SRC)\polyself.c $(HACK_H) $(O)potion.o: $(SRC)\potion.c $(HACK_H) $(O)pray.o: $(SRC)\pray.c $(HACK_H) $(O)priest.o: $(SRC)\priest.c $(HACK_H) $(INCL)\mfndpos.h -$(O)quest.o: $(SRC)\quest.c $(HACK_H) $(INCL)\qtext.h -$(O)questpgr.o: $(SRC)\questpgr.c $(HACK_H) $(INCL)\dlb.h $(INCL)\qtext.h +$(O)quest.o: $(SRC)\quest.c $(HACK_H) +$(O)questpgr.o: $(SRC)\questpgr.c $(HACK_H) $(INCL)\dlb.h $(O)read.o: $(SRC)\read.c $(HACK_H) $(O)rect.o: $(SRC)\rect.c $(HACK_H) -$(O)region.o: $(SRC)\region.c $(HACK_H) $(INCL)\lev.h -$(O)restore.o: $(SRC)\restore.c $(HACK_H) $(INCL)\lev.h $(INCL)\tcap.h +$(O)region.o: $(SRC)\region.c $(HACK_H) +$(O)restore.o: $(SRC)\restore.c $(HACK_H) $(INCL)\tcap.h $(O)rip.o: $(SRC)\rip.c $(HACK_H) $(O)rnd.o: $(SRC)\rnd.c $(HACK_H) $(O)role.o: $(SRC)\role.c $(HACK_H) -$(O)rumors.o: $(SRC)\rumors.c $(HACK_H) $(INCL)\lev.h $(INCL)\dlb.h -$(O)save.o: $(SRC)\save.c $(HACK_H) $(INCL)\lev.h +$(O)rumors.o: $(SRC)\rumors.c $(HACK_H) $(INCL)\dlb.h +$(O)save.o: $(SRC)\save.c $(HACK_H) $(O)shk.o: $(SRC)\shk.c $(HACK_H) $(O)shknam.o: $(SRC)\shknam.c $(HACK_H) $(O)sit.o: $(SRC)\sit.c $(HACK_H) $(INCL)\artifact.h @@ -854,7 +853,7 @@ $(O)spell.o: $(SRC)\spell.c $(HACK_H) $(O)steal.o: $(SRC)\steal.c $(HACK_H) $(O)steed.o: $(SRC)\steed.c $(HACK_H) $(O)teleport.o: $(SRC)\teleport.c $(HACK_H) -$(O)timeout.o: $(SRC)\timeout.c $(HACK_H) $(INCL)\lev.h +$(O)timeout.o: $(SRC)\timeout.c $(HACK_H) $(O)topten.o: $(SRC)\topten.c $(HACK_H) $(INCL)\dlb.h $(INCL)\patchlevel.h $(O)track.o: $(SRC)\track.c $(HACK_H) $(O)trap.o: $(SRC)\trap.c $(HACK_H) @@ -867,8 +866,8 @@ $(O)weapon.o: $(SRC)\weapon.c $(HACK_H) $(O)were.o: $(SRC)\were.c $(HACK_H) $(O)wield.o: $(SRC)\wield.c $(HACK_H) $(O)windows.o: $(SRC)\windows.c $(HACK_H) $(INCL)\wingem.h $(INCL)\winGnome.h -$(O)wizard.o: $(SRC)\wizard.c $(HACK_H) $(INCL)\qtext.h -$(O)worm.o: $(SRC)\worm.c $(HACK_H) $(INCL)\lev.h +$(O)wizard.o: $(SRC)\wizard.c $(HACK_H) +$(O)worm.o: $(SRC)\worm.c $(HACK_H) $(O)worn.o: $(SRC)\worn.c $(HACK_H) $(O)write.o: $(SRC)\write.c $(HACK_H) $(O)zap.o: $(SRC)\zap.c $(HACK_H) diff --git a/sys/wince/ceinc/.gitattributes b/sys/wince/ceinc/.gitattributes index 1763a5005..e95fe9840 100644 --- a/sys/wince/ceinc/.gitattributes +++ b/sys/wince/ceinc/.gitattributes @@ -1 +1 @@ -* NH_filestag=(header_file%s_for_Windows_CE_and_PocketPC_-_untested_for_3.6.2) +* NH_filestag=(header_file%s_for_Windows_CE_and_PocketPC_-_untested_for_3.6.4) diff --git a/sys/wince/mhmap.c b/sys/wince/mhmap.c index 61a2b9f52..dbdbb5f0b 100644 --- a/sys/wince/mhmap.c +++ b/sys/wince/mhmap.c @@ -632,7 +632,7 @@ onPaint(HWND hWnd) #else /* rely on NetHack core helper routine */ (void) mapglyph(data->map[i][j], &mgch, &color, - &special, i, j); + &special, i, j, 0); ch = (char) mgch; if (((special & MG_PET) && iflags.hilite_pet) || ((special & MG_DETECT) diff --git a/sys/wince/mswproc.c b/sys/wince/mswproc.c index 9236ccd7d..8133ea2eb 100644 --- a/sys/wince/mswproc.c +++ b/sys/wince/mswproc.c @@ -50,6 +50,7 @@ struct window_procs mswin_procs = { | WC_TILE_WIDTH | WC_TILE_HEIGHT | WC_TILE_FILE | WC_VARY_MSGCOUNT | WC_WINDOWCOLORS | WC_PLAYER_SELECTION, WC2_FULLSCREEN | WC2_SOFTKEYBOARD | WC2_WRAPTEXT, mswin_init_nhwindows, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */ mswin_player_selection, mswin_askname, mswin_get_nh_event, mswin_exit_nhwindows, mswin_suspend_nhwindows, mswin_resume_nhwindows, mswin_create_nhwindow, mswin_clear_nhwindow, mswin_display_nhwindow, diff --git a/sys/wince/winhack.rc b/sys/wince/winhack.rc index 10a0a03f5..b928c3b04 100644 --- a/sys/wince/winhack.rc +++ b/sys/wince/winhack.rc @@ -284,8 +284,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,6,1,0 - PRODUCTVERSION 3,6,2,0 + FILEVERSION 3,6,4,0 + PRODUCTVERSION 3,6,4,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x9L @@ -300,17 +300,17 @@ BEGIN BEGIN BLOCK "040904b0" BEGIN - VALUE "Comments", "NetHack 3.6.2 for Windows CE\0" + VALUE "Comments", "NetHack 3.6.4 for Windows CE\0" VALUE "CompanyName", " \0" VALUE "FileDescription", "nethackm\0" - VALUE "FileVersion", "3, 6, 2, 0\0" + VALUE "FileVersion", "3, 6, 4, 0\0" VALUE "InternalName", "nethackm\0" - VALUE "LegalCopyright", "Copyright © 1985-2018\0" + VALUE "LegalCopyright", "Copyright © 1985-2019\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "nethackm.exe\0" VALUE "PrivateBuild", "090914\0" VALUE "ProductName", "NetHack\0" - VALUE "ProductVersion", "3, 6, 2, 0\0" + VALUE "ProductVersion", "3, 6, 4, 0\0" VALUE "SpecialBuild", "\0" END END diff --git a/sys/wince/winhcksp.rc b/sys/wince/winhcksp.rc index 2ac6e1710..3e5373a2f 100644 --- a/sys/wince/winhcksp.rc +++ b/sys/wince/winhcksp.rc @@ -260,8 +260,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,6,1,0 - PRODUCTVERSION 3,6,1,0 + FILEVERSION 3,6,4,0 + PRODUCTVERSION 3,6,4,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x9L @@ -276,17 +276,17 @@ BEGIN BEGIN BLOCK "040904b0" BEGIN - VALUE "Comments", "NetHack 3.6.2 for Smartphone 2002\0" + VALUE "Comments", "NetHack 3.6.4 for Smartphone 2002\0" VALUE "CompanyName", " \0" VALUE "FileDescription", "nethackm\0" - VALUE "FileVersion", "3, 6, 2, 0\0" + VALUE "FileVersion", "3, 6, 4, 0\0" VALUE "InternalName", "nethackm\0" - VALUE "LegalCopyright", "Copyright © 1985-2018\0" + VALUE "LegalCopyright", "Copyright © 1985-2019\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "nethackm.exe\0" VALUE "PrivateBuild", "090914\0" VALUE "ProductName", "NetHack For Smartphone\0" - VALUE "ProductVersion", "3, 6, 2, 0\0" + VALUE "ProductVersion", "3, 6, 4, 0\0" VALUE "SpecialBuild", "\0" END END diff --git a/sys/winnt/defaults.nh b/sys/winnt/.nethackrc.template similarity index 89% rename from sys/winnt/defaults.nh rename to sys/winnt/.nethackrc.template index 39b7924cf..b2bacbd7f 100644 --- a/sys/winnt/defaults.nh +++ b/sys/winnt/.nethackrc.template @@ -104,7 +104,8 @@ OPTIONS=suppress_alert:3.3.1 # Map window settings # possible map_mode options include: tiles|ascii4x6|ascii6x8|ascii8x8|ascii16x8| # ascii7x12|ascii8x12|ascii16x12|ascii12x16| -# ascii10x18|fit_to_screen +# ascii10x18|fit_to_screen|ascii_fit_to_screen| +# tiles_fit_to_screen OPTIONS=map_mode:tiles,scroll_margin:10 # Message window settings @@ -142,28 +143,24 @@ OPTIONS=vary_msgcount:4 # IMPORTANT: If you change any of these locations, the directories they # point at must exist. NetHack will not create them for you. # -# HACKDIR is the default location for everything. -# Note: On Windows HACKDIR defaults to the location -# of the NetHack.exe or NetHackw.exe file so -# setting HACKDIR below to override that is -# not usually necessary or recommended. -#HACKDIR=c:\games\nethack +# The location that documentation and helps files are placed +#HACKDIR=c:\User\USERNAME\NetHack\3.6 # -# The location that level files in progress are stored (default=HACKDIR, writeable) -#LEVELDIR=c:\nethack\levels +# The location that level files in progress are stored (writeable) +#LEVELDIR=c:\User\USERNAME\AppData\Local\NetHack\3.6 # -# The location where saved games are kept (default=HACKDIR, writeable) -#SAVEDIR=c:\nethack\save +# The location where saved games are kept (writeable) +#SAVEDIR=c:\User\USERNAME\AppData\Local\NetHack\3.6 # -# The location that bones files are kept (default=HACKDIR, writeable) -#BONESDIR=c:\nethack\save +# The location that bones files are kept (writeable) +#BONESDIR=c:\ProgramData\NetHack\3.6 # -# The location that file synchronization locks are stored (default=HACKDIR, writeable) -#LOCKDIR=c:\nethack\levels +# The location that score files are kept (writeable) +#SCOREDIR=c:\ProgramData\NetHack\3.6 +# +# The location that file synchronization locks are stored (writeable) +#LOCKDIR=c:\ProgramData\NetHack\3.6 # -# The location that a record of game aborts and self-diagnosed game problems -# is kept (default=HACKDIR, writeable) -#TROUBLEDIR=c:\nethack\trouble # Finnish keyboards might need these modifications uncommented. # For \, @, $, [, | diff --git a/sys/winnt/Install.nt b/sys/winnt/Install.nt index 8842ad861..7ef199034 100644 --- a/sys/winnt/Install.nt +++ b/sys/winnt/Install.nt @@ -3,9 +3,9 @@ ============================================================== Instructions for compiling and installing NetHack 3.6 on a Windows system - (Windows 7/8.x/10 or later only. XP may work but is untested) + (Windows 7/8.x/10 or later only) ============================================================== - Last revision: $NHDT-Date: 1554784481 2019/04/09 04:34:41 $ + Last revision: $NHDT-Date: 1575245156 2019/12/02 00:05:56 $ Credit for the porting of NetHack to the Win32 Console Subsystem goes to the NT Porting Team started by Michael Allison. @@ -16,7 +16,7 @@ contributed the port. Alex Kompel, Dion Nicolaas, Yitzhak Sapir, Derek S. Ray, Michael Allison, Pasi Kallinen, Bart House, and Janet Walz contributed to the maintainance -of the tty and graphical windows versions of NetHack 3.6.2. +of the tty and graphical windows versions of NetHack 3.6.4. You can build a TTY version of NetHack and a Windows Graphical version. You can use one of the following build environments: @@ -93,11 +93,10 @@ using. Change to the directory win\win32\vs2017 and run "build.bat". * Optional curses window-port support * -Starting with 3.6.2, the community patch for a window-port that uses -curses was incorporated into the NetHack source code tree. That window-port, -which evolved from work originally done by Karl Garrison, has been used in -several NetHack variants and on nethack.alt.org and on -www.hardfought.org/nethack/. +Since 3.6.2, the community patch for a window-port that uses curses has been +incorporated into the NetHack source code tree. That window-port, which +evolved from work originally done by Karl Garrison, has been used in several +NetHack variants and on nethack.alt.org and on www.hardfought.org/nethack/. If you want to include the curses window-port support in your Visual Studio build, you will have to first obtain the PDCurses sources from @@ -152,7 +151,7 @@ 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. -NetHack's save files and bones files in the 3.6.2 release have not yet +NetHack's save files and bones files in the 3.6.4 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). Hopefully that will change in an upcoming release. @@ -204,8 +203,8 @@ Setting Up source tree. cd src -2. Starting with 3.6.2, the community patch for an optional curses - window-port was incorporated into the NetHack source code tree. That +2. Since 3.6.2, the community patch for an optional curses window-port + has been incorporated into the NetHack source code tree. That window-port, which evolved from work originally done by Karl Garrison, has been used in several NetHack variants and on nethack.alt.org and on www.hardfought.org/nethack/. The optional curses window-port is diff --git a/sys/winnt/Makefile.gcc b/sys/winnt/Makefile.gcc index 358965369..fbfd11000 100644 --- a/sys/winnt/Makefile.gcc +++ b/sys/winnt/Makefile.gcc @@ -1,4 +1,4 @@ -# NetHack 3.6 Makefile.gcc $NHDT-Date: 1546174698 2018/12/30 12:58:18 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.71 $ +# NetHack 3.7 Makefile.gcc $NHDT-Date: 1546174698 2018/12/30 12:58:18 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.71 $ # Copyright (c) 2010 by Michael Allison # NetHack may be freely redistributed. See license for details. # @@ -30,15 +30,24 @@ # If you have any questions read the sys/winnt/Install.nt file included # with the distribution. #============================================================================== -# BUILD DECISIONS SECTION +# DECISIONS SECTION # -# There are currently only 4 decisions that you have to make. +# Build Options Decisions +# +# There are currently 4 decisions that you can choose to make. +# None of the 4 decisions are absolutely required because defaults are in place: # 1. Where do you want your build to end up? # 2. Do you want debug information in the executable? # 3. Do you want to explicitly override auto-detection of a 32-bit or 64-bit target? # 4. Do you want to include any optional interfaces in the port? # 4a) curses # 4b) Qt +# +# Mandatory LUA source Location +# +# LUA source code or is required to build NetHack-3.7. +# LUATOP must point to the location of the LUA sources. +# #----------------------------------------------------------------------------------------- #========================================================================================= @@ -91,7 +100,7 @@ TARGET_CPU=x86 # your machine. # # ADD_CURSES=Y -# PDCURSES_TOP=../../pdcurses +# PDCURSES_TOP=../lib/pdcurses #4b Qt # @@ -116,7 +125,19 @@ TARGET_CPU=x86 # Other libraries are placed in a subdirectory of your home directory, either # x86libs or x64libs depending on whether you're building for 64 bits. # - +#--------------------------------------------------------------- +# Location of LUA +# +# Original source needs to be obtained from: +# http://www.lua.org/ftp/lua-5.3.5.tar.gz +# +# This build assumes that the LUA sources are located +# at the specified location. If they are actually elsewhere +# you'll need to specify the correct spot below in order to +# successfully build NetHack-3.7. +# +ADD_LUA=Y +LUATOP=../lib/lua-5.3.5 # #============================================================================== # This marks the end of the BUILD DECISIONS section. @@ -139,7 +160,7 @@ SKIP_NETHACKW=Y #============================================================================== # The version of the game this Makefile was designed for -NETHACK_VERSION="3.6.3" +NETHACK_VERSION="3.7.0" # A brief version for use in macros NHV1=$(subst .,,$(NETHACK_VERSION)) @@ -188,7 +209,7 @@ RANDOM = $(OBJ)/random.o #RANDOM = BCRYPT=-lbcrypt -WINPFLAG = -DTILES -DMSWIN_GRAPHICS -DWIN32CON -D_WIN32_IE=0x0400 -D_WIN32_WINNT=0x0501 +WINPFLAG = -DTILES -DMSWIN_GRAPHICS -DWIN32CON -D_WIN32_IE=0x0400 -D_WIN32_WINNT=0x0601 -DWINVER=0x0601 ifeq "$(WANT_WIN_QT4)" "Y" WINPFLAG += -DQT_GRAPHICS -DPIXMAPDIR='"."' endif @@ -251,19 +272,8 @@ U = $(UTIL)/ MAKESRC = $(U)makedefs.c -SPLEVSRC = $(U)lev_yacc.c $(U)lev_lex.c $(U)lev_main.c $(U)panic.c - -DGNCOMPSRC = $(U)dgn_yacc.c $(U)dgn_lex.c $(U)dgn_main.c - MAKEOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o -LEVCOMPOBJS = $(O)lev_yacc.o $(O)lev_lex.o $(O)lev_main.o \ - $(O)alloc.o $(O)decl.o $(O)drawing.o \ - $(O)monst.o $(O)objects.o $(O)panic.o - -DGNCOMPOBJS = $(O)dgn_yacc.o $(O)dgn_lex.o $(O)dgn_main.o \ - $(O)alloc.o $(O)panic.o - RECOVOBJS = $(O)recover.o TILEFILES = $(WSHR)/monsters.txt $(WSHR)/objects.txt $(WSHR)/other.txt @@ -313,7 +323,13 @@ VOBJ24 = $(O)track.o $(O)trap.o $(O)u_init.o $(O)uhitm.o VOBJ25 = $(O)vault.o $(O)vis_tab.o $(O)vision.o $(O)weapon.o VOBJ26 = $(O)were.o $(O)wield.o $(O)windows.o $(O)wizard.o VOBJ27 = $(O)worm.o $(O)worn.o $(O)write.o $(O)zap.o -#VOBJ28 = $(O)win10.o +VOBJ28 = $(O)sfstruct.o +#VOBJ31 = $(O)win10.o + +ifeq "$(ADD_LUA)" "Y" +LUAOBJ = $(O)nhlua.o $(O)nhlsel.o $(O)nhlobj.o +LUA_QTEXT_FILE = "quest.lua" +endif DLBOBJ = $(O)dlb.o @@ -389,10 +405,40 @@ SOUND = $(OBJ)/ntsound.o VVOBJ = $(O)version.o -ALLOBJ = $(SOBJ) $(DLBOBJ) $(WOBJ) $(OBJS) $(VVOBJ) +ALLOBJ = $(SOBJ) $(DLBOBJ) $(WOBJ) $(OBJS) $(VVOBJ) $(LUAOBJ) OPTIONS_FILE = $(DAT)\options +#===============-================================================= +# LUA library +# Source from http://www.lua.org/ftp/lua-5.3.5.tar.gz +#================================================================= + +LUAVER = 5.3.5 +LUASRC = $(LUATOP)/src +LUALIB = $(O)lua-$(LUAVER).static.a +LUADLL = $(O)lua-$(LUAVER).a +LUAINCL = -I$(LUASRC) +#LUAFLAGS = unix added -lm here? +LUATARGETS = lua.exe luac.exe $(LUADLL) $(LUALIB) + +LUASRCFILES = lapi.c lauxlib.c lbaselib.c lbitlib.c lcode.c \ + lcorolib.c lctype.c ldblib.c ldebug.c ldo.c \ + ldump.c lfunc.c lgc.c linit.c liolib.c llex.c \ + lmathlib.c lmem.c loadlib.c lobject.c lopcodes.c \ + loslib.c lparser.c lstate.c lstring.c lstrlib.c \ + ltable.c ltablib.c ltm.c lundump.c lutf8lib.c \ + lvm.c lzio.c + +LUAOBJFILES = $(O)lapi.o $(O)lauxlib.o $(O)lbaselib.o $(O)lbitlib.o \ + $(O)lcode.o $(O)lcorolib.o $(O)lctype.o $(O)ldblib.o \ + $(O)ldebug.o $(O)ldo.o $(O)ldump.o $(O)lfunc.o \ + $(O)lgc.o $(O)linit.o $(O)liolib.o $(O)llex.o \ + $(O)lmathlib.o $(O)lmem.o $(O)loadlib.o $(O)lobject.o \ + $(O)lopcodes.o $(O)loslib.o $(O)lparser.o $(O)lstate.o \ + $(O)lstring.o $(O)lstrlib.o $(O)ltable.o $(O)ltablib.o \ + $(O)ltm.o $(O)lundump.o $(O)lutf8lib.o $(O)lvm.o $(O)lzio.o + ifeq "$(ADD_CURSES)" "Y" #========================================== # PDCurses build macros @@ -445,9 +491,7 @@ HACK_H = $(INCL)/hack.h $(CONFIG_H) $(INCL)/align.h $(INCL)/context.h \ $(INCL)/rect.h $(INCL)/region.h $(INCL)/winprocs.h \ $(INCL)/wintty.h $(INCL)/sys.h $(INCL)/trampoli.h -LEV_H = $(INCL)/lev.h DGN_FILE_H = $(INCL)/dgn_file.h -LEV_COMP_H = $(INCL)/lev_comp.h SP_LEV_H = $(INCL)/sp_lev.h TILE_H = ../win/share/tile.h @@ -468,11 +512,7 @@ CURSDEF= CURSESLIB= endif -ifneq "$(ADD_CURSES)" "Y" -INCLDIR=-I../include -I../sys/winnt -else -INCLDIR=-I../include -I../sys/winnt -endif +INCLDIR=-I../include -I../sys/winnt $(LUAINCL) #========================================== #========================================== @@ -510,9 +550,9 @@ endif CFLAGSBASE = -c $(cflags) $(WINPINC) $(cdebug) $(CURSESDEF) #LFLAGSBASEC = $(linkdebug) #LFLAGSBASEG = $(linkdebug) -mwindows - -conlibs = -lgdi32 -lwinmm $(BCRYPT) -guilibs = -lcomctl32 -lwinmm +baselibs = -lwinmm -lshell32 -lole32 -luuid +conlibs = -lgdi32 $(baselibs) $(BCRYPT) +guilibs = -lcomctl32 $(baselibs) ifeq "$(WANT_WIN_QT4)" "Y" # Might be either Qt 4 or Qt 5 ifeq "$(HAVE_QT5)" "Y" @@ -654,49 +694,11 @@ $(OBJ)/%.o : $(PDCWINCON)/%.c $(cc) $(PDCINCL) $(CFLAGS) -o$@ $< #========================================== -# Level Compiler Info +# Rules for LUA files #========================================== -# Yacc/Lex ... if you got 'em. -# -# If you have yacc and lex programs (or work-alike such as bison -# and flex), comment out the upper two macros and uncomment -# the lower two. -# - -DO_YACC = YACC_MSG -DO_LEX = LEX_MSG -#DO_YACC = YACC_ACT -#DO_LEX = LEX_ACT - -# - Specify your yacc and lex programs (or work-alikes) here. - -#YACC = bison -y -#YACC = byacc -#YACC = yacc -YACC= - -#LEX = lex -#LEX = flex -LEX= - -# -# - Specify your flex skeleton file (if needed). -# - -FLEXSKEL = -#FLEXSKEL = -S../tools/flex.ske - -YTABC = y_tab.c -YTABH = y_tab.h -LEXYYC = lexyy.c - -export YACC -export LEX -export FLEXSKEL -export YTABC -export YTABH -export LEXYYC +$(OBJ)/%.o : $(LUASRC)/%.c + $(cc) $(CFLAGS) -o$@ $< #========================================== # Rules for files in win/Qt4 @@ -728,8 +730,8 @@ SHELL=CMD.EXE # Since DOS doesn't allow / as path separator, and GCC doesn't allow \ as # path separator, we must change all pathnames when performing DOS commands. # This is done by blindly applying $(subst /,\, ...) on every command. -# Where any command contain / for another reason (switch char, or echoing -# comment lines to lev/dungeon files) a little more care is taken. +# Where any command contain / for another reason (switch char, a little +# more care is taken. # # The default make target (so just typing 'nmake' is useful). @@ -742,13 +744,13 @@ default : install all : install -install: initialchk $(O)utility.tag $(GAMEDIR)/NetHack.exe $(NETHACKW_EXE) \ +install: $(INCL)/nhlua.h initialchk $(O)utility.tag $(GAMEDIR)/NetHack.exe $(NETHACKW_EXE) \ $(O)install.tag $(EXTRA_FILES) @echo NetHack is up to date. @echo Done. -$(O)install.tag: $(DAT)/data $(DAT)/rumors $(DAT)/dungeon \ - $(DAT)/oracles $(DAT)/quest.dat $(O)sp_lev.tag $(DLB) +$(O)install.tag: $(DAT)/data $(DAT)/rumors $(DAT)/oracles \ + $(O)sp_lev.tag $(DLB) ifdef TRAVIS_COMPILER ls -l $(SRC) ls -l $(DAT) @@ -761,14 +763,14 @@ ifeq "$(USE_DLB)" "Y" else $(subst /,\,copy $(DAT)/*. $(GAMEDIR)) $(subst /,\,copy $(DAT)/*.dat $(GAMEDIR)) - $(subst /,\,copy $(DAT)/*.lev $(GAMEDIR)) +# $(subst /,\,copy $(DAT)/*.lua $(GAMEDIR)) $(subst /,\,if exist $(GAMEDIR)/makefile del $(GAMEDIR)/makefile) endif - $(subst /,\,if not exist $(GAMEDIR)/sysconf copy $(MSWSYS)/sysconf $(GAMEDIR)) - $(subst /,\,if exist $(DAT)/symbols copy $(DAT)/symbols $(GAMEDIR)) + $(subst /,\,if exist $(MSWSYS)/sysconf.template copy $(MSWSYS)/sysconf.template $(GAMEDIR)) + $(subst /,\,if exist $(DAT)/symbols copy $(DAT)/symbols $(GAMEDIR)/symbols.template) $(subst /,\,if exist $(DOC)/guidebook.txt copy $(DOC)/guidebook.txt $(GAMEDIR)/Guidebook.txt) $(subst /,\,if exist $(DOC)/nethack.txt copy $(DOC)/nethack.txt $(GAMEDIR)/NetHack.txt) - $(subst /,\,if not exist $(GAMEDIR)/defaults.nh copy $(MSWSYS)/defaults.nh $(GAMEDIR)/defaults.nh) + $(subst /,\,if exist $(MSWSYS)/.nethackrc.template copy $(MSWSYS)/.nethackrc.template $(GAMEDIR)) $(subst /,\,-if not exist $(GAMEDIR)/record. echo.>$(GAMEDIR)/record.) # # @@ -780,48 +782,22 @@ recover: $(U)recover.exe $(subst /,\,if exist $(U)recover.exe copy $(U)recover.exe $(GAMEDIR)) $(subst /,\,if exist $(DOC)/recover.txt copy $(DOC)/recover.txt $(GAMEDIR)/recover.txt) -$(O)sp_lev.tag: $(O)utility.tag $(DAT)/bigroom.des $(DAT)/castle.des \ - $(DAT)/endgame.des $(DAT)/gehennom.des $(DAT)/knox.des \ - $(DAT)/medusa.des $(DAT)/oracle.des $(DAT)/tower.des \ - $(DAT)/yendor.des $(DAT)/arch.des $(DAT)/barb.des \ - $(DAT)/caveman.des $(DAT)/healer.des $(DAT)/knight.des \ - $(DAT)/monk.des $(DAT)/priest.des $(DAT)/ranger.des \ - $(DAT)/rogue.des $(DAT)/samurai.des $(DAT)/sokoban.des \ - $(DAT)/tourist.des $(DAT)/valkyrie.des $(DAT)/wizard.des - $(subst /,\,$(U)levcomp $(DAT)/bigroom.des) - $(subst /,\,$(U)levcomp $(DAT)/castle.des) - $(subst /,\,$(U)levcomp $(DAT)/endgame.des) - $(subst /,\,$(U)levcomp $(DAT)/gehennom.des) - $(subst /,\,$(U)levcomp $(DAT)/knox.des) - $(subst /,\,$(U)levcomp $(DAT)/mines.des) - $(subst /,\,$(U)levcomp $(DAT)/medusa.des) - $(subst /,\,$(U)levcomp $(DAT)/oracle.des) - $(subst /,\,$(U)levcomp $(DAT)/sokoban.des) - $(subst /,\,$(U)levcomp $(DAT)/tower.des) - $(subst /,\,$(U)levcomp $(DAT)/yendor.des) - $(subst /,\,$(U)levcomp $(DAT)/arch.des) - $(subst /,\,$(U)levcomp $(DAT)/barb.des) - $(subst /,\,$(U)levcomp $(DAT)/caveman.des) - $(subst /,\,$(U)levcomp $(DAT)/healer.des) - $(subst /,\,$(U)levcomp $(DAT)/knight.des) - $(subst /,\,$(U)levcomp $(DAT)/monk.des) - $(subst /,\,$(U)levcomp $(DAT)/priest.des) - $(subst /,\,$(U)levcomp $(DAT)/ranger.des) - $(subst /,\,$(U)levcomp $(DAT)/rogue.des) - $(subst /,\,$(U)levcomp $(DAT)/samurai.des) - $(subst /,\,$(U)levcomp $(DAT)/tourist.des) - $(subst /,\,$(U)levcomp $(DAT)/valkyrie.des) - $(subst /,\,$(U)levcomp $(DAT)/wizard.des) - $(subst /,\,copy *.lev $(DAT)) - $(subst /,\,del *.lev) +$(O)sp_lev.tag: $(O)utility.tag $(subst /,\,echo sp_levs done > $(O)sp_lev.tag) $(O)utility.tag: $(INCL)/date.h $(INCL)/onames.h $(INCL)/pm.h \ - $(SRC)/vis_tab.c $(U)levcomp.exe $(INCL)/vis_tab.h \ - $(U)dgncomp.exe $(TILEUTIL16) + $(SRC)/vis_tab.c $(INCL)/vis_tab.h $(TILEUTIL16) $(subst /,\,@echo utilities made >$@) @echo utilities made. +$(INCL)/nhlua.h: + echo '/* nhlua.h - generated by top Makefile */' > $@ + @echo '#include "../lib/lua-$(LUA_VERSION)/src/lua.h"' >> $@ + @echo 'LUA_API int (lua_error) (lua_State *L) NORETURN;' >>$@ + @echo '#include "../lib/lua-$(LUA_VERSION)/src/lualib.h"' >> $@ + @echo '#include "../lib/lua-$(LUA_VERSION)/src/lauxlib.h"' >> $@ + @echo '/*nhlua.h*/' >> $@ + tileutil: $(U)gif2txt.exe $(U)gif2tx32.exe $(U)txt2ppm.exe @echo Optional tile development utilities are up to date. @@ -844,10 +820,11 @@ gamedir.tag: test -d $(GAMEDIR) && echo directory created > $@ $(GAMEDIR)/NetHack.exe : gamedir.tag $(PDCLIB) $(O)tile.o $(O)nttty.o $(O)guistub.o \ - $(ALLOBJ) $(TTYOBJ) $(GUIOBJ) $(O)conres.o $(KEYDLLS) + $(ALLOBJ) $(TTYOBJ) $(GUIOBJ) $(O)conres.o $(KEYDLLS) \ + $(LUATARGETS) @echo Linking $@... $(link) $(lflags) -o$@ $(ALLOBJ) $(TTYOBJ) $(O)nttty.o $(O)tile.o \ - $(O)guistub.o $(O)conres.o $(PDCLIB) $(conlibs) -static -lstdc++ + $(O)guistub.o $(O)conres.o $(PDCLIB) $(LUALIB) $(conlibs) -static -lstdc++ $(subst /,\,@if exist $(O)install.tag del $(O)install.tag) # NetHackW @@ -860,10 +837,11 @@ $(GAMEDIR)/NetHack.exe : gamedir.tag $(PDCLIB) $(O)tile.o $(O)nttty.o $(O)guistu ifneq "$(SKIP_NETHACKW)" "Y" $(GAMEDIR)/NetHackW.exe : gamedir.tag $(PDCLIB) $(O)tile.o $(O)ttystub.o \ - $(ALLOBJ) $(TTYOBJ) $(GUIOBJ) $(O)winres.o $(KEYDLLS) + $(ALLOBJ) $(TTYOBJ) $(GUIOBJ) $(O)winres.o $(KEYDLLS) \ + $(LUATARGETS) @echo Linking $@... $(link) $(lflags) -mwindows -o$@ $(ALLOBJ) $(GUIOBJ) $(O)tile.o $(O)ttystub.o \ - $(O)winres.o $(PDCLIB) $(guilibs) -static -lstdc++ + $(O)winres.o $(PDCLIB) $(guilibs) $(LUALIB) -static -lstdc++ $(subst /,\,@if exist $(O)install.tag del $(O)install.tag) endif @@ -920,7 +898,7 @@ $(U)makedefs.exe: $(MAKEOBJS) $(link) $(LFLAGSU) -o$@ $(MAKEOBJS) $(O)makedefs.o: $(CONFIG_H) $(INCL)/monattk.h $(INCL)/monflag.h \ - $(INCL)/objclass.h $(INCL)/monsym.h $(INCL)/qtext.h \ + $(INCL)/objclass.h $(INCL)/monsym.h \ $(INCL)/patchlevel.h $(U)makedefs.c $(cc) $(CFLAGSU) -o$@ $(U)makedefs.c @@ -950,9 +928,6 @@ $(DAT)/data: $(O)utility.tag $(DATABASE) $(DAT)/rumors: $(O)utility.tag $(DAT)/rumors.tru $(DAT)/rumors.fal $(subst /,\,$(U)makedefs -r) -$(DAT)/quest.dat: $(O)utility.tag $(DAT)/quest.txt - $(subst /,\,$(U)makedefs -q) - $(DAT)/oracles: $(O)utility.tag $(DAT)/oracles.txt $(subst /,\,$(U)makedefs -h) @@ -965,10 +940,6 @@ $(DAT)/epitaph: $(DAT)/epitaph.txt $(U)makedefs.exe $(DAT)/bogusmon: $(DAT)/bogusmon.txt $(U)makedefs.exe $(subst /,\,$(U)makedefs -s) -$(DAT)/dungeon: $(O)utility.tag $(DAT)/dungeon.def - $(subst /,\,$(U)makedefs -e) - $(subst /,\,$(U)dgncomp $(DAT)/dungeon.pdf) - #========================================== # uudecode utility and uuencoded targets #========================================== @@ -1021,62 +992,6 @@ $(MSWIN)/splash.bmp: $(U)uudecode.exe $(MSWIN)/splash.uu $(subst /,\,copy splash.bmp $@) del splash.bmp - -#========================================== -# Level Compiler Stuff -#========================================== - -LEVCFLAGS=$(cflags) -c -DWIN32 -D_WIN32 -I../include $(cdebug) -DDLB - -$(U)lev_yacc.c: $(U)lev_comp.y - mingw32-make -C ../util -f ../win/win32/levstuff-mingw32.mak $(U)lev_yacc.c - -$(U)lev_lex.c: $(HACK_H) $(U)lev_comp.l - mingw32-make -C ../util -f ../win/win32/levstuff-mingw32.mak $(U)lev_lex.c - -$(INCL)/lev_comp.h: - mingw32-make -C ../include -f ../win/win32/levstuff-mingw32.mak $(INCL)/lev_comp.h - -$(O)lev_yacc.o: $(HACK_H) $(SP_LEV_H) $(INCL)/lev_comp.h $(U)lev_yacc.c - $(cc) $(LEVCFLAGS) -o$@ $(U)lev_yacc.c - -$(O)lev_lex.o: $(HACK_H) $(INCL)/lev_comp.h $(SP_LEV_H) $(U)lev_lex.c - $(cc) $(LEVCFLAGS) -o$@ $(U)lev_lex.c - -$(O)lev_main.o: $(U)lev_main.c $(HACK_H) $(SP_LEV_H) - $(cc) $(LEVCFLAGS) -o$@ $(U)lev_main.c - -$(U)levcomp.exe: $(LEVCOMPOBJS) - @echo Linking $@... - $(link) $(LFLAGSU) -o$@ $(LEVCOMPOBJS) - -#========================================== -# Dungeon Compiler Stuff -#========================================== -$(U)dgn_yacc.c: $(U)dgn_comp.y - mingw32-make -C ../util -f ../win/win32/dgnstuff-mingw32.mak $(U)dgn_yacc.c - -$(INCL)/dgn_comp.h: - mingw32-make -C ../include -f ../win/win32/dgnstuff-mingw32.mak $(INCL)/dgn_comp.h - -$(U)dgn_lex.c: $(U)dgn_comp.l - mingw32-make -C ../util -f ../win/win32/dgnstuff-mingw32.mak $(U)dgn_lex.c - -$(O)dgn_yacc.o: $(HACK_H) $(DGN_FILE_H) $(INCL)/dgn_comp.h $(U)dgn_yacc.c - $(cc) $(LEVCFLAGS) -o$@ $(U)dgn_yacc.c - -$(O)dgn_lex.o: $(HACK_H) $(DGN_FILE_H) $(INCL)\dgn_comp.h \ - $(U)dgn_lex.c - $(cc) $(LEVCFLAGS) -o$@ $(U)dgn_lex.c - -$(O)dgn_main.o: $(HACK_H) $(U)dgn_main.c - $(cc) $(LEVCFLAGS) -o$@ $(U)dgn_main.c - -$(U)dgncomp.exe: $(DGNCOMPOBJS) - @echo Linking $@... - @echo Linking $@... - $(link) $(LFLAGSU) -o$@ $(DGNCOMPOBJS) - #================================================= # For a couple of devteam utilities #================================================= @@ -1118,17 +1033,16 @@ $(DAT)/porthelp: $(MSWSYS)/porthelp $(subst /,\,@copy $(MSWSYS)/porthelp $@ >nul) nhdat$(NHV): $(U)dlb_main.exe $(DAT)/data $(DAT)/oracles $(OPTIONS_FILE) \ - $(DAT)/quest.dat $(DAT)/rumors $(DAT)/help $(DAT)/hh $(DAT)/cmdhelp $(DAT)/keyhelp \ - $(DAT)/history $(DAT)/opthelp $(DAT)/wizhelp $(DAT)/dungeon \ - $(DAT)/porthelp $(DAT)/license $(DAT)/engrave \ - $(DAT)/epitaph $(DAT)/bogusmon $(DAT)/tribute $(O)sp_lev.tag + $(DAT)/rumors $(DAT)/help $(DAT)/hh $(DAT)/cmdhelp $(DAT)/keyhelp \ + $(DAT)/history $(DAT)/opthelp $(DAT)/wizhelp \ + $(DAT)/porthelp $(DAT)/license $(DAT)/engrave \ + $(DAT)/epitaph $(DAT)/bogusmon $(DAT)/tribute $(O)sp_lev.tag $(subst /,\,echo data >$(DAT)/dlb.lst) $(subst /,\,echo oracles >>$(DAT)/dlb.lst) $(subst /,\,if exist $(DAT)/options echo options >>$(DAT)/dlb.lst) $(subst /,\,if exist $(DAT)/ttyoptions echo ttyoptions >>$(DAT)/dlb.lst) $(subst /,\,if exist $(DAT)/guioptions echo guioptions >>$(DAT)/dlb.lst) $(subst /,\,if exist $(DAT)/porthelp echo porthelp >>$(DAT)/dlb.lst) - $(subst /,\,echo quest.dat >>$(DAT)/dlb.lst) $(subst /,\,echo rumors >>$(DAT)/dlb.lst) $(subst /,\,echo help >>$(DAT)/dlb.lst) $(subst /,\,echo hh >>$(DAT)/dlb.lst) @@ -1137,13 +1051,12 @@ nhdat$(NHV): $(U)dlb_main.exe $(DAT)/data $(DAT)/oracles $(OPTIONS_FILE) \ $(subst /,\,echo history >>$(DAT)/dlb.lst) $(subst /,\,echo opthelp >>$(DAT)/dlb.lst) $(subst /,\,echo wizhelp >>$(DAT)/dlb.lst) - $(subst /,\,echo dungeon >>$(DAT)/dlb.lst) $(subst /,\,echo license >>$(DAT)/dlb.lst) $(subst /,\,echo engrave >>$(DAT)/dlb.lst) $(subst /,\,echo epitaph >>$(DAT)/dlb.lst) $(subst /,\,echo bogusmon >>$(DAT)/dlb.lst) $(subst /,\,echo tribute >>$(DAT)/dlb.lst) - dir /l /b /-p $(subst /,\,$(DAT)/*.lev >>$(DAT)/dlb.lst) + dir /l /b /-p $(subst /,\,$(DAT)/*.lua >>$(DAT)/dlb.lst) $(subst /,\,$(U)dlb_main CcIf $(DAT) dlb.lst $(SRC)/nhdat) #========================================== @@ -1238,6 +1151,27 @@ $(O)til2bm32.o: $(WSHR)/til2bm32.c $(HACK_H) $(TILE_H) $(MSWSYS)/win32api.h $(O)pdcurses.a : $(PDCLIBOBJS) $(PDCOBJS) ar rcs $@ $(PDCLIBOBJS) $(PDCOBJS) + +#============================================================= +# LUA +#============================================================= + +lua.exe: $(O)lua.o $(LUALIB) + $(link) $(LFLAGSU) -o$@ $(O)lua.o $(LUALIB) + +luac.exe: $(O)luac.o $(LUALIB) + $(link) $(LFLAGSU) -o$@ $(O)luac.o $(LUALIB) + +$(LUADLL): $(LUAOBJFILES) + $(cc) -shared -Wl,--export-all-symbols \ + -Wl,--add-stdcall-alias -o $@ $(LUAOBJSFILES) + +$(LUALIB): $(LUAOBJFILES) + ar rcs $@ $(LUAOBJFILES) + +$(O)lua.o: $(LUASRC)/lua.c +$(O)luac.o: $(LUASRC)/luac.c + #========================================== # Housekeeping #========================================== @@ -1268,40 +1202,12 @@ ifneq "$(W_DAT)" "" if exist $(W_DAT)\engrave del $(W_DAT)\engrave if exist $(W_DAT)\epitaph del $(W_DAT)\epitaph if exist $(W_DAT)\bogusmon del $(W_DAT)\bogusmon - if exist $(W_DAT)\???-fil?.lev del $(W_DAT)\???-fil?.lev - if exist $(W_DAT)\???-goal.lev del $(W_DAT)\???-goal.lev - if exist $(W_DAT)\???-loca.lev del $(W_DAT)\???-loca.lev - if exist $(W_DAT)\???-strt.lev del $(W_DAT)\???-strt.lev - if exist $(W_DAT)\air.lev del $(W_DAT)\air.lev - if exist $(W_DAT)\asmodeus.lev del $(W_DAT)\asmodeus.lev - if exist $(W_DAT)\astral.lev del $(W_DAT)\astral.lev - if exist $(W_DAT)\baalz.lev del $(W_DAT)\baalz.lev - if exist $(W_DAT)\bigrm-*.lev del $(W_DAT)\bigrm-*.lev - if exist $(W_DAT)\castle.lev del $(W_DAT)\castle.lev + if exist $(W_DAT)\oracles del $(W_DAT)\oracles + if exist $(W_DAT)\rumors del $(W_DAT)\rumors if exist $(W_DAT)\data del $(W_DAT)\data - if exist $(W_DAT)\dungeon del $(W_DAT)\dungeon - if exist $(W_DAT)\dungeon.pdf del $(W_DAT)\dungeon.pdf - if exist $(W_DAT)\earth.lev del $(W_DAT)\earth.lev - if exist $(W_DAT)\fakewiz?.lev del $(W_DAT)\fakewiz?.lev - if exist $(W_DAT)\fire.lev del $(W_DAT)\fire.lev - if exist $(W_DAT)\juiblex.lev del $(W_DAT)\juiblex.lev - if exist $(W_DAT)\knox.lev del $(W_DAT)\knox.lev - if exist $(W_DAT)\medusa-?.lev del $(W_DAT)\medusa-?.lev - if exist $(W_DAT)\mine*.lev del $(W_DAT)\mine*.lev if exist $(W_DAT)\options del $(W_DAT)\options if exist $(W_DAT)\ttyoptions del $(W_DAT)\ttyoptions if exist $(W_DAT)\guioptions del $(W_DAT)\guioptions - if exist $(W_DAT)\oracle.lev del $(W_DAT)\oracle.lev - if exist $(W_DAT)\oracles del $(W_DAT)\oracles - if exist $(W_DAT)\orcus.lev del $(W_DAT)\orcus.lev - if exist $(W_DAT)\rumors del $(W_DAT)\rumors - if exist $(W_DAT)\quest.dat del $(W_DAT)\quest.dat - if exist $(W_DAT)\sanctum.lev del $(W_DAT)\sanctum.lev - if exist $(W_DAT)\soko?-?.lev del $(W_DAT)\soko?-?.lev - if exist $(W_DAT)\tower?.lev del $(W_DAT)\tower?.lev - if exist $(W_DAT)\valley.lev del $(W_DAT)\valley.lev - if exist $(W_DAT)\water.lev del $(W_DAT)\water.lev - if exist $(W_DAT)\wizard?.lev del $(W_DAT)\wizard?.lev if exist $(W_DAT)\dlb.lst del $(W_DAT)\dlb.lst if exist $(W_DAT)\porthelp del $(W_DAT)\porthelp endif @@ -1353,12 +1259,11 @@ endif clean: if exist initialchk del initialchk + if exist $(W_INCL)\nhlua.h del $(W_INCL)\nhlua.h if exist $(O)install.tag del $(O)install.tag if exist $(O)utility.tag del $(O)utility.tag ifneq "$(W_UTIL)" "" if exist $(W_UTIL)\makedefs.exe del $(W_UTIL)\makedefs.exe - if exist $(W_UTIL)\levcomp.exe del $(W_UTIL)\levcomp.exe - if exist $(W_UTIL)\dgncomp.exe del $(W_UTIL)\dgncomp.exe endif ifneq "$(W_SRC)" "" if exist $(W_SRC)\*.lnk del $(W_SRC)\*.lnk @@ -1369,13 +1274,9 @@ ifneq "$(W_OBJ)" "" if exist $(W_OBJ)\utility.tag del $(W_OBJ)\utility.tag if exist $(W_OBJ)\install.tag del $(W_OBJ)\install.tag if exist $(W_OBJ)\console.res del $(W_OBJ)\console.res - if exist $(W_OBJ)\dgncomp.MAP del $(W_OBJ)\dgncomp.MAP - if exist $(W_OBJ)\dgncomp.PDB del $(W_OBJ)\dgncomp.PDB if exist $(W_OBJ)\dlb_main.MAP del $(W_OBJ)\dlb_main.MAP if exist $(W_OBJ)\dlb_main.PDB del $(W_OBJ)\dlb_main.PDB if exist $(W_OBJ)\gamedir.tag del $(W_OBJ)\gamedir.tag - if exist $(W_OBJ)\levcomp.MAP del $(W_OBJ)\levcomp.MAP - if exist $(W_OBJ)\levcomp.PDB del $(W_OBJ)\levcomp.PDB if exist $(W_OBJ)\makedefs.MAP del $(W_OBJ)\makedefs.MAP if exist $(W_OBJ)\makedefs.PDB del $(W_OBJ)\makedefs.PDB if exist $(W_OBJ)\NetHack.MAP del $(W_OBJ)\NetHack.MAP @@ -1400,27 +1301,9 @@ ifneq "$(W_OBJ)" "" if exist $(W_OBJ)\uudecode.MAP del $(W_OBJ)\uudecode.MAP if exist $(W_OBJ)\uudecode.PDB del $(W_OBJ)\uudecode.PDB endif - rem - rem defer to the steps in ../win/win32/levstuff-mingw32.mak - rem - mingw32-make -f ../win/win32/levstuff-mingw32.mak clean - rem - rem defer to the steps in ../win/win32/dgnstuff-mingw32.mak - mingw32-make -f ../win/win32/dgnstuff-mingw32.mak clean $(subst /,\,if exist $(TILEBMP16) del $(TILEBMP16)) $(subst /,\,if exist $(TILEBMP32) del $(TILEBMP32)) -#clean: -# -test -f $(O)install.tag && del $(O)install.tag -# -test -f $(O)utility.tag && del $(O)utility.tag -# -test -f $(U)makedefs.exe && del $(U)makedefs.exe -# -test -f $(U)levcomp.exe && del $(U)levcomp.exe -# -test -f $(U)dgncomp.exe && del $(U)dgncomp.exe -# -del $(SRC)/*.lnk -# -del $(SRC)/*.map -# -test -f $(TILEBMP16) && del $(TILEBMP16) -# -test -f $(TILEBMP32) && del $(TILEBMP32) -# #=================================================================== # OTHER DEPENDENCIES #=================================================================== @@ -1654,7 +1537,7 @@ $(O)apply.o: apply.c $(HACK_H) $(O)artifact.o: artifact.c $(HACK_H) $(INCL)/artifact.h $(INCL)/artilist.h $(O)attrib.o: attrib.c $(HACK_H) $(O)ball.o: ball.c $(HACK_H) -$(O)bones.o: bones.c $(HACK_H) $(INCL)/lev.h +$(O)bones.o: bones.c $(HACK_H) $(O)botl.o: botl.c $(HACK_H) $(O)cmd.o: cmd.c $(HACK_H) $(INCL)/func_tab.h $(O)dbridge.o: dbridge.c $(HACK_H) @@ -1663,7 +1546,7 @@ $(O)detect.o: detect.c $(HACK_H) $(INCL)/artifact.h $(O)dig.o: dig.c $(HACK_H) $(O)display.o: display.c $(HACK_H) $(O)dlb.o: dlb.c $(CONFIG_H) $(INCL)/dlb.h -$(O)do.o: do.c $(HACK_H) $(INCL)/lev.h +$(O)do.o: do.c $(HACK_H) $(O)do_name.o: do_name.c $(HACK_H) $(O)do_wear.o: do_wear.c $(HACK_H) $(O)dog.o: dog.c $(HACK_H) @@ -1673,8 +1556,8 @@ $(O)dothrow.o: dothrow.c $(HACK_H) $(O)drawing.o: drawing.c $(HACK_H) $(INCL)/tcap.h $(O)dungeon.o: dungeon.c $(HACK_H) $(INCL)/dgn_file.h $(INCL)/dlb.h $(O)eat.o: eat.c $(HACK_H) -$(O)end.o: end.c $(HACK_H) $(INCL)/lev.h $(INCL)/dlb.h -$(O)engrave.o: engrave.c $(HACK_H) $(INCL)/lev.h +$(O)end.o: end.c $(HACK_H) $(INCL)/dlb.h +$(O)engrave.o: engrave.c $(HACK_H) $(O)exper.o: exper.c $(HACK_H) $(O)explode.o: explode.c $(HACK_H) $(O)extralev.o: extralev.c $(HACK_H) @@ -1683,7 +1566,7 @@ $(O)fountain.o: fountain.c $(HACK_H) $(O)hack.o: hack.c $(HACK_H) $(O)hacklib.o: hacklib.c $(HACK_H) $(O)invent.o: invent.c $(HACK_H) -$(O)light.o: light.c $(HACK_H) $(INCL)/lev.h +$(O)light.o: light.c $(HACK_H) $(O)lock.o: lock.c $(HACK_H) $(O)mail.o: mail.c $(HACK_H) $(INCL)/mail.h $(O)makemon.o: makemon.c $(HACK_H) @@ -1694,7 +1577,7 @@ $(O)mhitu.o: mhitu.c $(HACK_H) $(INCL)/artifact.h $(O)minion.o: minion.c $(HACK_H) $(O)mklev.o: mklev.c $(HACK_H) $(O)mkmap.o: mkmap.c $(HACK_H) $(INCL)/sp_lev.h -$(O)mkmaze.o: mkmaze.c $(HACK_H) $(INCL)/sp_lev.h $(INCL)/lev.h +$(O)mkmaze.o: mkmaze.c $(HACK_H) $(INCL)/sp_lev.h $(O)mkobj.o: mkobj.c $(HACK_H) $(O)mkroom.o: mkroom.c $(HACK_H) $(O)mon.o: mon.c $(HACK_H) $(INCL)/mfndpos.h @@ -1707,7 +1590,10 @@ $(O)mplayer.o: mplayer.c $(HACK_H) $(O)mthrowu.o: mthrowu.c $(HACK_H) $(O)muse.o: muse.c $(HACK_H) $(O)music.o: music.c $(HACK_H) #interp.c -$(O)o_init.o: o_init.c $(HACK_H) $(INCL)/lev.h +$(O)nhlua.o: nhlua.c $(HACK_H) +$(O)nhlsel.o: nhlsel.c $(HACK_H) +$(O)nhlobj.o: nhlobj.c $(HACK_H) +$(O)o_init.o: o_init.c $(HACK_H) $(O)objects.o: objects.c $(CONFIG_H) $(INCL)/obj.h $(INCL)/objclass.h \ $(INCL)/prop.h $(INCL)/skills.h $(INCL)/color.h $(O)objnam.o: objnam.c $(HACK_H) @@ -1720,17 +1606,17 @@ $(O)polyself.o: polyself.c $(HACK_H) $(O)potion.o: potion.c $(HACK_H) $(O)pray.o: pray.c $(HACK_H) $(O)priest.o: priest.c $(HACK_H) $(INCL)/mfndpos.h -$(O)quest.o: quest.c $(HACK_H) $(INCL)/qtext.h -$(O)questpgr.o: questpgr.c $(HACK_H) $(INCL)/dlb.h $(INCL)/qtext.h +$(O)quest.o: quest.c $(HACK_H) +$(O)questpgr.o: questpgr.c $(HACK_H) $(INCL)/dlb.h $(O)read.o: read.c $(HACK_H) $(O)rect.o: rect.c $(HACK_H) -$(O)region.o: region.c $(HACK_H) $(INCL)/lev.h -$(O)restore.o: restore.c $(HACK_H) $(INCL)/lev.h $(INCL)/tcap.h +$(O)region.o: region.c $(HACK_H) +$(O)restore.o: restore.c $(HACK_H) $(INCL)/tcap.h $(O)rip.o: rip.c $(HACK_H) $(O)rnd.o: rnd.c $(HACK_H) $(O)role.o: role.c $(HACK_H) -$(O)rumors.o: rumors.c $(HACK_H) $(INCL)/lev.h $(INCL)/dlb.h -$(O)save.o: save.c $(HACK_H) $(INCL)/lev.h +$(O)rumors.o: rumors.c $(HACK_H) $(INCL)/dlb.h +$(O)save.o: save.c $(HACK_H) $(O)shk.o: shk.c $(HACK_H) $(O)shknam.o: shknam.c $(HACK_H) $(O)sit.o: sit.c $(HACK_H) $(INCL)/artifact.h @@ -1741,7 +1627,7 @@ $(O)steal.o: steal.c $(HACK_H) $(O)steed.o: steed.c $(HACK_H) $(O)sys.o: sys.c $(HACK_H) $(O)teleport.o: teleport.c $(HACK_H) -$(O)timeout.o: timeout.c $(HACK_H) $(INCL)/lev.h +$(O)timeout.o: timeout.c $(HACK_H) $(O)topten.o: topten.c $(HACK_H) $(INCL)/dlb.h $(INCL)/patchlevel.h $(O)track.o: track.c $(HACK_H) $(O)trap.o: trap.c $(HACK_H) @@ -1753,9 +1639,10 @@ $(O)vision.o: vision.c $(HACK_H) $(INCL)/vis_tab.h $(O)weapon.o: weapon.c $(HACK_H) $(O)were.o: were.c $(HACK_H) $(O)wield.o: wield.c $(HACK_H) +$(O)windmain.o: $(MSWSYS)/windmain.c $(HACK_H) $(O)windows.o: windows.c $(HACK_H) $(INCL)/wingem.h $(INCL)/winGnome.h -$(O)wizard.o: wizard.c $(HACK_H) $(INCL)/qtext.h -$(O)worm.o: worm.c $(HACK_H) $(INCL)/lev.h +$(O)wizard.o: wizard.c $(HACK_H) +$(O)worm.o: worm.c $(HACK_H) $(O)worn.o: worn.c $(HACK_H) $(O)write.o: write.c $(HACK_H) $(O)zap.o: zap.c $(HACK_H) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 7954b30c2..11bbbadb2 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -1,17 +1,18 @@ -# NetHack 3.7 Makefile.msc $NHDT-Date: 1554784482 2019/04/09 04:34:42 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.153 $ */ +# NetHack 3.7 Makefile.msc # Copyright (c) NetHack PC Development Team 1993-2019 # #============================================================================== # Build Tools Environment # -# NetHack 3.6.x Makefile for MS Visual Studio Visual C++ compiler -# +# NetHack 3.7 Work-in-progress Makefile for +# MS Visual Studio Visual C++ compiler +# # Visual Studio Compilers Tested: # - Microsoft Visual Studio 2017 Community Edition # - Microsoft Visual Studio 2019 Community Edition # #============================================================================== -# This is used for building two versions of NetHack: +# This is used for building two distinct executables of NetHack: # # A tty port utilizing the Win32 Console I/O subsystem, Console # NetHack.exe @@ -19,52 +20,77 @@ # A Win32 native port built on the Windows API, Graphical NetHack or # NetHackW.exe # -# In addition to your C compiler, +# BEFORE YOU START, in addition to your C compiler and linker, # -# if you want to change you will need a -# files with suffix workalike for -# .y yacc (such as bison) -# .l lex (such as flex) +# o You will need a complete Lua source tree parallel to your +# NetHack source tree. Lua is not an optional requirement, +# it is required in order to process the level and dungeon +# description files during the game. You can obtain the +# Lua source from here: +# https://www.lua.org/download.html # -# If you have any questions read the sys/winnt/Install.nt file included -# with the distribution. -#======================================================================================== -# BUILD DECISIONS SECTION +# o If you want to include the curses Window port in the non-GUI +# NetHack.exe build, you will need a complete PDCurses source +# tree parallel to your NetHack source tree. You can obtain the +# PDCurses source from here: +# https://sourceforge.net/projects/pdcurses/files/pdcurses/ +# or via git from here: +# git clone https://github.com/wmcbrine/PDCurses.git ../pdcurses # -# There are currently only 4 decisions that you can choose to make, and none are -# absolutely required because defaults are in place: -# 1. Where do you want your build to end up? -# 2. Do you want debug information in the executable? -# 3. Do you want to explicitly override auto-detection of a 32-bit or 64-bit target? -# 4. Do you want to include the optional curses port? +# o If you want your build of NetHack to include support for +# compressing your save files, or to be able to exchange and use +# compressed save files that originated on another platform such +# as Linux or a handheld phone or tablet, then you will need +# a copy of the zlib source tree parallel to your NetHack source +# tree. You can obtain the zlib source from here: +# https://www.zlib.net/zlib1211.zip # -#----------------------------------------------------------------------------------------- -#========================================================================================= - -#--------------------------------------------------------------- +# If you want to find out more information about Lua, PDCurses, or zlib, +# here are the home page links for each at the time of this writing: +# +# Lua: https://www.lua.org/ +# PDCurses: https://pdcurses.org/ +# zlib: https://www.zlib.net/ +# +# If you have any questions about building NetHack for the Windows platform +# please read sys/winnt/Install.nt file included in the distribution. +# +#============================================================================== +# DECISIONS SECTION +# +# Build Options Decisions +# +# There are currently 5 decisions that you can choose to make. +# none of the 5 decisions are absolutely required because defaults +# are in place: +# +# 1. Where do you want your build results to end up? +# 2. Do you want to include the optional curses port? +# 3. Do you want to include compressed savefile support to +# transfer compressed savefiles between platforms? +# 4. Do you want debug information in the executable? +# 5. Do you want to explicitly override auto-detection of +# a 32-bit or 64-bit target? +# +# Mandatory Lua source Location (not optional) +# +# Lua source code or is required to build NetHack-3.7. +# LUATOP below must point to the correct location of the LUA sources. +# By default it is assumed to be parallel to your NetHack source tree in +# the same parent directory/folder. +# +#------------------------------------------------------------------------------ +#============================================================================== +# +#------------------------------------------------------------------------------ # 1. Where do you want the game to be built (which folder)? - -GAMEDIR = ..\binary # Default game build directory - -#--------------------------------------------------------------- -# 2. Do you want debug information available to the executable? - -DEBUGINFO = Y - -#--------------------------------------------------------------- -# 3. This Makefile will attempt to auto-detect your selected target architecture -# based on Visual Studio command prompt configuration settins etc. -# However, if you want to manually override generation of a -# 32-bit or 64-bit build target, you can uncomment the apppropriate -# TARGET_CPU line below. # -#TARGET_CPU=x64 -#TARGET_CPU=x86 - -#--------------------------------------------------------------- +GAMEDIR = ..\binary # Default game build directory +# +#------------------------------------------------------------------------------ # OPTIONAL - Curses window port support # -# 4. Uncomment these and set them appropriately if you want to +# 2. Uncomment these and set them appropriately if you want to # include curses port support alongside TTY support in your # NetHack.exe binary. # @@ -73,22 +99,67 @@ DEBUGINFO = Y # of your PDCurses C files. # #ADD_CURSES=Y -#PDCURSES_TOP=..\..\pdcurses +#PDCURSES_TOP=..\lib\pdcurses # +#------------------------------------------------------------------------------ +# OPTIONAL - zlib support (to allow compressed savefile exchange across platforms +# +# 3. Location of zlib sources +# +# +#ADD_ZLIB=Y +#ZLIBTOP=..\lib\zlib +# +#------------------------------------------------------------------------------ +# 4. Do you want debug information available to the executable? +# +DEBUGINFO = Y +# +#------------------------------------------------------------------------------ +# 5. This Makefile will attempt to auto-detect your selected target architecture +# based on Visual Studio command prompt configuration settins etc. +# However, if you want to manually override generation of a +# 32-bit or 64-bit build target, you can uncomment the apppropriate +# TARGET_CPU line below. +# +#TARGET_CPU=x64 +#TARGET_CPU=x86 +# +# +#============================================================================== #============================================================================== # This marks the end of the BUILD DECISIONS section. #============================================================================== +#============================================================================== # -#=============================================== -#======= End of Modification Section =========== -#=============================================== +# Location of LUA # -################################################ -# # -# Nothing below here should have to be changed.# -# # -################################################ - +# Original source needs to be obtained from: +# http://www.lua.org/ftp/lua-5.3.5.tar.gz +# +# This build assumes that the LUA sources are located +# at the specified location. If they are actually elsewhere +# you'll need to specify the correct spot below in order to +# successfully build NetHack-3.7. You cannot build a functional +# version of NetHack-3.7 Work-in-progress without including Lua. +# +LUATOP=..\lib\lua-5.3.5 +# +# +#============================================================================== +# +#TEST_CROSSCOMPILE=Y +#OPTIONS_AT_RUNTIME=Y +# +#============================================================================== +#======================== End of Modification Section ========================= +#============================================================================== +# +# ################################################# +# # # +# # Nothing below here should have to be changed. # +# # # +# ################################################# # #============================================================================== # @@ -173,19 +244,26 @@ O = $(OBJ)^\ U = $(UTIL)^\ +!IFDEF TEST_CROSSCOMPILE +CROSSCOMPILE_TARGET = -DCROSSCOMPILE_TARGET +CROSSCOMPILE_HOST = -DCROSSCOMPILE_HOST +CROSSCOMPILE = -DCROSSCOMPILE +OPTIONS_AT_RUNTIME=Y +HOST=_host +!ELSE +!UNDEF CROSSCOMPILE_TARGET +!UNDEF CROSSCOMPILE_HOST +!UNDEF CROSSCOMPILE +!UNDEF HOST +!ENDIF + # # Utility Objects. # MAKESRC = $(U)makedefs.c -MAKEOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o - -LEVCOMPOBJS = $(O)lev_yacc.o $(O)lev_lex.o $(O)lev_main.o \ - $(O)alloc.o $(O)decl.o $(O)drawing.o $(O)monst.o $(O)objects.o $(O)panic.o - -DGNCOMPOBJS = $(O)dgn_yacc.o $(O)dgn_lex.o $(O)dgn_main.o \ - $(O)alloc.o $(O)panic.o +MAKEDEFSOBJS = $(O)makedefs$(HOST).o $(O)monst$(HOST).o $(O)objects$(HOST).o RECOVOBJS = $(O)recover.o @@ -194,16 +272,27 @@ TILEFILES = $(WSHR)\monsters.txt $(WSHR)\objects.txt $(WSHR)\other.txt # # These are not invoked during a normal game build in 3.4 # -TEXT_IO = $(O)tiletext.o $(O)tiletxt.o $(O)drawing.o \ - $(O)decl.o $(O)monst.o $(O)objects.o -TEXT_IO32 = $(O)tilete32.o $(O)tiletx32.o $(O)drawing.o \ - $(O)decl.o $(O)monst.o $(O)objects.o +!IFDEF CROSSCOMPILE_HOST +DO_UTILS = Y +!ELSE IFNDEF CROSSCOMPILE +DO_UTILS = Y +!ELSE +DO_UTILS = N +!ENDIF -GIFREADERS = $(O)gifread.o $(O)alloc.o $(O)panic.o -GIFREADERS32 = $(O)gifrd32.o $(O)alloc.o $(O)panic.o +!IF "$(DO_UTILS)" == "Y" +TEXT_IO = $(O)tiletext$(HOST).o $(O)tiletxt$(HOST).o $(O)drawing$(HOST).o \ + $(O)decl$(HOST).o $(O)monst$(HOST).o $(O)objects$(HOST).o -PPMWRITERS = $(O)ppmwrite.o $(O)alloc.o $(O)panic.o +TEXT_IO32 = $(O)tilete32$(HOST).o $(O)tiletx32$(HOST).o $(O)drawing$(HOST).o \ + $(O)decl$(HOST).o $(O)monst$(HOST).o $(O)objects$(HOST).o + +GIFREADERS = $(O)gifread$(HOST).o $(O)alloc$(HOST).o $(O)panic$(HOST).o +GIFREADERS32 = $(O)gifrd32$(HOST).o $(O)alloc$(HOST).o $(O)panic$(HOST).o + +PPMWRITERS = $(O)ppmwrite$(HOST).o $(O)alloc$(HOST).o $(O)panic$(HOST).o +!ENDIF # # Object files for the game itself. @@ -236,15 +325,28 @@ VOBJ24 = $(O)track.o $(O)trap.o $(O)u_init.o $(O)uhitm.o VOBJ25 = $(O)vault.o $(O)vis_tab.o $(O)vision.o $(O)weapon.o VOBJ26 = $(O)were.o $(O)wield.o $(O)windows.o $(O)wizard.o VOBJ27 = $(O)worm.o $(O)worn.o $(O)write.o $(O)zap.o -VOBJ28 = $(O)sfbase.o $(O)sfdata.o -VOBJ29 = $(O)sfstruct.o $(O)sfascii.o $(O)sflendian.o +VOBJ28 = $(O)sfstruct.o +LUAOBJ = $(O)nhlua.o $(O)nhlsel.o $(O)nhlobj.o +LUA_QTEXT_FILE = "quest.lua" + +!IFDEF CROSSCOMPILE_HOST +DLBOBJ_HOST = $(O)dlb$(HOST).o +!ENDIF DLBOBJ = $(O)dlb.o REGEX = $(O)cppregex.o TTYOBJ = $(O)topl.o $(O)getline.o $(O)wintty.o +MDLIB = $(O)mdlib.o + +!IF "$(OPTIONS_AT_RUNTIME)" == "Y" +RUNTIMEOPTDEF=-DOPTIONS_AT_RUNTIME +!ELSE +RUNTIMEOPTDEF= +!ENDIF + !IFNDEF ADD_CURSES CURSESOBJ= !ELSE @@ -261,7 +363,7 @@ OBJS = $(VOBJ01) $(VOBJ02) $(VOBJ03) $(VOBJ04) $(VOBJ05) \ $(VOBJ16) $(VOBJ17) $(VOBJ18) $(VOBJ19) $(VOBJ20) \ $(VOBJ21) $(VOBJ22) $(VOBJ23) $(VOBJ24) $(VOBJ25) \ $(VOBJ26) $(VOBJ27) $(VOBJ28) $(VOBJ29) $(VOBJ30) \ - $(REGEX) $(CURSESOBJ) + $(REGEX) $(CURSESOBJ) $(MDLIB) GUIOBJ = $(O)mhaskyn.o $(O)mhdlg.o \ $(O)mhfont.o $(O)mhinput.o $(O)mhmain.o $(O)mhmap.o \ @@ -287,10 +389,66 @@ SOUND = $(OBJ)\ntsound.o VVOBJ = $(O)version.o -ALLOBJ = $(SOBJ) $(DLBOBJ) $(WOBJ) $(OBJS) $(VVOBJ) +ALLOBJ = $(SOBJ) $(DLBOBJ) $(WOBJ) $(OBJS) $(VVOBJ) $(LUAOBJ) OPTIONS_FILE = $(DAT)\options +#===============-================================================= +# LUA library +# Source from http://www.lua.org/ftp/lua-5.3.5.tar.gz +#================================================================= + +!IFDEF LUATOP +LUATMP = $(LUATOP:..\..\lua-=) #strip leading "..\..\lua-" +LUATMP = $(LUATMP:-beta=) #strip suffix if exists "-beta" +!IF "$(LUATMP)" == "5.4.0" +LUAVER = 5.4.0 +!ENDIF +!ELSE +!ERROR NetHack 3.7 requires LUA so LUATOP must be defined +!ENDIF + +!IFNDEF LUAVER +LUATMP = $(LUATOP:..\..\LUA-=) #strip leading "..\..\LUA-" +LUATMP = $(LUATMP:-BETA=) #strip suffix if exists "-BETA" +!IF "$(LUATMP)" == "5.4.0" +LUAVER = 5.4.0 +!ELSE +LUAVER = 5.3.5 +!ENDIF +!ENDIF + +LUASRC = $(LUATOP)\src +LUALIB = $(O)lua$(LUAVER)-static.lib +LUADLL = $(O)lua$(LUAVER).dll +LUAINCL = /I$(LUASRC) +LUATARGETS = lua.exe luac.exe $(LUADLL) $(LUALIB) + +LUASRCFILES = lapi.c lauxlib.c lbaselib.c lcode.c \ + lcorolib.c lctype.c ldblib.c ldebug.c ldo.c \ + ldump.c lfunc.c lgc.c linit.c liolib.c llex.c \ + lmathlib.c lmem.c loadlib.c lobject.c lopcodes.c \ + loslib.c lparser.c lstate.c lstring.c lstrlib.c \ + ltable.c ltablib.c ltm.c lundump.c lutf8lib.c \ + lvm.c lzio.c + +LUAOBJFILES = $(O)lapi.o $(O)lauxlib.o $(O)lbaselib.o \ + $(O)lcode.o $(O)lcorolib.o $(O)lctype.o $(O)ldblib.o \ + $(O)ldebug.o $(O)ldo.o $(O)ldump.o $(O)lfunc.o \ + $(O)lgc.o $(O)linit.o $(O)liolib.o $(O)llex.o \ + $(O)lmathlib.o $(O)lmem.o $(O)loadlib.o $(O)lobject.o \ + $(O)lopcodes.o $(O)loslib.o $(O)lparser.o $(O)lstate.o \ + $(O)lstring.o $(O)lstrlib.o $(O)ltable.o $(O)ltablib.o \ + $(O)ltm.o $(O)lundump.o $(O)lutf8lib.o $(O)lvm.o $(O)lzio.o + +!IF "$(LUAVER)" == "5.3.5" +LUASRCFILES = $(LUASRCFILES) lbitlib.c +LUAOBJFILES = $(LUAOBJFILES) $(O)lbitlib.o +!ELSEIF "$(LUAVER)" == "5.4.0" +# 5.4.0 adds header files ljumptab.h and lopnames.h +# and removes lbitlib.c +!ENDIF + !IF "$(ADD_CURSES)" == "Y" #===============-================================================= # PDCurses build macros @@ -328,29 +486,27 @@ PDCLIB = CONFIG_H = $(INCL)\config.h $(INCL)\config1.h $(INCL)\tradstdc.h \ $(INCL)\global.h $(INCL)\coord.h $(INCL)\vmsconf.h \ - $(INCL)\system.h $(INCL)\unixconf.h $(INCL)\os2conf.h \ - $(INCL)\micro.h $(INCL)\pcconf.h $(INCL)\tosconf.h \ - $(INCL)\amiconf.h $(INCL)\macconf.h $(INCL)\beconf.h \ - $(INCL)\ntconf.h + $(INCL)\system.h $(INCL)\nhlua.h $(INCL)\unixconf.h \ + $(INCL)\os2conf.h $(INCL)\micro.h $(INCL)\pcconf.h \ + $(INCL)\tosconf.h $(INCL)\amiconf.h $(INCL)\macconf.h \ + $(INCL)\beconf.h $(INCL)\wceconf.h $(INCL)\ntconf.h -HACK_H = $(INCL)\hack.h $(CONFIG_H) $(INCL)\align.h $(INCL)\context.h \ +HACK_H = $(INCL)\hack.h $(CONFIG_H) $(INCL)\lint.h $(INCL)\align.h \ $(INCL)\dungeon.h $(INCL)\monsym.h $(INCL)\mkroom.h \ $(INCL)\objclass.h $(INCL)\youprop.h $(INCL)\prop.h \ $(INCL)\permonst.h $(INCL)\monattk.h \ $(INCL)\monflag.h $(INCL)\mondata.h $(INCL)\pm.h \ - $(INCL)\wintype.h $(INCL)\decl.h $(INCL)\quest.h \ + $(INCL)\wintype.h $(INCL)\context.h $(INCL)\rm.h \ + $(INCL)\botl.h $(INCL)\rect.h \ + $(INCL)\region.h $(INCL)\decl.h $(INCL)\quest.h \ $(INCL)\spell.h $(INCL)\color.h $(INCL)\obj.h \ - $(INCL)\you.h $(INCL)\attrib.h $(INCL)\monst.h $(INCL)\lint.h \ + $(INCL)\you.h $(INCL)\attrib.h $(INCL)\monst.h \ $(INCL)\mextra.h $(INCL)\skills.h $(INCL)\onames.h \ - $(INCL)\timeout.h $(INCL)\trap.h $(INCL)\flag.h $(INCL)\rm.h \ + $(INCL)\timeout.h $(INCL)\trap.h $(INCL)\flag.h \ $(INCL)\vision.h $(INCL)\display.h $(INCL)\engrave.h \ - $(INCL)\rect.h $(INCL)\region.h $(INCL)\winprocs.h $(INCL)\botl.h \ - $(INCL)\wintty.h $(INCL)\sys.h $(INCL)\trampoli.h + $(INCL)\winprocs.h $(INCL)\sys.h $(INCL)\wintty.h \ + $(INCL)\trampoli.h -LEV_H = $(INCL)\lev.h -DGN_FILE_H = $(INCL)\dgn_file.h -LEV_COMP_H = $(INCL)\lev_comp.h -SP_LEV_H = $(INCL)\sp_lev.h TILE_H = ..\win\share\tile.h #========================================== @@ -369,7 +525,12 @@ DATABASE = $(DAT)\data.base # ctags options # #CTAGSCMD=ctags-orig.exe +!IF "$(TRAVIS_BUILD_DIR)" != "" +CTAGSCMD=..\lib\ctags\ctags.exe +!ELSE CTAGSCMD=..\..\..\ctags\ctags.exe +!ENDIF + CTAGSOPT =--language-force=c --sort=no -D"Bitfield(x,n)=unsigned x : n" --excmd=pattern # # ctags wants unix-style pathnames @@ -474,14 +635,14 @@ CL_RECENT=-sdl !IF "$(ADD_CURSES)" == "Y" CURSESDEF=-D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE" -DCHTYPE_32 !ELSE -CURSDEF= -CURSESLIB= +!UNDEF CURSDEF= +!UNDEF CURSESLIB= !ENDIF ccommon= -c -nologo -D"_CONSOLE" -D"_CRT_NONSTDC_NO_DEPRECATE" -D"_CRT_SECURE_NO_DEPRECATE" \ -D"_LIB" -D"_SCL_SECURE_NO_DEPRECATE" -D"_VC80_UPGRADE=0x0600" -D"DLB" -D"_MBCS" \ -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -D"NDEBUG" -D"YY_NO_UNISTD_H" \ - -DHAS_STDINT_H -DHAS_INLINE $(CURSESDEF) \ + -DHAS_STDINT_H -DHAS_INLINE $(CURSESDEF) $(RUNTIMEOPTDEF) \ -EHsc -fp:precise -Gd -GF -GS -Gy \ $(CL_RECENT) -WX- -Zc:forScope -Zc:wchar_t -Zi cdebug= -analyze- -D"_DEBUG" -MTd -RTC1 -Od @@ -540,7 +701,8 @@ guilflags = $(lflags) -subsystem:windows,$(EXEVER) dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll # basic subsystem specific libraries, less the C Run-Time -baselibs = kernel32.lib $(optlibs) $(winsocklibs) advapi32.lib gdi32.lib +baselibs = kernel32.lib $(optlibs) $(winsocklibs) advapi32.lib gdi32.lib \ + ole32.lib Shell32.lib winlibs = $(baselibs) user32.lib comdlg32.lib winspool.lib # for Windows applications that use the C Run-Time libraries @@ -548,11 +710,7 @@ conlibs = $(baselibs) guilibs = $(winlibs) # -!IFNDEF ADD_CURSES -INCLDIR= /I..\include /I..\sys\winnt -!ELSE -INCLDIR= /I..\include /I..\sys\winnt -!ENDIF +INCLDIR= /I..\include /I..\sys\winnt $(LUAINCL) #========================================== # Util builds @@ -584,20 +742,20 @@ DLB = #========================================== .c{$(OBJ)}.o: - @$(cc) $(cflagsBuild) -Fo$@ $< + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $< {$(SRC)}.c{$(OBJ)}.o: - @$(cc) $(cflagsBuild) -Fo$@ $< + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $< #========================================== # Rules for files in sys\share #========================================== {$(SSYS)}.c{$(OBJ)}.o: - @$(cc) $(cflagsBuild) -Fo$@ $< + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $< {$(SSYS)}.cpp{$(OBJ)}.o: - @$(cc) $(cflagsBuild) /EHsc -Fo$@ $< + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) /EHsc -Fo$@ $< #========================================== # Rules for files in sys\winnt @@ -614,14 +772,14 @@ DLB = #========================================== {$(UTIL)}.c{$(OBJ)}.o: - @$(cc) $(cflagsBuild) -Fo$@ $< + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) -Fo$@ $< #========================================== # Rules for files in win\share #========================================== {$(WSHR)}.c{$(OBJ)}.o: - @$(cc) $(cflagsBuild) -Fo$@ $< + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $< {$(WSHR)}.h{$(INCL)}.h: @copy $< $@ @@ -634,7 +792,7 @@ DLB = #========================================== {$(TTY)}.c{$(OBJ)}.o: - $(cc) $(cflagsBuild) -Fo$@ $< + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $< #========================================== @@ -642,14 +800,14 @@ DLB = #========================================== {$(MSWIN)}.c{$(OBJ)}.o: - @$(cc) $(cflagsBuild) -Fo$@ $< + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $< #========================================== # Rules for files in win\curses #========================================== {$(WCURSES)}.c{$(OBJ)}.o: - @$(cc) -DPDC_NCMOUSE $(PDCINCL) $(cflagsBuild) -Fo$@ $< + @$(cc) -DPDC_NCMOUSE $(PDCINCL) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $< #{$(WCURSES)}.txt{$(DAT)}.txt: # @copy $< $@ @@ -659,13 +817,20 @@ DLB = #========================================== {$(PDCURSES_TOP)}.c{$(OBJ)}.o: - @$(cc) $(PDCINCL) $(cflagsBuild) -Fo$@ $< + @$(cc) $(PDCINCL) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $< {$(PDCSRC)}.c{$(OBJ)}.o: - @$(cc) $(PDCINCL) $(cflagsBuild) -Fo$@ $< + @$(cc) $(PDCINCL) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $< {$(PDCWINCON)}.c{$(OBJ)}.o: - @$(cc) $(PDCINCL) $(cflagsBuild) -Fo$@ $< + @$(cc) $(PDCINCL) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $< + +#========================================== +# Rules for LUA files +#========================================== + +{$(LUASRC)}.c{$(OBJ)}.o: + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $< #========================================== #=============== TARGETS ================== @@ -679,102 +844,17 @@ default : install # # The game target. # - # # Everything # all : install -install: $(O)envchk.tag $(O)obj.tag $(O)utility.tag $(GAMEDIR)\NetHack.exe $(GAMEDIR)\NetHackW.exe $(O)install.tag +install: $(INCL)\nhlua.h $(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 \ - $(DAT)\oracles $(DAT)\quest.dat $(O)sp_lev.tag $(DLB) -! IF ("$(USE_DLB)"=="Y") - copy nhdat$(NHV) $(GAMEDIR) - copy $(DAT)\license $(GAMEDIR) - copy $(DAT)\opthelp $(GAMEDIR) -! ELSE - copy $(DAT)\*. $(GAMEDIR) - copy $(DAT)\*.dat $(GAMEDIR) - copy $(DAT)\*.lev $(GAMEDIR) - if exist $(GAMEDIR)\makefile del $(GAMEDIR)\makefile -! ENDIF - if not exist $(GAMEDIR)\sysconf copy $(MSWSYS)\sysconf $(GAMEDIR) - if exist $(DAT)\symbols copy $(DAT)\symbols $(GAMEDIR) - if exist $(DOC)\guidebook.txt copy $(DOC)\guidebook.txt $(GAMEDIR)\Guidebook.txt - if exist $(DOC)\nethack.txt copy $(DOC)\nethack.txt $(GAMEDIR)\NetHack.txt - @if exist $(GAMEDIR)\NetHack.PDB echo NOTE: You may want to remove $(GAMEDIR:\=/)/NetHack.PDB to conserve space - @if exist $(GAMEDIR)\NetHackW.PDB echo NOTE: You may want to remove $(GAMEDIR:\=/)/NetHackW.PDB to conserve space - -if not exist $(GAMEDIR)\defaults.nh copy $(MSWSYS)\defaults.nh $(GAMEDIR)\defaults.nh - -if not exist $(GAMEDIR)\record. goto>$(GAMEDIR)\record. - echo install done > $@ - -# copy $(MSWSYS)\winnt.hlp $(GAMEDIR) - -recover: $(U)recover.exe - if exist $(U)recover.exe copy $(U)recover.exe $(GAMEDIR) - if exist $(DOC)\recover.txt copy $(DOC)\recover.txt $(GAMEDIR)\recover.txt - -$(O)sp_lev.tag: $(O)utility.tag $(DAT)\bigroom.des $(DAT)\castle.des \ - $(DAT)\endgame.des $(DAT)\gehennom.des $(DAT)\knox.des \ - $(DAT)\medusa.des $(DAT)\oracle.des $(DAT)\tower.des \ - $(DAT)\yendor.des $(DAT)\arch.des $(DAT)\barb.des \ - $(DAT)\caveman.des $(DAT)\healer.des $(DAT)\knight.des \ - $(DAT)\monk.des $(DAT)\priest.des $(DAT)\ranger.des \ - $(DAT)\rogue.des $(DAT)\samurai.des $(DAT)\sokoban.des \ - $(DAT)\tourist.des $(DAT)\valkyrie.des $(DAT)\wizard.des - cd $(DAT) - $(U)levcomp bigroom.des - $(U)levcomp castle.des - $(U)levcomp endgame.des - $(U)levcomp gehennom.des - $(U)levcomp knox.des - $(U)levcomp mines.des - $(U)levcomp medusa.des - $(U)levcomp oracle.des - $(U)levcomp sokoban.des - $(U)levcomp tower.des - $(U)levcomp yendor.des - $(U)levcomp arch.des - $(U)levcomp barb.des - $(U)levcomp caveman.des - $(U)levcomp healer.des - $(U)levcomp knight.des - $(U)levcomp monk.des - $(U)levcomp priest.des - $(U)levcomp ranger.des - $(U)levcomp rogue.des - $(U)levcomp samurai.des - $(U)levcomp tourist.des - $(U)levcomp valkyrie.des - $(U)levcomp wizard.des - cd $(SRC) - echo sp_levs done > $(O)sp_lev.tag - -$(O)utility.tag: $(INCL)\date.h $(INCL)\onames.h $(INCL)\pm.h \ - $(SRC)\vis_tab.c \ - $(U)levcomp.exe $(INCL)\vis_tab.h \ - $(U)dgncomp.exe $(TILEUTIL16) - @echo utilities made >$@ - @echo utilities made. - -tileutil: $(U)gif2txt.exe $(U)gif2tx32.exe $(U)txt2ppm.exe - @echo Optional tile development utilities are up to date. - -$(O)NetHackW.res: $(TILEBMP16) $(MSWIN)\NetHackW.rc $(MSWIN)\mnsel.bmp \ - $(MSWIN)\mnselcnt.bmp $(MSWIN)\mnunsel.bmp \ - $(MSWIN)\petmark.bmp $(MSWIN)\pilemark.bmp $(MSWIN)\NetHack.ico $(MSWIN)\rip.bmp \ - $(MSWIN)\splash.bmp - @$(rc) -r -fo$@ -i$(MSWIN) -dNDEBUG $(MSWIN)\NetHackW.rc - -$(O)console.res: $(MSWSYS)\console.rc $(MSWSYS)\NetHack.ico - @$(rc) -r -fo$@ -i$(MSWSYS) -dNDEBUG $(MSWSYS)\console.rc - - #========================================== -# The game targets. +# Main game targets. #========================================== # The section for linking the NetHack image looks a little strange at @@ -818,11 +898,13 @@ GAMEOBJ=$(GAMEOBJ:^ =^ $(GAMEDIR)\NetHack.exe : $(O)gamedir.tag $(PDCLIB) $(O)tile.o $(O)nttty.o $(O)guistub.o \ - $(ALLOBJ) $(TTYOBJ) $(GUIOBJ) $(O)console.res $(KEYDLLS) + $(ALLOBJ) $(TTYOBJ) $(GUIOBJ) $(O)console.res $(KEYDLLS) \ + $(LUATARGETS) @if not exist $(GAMEDIR)\*.* mkdir $(GAMEDIR) @echo Linking $(@:\=/) $(link) $(lflagsBuild) $(conlflags) /STACK:2048 /PDB:$(GAMEDIR)\$(@B).PDB /MAP:$(O)$(@B).MAP \ - $(LIBS) $(PDCLIB) $(conlibs) $(BCRYPT) -out:$@ @<<$(@B).lnk + $(LIBS) $(PDCLIB) $(LUALIB) \ + $(conlibs) $(BCRYPT) -out:$@ @<<$(@B).lnk $(GAMEOBJ) $(TTYOBJ) $(O)nttty.o @@ -834,18 +916,21 @@ $(GAMEDIR)\NetHack.exe : $(O)gamedir.tag $(PDCLIB) $(O)tile.o $(O)nttty.o $(O)gu # NetHackW # full tty linkage libs: -# libs: $(LIBS) $(guilibs) $(COMCTRL) +# libs: $(LIBS) $(PDCLIB) $(LUALIB) $(guilibs) $(COMCTRL) # objs: $(GAMEOBJ) $(GUIOBJ) $(TTYOBJ) $(O)tile.o $(O)nttty.o # otherwise: -# libs: $(LIBS) $(guilibs) $(COMCTRL) +# libs: $(LIBS) $(PDCLIB) $(LUALIB) $(guilibs) $(COMCTRL) # objs: $(GAMEOBJ) $(GUIOBJ) $(O)tile.o $(O)ttystub.o $(GAMEDIR)\NetHackW.exe : $(O)gamedir.tag $(O)tile.o $(O)ttystub.o \ - $(ALLOBJ) $(TTYOBJ) $(GUIOBJ) $(O)NetHackW.res $(O)gamedir.tag $(KEYDLLS) + $(ALLOBJ) $(TTYOBJ) $(GUIOBJ) $(O)NetHackW.res \ + $(O)gamedir.tag $(KEYDLLS) \ + $(LUATARGETS) @if not exist $(GAMEDIR)\*.* mkdir $(GAMEDIR) @echo Linking $(@:\=/) $(link) $(lflagsBuild) $(guilflags) /STACK:2048 /PDB:$(GAMEDIR)\$(@B).PDB \ - /MAP:$(O)$(@B).MAP $(LIBS) $(PDCLIB) $(guilibs) $(COMCTRL) $(BCRYPT) -out:$@ @<<$(@B).lnk + /MAP:$(O)$(@B).MAP $(LIBS) $(PDCLIB) $(LUALIB) \ + $(guilibs) $(COMCTRL) $(BCRYPT) -out:$@ @<<$(@B).lnk $(GAMEOBJ) $(GUIOBJ) $(O)tile.o @@ -915,6 +1000,64 @@ $(GAMEDIR)\nhraykey.dll : $(O)$(@B).o $(O)gamedir.tag $(O)$(@B).def /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).map" /DEF:$(O)$(@B).def \ /IMPLIB:$(O)$(@B).lib -out:$@ $(O)$(@B).o +$(O)install.tag: $(DAT)\data $(DAT)\rumors $(DAT)\oracles \ +! IFNDEF LUA_QTEXT_FILE + $(DAT)\quest.dat \ +! ENDIF + $(O)sp_lev.tag $(DLB) +! IF ("$(USE_DLB)"=="Y") + copy nhdat$(NHV) $(GAMEDIR) + copy $(DAT)\license $(GAMEDIR) + copy $(DAT)\opthelp $(GAMEDIR) +! ELSE + copy $(DAT)\*. $(GAMEDIR) + copy $(DAT)\*.dat $(GAMEDIR) + if exist $(GAMEDIR)\makefile del $(GAMEDIR)\makefile +! ENDIF + if exist $(MSWSYS)\sysconf.template copy $(MSWSYS)\sysconf.template $(GAMEDIR) + if exist $(DAT)\symbols copy $(DAT)\symbols $(GAMEDIR)\symbols.template + if exist $(DOC)\guidebook.txt copy $(DOC)\guidebook.txt $(GAMEDIR)\Guidebook.txt + if exist $(DOC)\nethack.txt copy $(DOC)\nethack.txt $(GAMEDIR)\NetHack.txt + @if exist $(GAMEDIR)\NetHack.PDB echo NOTE: You may want to remove $(GAMEDIR:\=/)/NetHack.PDB to conserve space + @if exist $(GAMEDIR)\NetHackW.PDB echo NOTE: You may want to remove $(GAMEDIR:\=/)/NetHackW.PDB to conserve space + -if exist $(MSWSYS)\.nethackrc.template copy $(MSWSYS)\.nethackrc.template $(GAMEDIR) + -if not exist $(GAMEDIR)\record. goto>$(GAMEDIR)\record. + echo install done > $@ + +# copy $(MSWSYS)\winnt.hlp $(GAMEDIR) + +recover: $(U)recover.exe + if exist $(U)recover.exe copy $(U)recover.exe $(GAMEDIR) + if exist $(DOC)\recover.txt copy $(DOC)\recover.txt $(GAMEDIR)\recover.txt + +$(O)sp_lev.tag: + echo sp_levs done > $(O)sp_lev.tag + +$(O)utility.tag: $(INCL)\nhlua.h $(INCL)\date.h $(INCL)\onames.h $(INCL)\pm.h \ + $(SRC)\vis_tab.c $(INCL)\vis_tab.h $(TILEUTIL16) + @echo utilities made >$@ + @echo utilities made. + +$(INCL)\nhlua.h: + @echo /* nhlua.h - generated by Makefile */ > $@ + @echo #include "../lib/lua-$(LUAVER)/src/lua.h" >> $@ + @echo LUA_API int (lua_error) (lua_State *L) NORETURN; >> $@ + @echo #include "../lib/lua-$(LUAVER)/src/lualib.h" >> $@ + @echo #include "../lib/lua-$(LUAVER)/src/lauxlib.h" >> $@ + @echo /*nhlua.h*/ >> $@ + +tileutil: $(U)gif2txt.exe $(U)gif2tx32.exe $(U)txt2ppm.exe + @echo Optional tile development utilities are up to date. + +$(O)NetHackW.res: $(TILEBMP16) $(MSWIN)\NetHackW.rc $(MSWIN)\mnsel.bmp \ + $(MSWIN)\mnselcnt.bmp $(MSWIN)\mnunsel.bmp \ + $(MSWIN)\petmark.bmp $(MSWIN)\pilemark.bmp $(MSWIN)\NetHack.ico $(MSWIN)\rip.bmp \ + $(MSWIN)\splash.bmp + @$(rc) -r -fo$@ -i$(MSWIN) -dNDEBUG $(MSWIN)\NetHackW.rc + +$(O)console.res: $(MSWSYS)\console.rc $(MSWSYS)\NetHack.ico + @$(rc) -r -fo$@ -i$(MSWSYS) -dNDEBUG $(MSWSYS)\console.rc + # # Secondary Targets. # @@ -922,23 +1065,26 @@ $(GAMEDIR)\nhraykey.dll : $(O)$(@B).o $(O)gamedir.tag $(O)$(@B).def #========================================== # Makedefs Stuff #========================================== -$(U)nhsizes.exe: $(O)nhsizes.o +$(U)nhsizes3.exe: $(O)nhsizes3$(HOST).o @echo Linking $(@:\=/) - $(link) $(lflagsBuild) -out:$@ $(O)nhsizes.o $(O)panic.o $(O)alloc.o + $(link) $(lflagsBuild) -out:$@ $(O)nhsizes$(HOST).o $(O)panic$(HOST).o $(O)alloc$(HOST).o -$(O)nhsizes.o: $(CONFIG_H) nhsizes.c - @$(cc) $(cflagsBuild) -Fo$@ nhsizes.c +$(O)nhsizes3$(HOST).o: $(CONFIG_H) nhsizes3.c + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) -Fo$@ nhsizes3.c -$(U)makedefs.exe: $(MAKEOBJS) +$(U)makedefs.exe: $(MAKEDEFSOBJS) @echo Linking $(@:\=/) - @$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ $(MAKEOBJS) + @$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ $(MAKEDEFSOBJS) -$(O)makedefs.o: $(CONFIG_H) $(INCL)\monattk.h $(INCL)\monflag.h $(INCL)\objclass.h \ - $(INCL)\monsym.h $(INCL)\qtext.h $(INCL)\patchlevel.h \ - $(U)makedefs.c +$(O)makedefs$(HOST).o: $(U)makedefs.c $(SRC)\mdlib.c $(CONFIG_H) $(INCL)\permonst.h \ + $(INCL)\objclass.h $(INCL)\monsym.h \ + $(INCL)\artilist.h $(INCL)\dungeon.h $(INCL)\obj.h \ + $(INCL)\monst.h $(INCL)\you.h $(INCL)\flag.h \ + $(INCL)\dlb.h $(INCL)\patchlevel.h @if not exist $(OBJ)\*.* echo creating directory $(OBJ:\=/) @if not exist $(OBJ)\*.* mkdir $(OBJ) - @$(cc) -DENUM_PM $(cflagsBuild) -Fo$@ $(U)makedefs.c + @$(cc) -DENUM_PM $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) -Fo$@ $(U)makedefs.c +# @$(cc) -DENUM_PM $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) /EP -Fo$@ $(U)makedefs.c >makedefs.c.preprocessed # # date.h should be remade every time any of the source or include @@ -964,12 +1110,12 @@ $(SRC)\vis_tab.c: $(U)makedefs.exe # uudecode utility and uuencoded targets #========================================== -$(U)uudecode.exe: $(O)uudecode.o +$(U)uudecode.exe: $(O)uudecode$(HOST).o @echo Linking $(@:\=/) - @$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ $(O)uudecode.o + @$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ $(O)uudecode$(HOST).o -$(O)uudecode.o: $(SSYS)\uudecode.c - @$(cc) $(cflagsBuild) /D_CRT_SECURE_NO_DEPRECATE -Fo$@ $(SSYS)\uudecode.c +$(O)uudecode$(HOST).o: $(SSYS)\uudecode.c + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) /D_CRT_SECURE_NO_DEPRECATE -Fo$@ $(SSYS)\uudecode.c $(MSWSYS)\NetHack.ico : $(U)uudecode.exe $(MSWSYS)\nhico.uu chdir $(MSWSYS) @@ -1016,71 +1162,6 @@ $(MSWIN)\splash.bmp: $(U)uudecode.exe $(MSWIN)\splash.uu ..\..\util\uudecode.exe splash.uu chdir ..\..\src -#================================================= -# Level Compiler Stuff -#================================================= -# -# defer to the steps in ..\win\win32\levstuff.mak -# - -$(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 - @$(cc) $(cflagsBuild) -Fo$@ $(U)lev_lex.c - -$(O)lev_main.o: $(U)lev_main.c $(HACK_H) $(SP_LEV_H) - @$(cc) $(cflagsBuild) -Fo$@ $(U)lev_main.c - -$(U)levcomp.exe: $(LEVCOMPOBJS) - @echo Linking $(@:\=/) - @$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ @<<$(@B).lnk - $(LEVCOMPOBJS:^ =^ - ) -<< - -#================================================= -# Dungeon Compiler Stuff -#================================================= -# -# defer to the steps in ..\win\win32\dgnstuff.mak -# -$(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 - -$(O)dgn_lex.o: $(HACK_H) $(DGN_FILE_H) $(INCL)\dgn_comp.h \ - $(U)dgn_lex.c - @$(cc) $(cflagsBuild) -Fo$@ $(U)dgn_lex.c - -$(O)dgn_main.o: $(HACK_H) $(U)dgn_main.c - @$(cc) $(cflagsBuild) -Fo$@ $(U)dgn_main.c - -$(U)dgncomp.exe: $(DGNCOMPOBJS) - @echo Linking $(@:\=/) - @$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ @<<$(@B).lnk - $(DGNCOMPOBJS:^ =^ - ) -<< - - #================================================= # Create directory for holding object files #================================================= @@ -1122,27 +1203,42 @@ $(O)envchk.tag: $(O)obj.tag # DLB utility and nhdatNNN file creation #========================================== -$(U)dlb_main.exe: $(DLBOBJ) $(O)dlb.o +$(U)dlb_main.exe: $(DLBOBJ_HOST) $(O)dlb$(HOST).o @echo Linking $(@:\=/) @$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ @<<$(@B).lnk - $(O)dlb_main.o - $(O)dlb.o - $(O)alloc.o - $(O)panic.o + $(O)dlb_main$(HOST).o + $(O)dlb$(HOST).o + $(O)alloc$(HOST).o + $(O)panic$(HOST).o << -$(O)dlb.o: $(O)dlb_main.o $(O)alloc.o $(O)panic.o $(INCL)\dlb.h - @$(cc) $(cflagsBuild) /Fo$@ $(SRC)\dlb.c +!IFDEF CROSSCOMPILE_HOST +$(O)dlb$(HOST).o: $(O)dlb_main$(HOST).o $(O)alloc$(HOST).o $(O)panic$(HOST).o $(INCL)\dlb.h + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) /Fo$@ $(SRC)\dlb.c +!ENDIF + +$(O)dlb.o: $(O)dlb_main.o $(O)alloc.o $(O)panic.o $(INCL)\dlb.h + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) /Fo$@ $(SRC)\dlb.c +!IFDEF CROSSCOMPILE_HOST +$(O)dlb_main$(HOST).o: $(UTIL)\dlb_main.c $(INCL)\config.h $(INCL)\dlb.h + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) /Fo$@ $(UTIL)\dlb_main.c +!ENDIF + $(O)dlb_main.o: $(UTIL)\dlb_main.c $(INCL)\config.h $(INCL)\dlb.h - @$(cc) $(cflagsBuild) /Fo$@ $(UTIL)\dlb_main.c + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) /Fo$@ $(UTIL)\dlb_main.c $(DAT)\porthelp: $(MSWSYS)\porthelp @copy $(MSWSYS)\porthelp $@ >nul nhdat$(NHV): $(U)dlb_main.exe $(DAT)\data $(DAT)\oracles $(OPTIONS_FILE) \ - $(DAT)\quest.dat $(DAT)\rumors $(DAT)\help $(DAT)\hh $(DAT)\cmdhelp $(DAT)\keyhelp \ - $(DAT)\history $(DAT)\opthelp $(DAT)\wizhelp $(DAT)\dungeon $(DAT)\porthelp \ +!IFNDEF LUA_QTEXT_FILE + $(DAT)\quest.dat \ +!ELSE + $(DAT)\quest.lua \ +!ENDIF + $(DAT)\rumors $(DAT)\help $(DAT)\hh $(DAT)\cmdhelp $(DAT)\keyhelp \ + $(DAT)\history $(DAT)\opthelp $(DAT)\wizhelp $(DAT)\porthelp \ $(DAT)\license $(DAT)\engrave $(DAT)\epitaph $(DAT)\bogusmon $(DAT)\tribute $(O)sp_lev.tag cd $(DAT) echo data >dlb.lst @@ -1151,12 +1247,10 @@ nhdat$(NHV): $(U)dlb_main.exe $(DAT)\data $(DAT)\oracles $(OPTIONS_FILE) \ if exist ttyoptions echo ttyoptions >>dlb.lst if exist guioptions echo guioptions >>dlb.lst if exist porthelp echo porthelp >>dlb.lst +!IFNDEF LUA_QTEXT_FILE echo quest.dat >>dlb.lst +!ENDIF echo rumors >>dlb.lst - echo engrave >>dlb.lst - echo epitaph >>dlb.lst - echo bogusmon >>dlb.lst - echo tribute >>dlb.lst echo help >>dlb.lst echo hh >>dlb.lst echo cmdhelp >>dlb.lst @@ -1164,9 +1258,12 @@ nhdat$(NHV): $(U)dlb_main.exe $(DAT)\data $(DAT)\oracles $(OPTIONS_FILE) \ echo history >>dlb.lst echo opthelp >>dlb.lst echo wizhelp >>dlb.lst - echo dungeon >>dlb.lst echo license >>dlb.lst - for %%N in (*.lev) do echo %%N >>dlb.lst + echo engrave >>dlb.lst + echo epitaph >>dlb.lst + echo bogusmon >>dlb.lst + echo tribute >>dlb.lst + for %%N in (*.lua) do echo %%N >>dlb.lst $(U)dlb_main cIf dlb.lst $(SRC)\nhdat cd $(SRC) @@ -1179,7 +1276,7 @@ $(U)recover.exe: $(RECOVOBJS) $(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ $(RECOVOBJS) $(O)recover.o: $(CONFIG_H) $(U)recover.c $(MSWSYS)\win32api.h - @$(cc) $(cflagsBuild) -Fo$@ $(U)recover.c + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) -Fo$@ $(U)recover.c #========================================== # Tile Mapping @@ -1189,33 +1286,33 @@ $(SRC)\tile.c: $(U)tilemap.exe @echo A new $(@:\=/) has been created @$(U)tilemap -$(U)tilemap.exe: $(O)tilemap.o +$(U)tilemap.exe: $(O)tilemap$(HOST).o @echo Linking $(@:\=/) - @$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ $(O)tilemap.o + @$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ $(O)tilemap$(HOST).o -$(O)tilemap.o: $(WSHR)\tilemap.c $(HACK_H) - @$(cc) $(cflagsBuild) -Fo$@ $(WSHR)\tilemap.c +$(O)tilemap$(HOST).o: $(WSHR)\tilemap.c $(HACK_H) + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) -Fo$@ $(WSHR)\tilemap.c -$(O)tiletx32.o: $(WSHR)\tilemap.c $(HACK_H) - @$(cc) $(cflagsBuild) /DTILETEXT /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\tilemap.c +$(O)tiletx32$(HOST).o: $(WSHR)\tilemap.c $(HACK_H) + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) /DTILETEXT /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\tilemap.c -$(O)tiletxt.o: $(WSHR)\tilemap.c $(HACK_H) - @$(cc) $(cflagsBuild) /DTILETEXT -Fo$@ $(WSHR)\tilemap.c +$(O)tiletxt$(HOST).o: $(WSHR)\tilemap.c $(HACK_H) + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) /DTILETEXT -Fo$@ $(WSHR)\tilemap.c -$(O)gifread.o: $(WSHR)\gifread.c $(CONFIG_H) $(TILE_H) - @$(cc) $(cflagsBuild) -I$(WSHR) -Fo$@ $(WSHR)\gifread.c +$(O)gifread$(HOST).o: $(WSHR)\gifread.c $(CONFIG_H) $(TILE_H) + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) -I$(WSHR) -Fo$@ $(WSHR)\gifread.c -$(O)gifrd32.o: $(WSHR)\gifread.c $(CONFIG_H) $(TILE_H) - @$(cc) $(cflagsBuild) -I$(WSHR) /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\gifread.c +$(O)gifrd32$(HOST).o: $(WSHR)\gifread.c $(CONFIG_H) $(TILE_H) + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) -I$(WSHR) /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\gifread.c -$(O)ppmwrite.o: $(WSHR)\ppmwrite.c $(CONFIG_H) $(TILE_H) - @$(cc) $(cflagsBuild) -I$(WSHR) -Fo$@ $(WSHR)\ppmwrite.c +$(O)ppmwrite$(HOST).o: $(WSHR)\ppmwrite.c $(CONFIG_H) $(TILE_H) + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) -I$(WSHR) -Fo$@ $(WSHR)\ppmwrite.c -$(O)tiletext.o: $(WSHR)\tiletext.c $(CONFIG_H) $(TILE_H) - @$(cc) $(cflagsBuild) -I$(WSHR) -Fo$@ $(WSHR)\tiletext.c +$(O)tiletext$(HOST).o: $(WSHR)\tiletext.c $(CONFIG_H) $(TILE_H) + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) -I$(WSHR) -Fo$@ $(WSHR)\tiletext.c -$(O)tilete32.o: $(WSHR)\tiletext.c $(CONFIG_H) $(TILE_H) - @$(cc) $(cflagsBuild) -I$(WSHR) /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\tiletext.c +$(O)tilete32$(HOST).o: $(WSHR)\tiletext.c $(CONFIG_H) $(TILE_H) + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) -I$(WSHR) /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\tiletext.c #========================================== # Optional Tile Utilities @@ -1251,32 +1348,33 @@ $(U)txt2ppm.exe: $(PPMWRITERS) $(TEXT_IO) $(TILEBMP16): $(TILEUTIL16) $(TILEFILES) @echo Creating 16x16 binary tile files (this may take some time) @$(U)tile2bmp $(TILEBMP16) + #$(TILEBMP32): $(TILEUTIL32) $(TILEFILES32) # @echo Creating 32x32 binary tile files (this may take some time) # @$(U)til2bm32 $(TILEBMP32) -$(U)tile2bmp.exe: $(O)tile2bmp.o $(TEXT_IO) +$(U)tile2bmp.exe: $(O)tile2bmp$(HOST).o $(TEXT_IO) @echo Linking $(@:\=/) @$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ @<<$(@B).lnk - $(O)tile2bmp.o + $(O)tile2bmp$(HOST).o $(TEXT_IO:^ =^ ) << -$(U)til2bm32.exe: $(O)til2bm32.o $(TEXT_IO32) +$(U)til2bm32.exe: $(O)til2bm32$(HOST).o $(TEXT_IO32) @echo Linking $(@:\=/) @$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ @<<$(@B).lnk - $(O)til2bm32.o + $(O)til2bm32$(HOST).o $(TEXT_IO32:^ =^ ) << -$(O)tile2bmp.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(MSWSYS)\win32api.h - @$(cc) $(cflagsBuild) -I$(WSHR) /DPACKED_FILE /Fo$@ $(WSHR)\tile2bmp.c +$(O)tile2bmp$(HOST).o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(MSWSYS)\win32api.h + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) -I$(WSHR) /DPACKED_FILE /Fo$@ $(WSHR)\tile2bmp.c -$(O)til2bm32.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(MSWSYS)\win32api.h - @$(cc) $(cflagsBuild) -I$(WSHR) /DPACKED_FILE /DTILE_X=32 /DTILE_Y=32 /Fo$@ $(WSHR)\tile2bmp.c +$(O)til2bm32$(HOST).o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(MSWSYS)\win32api.h + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) -I$(WSHR) /DPACKED_FILE /DTILE_X=32 /DTILE_Y=32 /Fo$@ $(WSHR)\tile2bmp.c #=============================================================================== # PDCurses @@ -1286,7 +1384,51 @@ $(O)pdcurses.lib : $(PDCLIBOBJS) $(PDCOBJS) lib -nologo /out:$@ $(PDCLIBOBJS) $(PDCOBJS) $(O)pdcscrn.o : $(PDCURSES_HEADERS) $(PDCWINCON)\pdcscrn.c $(MSWSYS)\stub-pdcscrn.c - $(cc) $(PDCINCL) $(cflagsBuild) -Fo$@ $(MSWSYS)\stub-pdcscrn.c + @$(cc) $(PDCINCL) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $(MSWSYS)\stub-pdcscrn.c + +#=============================================================================== +# LUA +#=============================================================================== + +lua.exe: $(O)lua.o $(LUALIB) + link /OUT:$@ $(O)lua.o $(LUALIB) + +luac.exe: $(O)luac.o $(LUALIB) + link /OUT:$@ $(O)luac.o $(LUALIB) + +$(O)lua$(LUAVER).dll: $(LUAOBJFILES) + link /DLL /IMPLIB:lua$(LUAVER).lib /OUT:$@ $(LUAOBJFILES) + +$(O)lua$(LUAVER)-static.lib: $(LUAOBJFILES) + lib /OUT:$@ $(LUAOBJFILES) + +$(O)lua.o: $(LUASRC)\lua.c +$(O)luac.o: $(LUASRC)\luac.c +$(O)lapi.o: $(LUASRC)\lapi.c + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -wd4244 -Fo$@ $(LUASRC)\lapi.c + +#=============================================================================== +# CROSSCOMPILE +#=============================================================================== + +# Under a cross-compile, some of the values stored statically into +# text files cannot be trusted as being representative of the +# settings and features used on the build of the target binaries. +# +# We move some of that stuff into the game run-time by separating +# out the functions into src\mdlib.c to get some of the required +# functionality at game runtime instead of from a previously written +# data file. +# + +!IFDEF CROSSCOMPILE_HOST +$(O)mdlib$(HOST).o: $(SRC)\mdlib.c + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSDEFINE_HOST) -Fo$@ $(SRC)\mdlib.c +!ENDIF + +$(O)mdlib.o: $(SRC)\mdlib.c + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $(SRC)\mdlib.c +# @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) /EP -Fo$@ $(SRC)\mdlib.c >mdlib.c.preprocessed #=============================================================================== # Housekeeping @@ -1315,40 +1457,6 @@ spotless: clean 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 @@ -1375,23 +1483,28 @@ spotless: clean !IF "$(ADD_CURSES)" == "Y" if exist $(O)pdcurses.lib del $(O)pdcurses.lib !ENDIF + if exist $(DAT)\oracles del $(DAT)\oracles + if exist $(DAT)\rumors del $(DAT)\rumors +!IFNDEF LUA_QTEXT_FILE + if exist $(DAT)\quest.dat del $(DAT)\quest.dat +!ENDIF + if exist $(DAT)\options del $(DAT)\options + if exist $(DAT)\ttyoptions del $(DAT)\ttyoptions + if exist $(DAT)\guioptions del $(DAT)\guioptions + if exist $(DAT)\data del $(DAT)\data + clean: if exist $(O)*.o del $(O)*.o + if exist $(INCL)\nhlua.h del $(INCL)\nhlua.h if exist $(O)utility.tag del $(O)utility.tag if exist $(U)makedefs.exe del $(U)makedefs.exe - if exist $(U)levcomp.exe del $(U)levcomp.exe - if exist $(U)dgncomp.exe del $(U)dgncomp.exe if exist $(SRC)\*.lnk del $(SRC)\*.lnk if exist $(SRC)\*.map del $(SRC)\*.map if exist $(O)install.tag del $(O)install.tag if exist $(O)console.res del $(O)console.res - if exist $(O)dgncomp.MAP del $(O)dgncomp.MAP - if exist $(O)dgncomp.PDB del $(O)dgncomp.PDB if exist $(O)dlb_main.MAP del $(O)dlb_main.MAP if exist $(O)dlb_main.PDB del $(O)dlb_main.PDB if exist $(O)gamedir.tag del $(O)gamedir.tag - if exist $(O)levcomp.MAP del $(O)levcomp.MAP - if exist $(O)levcomp.PDB del $(O)levcomp.PDB if exist $(O)makedefs.MAP del $(O)makedefs.MAP if exist $(O)makedefs.PDB del $(O)makedefs.PDB if exist $(O)NetHack.MAP del $(O)NetHack.MAP @@ -1415,14 +1528,6 @@ clean: if exist $(O)sp_lev.tag del $(O)sp_lev.tag if exist $(O)uudecode.MAP del $(O)uudecode.MAP if exist $(O)uudecode.PDB del $(O)uudecode.PDB - rem - rem defer to the steps in ..\win\win32\levstuff.mak - rem - nmake -nologo -f ..\win\win32\levstuff.mak clean - rem - 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) @@ -1440,8 +1545,10 @@ $(DAT)\data: $(O)utility.tag $(DATABASE) $(DAT)\rumors: $(O)utility.tag $(DAT)\rumors.tru $(DAT)\rumors.fal $(U)makedefs -r +!IFNDEF LUA_QTEXT_FILE $(DAT)\quest.dat: $(O)utility.tag $(DAT)\quest.txt $(U)makedefs -q +!ENDIF $(DAT)\oracles: $(O)utility.tag $(DAT)\oracles.txt $(U)makedefs -h @@ -1455,146 +1562,124 @@ $(DAT)\epitaph: $(DAT)\epitaph.txt $(U)makedefs.exe $(DAT)\bogusmon: $(DAT)\bogusmon.txt $(U)makedefs.exe $(U)makedefs -s +!IFDEF OBSOLETE_DGN_COMPILER $(DAT)\dungeon: $(O)utility.tag $(DAT)\dungeon.def $(U)makedefs -e cd $(DAT) $(U)dgncomp dungeon.pdf cd $(SRC) +!ENDIF # # NT dependencies # $(O)nttty.o: $(HACK_H) $(TILE_H) $(MSWSYS)\win32api.h $(MSWSYS)\nttty.c - @$(cc) $(cflagsBuild) -I$(WSHR) -Fo$@ $(MSWSYS)\nttty.c + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -I$(WSHR) -Fo$@ $(MSWSYS)\nttty.c $(O)winnt.o: $(HACK_H) $(MSWSYS)\win32api.h $(MSWSYS)\winnt.c - @$(cc) $(cflagsBuild) -I$(MSWSYS) -I$(MSWIN) -Fo$@ $(MSWSYS)\win10.c - @$(cc) $(cflagsBuild) -Fo$@ $(MSWSYS)\winnt.c + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -I$(MSWSYS) -I$(MSWIN) -Fo$@ $(MSWSYS)\win10.c + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $(MSWSYS)\winnt.c $(O)ntsound.o: $(HACK_H) $(MSWSYS)\ntsound.c - @$(cc) $(cflagsBuild) -Fo$@ $(MSWSYS)\ntsound.c + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $(MSWSYS)\ntsound.c +$(O)windmain.o: $(MSWSYS)\windmain.c $(HACK_H) #if you aren't linking in the full gui then #include the following stub for proper linkage. $(O)guistub.o: $(HACK_H) $(MSWSYS)\stubs.c - @$(cc) $(cflagsBuild) -DGUISTUB -Fo$@ $(MSWSYS)\stubs.c + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -DGUISTUB -Fo$@ $(MSWSYS)\stubs.c # # WIN32 dependencies # $(O)NetHackW.o: $(HACK_H) $(MSWIN)\NetHackW.c - @$(cc) $(cflagsBuild) -I$(MSWSYS) -I$(MSWIN) -Fo$@ $(MSWIN)\NetHackW.c + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -I$(MSWSYS) -I$(MSWIN) -Fo$@ $(MSWIN)\NetHackW.c #if you aren't linking in the full tty then #include the following stub for proper linkage. $(O)ttystub.o: $(HACK_H) $(MSWSYS)\stubs.c - @$(cc) $(cflagsBuild) -DTTYSTUB -Fo$@ $(MSWSYS)\stubs.c + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -DTTYSTUB -Fo$@ $(MSWSYS)\stubs.c # #============================================ -# fieldlevel save dependencies +# save dependencies #============================================ -$(O)sfbase.o: $(HACK_H) $(INCL)\sfproto.h $(INCL)\sfprocs.h \ - $(SRC)\sfbase.c - @$(cc) $(cflagsBuild) -Fo$@ $(SRC)\sfbase.c - -$(O)sfdata.o: $(HACK_H) $(INCL)\sfprocs.h $(SRC)\sfdata.c - @$(cc) $(cflagsBuild) -Fo$@ $(SRC)\sfdata.c - $(O)sfstruct.o: $(HACK_H) $(SRC)\sfstruct.c - @$(cc) $(cflagsBuild) -Fo$@ $(SRC)\sfstruct.c - -$(O)sfascii.o: $(HACK_H) $(INCL)\sfprocs.h $(SRC)\sfascii.c - @$(cc) $(cflagsBuild) -Fo$@ $(SRC)\sfascii.c - -$(O)sflendian.o: $(HACK_H) $(INCL)\sfprocs.h $(SRC)\sflendian.c - @$(cc) $(cflagsBuild) -Fo$@ $(SRC)\sflendian.c - -$(SRC)\sfdata.c: $(U)readtags.exe $(U)nethack.tags - $(U)readtags.exe - -$(INCL)\sfproto.h: $(U)readtags.exe $(U)nethack.tags - $(U)readtags.exe - -$(U)readtags.exe: $(O)readtags.o - @$(link) $(lflagsBuild) -out:$@ $(O)readtags.o - -$(O)readtags.o: $(U)readtags.c $(U)nethack.tags $(CONFIG_H) $(PATCHLEVEL_H) - @$(cc) $(cflagsBuild) $(TEMPL) -Fo$@ $(U)readtags.c - -# -#tested only with exuberant ctags from http://ctags.sourceforge.net -# -CTAGDEP = $(TINC)/align.h $(TINC)/artifact.h $(TSRC)/artifact.c \ - $(TINC)/artilist.h $(TINC)/attrib.h $(TSRC)/bones.c \ - $(TINC)/context.h $(TINC)/coord.h $(TINC)/decl.h \ - $(TSRC)/decl.c $(TINC)/dungeon.h $(TINC)/engrave.h \ - $(TSRC)/engrave.c $(TINC)/flag.h $(TINC)/func_tab.h \ - $(TINC)/global.h $(TINC)/hack.h $(TINC)/lev.h \ - $(TINC)/mextra.h $(TINC)/mkroom.h $(TINC)/monst.h \ - $(TINC)/monsym.h $(TINC)/obj.h $(TINC)/objclass.h \ - $(TINC)/permonst.h $(TINC)/prop.h $(TINC)/quest.h \ - $(TINC)/rect.h $(TINC)/region.h $(TINC)/rm.h \ - $(TINC)/skills.h $(TINC)/spell.h $(TINC)/sys.h \ - $(TINC)/timeout.h $(TINC)/trap.h $(TINC)/you.h \ - $(TINC)/onames.h $(TINC)/wintype.h - -$(U)nethack.tags: $(CTAGDEP) - $(CTAGSCMD) $(CTAGSOPT) -f $(U)nethack.tags $(TINC)/align.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/artifact.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TSRC)/artifact.c - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/artilist.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/attrib.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TSRC)/bones.c - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/context.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/coord.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/decl.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TSRC)/decl.c - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/dungeon.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/engrave.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TSRC)/engrave.c - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/flag.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/func_tab.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/global.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/hack.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/lev.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/mextra.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/mkroom.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/monst.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/monsym.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/obj.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/objclass.h -# $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/permonst.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/prop.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/quest.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/rect.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/region.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/rm.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/skills.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/spell.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/sys.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/timeout.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/trap.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/you.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/onames.h - $(CTAGSCMD) $(CTAGSOPT) -a -f $(U)nethack.tags $(TINC)/wintype.h +# @$(cc) $(cflagsBuild) -Fo$@ $(SRC)\sfstruct.c # # util dependencies +# These have dual-roles and need to be build for host and targt platforms. # +!IFDEF CROSSCOMPILE_HOST +$(O)panic$(HOST).o: $(U)panic.c $(CONFIG_H) + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) -Fo$@ $(U)panic.c +!ENDIF + $(O)panic.o: $(U)panic.c $(CONFIG_H) - @$(cc) $(cflagsBuild) -Fo$@ $(U)panic.c + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $(U)panic.c + + +!IFDEF CROSSCOMPILE_HOST +$(O)drawing$(HOST).o: drawing.c $(HACK_H) $(INCL)\tcap.h + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) -Fo$@ drawing.c +!ENDIF + +$(O)drawing.o: drawing.c $(HACK_H) $(INCL)\tcap.h + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ drawing.c + +!IFDEF CROSSCOMPILE_HOST +$(O)decl$(HOST).o: decl.c $(HACK_H) + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) -Fo$@ decl.c +!ENDIF + +$(O)decl.o: decl.c $(HACK_H) + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ decl.c + +!IFDEF CROSSCOMPILE_HOST +$(O)monst$(HOST).o: monst.c $(CONFIG_H) $(INCL)\permonst.h $(INCL)\align.h \ + $(INCL)\monattk.h $(INCL)\monflag.h $(INCL)\monsym.h \ + $(INCL)\color.h + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) -Fo$@ monst.c +!ENDIF + +$(O)monst.o: monst.c $(CONFIG_H) $(INCL)\permonst.h $(INCL)\align.h \ + $(INCL)\monattk.h $(INCL)\monflag.h $(INCL)\monsym.h \ + $(INCL)\color.h + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ monst.c + +!IFDEF CROSSCOMPILE_HOST +$(O)objects$(HOST).o: objects.c $(CONFIG_H) $(INCL)\obj.h $(INCL)\objclass.h \ + $(INCL)\prop.h $(INCL)\skills.h $(INCL)\color.h + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_HOST) -Fo$@ objects.c +!ENDIF + +$(O)objects.o: objects.c $(CONFIG_H) $(INCL)\obj.h $(INCL)\objclass.h \ + $(INCL)\prop.h $(INCL)\skills.h $(INCL)\color.h + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ objects.c + +!IFDEF CROSSCOMPILE_HOST +$(O)alloc$(HOST).o: alloc.c $(CONFIG_H) + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ alloc.c +!ENDIF + +$(O)alloc.o: alloc.c $(CONFIG_H) + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ alloc.c + +$(O)version.o: version.c $(HACK_H) $(INCL)\dlb.h $(INCL)\date.h \ + $(INCL)\patchlevel.h + @$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ version.c # # sys/share dependencies # (O)cppregex.o: $(O)cppregex.cpp $(HACK_H) - @$(CC) $(cflagsBuild) -Fo$@ ..\sys\share\cppregex.cpp + @$(CC) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ ..\sys\share\cppregex.cpp # # curses window port dependencies @@ -1614,134 +1699,299 @@ $(O)curswins.o: $(WCURSES)\curswins.c $(WCURSES)\curswins.h $(INCL)\wincurs.h # * slashes changed to back-slashes # * -c (which is included in CFLAGS) substituted with -Fo$@ # * $(CFLAGS) replaced with $(cflagsBuild) -# * $(CC) replaced with @$(CC) +# * $(CC) replaced with @$(cc) # * targets prefixed with $(O) +# * win/X11/Window.o commented due to conflict with pdcurses +# * most recipes below are commented out because the flags are incorrect +# and probably a different variant is used above # but otherwise untouched. # That means that there is some irrelevant stuff # in here, but maintenance should be easier. # - $(O)tos.o: ..\sys\atari\tos.c $(HACK_H) $(INCL)\tcap.h - @$(CC) $(cflagsBuild) -Fo$@ ..\sys\atari\tos.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\sys\atari\tos.c +$(O)pcmain.o: ..\sys\share\pcmain.c $(HACK_H) $(INCL)\dlb.h +# @$(cc) $(cflagsBuild) -Fo$@ ..\sys\share\pcmain.c +$(O)pcsys.o: ..\sys\share\pcsys.c $(HACK_H) +# @$(cc) $(cflagsBuild) -Fo$@ ..\sys\share\pcsys.c $(O)pctty.o: ..\sys\share\pctty.c $(HACK_H) - @$(CC) $(cflagsBuild) -Fo$@ ..\sys\share\pctty.c -$(O)isaac64.o: ..\src\isaac64.c $(HACK_H) $(INCL)\isaac64.h $(INCL)\integer.h - @$(CC) $(cflagsBuild) -Fo$@ ..\src\isaac64.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\sys\share\pctty.c +$(O)pcunix.o: ..\sys\share\pcunix.c $(HACK_H) +# @$(cc) $(cflagsBuild) -Fo$@ ..\sys\share\pcunix.c +$(O)pmatchregex.o: ..\sys\share\pmatchregex.c $(HACK_H) +# @$(cc) $(cflagsBuild) -Fo$@ ..\sys\share\pmatchregex.c +$(O)posixregex.o: ..\sys\share\posixregex.c $(HACK_H) +# @$(cc) $(cflagsBuild) -Fo$@ ..\sys\share\posixregex.c $(O)random.o: ..\sys\share\random.c $(HACK_H) - @$(CC) $(cflagsBuild) -Fo$@ ..\sys\share\random.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\sys\share\random.c $(O)ioctl.o: ..\sys\share\ioctl.c $(HACK_H) $(INCL)\tcap.h - @$(CC) $(cflagsBuild) -Fo$@ ..\sys\share\ioctl.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\sys\share\ioctl.c $(O)unixtty.o: ..\sys\share\unixtty.c $(HACK_H) - @$(CC) $(cflagsBuild) -Fo$@ ..\sys\share\unixtty.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\sys\share\unixtty.c $(O)unixmain.o: ..\sys\unix\unixmain.c $(HACK_H) $(INCL)\dlb.h - @$(CC) $(cflagsBuild) -Fo$@ ..\sys\unix\unixmain.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\sys\unix\unixmain.c $(O)unixunix.o: ..\sys\unix\unixunix.c $(HACK_H) - @$(CC) $(cflagsBuild) -Fo$@ ..\sys\unix\unixunix.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\sys\unix\unixunix.c $(O)unixres.o: ..\sys\unix\unixres.c $(CONFIG_H) - @$(CC) $(cflagsBuild) -Fo$@ ..\sys\unix\unixres.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\sys\unix\unixres.c $(O)bemain.o: ..\sys\be\bemain.c $(HACK_H) $(INCL)\dlb.h - @$(CC) $(cflagsBuild) -Fo$@ ..\sys\be\bemain.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\sys\be\bemain.c $(O)getline.o: ..\win\tty\getline.c $(HACK_H) $(INCL)\func_tab.h - @$(CC) $(cflagsBuild) -Fo$@ ..\win\tty\getline.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\tty\getline.c $(O)termcap.o: ..\win\tty\termcap.c $(HACK_H) $(INCL)\tcap.h - @$(CC) $(cflagsBuild) -Fo$@ ..\win\tty\termcap.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\tty\termcap.c $(O)topl.o: ..\win\tty\topl.c $(HACK_H) $(INCL)\tcap.h - @$(CC) $(cflagsBuild) -Fo$@ ..\win\tty\topl.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\tty\topl.c $(O)wintty.o: ..\win\tty\wintty.c $(HACK_H) $(INCL)\dlb.h $(INCL)\tcap.h - @$(CC) $(cflagsBuild) -Fo$@ ..\win\tty\wintty.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\tty\wintty.c +$(O)cursmain.o: ..\win\curses\cursmain.c $(HACK_H) $(INCL)\patchlevel.h \ + $(INCL)\wincurs.h +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\curses\cursmain.c +$(O)curswins.o: ..\win\curses\curswins.c $(HACK_H) $(INCL)\wincurs.h \ + ..\win\curses\curswins.h +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\curses\curswins.c +$(O)cursmisc.o: ..\win\curses\cursmisc.c $(HACK_H) $(INCL)\wincurs.h \ + ..\win\curses\cursmisc.h $(INCL)\func_tab.h $(INCL)\dlb.h +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\curses\cursmisc.c +$(O)cursdial.o: ..\win\curses\cursdial.c $(HACK_H) $(INCL)\wincurs.h \ + ..\win\curses\cursdial.h $(INCL)\func_tab.h +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\curses\cursdial.c +$(O)cursstat.o: ..\win\curses\cursstat.c $(HACK_H) $(INCL)\wincurs.h \ + ..\win\curses\cursstat.h +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\curses\cursstat.c +$(O)cursinit.o: ..\win\curses\cursinit.c $(HACK_H) $(INCL)\wincurs.h \ + ..\win\curses\cursinit.h +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\curses\cursinit.c +$(O)cursmesg.o: ..\win\curses\cursmesg.c $(HACK_H) $(INCL)\wincurs.h \ + ..\win\curses\cursmesg.h +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\curses\cursmesg.c +$(O)cursinvt.o: ..\win\curses\cursinvt.c $(HACK_H) $(INCL)\wincurs.h \ + ..\win\curses\cursinvt.h +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\curses\cursinvt.c #$(O)Window.o: ..\win\X11\Window.c $(INCL)\xwindowp.h $(INCL)\xwindow.h \ -# $(CONFIG_H) -# @$(CC) $(cflagsBuild) -Fo$@ ..\win\X11\Window.c -$(O)dialogs.o: ..\win\X11\dialogs.c $(CONFIG_H) - @$(CC) $(cflagsBuild) -Fo$@ ..\win\X11\dialogs.c +# $(CONFIG_H) $(INCL)\lint.h +# @$(cc) $(cflagsBuild) $(X11CFLAGS) -Fo$@ ..\win\X11\Window.c +$(O)dialogs.o: ..\win\X11\dialogs.c $(CONFIG_H) $(INCL)\lint.h +# @$(cc) $(cflagsBuild) $(X11CFLAGS) -Fo$@ ..\win\X11\dialogs.c $(O)winX.o: ..\win\X11\winX.c $(HACK_H) $(INCL)\winX.h $(INCL)\dlb.h \ - ..\win\X11\nh72icon ..\win\X11\nh56icon ..\win\X11\nh32icon - @$(CC) $(cflagsBuild) -Fo$@ ..\win\X11\winX.c + $(INCL)\xwindow.h ..\win\X11\nh72icon ..\win\X11\nh56icon \ + ..\win\X11\nh32icon +# @$(cc) $(cflagsBuild) $(X11CFLAGS) -Fo$@ ..\win\X11\winX.c $(O)winmap.o: ..\win\X11\winmap.c $(INCL)\xwindow.h $(HACK_H) $(INCL)\dlb.h \ $(INCL)\winX.h $(INCL)\tile2x11.h - @$(CC) $(cflagsBuild) -Fo$@ ..\win\X11\winmap.c +# @$(cc) $(cflagsBuild) $(X11CFLAGS) -Fo$@ ..\win\X11\winmap.c $(O)winmenu.o: ..\win\X11\winmenu.c $(HACK_H) $(INCL)\winX.h - @$(CC) $(cflagsBuild) -Fo$@ ..\win\X11\winmenu.c +# @$(cc) $(cflagsBuild) $(X11CFLAGS) -Fo$@ ..\win\X11\winmenu.c $(O)winmesg.o: ..\win\X11\winmesg.c $(INCL)\xwindow.h $(HACK_H) $(INCL)\winX.h - @$(CC) $(cflagsBuild) -Fo$@ ..\win\X11\winmesg.c +# @$(cc) $(cflagsBuild) $(X11CFLAGS) -Fo$@ ..\win\X11\winmesg.c $(O)winmisc.o: ..\win\X11\winmisc.c $(HACK_H) $(INCL)\func_tab.h \ $(INCL)\winX.h - @$(CC) $(cflagsBuild) -Fo$@ ..\win\X11\winmisc.c -$(O)winstat.o: ..\win\X11\winstat.c $(HACK_H) $(INCL)\winX.h - @$(CC) $(cflagsBuild) -Fo$@ ..\win\X11\winstat.c +# @$(cc) $(cflagsBuild) $(X11CFLAGS) -Fo$@ ..\win\X11\winmisc.c +$(O)winstat.o: ..\win\X11\winstat.c $(HACK_H) $(INCL)\winX.h $(INCL)\xwindow.h +# @$(cc) $(cflagsBuild) $(X11CFLAGS) -Fo$@ ..\win\X11\winstat.c $(O)wintext.o: ..\win\X11\wintext.c $(HACK_H) $(INCL)\winX.h $(INCL)\xwindow.h - @$(CC) $(cflagsBuild) -Fo$@ ..\win\X11\wintext.c +# @$(cc) $(cflagsBuild) $(X11CFLAGS) -Fo$@ ..\win\X11\wintext.c $(O)winval.o: ..\win\X11\winval.c $(HACK_H) $(INCL)\winX.h - @$(CC) $(cflagsBuild) -Fo$@ ..\win\X11\winval.c +# @$(cc) $(cflagsBuild) $(X11CFLAGS) -Fo$@ ..\win\X11\winval.c $(O)tile.o: $(SRC)\tile.c $(HACK_H) $(O)gnaskstr.o: ..\win\gnome\gnaskstr.c ..\win\gnome\gnaskstr.h \ ..\win\gnome\gnmain.h - @$(CC) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnaskstr.c -$(O)gnbind.o: ..\win\gnome\gnbind.c ..\win\gnome\gnbind.h ..\win\gnome\gnmain.h \ - ..\win\gnome\gnmenu.h ..\win\gnome\gnaskstr.h \ - ..\win\gnome\gnyesno.h - @$(CC) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnbind.c -$(O)gnglyph.o: ..\win\gnome\gnglyph.c ..\win\gnome\gnglyph.h $(INCL)\tile2x11.h - @$(CC) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnglyph.c +# @$(cc) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnaskstr.c +$(O)gnbind.o: ..\win\gnome\gnbind.c ..\win\gnome\gnbind.h ..\win\gnome\gnomeprv.h \ + $(HACK_H) $(INCL)\dlb.h $(INCL)\patchlevel.h \ + $(INCL)\winGnome.h ..\win\gnome\gnmain.h \ + ..\win\gnome\gnmap.h ..\win\gnome\gnmenu.h \ + ..\win\gnome\gnplayer.h ..\win\gnome\gnsignal.h \ + ..\win\gnome\gnglyph.h ..\win\gnome\gnstatus.h \ + ..\win\gnome\gntext.h ..\win\gnome\gnmesg.h \ + ..\win\gnome\gnyesno.h ..\win\gnome\gnworn.h \ + ..\win\gnome\gnaskstr.h +# @$(cc) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnbind.c +$(O)gnglyph.o: ..\win\gnome\gnglyph.c ..\win\gnome\gnglyph.h $(CONFIG_H) \ + $(INCL)\tile2x11.h +# @$(cc) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnglyph.c $(O)gnmain.o: ..\win\gnome\gnmain.c ..\win\gnome\gnmain.h ..\win\gnome\gnsignal.h \ - ..\win\gnome\gnbind.h ..\win\gnome\gnopts.h $(HACK_H) \ - $(INCL)\date.h - @$(CC) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmain.c -$(O)gnmap.o: ..\win\gnome\gnmap.c ..\win\gnome\gnmap.h ..\win\gnome\gnglyph.h \ - ..\win\gnome\gnsignal.h $(HACK_H) - @$(CC) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmap.c -$(O)gnmenu.o: ..\win\gnome\gnmenu.c ..\win\gnome\gnmenu.h ..\win\gnome\gnmain.h \ - ..\win\gnome\gnbind.h $(INCL)\func_tab.h - @$(CC) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmenu.c -$(O)gnmesg.o: ..\win\gnome\gnmesg.c ..\win\gnome\gnmesg.h ..\win\gnome\gnsignal.h - @$(CC) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmesg.c + ..\win\gnome\gnomeprv.h $(HACK_H) $(INCL)\dlb.h \ + $(INCL)\patchlevel.h $(INCL)\winGnome.h \ + ..\win\gnome\gnglyph.h ..\win\gnome\gnbind.h \ + ..\win\gnome\gnmap.h ..\win\gnome\gnmenu.h \ + ..\win\gnome\gnplayer.h ..\win\gnome\gnstatus.h \ + ..\win\gnome\gntext.h ..\win\gnome\gnmesg.h \ + ..\win\gnome\gnyesno.h ..\win\gnome\gnworn.h \ + ..\win\gnome\gnopts.h $(INCL)\date.h +# @$(cc) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmain.c +$(O)gnmap.o: ..\win\gnome\gnmap.c ..\win\gnome\gnmap.h $(CONFIG_H) \ + ..\win\gnome\gnglyph.h ..\win\gnome\gnsignal.h \ + ..\win\gnome\gnomeprv.h $(HACK_H) $(INCL)\dlb.h \ + $(INCL)\patchlevel.h $(INCL)\winGnome.h +# @$(cc) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmap.c +$(O)gnmenu.o: ..\win\gnome\gnmenu.c ..\win\gnome\gnmenu.h $(CONFIG_H) \ + ..\win\gnome\gnomeprv.h $(HACK_H) $(INCL)\dlb.h \ + $(INCL)\patchlevel.h $(INCL)\winGnome.h \ + ..\win\gnome\gnmain.h ..\win\gnome\gnbind.h \ + ..\win\gnome\gnmap.h ..\win\gnome\gnplayer.h \ + ..\win\gnome\gnsignal.h ..\win\gnome\gnglyph.h \ + ..\win\gnome\gnstatus.h ..\win\gnome\gntext.h \ + ..\win\gnome\gnmesg.h ..\win\gnome\gnyesno.h \ + ..\win\gnome\gnworn.h $(INCL)\func_tab.h +# @$(cc) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmenu.c +$(O)gnmesg.o: ..\win\gnome\gnmesg.c ..\win\gnome\gnmesg.h $(CONFIG_H) \ + ..\win\gnome\gnsignal.h ..\win\gnome\gnomeprv.h $(HACK_H) \ + $(INCL)\dlb.h $(INCL)\patchlevel.h $(INCL)\winGnome.h \ + ..\win\gnome\gnglyph.h +# @$(cc) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmesg.c $(O)gnopts.o: ..\win\gnome\gnopts.c ..\win\gnome\gnopts.h ..\win\gnome\gnglyph.h \ - ..\win\gnome\gnmain.h ..\win\gnome\gnmap.h $(HACK_H) - @$(CC) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnopts.c + $(CONFIG_H) ..\win\gnome\gnmain.h ..\win\gnome\gnmap.h $(HACK_H) +# @$(cc) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnopts.c $(O)gnplayer.o: ..\win\gnome\gnplayer.c ..\win\gnome\gnplayer.h \ ..\win\gnome\gnmain.h $(HACK_H) - @$(CC) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnplayer.c +# @$(cc) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnplayer.c $(O)gnsignal.o: ..\win\gnome\gnsignal.c ..\win\gnome\gnsignal.h \ - ..\win\gnome\gnmain.h - @$(CC) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnsignal.c -$(O)gnstatus.o: ..\win\gnome\gnstatus.c ..\win\gnome\gnstatus.h \ - ..\win\gnome\gnsignal.h ..\win\gnome\gn_xpms.h \ - ..\win\gnome\gnomeprv.h - @$(CC) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnstatus.c -$(O)gntext.o: ..\win\gnome\gntext.c ..\win\gnome\gntext.h ..\win\gnome\gnmain.h \ - ..\win\gnome\gn_rip.h - @$(CC) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gntext.c -$(O)gnyesno.o: ..\win\gnome\gnyesno.c ..\win\gnome\gnbind.h ..\win\gnome\gnyesno.h - @$(CC) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnyesno.c -$(O)gnworn.o: ..\win\gnome\gnworn.c ..\win\gnome\gnworn.h ..\win\gnome\gnglyph.h \ - ..\win\gnome\gnsignal.h ..\win\gnome\gnomeprv.h - @$(CC) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnworn.c + ..\win\gnome\gnomeprv.h $(HACK_H) $(INCL)\dlb.h \ + $(INCL)\patchlevel.h $(INCL)\winGnome.h \ + ..\win\gnome\gnglyph.h ..\win\gnome\gnmain.h +# @$(cc) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnsignal.c +$(O)gnstatus.o: ..\win\gnome\gnstatus.c ..\win\gnome\gnstatus.h $(CONFIG_H) \ + ..\win\gnome\gnsignal.h ..\win\gnome\gnomeprv.h $(HACK_H) \ + $(INCL)\dlb.h $(INCL)\patchlevel.h $(INCL)\winGnome.h \ + ..\win\gnome\gnglyph.h ..\win\gnome\gn_xpms.h +# @$(cc) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnstatus.c +$(O)gntext.o: ..\win\gnome\gntext.c ..\win\gnome\gntext.h $(CONFIG_H) \ + ..\win\gnome\gnmain.h ..\win\gnome\gn_rip.h +# @$(cc) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gntext.c +$(O)gnyesno.o: ..\win\gnome\gnyesno.c ..\win\gnome\gnbind.h \ + ..\win\gnome\gnomeprv.h $(HACK_H) $(INCL)\dlb.h \ + $(INCL)\patchlevel.h $(INCL)\winGnome.h \ + ..\win\gnome\gnmain.h ..\win\gnome\gnmap.h \ + ..\win\gnome\gnmenu.h ..\win\gnome\gnplayer.h \ + ..\win\gnome\gnsignal.h ..\win\gnome\gnglyph.h \ + ..\win\gnome\gnstatus.h ..\win\gnome\gntext.h \ + ..\win\gnome\gnmesg.h ..\win\gnome\gnyesno.h \ + ..\win\gnome\gnworn.h +# @$(cc) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnyesno.c +$(O)gnworn.o: ..\win\gnome\gnworn.c ..\win\gnome\gnworn.h $(CONFIG_H) \ + ..\win\gnome\gnglyph.h ..\win\gnome\gnsignal.h \ + ..\win\gnome\gnomeprv.h $(HACK_H) $(INCL)\dlb.h \ + $(INCL)\patchlevel.h $(INCL)\winGnome.h +# @$(cc) $(cflagsBuild) $(GNOMEINC) -Fo$@ ..\win\gnome\gnworn.c $(O)wingem.o: ..\win\gem\wingem.c $(HACK_H) $(INCL)\func_tab.h $(INCL)\dlb.h \ $(INCL)\patchlevel.h $(INCL)\wingem.h - @$(CC) $(cflagsBuild) -Fo$@ ..\win\gem\wingem.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\gem\wingem.c $(O)wingem1.o: ..\win\gem\wingem1.c $(INCL)\gem_rsc.h $(INCL)\load_img.h \ $(INCL)\gr_rect.h $(INCL)\wintype.h $(INCL)\wingem.h - @$(CC) $(cflagsBuild) -Fo$@ ..\win\gem\wingem1.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\gem\wingem1.c $(O)load_img.o: ..\win\gem\load_img.c $(INCL)\load_img.h - @$(CC) $(cflagsBuild) -Fo$@ ..\win\gem\load_img.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\gem\load_img.c $(O)gr_rect.o: ..\win\gem\gr_rect.c $(INCL)\gr_rect.h - @$(CC) $(cflagsBuild) -Fo$@ ..\win\gem\gr_rect.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\gem\gr_rect.c $(O)tile.o: $(SRC)\tile.c $(HACK_H) -$(O)qt_win.o: ..\win\Qt\qt_win.cpp $(HACK_H) $(INCL)\func_tab.h \ +#cppregex.o: ..\sys\share\cppregex.cpp +# $(CXX) $(CXXFLAGS) -Fo$@ ..\sys\share\cppregex.cpp +$(O)qt_bind.o: ..\win\Qt\qt_bind.cpp $(HACK_H) ..\win\Qt\qt_bind.h \ + ..\win\Qt\qt_main.h ..\win\Qt\qt_kde0.h ..\win\Qt\qt_click.h \ + ..\win\Qt\qt_delay.h ..\win\Qt\qt_xcmd.h ..\win\Qt\qt_key.h \ + ..\win\Qt\qt_map.h ..\win\Qt\qt_win.h ..\win\Qt\qt_clust.h \ + ..\win\Qt\qt_menu.h ..\win\Qt\qt_rip.h ..\win\Qt\qt_msg.h \ + ..\win\Qt\qt_plsel.h ..\win\Qt\qt_svsel.h ..\win\Qt\qt_set.h \ + ..\win\Qt\qt_stat.h ..\win\Qt\qt_icon.h ..\win\Qt\qt_streq.h \ + ..\win\Qt\qt_line.h ..\win\Qt\qt_yndlg.h ..\win\Qt\qt_str.h \ + $(INCL)\dlb.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_bind.cpp +$(O)qt_click.o: ..\win\Qt\qt_click.cpp $(HACK_H) ..\win\Qt\qt_click.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_click.cpp +$(O)qt_clust.o: ..\win\Qt\qt_clust.cpp ..\win\Qt\qt_clust.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_clust.cpp +$(O)qt_delay.o: ..\win\Qt\qt_delay.cpp $(HACK_H) ..\win\Qt\qt_delay.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_delay.cpp +$(O)qt_glyph.o: ..\win\Qt\qt_glyph.cpp $(HACK_H) $(INCL)\tile2x11.h \ + ..\win\Qt\qt_glyph.h ..\win\Qt\qt_set.h ..\win\Qt\qt_str.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_glyph.cpp +$(O)qt_icon.o: ..\win\Qt\qt_icon.cpp $(HACK_H) ..\win\Qt\qt_icon.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_icon.cpp +$(O)qt_inv.o: ..\win\Qt\qt_inv.cpp $(HACK_H) ..\win\Qt\qt_inv.h \ + ..\win\Qt\qt_glyph.h ..\win\Qt\qt_set.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_inv.cpp +$(O)qt_key.o: ..\win\Qt\qt_key.cpp $(HACK_H) ..\win\Qt\qt_key.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_key.cpp +$(O)qt_line.o: ..\win\Qt\qt_line.cpp $(HACK_H) ..\win\Qt\qt_line.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_line.cpp +$(O)qt_main.o: ..\win\Qt\qt_main.cpp $(HACK_H) $(INCL)\patchlevel.h \ + ..\win\Qt\qt_main.h ..\win\Qt\qt_kde0.h qt_main.moc \ + ..\win\Qt\qt_bind.h ..\win\Qt\qt_glyph.h ..\win\Qt\qt_inv.h \ + ..\win\Qt\qt_key.h ..\win\Qt\qt_map.h ..\win\Qt\qt_win.h \ + ..\win\Qt\qt_clust.h ..\win\Qt\qt_msg.h ..\win\Qt\qt_set.h \ + ..\win\Qt\qt_stat.h ..\win\Qt\qt_icon.h ..\win\Qt\qt_str.h \ + qt_kde0.moc + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_main.cpp +$(O)qt_map.o: ..\win\Qt\qt_map.cpp $(HACK_H) ..\win\Qt\qt_map.h ..\win\Qt\qt_win.h \ + ..\win\Qt\qt_clust.h qt_map.moc ..\win\Qt\qt_click.h \ + ..\win\Qt\qt_glyph.h ..\win\Qt\qt_xpms.h ..\win\Qt\qt_set.h \ + ..\win\Qt\qt_str.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_map.cpp +$(O)qt_menu.o: ..\win\Qt\qt_menu.cpp $(HACK_H) ..\win\Qt\qt_menu.h \ + ..\win\Qt\qt_win.h ..\win\Qt\qt_rip.h qt_menu.moc \ + ..\win\Qt\qt_glyph.h ..\win\Qt\qt_set.h ..\win\Qt\qt_streq.h \ + ..\win\Qt\qt_line.h ..\win\Qt\qt_str.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_menu.cpp +$(O)qt_msg.o: ..\win\Qt\qt_msg.cpp $(HACK_H) ..\win\Qt\qt_msg.h ..\win\Qt\qt_win.h \ + qt_msg.moc ..\win\Qt\qt_map.h ..\win\Qt\qt_clust.h \ + ..\win\Qt\qt_set.h ..\win\Qt\qt_str.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_msg.cpp +$(O)qt_plsel.o: ..\win\Qt\qt_plsel.cpp $(HACK_H) ..\win\Qt\qt_plsel.h qt_plsel.moc \ + ..\win\Qt\qt_bind.h ..\win\Qt\qt_main.h ..\win\Qt\qt_kde0.h \ + ..\win\Qt\qt_glyph.h ..\win\Qt\qt_set.h ..\win\Qt\qt_str.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_plsel.cpp +$(O)qt_rip.o: ..\win\Qt\qt_rip.cpp $(HACK_H) ..\win\Qt\qt_rip.h \ + ..\win\Qt\qt_bind.h ..\win\Qt\qt_main.h ..\win\Qt\qt_kde0.h \ + ..\win\Qt\qt_str.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_rip.cpp +$(O)qt_set.o: ..\win\Qt\qt_set.cpp $(HACK_H) ..\win\Qt\qt_set.h qt_set.moc \ + ..\win\Qt\qt_glyph.h ..\win\Qt\qt_str.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_set.cpp +$(O)qt_stat.o: ..\win\Qt\qt_stat.cpp $(HACK_H) ..\win\Qt\qt_stat.h \ + ..\win\Qt\qt_win.h ..\win\Qt\qt_icon.h qt_stat.moc \ + ..\win\Qt\qt_set.h ..\win\Qt\qt_str.h ..\win\Qt\qt_xpms.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_stat.cpp +$(O)qt_str.o: ..\win\Qt\qt_str.cpp ..\win\Qt\qt_str.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_str.cpp +$(O)qt_streq.o: ..\win\Qt\qt_streq.cpp $(HACK_H) ..\win\Qt\qt_streq.h \ + ..\win\Qt\qt_line.h ..\win\Qt\qt_str.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_streq.cpp +$(O)qt_svsel.o: ..\win\Qt\qt_svsel.cpp $(HACK_H) ..\win\Qt\qt_svsel.h \ + ..\win\Qt\qt_bind.h ..\win\Qt\qt_main.h ..\win\Qt\qt_kde0.h \ + ..\win\Qt\qt_str.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_svsel.cpp +$(O)qt_win.o: ..\win\Qt\qt_win.cpp $(HACK_H) ..\win\Qt\qt_win.h \ + ..\win\Qt\qt_bind.h ..\win\Qt\qt_main.h ..\win\Qt\qt_kde0.h \ + ..\win\Qt\qt_click.h ..\win\Qt\qt_glyph.h ..\win\Qt\qt_inv.h \ + ..\win\Qt\qt_key.h ..\win\Qt\qt_icon.h ..\win\Qt\qt_map.h \ + ..\win\Qt\qt_clust.h ..\win\Qt\qt_menu.h ..\win\Qt\qt_rip.h \ + ..\win\Qt\qt_msg.h ..\win\Qt\qt_set.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_win.cpp +$(O)qt_xcmd.o: ..\win\Qt\qt_xcmd.cpp $(HACK_H) $(INCL)\func_tab.h \ + ..\win\Qt\qt_xcmd.h qt_xcmd.moc ..\win\Qt\qt_bind.h \ + ..\win\Qt\qt_main.h ..\win\Qt\qt_kde0.h ..\win\Qt\qt_set.h \ + ..\win\Qt\qt_str.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_xcmd.cpp +$(O)qt_yndlg.o: ..\win\Qt\qt_yndlg.cpp $(HACK_H) ..\win\Qt\qt_yndlg.h qt_yndlg.moc \ + ..\win\Qt\qt_str.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_yndlg.cpp +$(O)qt3_win.o: ..\win\Qt3\qt3_win.cpp $(HACK_H) $(INCL)\func_tab.h \ $(INCL)\dlb.h $(INCL)\patchlevel.h $(INCL)\tile2x11.h \ - $(INCL)\qt_win.h $(INCL)\qt_clust.h $(INCL)\qt_kde0.h \ - $(INCL)\qt_xpms.h qt_win.moc qt_kde0.moc qttableview.moc - $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_win.cpp -$(O)qt_clust.o: ..\win\Qt\qt_clust.cpp $(INCL)\qt_clust.h - $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_clust.cpp -$(O)qttableview.o: ..\win\Qt\qttableview.cpp $(INCL)\qttableview.h - $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qttableview.cpp + ..\win\Qt3\qt3_win.h ..\win\Qt3\qt3_clust.h \ + ..\win\Qt3\qt3_kde0.h ..\win\Qt3\qt3_xpms.h qt3_win.moc \ + qt3_kde0.moc qt3tableview.moc + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt3\qt3_win.cpp +$(O)qt3_clust.o: ..\win\Qt3\qt3_clust.cpp ..\win\Qt3\qt3_clust.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt3\qt3_clust.cpp +$(O)qt3tableview.o: ..\win\Qt3\qt3tableview.cpp ..\win\Qt3\qt3tableview.h + $(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt3\qt3tableview.cpp $(O)wc_chainin.o: ..\win\chain\wc_chainin.c $(HACK_H) - @$(cc) $(cflagsBuild) -Fo$@ ..\win\chain\wc_chainin.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\chain\wc_chainin.c $(O)wc_chainout.o: ..\win\chain\wc_chainout.c $(HACK_H) - @$(cc) $(cflagsBuild) -Fo$@ ..\win\chain\wc_chainout.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\chain\wc_chainout.c $(O)wc_trace.o: ..\win\chain\wc_trace.c $(HACK_H) $(INCL)\func_tab.h - @$(cc) $(cflagsBuild) -Fo$@ ..\win\chain\wc_trace.c +# @$(cc) $(cflagsBuild) -Fo$@ ..\win\chain\wc_trace.c $(O)vis_tab.o: vis_tab.c $(CONFIG_H) $(INCL)\vis_tab.h $(O)allmain.o: allmain.c $(HACK_H) $(O)alloc.o: alloc.c $(CONFIG_H) @@ -1749,7 +1999,7 @@ $(O)apply.o: apply.c $(HACK_H) $(O)artifact.o: artifact.c $(HACK_H) $(INCL)\artifact.h $(INCL)\artilist.h $(O)attrib.o: attrib.c $(HACK_H) $(O)ball.o: ball.c $(HACK_H) -$(O)bones.o: bones.c $(HACK_H) $(INCL)\lev.h +$(O)bones.o: bones.c $(HACK_H) $(O)botl.o: botl.c $(HACK_H) $(O)cmd.o: cmd.c $(HACK_H) $(INCL)\func_tab.h $(O)dbridge.o: dbridge.c $(HACK_H) @@ -1757,8 +2007,8 @@ $(O)decl.o: decl.c $(HACK_H) $(O)detect.o: detect.c $(HACK_H) $(INCL)\artifact.h $(O)dig.o: dig.c $(HACK_H) $(O)display.o: display.c $(HACK_H) -$(O)dlb.o: dlb.c $(CONFIG_H) $(INCL)\dlb.h -$(O)do.o: do.c $(HACK_H) $(INCL)\lev.h +$(O)dlb.o: dlb.c $(CONFIG_H) $(INCL)\dlb.h $(INCL)\patchlevel.h +$(O)do.o: do.c $(HACK_H) $(O)do_name.o: do_name.c $(HACK_H) $(O)do_wear.o: do_wear.c $(HACK_H) $(O)dog.o: dog.c $(HACK_H) @@ -1768,8 +2018,8 @@ $(O)dothrow.o: dothrow.c $(HACK_H) $(O)drawing.o: drawing.c $(HACK_H) $(INCL)\tcap.h $(O)dungeon.o: dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h $(O)eat.o: eat.c $(HACK_H) -$(O)end.o: end.c $(HACK_H) $(INCL)\lev.h $(INCL)\dlb.h -$(O)engrave.o: engrave.c $(HACK_H) $(INCL)\lev.h +$(O)end.o: end.c $(HACK_H) $(INCL)\dlb.h +$(O)engrave.o: engrave.c $(HACK_H) $(O)exper.o: exper.c $(HACK_H) $(O)explode.o: explode.c $(HACK_H) $(O)extralev.o: extralev.c $(HACK_H) @@ -1778,18 +2028,27 @@ $(O)fountain.o: fountain.c $(HACK_H) $(O)hack.o: hack.c $(HACK_H) $(O)hacklib.o: hacklib.c $(HACK_H) $(O)invent.o: invent.c $(HACK_H) -$(O)light.o: light.c $(HACK_H) $(INCL)\lev.h +$(O)isaac64.o: isaac64.c $(CONFIG_H) $(INCL)\isaac64.h +$(O)light.o: light.c $(HACK_H) $(O)lock.o: lock.c $(HACK_H) $(O)mail.o: mail.c $(HACK_H) $(INCL)\mail.h $(O)makemon.o: makemon.c $(HACK_H) $(O)mapglyph.o: mapglyph.c $(HACK_H) $(O)mcastu.o: mcastu.c $(HACK_H) +$(O)mdlib.o: mdlib.c $(CONFIG_H) $(INCL)\permonst.h $(INCL)\align.h \ + $(INCL)\monattk.h $(INCL)\monflag.h \ + $(INCL)\objclass.h $(INCL)\monsym.h \ + $(INCL)\artilist.h $(INCL)\dungeon.h $(INCL)\obj.h \ + $(INCL)\monst.h $(INCL)\mextra.h $(INCL)\you.h \ + $(INCL)\attrib.h $(INCL)\prop.h $(INCL)\skills.h \ + $(INCL)\context.h $(INCL)\flag.h $(INCL)\dlb.h \ + $(INCL)\patchlevel.h $(O)mhitm.o: mhitm.c $(HACK_H) $(INCL)\artifact.h $(O)mhitu.o: mhitu.c $(HACK_H) $(INCL)\artifact.h $(O)minion.o: minion.c $(HACK_H) $(O)mklev.o: mklev.c $(HACK_H) $(O)mkmap.o: mkmap.c $(HACK_H) $(INCL)\sp_lev.h -$(O)mkmaze.o: mkmaze.c $(HACK_H) $(INCL)\sp_lev.h $(INCL)\lev.h +$(O)mkmaze.o: mkmaze.c $(HACK_H) $(INCL)\sp_lev.h $(O)mkobj.o: mkobj.c $(HACK_H) $(O)mkroom.o: mkroom.c $(HACK_H) $(O)mon.o: mon.c $(HACK_H) $(INCL)\mfndpos.h @@ -1801,8 +2060,10 @@ $(O)monst.o: monst.c $(CONFIG_H) $(INCL)\permonst.h $(INCL)\align.h \ $(O)mplayer.o: mplayer.c $(HACK_H) $(O)mthrowu.o: mthrowu.c $(HACK_H) $(O)muse.o: muse.c $(HACK_H) -$(O)music.o: music.c $(HACK_H) #interp.c -$(O)o_init.o: o_init.c $(HACK_H) $(INCL)\lev.h +$(O)music.o: music.c $(HACK_H) +$(O)nhlua.o: nhlua.c $(HACK_H) $(INCL)\dlb.h +$(O)nhlsel.o: nhlsel.c $(HACK_H) $(INCL)\sp_lev.h +$(O)o_init.o: o_init.c $(HACK_H) $(O)objects.o: objects.c $(CONFIG_H) $(INCL)\obj.h $(INCL)\objclass.h \ $(INCL)\prop.h $(INCL)\skills.h $(INCL)\color.h $(O)objnam.o: objnam.c $(HACK_H) @@ -1815,28 +2076,29 @@ $(O)polyself.o: polyself.c $(HACK_H) $(O)potion.o: potion.c $(HACK_H) $(O)pray.o: pray.c $(HACK_H) $(O)priest.o: priest.c $(HACK_H) $(INCL)\mfndpos.h -$(O)quest.o: quest.c $(HACK_H) $(INCL)\qtext.h -$(O)questpgr.o: questpgr.c $(HACK_H) $(INCL)\dlb.h $(INCL)\qtext.h +$(O)quest.o: quest.c $(HACK_H) +$(O)questpgr.o: questpgr.c $(HACK_H) $(INCL)\dlb.h $(O)read.o: read.c $(HACK_H) $(O)rect.o: rect.c $(HACK_H) -$(O)region.o: region.c $(HACK_H) $(INCL)\lev.h -$(O)restore.o: restore.c $(HACK_H) $(INCL)\lev.h $(INCL)\tcap.h +$(O)region.o: region.c $(HACK_H) +$(O)restore.o: restore.c $(HACK_H) $(INCL)\tcap.h $(O)rip.o: rip.c $(HACK_H) -$(O)rnd.o: rnd.c $(HACK_H) +$(O)rnd.o: rnd.c $(HACK_H) $(INCL)\isaac64.h $(O)role.o: role.c $(HACK_H) -$(O)rumors.o: rumors.c $(HACK_H) $(INCL)\lev.h $(INCL)\dlb.h -$(O)save.o: save.c $(HACK_H) $(INCL)\lev.h +$(O)rumors.o: rumors.c $(HACK_H) $(INCL)\dlb.h +$(O)save.o: save.c $(HACK_H) +$(O)sfstruct.o: sfstruct.c $(HACK_H) $(O)shk.o: shk.c $(HACK_H) $(O)shknam.o: shknam.c $(HACK_H) $(O)sit.o: sit.c $(HACK_H) $(INCL)\artifact.h $(O)sounds.o: sounds.c $(HACK_H) -$(O)sp_lev.o: sp_lev.c $(HACK_H) $(INCL)\dlb.h $(INCL)\sp_lev.h +$(O)sp_lev.o: sp_lev.c $(HACK_H) $(INCL)\sp_lev.h $(O)spell.o: spell.c $(HACK_H) $(O)steal.o: steal.c $(HACK_H) $(O)steed.o: steed.c $(HACK_H) $(O)sys.o: sys.c $(HACK_H) $(O)teleport.o: teleport.c $(HACK_H) -$(O)timeout.o: timeout.c $(HACK_H) $(INCL)\lev.h +$(O)timeout.o: timeout.c $(HACK_H) $(O)topten.o: topten.c $(HACK_H) $(INCL)\dlb.h $(INCL)\patchlevel.h $(O)track.o: track.c $(HACK_H) $(O)trap.o: trap.c $(HACK_H) @@ -1849,9 +2111,9 @@ $(O)vision.o: vision.c $(HACK_H) $(INCL)\vis_tab.h $(O)weapon.o: weapon.c $(HACK_H) $(O)were.o: were.c $(HACK_H) $(O)wield.o: wield.c $(HACK_H) -#$(O)windows.o: windows.c $(HACK_H) $(INCL)\wingem.h $(INCL)\winGnome.h -$(O)wizard.o: wizard.c $(HACK_H) $(INCL)\qtext.h -$(O)worm.o: worm.c $(HACK_H) $(INCL)\lev.h +$(O)windows.o: windows.c $(HACK_H) $(INCL)\wingem.h $(INCL)\winGnome.h +$(O)wizard.o: wizard.c $(HACK_H) +$(O)worm.o: worm.c $(HACK_H) $(O)worn.o: worn.c $(HACK_H) $(O)write.o: write.c $(HACK_H) $(O)zap.o: zap.c $(HACK_H) diff --git a/sys/winnt/console.rc b/sys/winnt/console.rc index 0d9733971..427079ede 100644 --- a/sys/winnt/console.rc +++ b/sys/winnt/console.rc @@ -1,4 +1,4 @@ -/* NetHack 3.6 console.rc $NHDT-Date: 1432512793 2015/05/25 00:13:13 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */ +/* NetHack 3.6 console.rc $NHDT-Date: 1575245149 2019/12/02 00:05:49 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.13 $ */ /* Copyright (c) Yitzhak Sapir, 2002. */ /* NetHack may be freely redistributed. See license for details. */ @@ -12,8 +12,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,6,2,0 - PRODUCTVERSION 3,6,2,0 + FILEVERSION 3,6,3,0 + PRODUCTVERSION 3,6,3,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.6.2\0" + VALUE "FileVersion", "3.6.3\0" VALUE "InternalName", "NetHack\0" - VALUE "LegalCopyright", "Copyright (C) 1985 - 2018. By Stichting Mathematisch Centrum and M. Stephenson. See license for details.\0" + VALUE "LegalCopyright", "Copyright (C) 1985 - 2019. 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.6.2\0" + VALUE "ProductVersion", "3.6.3\0" END END BLOCK "VarFileInfo" diff --git a/sys/winnt/nethack.def b/sys/winnt/nethack.def index 9d3a5cceb..67f372a46 100644 --- a/sys/winnt/nethack.def +++ b/sys/winnt/nethack.def @@ -1,5 +1,5 @@ NAME NETHACK -DESCRIPTION 'NetHack 3.6.2 for Windows' +DESCRIPTION 'NetHack 3.6.4 for Windows' EXETYPE WINDOWS STUB 'WINSTUB.EXE' CODE PRELOAD MOVEABLE DISCARDABLE diff --git a/sys/winnt/nh340key.c b/sys/winnt/nh340key.c index 78600ec67..a4faa80c1 100644 --- a/sys/winnt/nh340key.c +++ b/sys/winnt/nh340key.c @@ -52,6 +52,13 @@ DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved) #define PADKEYS (KEYPADHI - KEYPADLO + 1) #define iskeypad(x) (KEYPADLO <= (x) && (x) <= KEYPADHI) +#ifdef QWERTZ_SUPPORT +/* when 'numberpad' is 0 and Cmd.swap_yz is True + (signaled by setting 0x10 on boolean numpad argument) + treat keypress of numpad 7 as 'z' rather than 'y' */ +static boolean qwertz = FALSE; +#endif + /* * Keypad keys are translated to the normal values below. * Shifted keypad keys are translated to the @@ -110,6 +117,15 @@ int portdebug; int altseq = 0; const struct pad *kpad; +#ifdef QWERTZ_SUPPORT + if (numberpad & 0x10) { + numberpad &= ~0x10; + qwertz = TRUE; + } else { + qwertz = FALSE; + } +#endif + shiftstate = 0L; ch = pre_ch = ir->Event.KeyEvent.uChar.AsciiChar; scan = ir->Event.KeyEvent.wVirtualScanCode; @@ -149,6 +165,14 @@ int portdebug; } else { ch = kpad[scan - KEYPADLO].normal; } +#ifdef QWERTZ_SUPPORT + /* OPTIONS=number_pad:-1 is for qwertz keyboard; for that setting, + 'numberpad' will be 0; core swaps y to zap, z to move northwest; + we want numpad 7 to move northwest, so when qwertz is set, + tell core that user who types numpad 7 typed z rather than y */ + if (qwertz && kpad[scan - KEYPADLO].normal == 'y') + ch += 1; /* changes y to z, Y to Z, ^Y to ^Z */ +#endif /*QWERTZ_SUPPORT*/ } else if (altseq > 0) { /* ALT sequence */ if (vk == 0xBF) ch = M('?'); @@ -238,6 +262,15 @@ coord *cc; #endif int ch; boolean valid = 0, done = 0; + +#ifdef QWERTZ_SUPPORT + if (numpad & 0x10) { + numpad &= ~0x10; + qwertz = TRUE; + } else { + qwertz = FALSE; + } +#endif while (!done) { #if defined(SAFERHANGUP) dwWait = WaitForSingleObjectEx(hConIn, // event object to wait for @@ -249,7 +282,14 @@ coord *cc; ReadConsoleInput(hConIn, ir, 1, count); if (mode == 0) { if ((ir->EventType == KEY_EVENT) && ir->Event.KeyEvent.bKeyDown) { +#ifdef QWERTZ_SUPPORT + if (qwertz) + numpad |= 0x10; +#endif ch = ProcessKeystroke(hConIn, ir, &valid, numpad, 0); +#ifdef QWERTZ_SUPPORT + numpad &= ~0x10; +#endif done = valid; } } else { diff --git a/sys/winnt/nhdefkey.c b/sys/winnt/nhdefkey.c index e82f0d9dd..acbb75990 100644 --- a/sys/winnt/nhdefkey.c +++ b/sys/winnt/nhdefkey.c @@ -59,6 +59,13 @@ DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved) #define PADKEYS (KEYPADHI - KEYPADLO + 1) #define iskeypad(x) (KEYPADLO <= (x) && (x) <= KEYPADHI) +#ifdef QWERTZ_SUPPORT +/* when 'numberpad' is 0 and Cmd.swap_yz is True + (signaled by setting 0x10 on boolean numpad argument) + treat keypress of numpad 7 as 'z' rather than 'y' */ +static boolean qwertz = FALSE; +#endif + /* * Keypad keys are translated to the normal values below. * Shifted keypad keys are translated to the @@ -119,6 +126,14 @@ int portdebug; int altseq = 0; const struct pad *kpad; +#ifdef QWERTZ_SUPPORT + if (numberpad & 0x10) { + numberpad &= ~0x10; + qwertz = TRUE; + } else { + qwertz = FALSE; + } +#endif shiftstate = 0L; ch = pre_ch = ir->Event.KeyEvent.uChar.AsciiChar; scan = ir->Event.KeyEvent.wVirtualScanCode; @@ -162,6 +177,14 @@ int portdebug; } else { ch = kpad[scan - KEYPADLO].normal; } +#ifdef QWERTZ_SUPPORT + /* OPTIONS=number_pad:-1 is for qwertz keyboard; for that setting, + 'numberpad' will be 0; core swaps y to zap, z to move northwest; + we want numpad 7 to move northwest, so when qwertz is set, + tell core that user who types numpad 7 typed z rather than y */ + if (qwertz && kpad[scan - KEYPADLO].normal == 'y') + ch += 1; /* changes y to z, Y to Z, ^Y to ^Z */ +#endif /*QWERTZ_SUPPORT*/ } else if (altseq > 0) { /* ALT sequence */ if (vk == 0xBF) ch = M('?'); @@ -270,6 +293,15 @@ coord *cc; #endif int ch; boolean valid = 0, done = 0; + +#ifdef QWERTZ_SUPPORT + if (numpad & 0x10) { + numpad &= ~0x10; + qwertz = TRUE; + } else { + qwertz = FALSE; + } +#endif while (!done) { #if defined(SAFERHANGUP) dwWait = WaitForSingleObjectEx(hConIn, // event object to wait for @@ -288,7 +320,14 @@ coord *cc; if (count > 0) { if (ir->EventType == KEY_EVENT && ir->Event.KeyEvent.bKeyDown) { +#ifdef QWERTZ_SUPPORT + if (qwertz) + numpad |= 0x10; +#endif ch = ProcessKeystroke(hConIn, ir, &valid, numpad, 0); +#ifdef QWERTZ_SUPPORT + numpad &= ~0x10; +#endif if (valid) return ch; } else if (ir->EventType == MOUSE_EVENT) { diff --git a/sys/winnt/nhraykey.c b/sys/winnt/nhraykey.c index aafe9c44c..7ce4e0e50 100644 --- a/sys/winnt/nhraykey.c +++ b/sys/winnt/nhraykey.c @@ -212,6 +212,13 @@ DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved) #define isnumkeypad(x) \ (KEYPADLO <= (x) && (x) <= 0x51 && (x) != 0x4A && (x) != 0x4E) +#ifdef QWERTZ_SUPPORT +/* when 'numberpad' is 0 and Cmd.swap_yz is True + (signaled by setting 0x10 on boolean numpad argument) + treat keypress of numpad 7 as 'z' rather than 'y' */ +static boolean qwertz = FALSE; +#endif + /* * Keypad keys are translated to the normal values below. * Shifted keypad keys are translated to the @@ -301,6 +308,14 @@ int portdebug; const struct pad *kpad; DWORD count; +#ifdef QWERTZ_SUPPORT + if (numberpad & 0x10) { + numberpad &= ~0x10; + qwertz = TRUE; + } else { + qwertz = FALSE; + } +#endif shiftstate = 0L; ch = pre_ch = ir->Event.KeyEvent.uChar.AsciiChar; scan = ir->Event.KeyEvent.wVirtualScanCode; @@ -347,6 +362,14 @@ int portdebug; } else { ch = kpad[scan - KEYPADLO].normal; } +#ifdef QWERTZ_SUPPORT + /* OPTIONS=number_pad:-1 is for qwertz keyboard; for that setting, + 'numberpad' will be 0; core swaps y to zap, z to move northwest; + we want numpad 7 to move northwest, so when qwertz is set, + tell core that user who types numpad 7 typed z rather than y */ + if (qwertz && kpad[scan - KEYPADLO].normal == 'y') + ch += 1; /* changes y to z, Y to Z, ^Y to ^Z */ +#endif /*QWERTZ_SUPPORT*/ } else if (altseq > 0) { /* ALT sequence */ ReadConsoleInput(hConIn, ir, 1, &count); if (vk == 0xBF) @@ -471,6 +494,15 @@ coord *cc; #endif int ch; boolean valid = 0, done = 0; + +#ifdef QWERTZ_SUPPORT + if (numpad & 0x10) { + numpad &= ~0x10; + qwertz = TRUE; + } else { + qwertz = FALSE; + } +#endif while (!done) { *count = 0; dwWait = WaitForSingleObject(hConIn, INFINITE); @@ -490,12 +522,19 @@ coord *cc; if (count > 0) { if (ir->EventType == KEY_EVENT && ir->Event.KeyEvent.bKeyDown) { +#ifdef QWERTZ_SUPPORT + if (qwertz) + numpad |= 0x10; +#endif ch = ProcessKeystroke(hConIn, ir, &valid, numpad, #ifdef PORTDEBUG 1); #else 0); #endif +#ifdef QWERTZ_SUPPORT + numpad &= ~0x10; +#endif if (valid) return ch; } else { @@ -549,6 +588,7 @@ INPUT_RECORD *ir; unsigned char ch; unsigned long shiftstate; int altseq = 0, keycode, vk; + done = 0; retval = 0; while (!done) { diff --git a/sys/winnt/nhsetup.bat b/sys/winnt/nhsetup.bat index a5c9ce75b..25ac9fee7 100755 --- a/sys/winnt/nhsetup.bat +++ b/sys/winnt/nhsetup.bat @@ -23,7 +23,7 @@ goto :EOF echo Checking to see if source tree directories are set up properly... if not exist ..\..\include\hack.h goto :err_dir if not exist ..\..\src\hack.c goto :err_dir -if not exist ..\..\dat\wizard.des goto :err_dir +if not exist ..\..\dat\wizard1.lua goto :err_dir if not exist ..\..\util\makedefs.c goto :err_dir if not exist ..\..\sys\winnt\winnt.c goto :err_dir echo Directories look ok. diff --git a/sys/winnt/nttty.c b/sys/winnt/nttty.c index ede8c22ec..43c106e85 100644 --- a/sys/winnt/nttty.c +++ b/sys/winnt/nttty.c @@ -13,7 +13,6 @@ * */ - #ifdef WIN32 #define NEED_VARARGS /* Uses ... */ #include "win32api.h" @@ -428,8 +427,17 @@ boolean *valid; boolean numberpad; int portdebug; { - int ch = keyboard_handler.pProcessKeystroke( + int ch; + +#ifdef QWERTZ_SUPPORT + if (g.Cmd.swap_yz) + numberpad |= 0x10; +#endif + ch = keyboard_handler.pProcessKeystroke( console.hConIn, ir, valid, numberpad, portdebug); +#ifdef QWERTZ_SUPPORT + numberpad &= ~0x10; +#endif /* check for override */ if (ch && ch < MAX_OVERRIDES && key_overrides[ch]) ch = key_overrides[ch]; @@ -448,13 +456,20 @@ tgetch() int mod; coord cc; DWORD count; + boolean numpad = iflags.num_pad; + really_move_cursor(); if (iflags.debug_fuzzer) return randomkey(); +#ifdef QWERTZ_SUPPORT + if (g.Cmd.swap_yz) + numpad |= 0x10; +#endif + return (g.program_state.done_hup) ? '\033' : keyboard_handler.pCheckInput( - console.hConIn, &ir, &count, iflags.num_pad, 0, &mod, &cc); + console.hConIn, &ir, &count, numpad, 0, &mod, &cc); } int @@ -464,6 +479,8 @@ int *x, *y, *mod; int ch; coord cc; DWORD count; + boolean numpad = iflags.num_pad; + really_move_cursor(); if (iflags.debug_fuzzer) { int poskey = randomkey(); @@ -474,10 +491,17 @@ int *x, *y, *mod; } return poskey; } +#ifdef QWERTZ_SUPPORT + if (g.Cmd.swap_yz) + numpad |= 0x10; +#endif ch = (g.program_state.done_hup) ? '\033' : keyboard_handler.pCheckInput( - console.hConIn, &ir, &count, iflags.num_pad, 1, mod, &cc); + console.hConIn, &ir, &count, numpad, 1, mod, &cc); +#ifdef QWERTZ_SUPPORT + numpad &= ~0x10; +#endif if (!ch) { *x = cc.x; *y = cc.y; @@ -537,12 +561,14 @@ int x, y; set_console_cursor(x, y); } -void +/* same signature as 'putchar()' with potential failure result ignored */ +int xputc(ch) -char ch; +int ch; { set_console_cursor(ttyDisplay->curx, ttyDisplay->cury); - xputc_core(ch); + xputc_core((char) ch); + return 0; } void @@ -550,7 +576,7 @@ xputs(s) const char *s; { int k; - int slen = strlen(s); + int slen = (int) strlen(s); if (ttyDisplay) set_console_cursor(ttyDisplay->curx, ttyDisplay->cury); @@ -661,13 +687,37 @@ cl_end() void raw_clear_screen() { - buffer_fill_to_end(console.back_buffer, &clear_cell, 0, 0); + if (WINDOWPORT("tty")) { + cell_t * back = console.back_buffer; + cell_t * front = console.front_buffer; + COORD pos; + DWORD unused; + + for (pos.Y = 0; pos.Y < console.height; pos.Y++) { + for (pos.X = 0; pos.X < console.width; pos.X++) { + WriteConsoleOutputAttribute(console.hConOut, &back->attribute, + 1, pos, &unused); + front->attribute = back->attribute; + if (console.has_unicode) { + WriteConsoleOutputCharacterW(console.hConOut, + &back->character, 1, pos, &unused); + } else { + char ch = (char)back->character; + WriteConsoleOutputCharacterA(console.hConOut, &ch, 1, pos, + &unused); + } + *front = *back; + back++; + front++; + } + } + } } void clear_screen() { - raw_clear_screen(); + buffer_fill_to_end(console.back_buffer, &clear_cell, 0, 0); home(); } @@ -720,7 +770,6 @@ tty_delay_output() } } -#ifdef TEXTCOLOR /* * CLR_BLACK 0 * CLR_RED 1 @@ -793,10 +842,10 @@ init_ttycolor() #endif init_ttycolor_completed = TRUE; } -#endif /* TEXTCOLOR */ +#if 0 int -has_color(int color) +has_color(int color) /* this function is commented out */ { #ifdef TEXTCOLOR if ((color >= 0) && (color < CLR_MAX)) @@ -808,6 +857,7 @@ has_color(int color) else return 0; } +#endif int term_attr_fixup(int attrmask) @@ -1604,8 +1654,8 @@ check_font_widths() boolean used[256]; memset(used, 0, sizeof(used)); for (int i = 0; i < SYM_MAX; i++) { - used[g.l_syms[i]] = TRUE; - used[g.r_syms[i]] = TRUE; + used[g.primary_syms[i]] = TRUE; + used[g.rogue_syms[i]] = TRUE; } int wcUsedCount = 0; @@ -1906,12 +1956,17 @@ void nethack_enter_nttty() HKL keyboard_layout = GetKeyboardLayout(0); DWORD primary_language = (UINT_PTR) keyboard_layout & 0x3f; - if (primary_language == LANG_ENGLISH) { - if (!load_keyboard_handler("nhdefkey")) - error("Unable to load nhdefkey.dll"); - } else { - if (!load_keyboard_handler("nhraykey")) - error("Unable to load nhraykey.dll"); + /* This was overriding the handler that had already + been loaded during options parsing. Needs to + check first */ + if (!iflags.altkeyhandler[0]) { + if (primary_language == LANG_ENGLISH) { + if (!load_keyboard_handler("nhdefkey")) + error("Unable to load nhdefkey.dll"); + } else { + if (!load_keyboard_handler("nhraykey")) + error("Unable to load nhraykey.dll"); + } } } #endif /* TTY_GRAPHICS */ diff --git a/sys/winnt/stubs.c b/sys/winnt/stubs.c index ca7313b5b..447b0dabb 100644 --- a/sys/winnt/stubs.c +++ b/sys/winnt/stubs.c @@ -82,11 +82,11 @@ int mode; return; } -void +int xputc(ch) -char ch; +int ch; { - return; + return 0; } void @@ -114,12 +114,6 @@ backsp() return; } -int -has_color(int color) -{ - return 1; -} - #ifndef NO_MOUSE_ALLOWED void toggle_mouse_support() diff --git a/sys/winnt/sysconf.template b/sys/winnt/sysconf.template new file mode 100644 index 000000000..707c61db6 --- /dev/null +++ b/sys/winnt/sysconf.template @@ -0,0 +1,106 @@ +# +# NetHack 3.7 sysconf $NHDT-Date: 1524689357 2018/04/25 20:49:17 $ $NHDT-Branch: NetHack-3.7.0 $:$NHDT-Revision: 1.22 $ +# Copyright (c) 2015 by Michael Allison +# NetHack may be freely redistributed. See license for details. +# +# Sample sysconf file. +# The sysconf file is only used if NetHack is compiled with SYSCF defined. +# This file uses the same syntax as nethack.cf. + +# Which users can use WIZARD (debugging) mode (the -D flag). +# A value of * allows anyone to enter debugging mode. +WIZARDS=* + +# Users allowed to use the ! (shell escape) command or to suspend the game. +# Uses the same syntax as the WIZARDS option above. +#SHELLERS= + +# Show debugging information originating from these source files. +# Use '*' for all, or list source files separated by spaces. +# Only available if game has been compiled with DEBUG. +#DEBUGFILES=* + +# Save end of game dump log to this file. +# Only available if NetHack was compiled with DUMPLOG +# Allows following placeholders: +# %% literal '%' +# %v version (eg. "3.7.0-0") +# %u game UID +# %t game start time, UNIX timestamp format +# %T current time, UNIX timestamp format +# %d game start time, YYYYMMDDhhmmss format +# %D current time, YYYYMMDDhhmmss format +# %n player name +# %N first character of player name +#DUMPLOGFILE=nethack-%n-%d.log + +# Number of bones file pools. +# The pool you belong to is determined at game start. You will +# load and save bones only from that pool. Generally useful +# for public servers only. +# Changing this might make existing bones inaccessible. +# Disabled by setting to 0, or commenting out. +#BONES_POOLS=10 + +# Limit the number of simultaneous games (see also nethack.sh). +#MAXPLAYERS=10 + +# If not null, added to string "To get local support, " in the support +# information help. +#SUPPORT=call Izchak at extension 42. + +# Uncomment the next line to disable the SEDUCE option. +#SEDUCE=0 + +# Uncomment the next line to enable some accessibility features such +# as S_hero_override and S_pet_override symbols for screen readers +# in the user config file. +#ACCESSIBILITY=1 + +# Record (high score) file options. +# CAUTION: changing these after people have started playing games can +# lead to lost high scores! +# Maximum entries for one person. +#PERSMAX=10 +# Maximum entries in the record file. +#ENTRYMAX=100 +# Minimum points to get an entry. +#POINTSMIN=1 +# Determine identity of "person" in the score file with name (0) or +# numeric (1) user id. +#PERS_IS_UID=1 + +# Maximum number of score file entries to use for random statue names +#MAX_STATUENAME_RANK=10 + +# *** LOCATIONS *** +# IMPORTANT: If you change any of these locations, the directories they +# point at must exist. NetHack will not create them for you. +# +# Before adjusting, you can verify the default locations for files with: +# nethack --showpaths +# +# The location that users can adjust their config file startup options +#CONFIGDIR=%USERPROFILE%\NetHack +# +# The location that a record of game aborts and self-diagnosed game problems +# is kept (default=HACKDIR, writeable) +#TROUBLEDIR=%USERPROFILE%\NetHack\3.7 +# +# The location that documentation and helps files are placed +#HACKDIR=%USERPROFILE%\NetHack\3.7 +# +# The location that level files in progress are stored (writeable) +#LEVELDIR=%USERPROFILE%\AppData\Local\NetHack\3.7 +# +# The location where saved games are kept (writeable) +#SAVEDIR=%USERPROFILE%\AppData\Local\NetHack\3.7 +# +# The location that bones files are kept (writeable) +#BONESDIR=c:\ProgramData\NetHack\3.7 +# +# The location that score files are kept (writeable) +#SCOREDIR=c:\ProgramData\NetHack\3.7 +# +# The location that file synchronization locks are stored (writeable) +#LOCKDIR=c:\ProgramData\NetHack\3.7 diff --git a/sys/winnt/win10.c b/sys/winnt/win10.c index c6d667080..abf76d9eb 100644 --- a/sys/winnt/win10.c +++ b/sys/winnt/win10.c @@ -9,6 +9,21 @@ #include "hack.h" +typedef DPI_AWARENESS_CONTEXT(WINAPI *GetThreadDpiAwarenessContextProc)(VOID); +typedef BOOL(WINAPI *AreDpiAwarenessContextsEqualProc)( + DPI_AWARENESS_CONTEXT dpiContextA, DPI_AWARENESS_CONTEXT dpiContextB); +typedef UINT(WINAPI *GetDpiForWindowProc)(HWND hwnd); +typedef LONG (WINAPI *GetCurrentPackageFullNameProc)(UINT32 *packageFullNameLength, + PWSTR packageFullName); + +typedef struct { + BOOL Valid; + GetThreadDpiAwarenessContextProc GetThreadDpiAwarenessContext; + AreDpiAwarenessContextsEqualProc AreDpiAwarenessContextsEqual; + GetDpiForWindowProc GetDpiForWindow; + GetCurrentPackageFullNameProc GetCurrentPackageFullName; +} Win10; + Win10 gWin10 = { 0 }; void win10_init() @@ -34,6 +49,17 @@ void win10_init() FreeLibrary(hUser32); + HINSTANCE hKernel32 = LoadLibraryA("kernel32.dll"); + + if (hKernel32 == NULL) + panic("Unable to load kernel32.dll"); + + gWin10.GetCurrentPackageFullName = (GetCurrentPackageFullNameProc) GetProcAddress(hKernel32, "GetCurrentPackageFullName"); + if (gWin10.GetCurrentPackageFullName == NULL) + panic("Unable to get address of GetCurrentPackageFullName"); + + FreeLibrary(hKernel32); + gWin10.Valid = TRUE; } @@ -80,4 +106,19 @@ void win10_monitor_info(HWND hWnd, MonitorInfo * monitorInfo) monitorInfo->left = info.rcMonitor.left; monitorInfo->top = info.rcMonitor.top; } + +BOOL +win10_is_desktop_bridge_application() +{ + if (gWin10.Valid) { + UINT32 length = 0; + LONG rc = gWin10.GetCurrentPackageFullName(&length, NULL); + + return (rc == ERROR_INSUFFICIENT_BUFFER); + } + + return FALSE; +} + + #endif /* _MSC_VER */ diff --git a/sys/winnt/win10.h b/sys/winnt/win10.h index 458e6991d..bbb0ca9a3 100644 --- a/sys/winnt/win10.h +++ b/sys/winnt/win10.h @@ -7,18 +7,6 @@ #include "win32api.h" -typedef DPI_AWARENESS_CONTEXT(WINAPI *GetThreadDpiAwarenessContextProc)(VOID); -typedef BOOL(WINAPI *AreDpiAwarenessContextsEqualProc)( - DPI_AWARENESS_CONTEXT dpiContextA, DPI_AWARENESS_CONTEXT dpiContextB); -typedef UINT(WINAPI *GetDpiForWindowProc)(HWND hwnd); - -typedef struct { - BOOL Valid; - GetThreadDpiAwarenessContextProc GetThreadDpiAwarenessContext; - AreDpiAwarenessContextsEqualProc AreDpiAwarenessContextsEqual; - GetDpiForWindowProc GetDpiForWindow; -} Win10; - typedef struct { double scale; // dpi of monitor / 96 int width; // in pixels @@ -27,13 +15,10 @@ typedef struct { int left; // in desktop coordinate pixel space } MonitorInfo; -extern Win10 gWin10; - void win10_init(); int win10_monitor_dpi(HWND hWnd); double win10_monitor_scale(HWND hWnd); -void win10_monitor_size(HWND hWnd, int * width, int * height); void win10_monitor_info(HWND hWnd, MonitorInfo * monitorInfo); - +BOOL win10_is_desktop_bridge_application(void); #endif // WIN10_H diff --git a/sys/winnt/windmain.c b/sys/winnt/windmain.c index 1f5264670..908b0de88 100644 --- a/sys/winnt/windmain.c +++ b/sys/winnt/windmain.c @@ -8,11 +8,12 @@ #include "hack.h" #include "dlb.h" #include +#include #include #include - -#if 0 -#include "wintty.h" +#include +#if !defined(VERSION_MAJOR) +#include "patchlevel.h" #endif #if !defined(SAFEPROCS) @@ -22,7 +23,8 @@ #define E extern static void FDECL(process_options, (int argc, char **argv)); static void NDECL(nhusage); -static char *FDECL(exepath, (char *)); +static char *NDECL(get_executable_path); +char *FDECL(translate_path_variables, (const char *, char *)); char *NDECL(exename); boolean NDECL(fakeconsole); void NDECL(freefakeconsole); @@ -36,6 +38,13 @@ extern void NDECL(backsp); extern void NDECL(clear_screen); #undef E +#ifdef _MSC_VER +#ifdef kbhit +#undef kbhit +#endif +#include +#endif + #ifdef PC_LOCKING static int NDECL(eraseoldlocks); #endif @@ -47,10 +56,14 @@ char FDECL(windows_yn_function, (const char *, const char *, CHAR_P)); static void FDECL(windows_getlin, (const char *, char *)); extern int NDECL(windows_console_custom_nhgetch); void NDECL(safe_routines); +int NDECL(tty_self_recover_prompt); +int NDECL(other_self_recover_prompt); char orgdir[PATHLEN]; -char *dir; boolean getreturn_enabled; +int windows_startup_state = 0; /* we flag whether to continue with this */ + /* 0 = keep starting up, everything is good */ + extern int redirect_stdout; /* from sys/share/pcsys.c */ extern int GUILaunched; HANDLE hStdOut; @@ -61,11 +74,313 @@ char default_window_sys[] = "mswin"; static struct stat hbuf; #endif #include -#if defined(WIN32) || defined(MSDOS) -#endif + extern char orgdir[]; +void +get_known_folder_path( + const KNOWNFOLDERID * folder_id, + char * path + , size_t path_size) +{ + PWSTR wide_path; + if (FAILED(SHGetKnownFolderPath(folder_id, 0, NULL, &wide_path))) + error("Unable to get known folder path"); + + size_t converted; + errno_t err; + + err = wcstombs_s(&converted, path, path_size, wide_path, path_size - 1); + + CoTaskMemFree(wide_path); + + if (err != 0) error("Failed folder path string conversion"); +} + +void +create_directory(const char * path) +{ + HRESULT hr = CreateDirectoryA(path, NULL); + + if (FAILED(hr) && hr != ERROR_ALREADY_EXISTS) + error("Unable to create directory '%s'", path); +} + +void +build_known_folder_path( + const KNOWNFOLDERID * folder_id, + char * path, + size_t path_size, + boolean versioned) +{ + get_known_folder_path(folder_id, path, path_size); + strcat(path, "\\NetHack\\"); + create_directory(path); + if (versioned) { + Sprintf(eos(path), "%d.%d\\", + VERSION_MAJOR, VERSION_MINOR); + create_directory(path); + } +} + +void +build_environment_path( + const char * env_str, + const char * folder, + char * path, + size_t path_size) +{ + path[0] = '\0'; + + const char * root_path = nh_getenv(env_str); + + if (root_path == NULL) return; + + strcpy_s(path, path_size, root_path); + + char * colon = index(path, ';'); + if (colon != NULL) path[0] = '\0'; + + if (strlen(path) == 0) return; + + append_slash(path); + + if (folder != NULL) { + strcat_s(path, path_size, folder); + strcat_s(path, path_size, "\\"); + } +} + +boolean +folder_file_exists(const char * folder, const char * file_name) +{ + char path[MAX_PATH]; + + if (folder[0] == '\0') return FALSE; + + strcpy(path, folder); + strcat(path, file_name); + return file_exists(path); +} + +boolean +test_portable_config( + const char *executable_path, + char *portable_device_path, + size_t portable_device_path_size) +{ + int lth = 0; + const char *sysconf = "sysconf"; + char tmppath[MAX_PATH]; + boolean retval = FALSE, + save_initoptions_noterminate = iflags.initoptions_noterminate; + + if (portable_device_path && folder_file_exists(executable_path, "sysconf")) { + /* + There is a sysconf file (not just sysconf.template) present in + the exe path, which is not the way NetHack is initially distributed, + so assume it means that the admin/installer wants to override + something, perhaps set up for a fully-portable configuration that + leaves no traces behind elsewhere on this computer's hard drive - + delve into that... + */ + + *portable_device_path = '\0'; + lth = sizeof tmppath - strlen(sysconf); + (void) strncpy(tmppath, executable_path, lth - 1); + tmppath[lth - 1] = '\0'; + (void) strcat(tmppath, sysconf); + + iflags.initoptions_noterminate = 1; + /* assure_syscf_file(); */ + config_error_init(TRUE, tmppath, FALSE); + /* ... and _must_ parse correctly. */ + if (read_config_file(tmppath, SET_IN_SYS) + && sysopt.portable_device_paths) + retval = TRUE; + (void) config_error_done(); + iflags.initoptions_noterminate = save_initoptions_noterminate; + sysopt_release(); /* the real sysconf processing comes later */ + } + if (retval) { + lth = strlen(executable_path); + if (lth <= (int) portable_device_path_size - 1) + Strcpy(portable_device_path, executable_path); + else + retval = FALSE; + } + return retval; +} + +static char portable_device_path[MAX_PATH]; + +const char *get_portable_device() +{ + return (const char *) portable_device_path; +} + +void +set_default_prefix_locations(const char *programPath) +{ + char *envp = NULL; + char *sptr = NULL; + + static char executable_path[MAX_PATH]; + static char profile_path[MAX_PATH]; + static char versioned_profile_path[MAX_PATH]; + static char versioned_user_data_path[MAX_PATH]; + static char versioned_global_data_path[MAX_PATH]; + static char versioninfo[20]; + + strcpy(executable_path, get_executable_path()); + append_slash(executable_path); + + if (test_portable_config(executable_path, + portable_device_path, sizeof portable_device_path)) { + g.fqn_prefix[SYSCONFPREFIX] = executable_path; + g.fqn_prefix[CONFIGPREFIX] = portable_device_path; + g.fqn_prefix[HACKPREFIX] = portable_device_path; + g.fqn_prefix[SAVEPREFIX] = portable_device_path; + g.fqn_prefix[LEVELPREFIX] = portable_device_path; + g.fqn_prefix[BONESPREFIX] = portable_device_path; + g.fqn_prefix[SCOREPREFIX] = portable_device_path; + g.fqn_prefix[LOCKPREFIX] = portable_device_path; + g.fqn_prefix[TROUBLEPREFIX] = portable_device_path; + g.fqn_prefix[DATAPREFIX] = executable_path; + } else { + build_known_folder_path(&FOLDERID_Profile, profile_path, + sizeof(profile_path), FALSE); + + build_known_folder_path(&FOLDERID_Profile, versioned_profile_path, + sizeof(profile_path), TRUE); + + build_known_folder_path(&FOLDERID_LocalAppData, + versioned_user_data_path, sizeof(versioned_user_data_path), TRUE); + + build_known_folder_path(&FOLDERID_ProgramData, + versioned_global_data_path, sizeof(versioned_global_data_path), TRUE); + g.fqn_prefix[SYSCONFPREFIX] = versioned_global_data_path; + g.fqn_prefix[CONFIGPREFIX] = profile_path; + g.fqn_prefix[HACKPREFIX] = versioned_profile_path; + g.fqn_prefix[SAVEPREFIX] = versioned_user_data_path; + g.fqn_prefix[LEVELPREFIX] = versioned_user_data_path; + g.fqn_prefix[BONESPREFIX] = versioned_global_data_path; + g.fqn_prefix[SCOREPREFIX] = versioned_global_data_path; + g.fqn_prefix[LOCKPREFIX] = versioned_global_data_path; + g.fqn_prefix[TROUBLEPREFIX] = versioned_profile_path; + g.fqn_prefix[DATAPREFIX] = executable_path; + } +} + +/* copy file if destination does not exist */ +void +copy_file( + const char * dst_folder, + const char * dst_name, + const char * src_folder, + const char * src_name) +{ + char dst_path[MAX_PATH]; + strcpy(dst_path, dst_folder); + strcat(dst_path, dst_name); + + char src_path[MAX_PATH]; + strcpy(src_path, src_folder); + strcat(src_path, src_name); + + if(!file_exists(src_path)) + error("Unable to copy file '%s' as it does not exist", src_path); + + if(file_exists(dst_path)) + return; + + BOOL success = CopyFileA(src_path, dst_path, TRUE); + if(!success) error("Failed to copy '%s' to '%s'", src_path, dst_path); +} + +/* update file copying if it does not exist or src is newer then dst */ +void +update_file( + const char * dst_folder, + const char * dst_name, + const char * src_folder, + const char * src_name, + BOOL save_copy) +{ + char dst_path[MAX_PATH]; + strcpy(dst_path, dst_folder); + strcat(dst_path, dst_name); + + char src_path[MAX_PATH]; + strcpy(src_path, src_folder); + strcat(src_path, src_name); + + char save_path[MAX_PATH]; + strcpy(save_path, dst_folder); + strcat(save_path, dst_name); + strcat(save_path, ".save"); + + if(!file_exists(src_path)) + error("Unable to copy file '%s' as it does not exist", src_path); + + if (!file_newer(src_path, dst_path)) + return; + + if (file_exists(dst_path) && save_copy) + CopyFileA(dst_path, save_path, FALSE); + + BOOL success = CopyFileA(src_path, dst_path, FALSE); + if(!success) error("Failed to update '%s' to '%s'", src_path, dst_path); + +} + +void copy_sysconf_content() +{ + /* Using the SYSCONFPREFIX path, lock it so that it does not change */ + fqn_prefix_locked[SYSCONFPREFIX] = TRUE; + + update_file(g.fqn_prefix[SYSCONFPREFIX], SYSCF_TEMPLATE, + g.fqn_prefix[DATAPREFIX], SYSCF_TEMPLATE, FALSE); + + update_file(g.fqn_prefix[SYSCONFPREFIX], SYMBOLS_TEMPLATE, + g.fqn_prefix[DATAPREFIX], SYMBOLS_TEMPLATE, FALSE); + + /* If the required early game file does not exist, copy it */ + copy_file(g.fqn_prefix[SYSCONFPREFIX], SYSCF_FILE, + g.fqn_prefix[DATAPREFIX], SYSCF_TEMPLATE); + + update_file(g.fqn_prefix[SYSCONFPREFIX], SYMBOLS, + g.fqn_prefix[DATAPREFIX], SYMBOLS_TEMPLATE, TRUE); +} + +void copy_config_content() +{ + /* Using the CONFIGPREFIX path, lock it so that it does not change */ + fqn_prefix_locked[CONFIGPREFIX] = TRUE; + + /* Keep templates up to date */ + update_file(g.fqn_prefix[CONFIGPREFIX], CONFIG_TEMPLATE, + g.fqn_prefix[DATAPREFIX], CONFIG_TEMPLATE, FALSE); + + /* If the required early game file does not exist, copy it */ + /* NOTE: We never replace .nethackrc or sysconf */ + copy_file(g.fqn_prefix[CONFIGPREFIX], CONFIG_FILE, + g.fqn_prefix[DATAPREFIX], CONFIG_TEMPLATE); +} + +void +copy_hack_content() +{ + nhassert(fqn_prefix_locked[HACKPREFIX]); + + /* Keep Guidebook and opthelp up to date */ + update_file(g.fqn_prefix[HACKPREFIX], GUIDEBOOK_FILE, + g.fqn_prefix[DATAPREFIX], GUIDEBOOK_FILE, FALSE); + update_file(g.fqn_prefix[HACKPREFIX], OPTIONFILE, + g.fqn_prefix[DATAPREFIX], OPTIONFILE, FALSE); +} + /* * __MINGW32__ Note * If the graphics version is built, we don't need a main; it is skipped @@ -119,123 +434,54 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ #endif g.hname = "NetHack"; /* used for syntax messages */ + +#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS) /* Save current directory and make sure it gets restored when * the game is exited. */ if (getcwd(orgdir, sizeof orgdir) == (char *) 0) error("NetHack: current directory path too long"); - dir = nh_getenv("NETHACKDIR"); - if (dir == (char *) 0) - dir = nh_getenv("HACKDIR"); - if (dir == (char *) 0) - dir = exepath(argv[0]); -#ifdef _MSC_VER - if (IsDebuggerPresent()) { - static char exepath[_MAX_PATH]; - /* check if we're running under the debugger so we can get to the right folder anyway */ - if (dir != (char *)0) { - char *top = (char *)0; - - if (strlen(dir) < (_MAX_PATH - 1)) - strcpy(exepath, dir); - top = strstr(exepath, "\\build\\.\\Debug"); - if (!top) top = strstr(exepath, "\\build\\.\\Release"); - if (top) { - *top = '\0'; - if (strlen(exepath) < (_MAX_PATH - (strlen("\\binary\\") + 1))) { - Strcat(exepath, "\\binary\\"); - if (strlen(exepath) < (PATHLEN - 1)) { - dir = exepath; - } - } - } - } - } #endif - if (dir != (char *)0) { - int prefcnt; - int fd; - boolean have_syscf = FALSE; - (void) strncpy(g.hackdir, dir, PATHLEN - 1); - g.hackdir[PATHLEN - 1] = '\0'; - g.fqn_prefix[0] = (char *) alloc(strlen(g.hackdir) + 2); - Strcpy(g.fqn_prefix[0], g.hackdir); - append_slash(g.fqn_prefix[0]); - for (prefcnt = 1; prefcnt < PREFIX_COUNT; prefcnt++) - g.fqn_prefix[prefcnt] = g.fqn_prefix[0]; - /* sysconf should be searched for in this location */ - envp = nh_getenv("COMMONPROGRAMFILES"); - if (envp) { - if ((sptr = index(envp, ';')) != 0) - *sptr = '\0'; - if (strlen(envp) > 0) { - g.fqn_prefix[SYSCONFPREFIX] = - (char *) alloc(strlen(envp) + 10); - Strcpy(g.fqn_prefix[SYSCONFPREFIX], envp); - append_slash(g.fqn_prefix[SYSCONFPREFIX]); - Strcat(g.fqn_prefix[SYSCONFPREFIX], "NetHack\\"); - } - } + set_default_prefix_locations(argv[0]); - /* okay so we have the overriding and definitive locaton - for sysconf, but only in the event that there is not a - sysconf file there (for whatever reason), check a secondary - location rather than abort. */ +#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS) + chdir(g.fqn_prefix[HACKPREFIX]); +#endif - /* Is there a SYSCF_FILE there? */ - fd = open(fqname(SYSCF_FILE, SYSCONFPREFIX, 0), O_RDONLY); - if (fd >= 0) { - /* readable */ - close(fd); - have_syscf = TRUE; - } - - if (!have_syscf) { - /* No SYSCF_FILE where there should be one, and - without an installer, a user may not be able - to place one there. So, let's try somewhere else... */ - g.fqn_prefix[SYSCONFPREFIX] = g.fqn_prefix[0]; - - /* Is there a SYSCF_FILE there? */ - fd = open(fqname(SYSCF_FILE, SYSCONFPREFIX, 0), O_RDONLY); - if (fd >= 0) { - /* readable */ - close(fd); - have_syscf = TRUE; - } - } - - /* user's home directory should default to this - unless - * overridden */ - envp = nh_getenv("USERPROFILE"); - if (envp) { - if ((sptr = index(envp, ';')) != 0) - *sptr = '\0'; - if (strlen(envp) > 0) { - g.fqn_prefix[CONFIGPREFIX] = - (char *) alloc(strlen(envp) + 2); - Strcpy(g.fqn_prefix[CONFIGPREFIX], envp); - append_slash(g.fqn_prefix[CONFIGPREFIX]); - } - } - } - if (GUILaunched || IsDebuggerPresent()) { + if (GUILaunched || IsDebuggerPresent()) getreturn_enabled = TRUE; - } check_recordfile((char *) 0); iflags.windowtype_deferred = TRUE; - initoptions(); + copy_sysconf_content(); + initoptions(); + + /* Now that sysconf has had a chance to set the TROUBLEPREFIX, don't + allow it to be changed from here on out. */ + fqn_prefix_locked[TROUBLEPREFIX] = TRUE; + + copy_config_content(); + process_options(argc, argv); + + /* did something earlier flag a need to exit without starting a game? */ + if (windows_startup_state > 0) { + raw_printf("Exiting."); + nethack_exit(EXIT_FAILURE); + } + + /* Finished processing options, lock all directory paths */ + for(int i = 0; i < PREFIX_COUNT; i++) + fqn_prefix_locked[i] = TRUE; + if (!validate_prefix_locations(failbuf)) { raw_printf("Some invalid directory locations were specified:\n\t%s\n", failbuf); nethack_exit(EXIT_FAILURE); } - if (!g.hackdir[0]) - Strcpy(g.hackdir, orgdir); - process_options(argc, argv); - + + copy_hack_content(); + /* * It seems you really want to play. */ @@ -291,17 +537,16 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ setting of renameallowed; when False, player_selection() won't resent renaming as an option */ iflags.renameallowed = FALSE; -#if 0 /* Obtain the name of the logged on user and incorporate * it into the name. */ -#endif Sprintf(fnamebuf, "%s", g.plname); (void) fname_encode( "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-.", '%', fnamebuf, encodedfnamebuf, BUFSZ); Sprintf(g.lock, "%s", encodedfnamebuf); /* regularize(lock); */ /* we encode now, rather than substitute */ - getlock(); + if (getlock() == 0) + nethack_exit(EXIT_SUCCESS); /* Set up level 0 file to keep the game state. */ @@ -345,6 +590,10 @@ attempt_restore: } } } + if (g.program_state.in_self_recover) { + g.program_state.in_self_recover = FALSE; + set_savefile_name(TRUE); + } } if (!resuming) { @@ -366,9 +615,9 @@ attempt_restore: You("are in non-scoring discovery mode."); } - // iflags.debug_fuzzer = TRUE; + // iflags.debug_fuzzer = TRUE; - moveloop(resuming); + moveloop(resuming); nethack_exit(EXIT_SUCCESS); /*NOTREACHED*/ return 0; @@ -388,21 +637,28 @@ char *argv[]; if (argcheck(argc, argv, ARG_VERSION) == 2) nethack_exit(EXIT_SUCCESS); + if (argcheck(argc, argv, ARG_SHOWPATHS) == 2) { + iflags.initoptions_noterminate = TRUE; + initoptions(); + iflags.initoptions_noterminate = FALSE; + reveal_paths(); + nethack_exit(EXIT_SUCCESS); + } if (argcheck(argc, argv, ARG_DEBUG) == 1) { argc--; argv++; - } - if (argcheck(argc, argv, ARG_WINDOWS) == 1) { - argc--; - argv++; - } + } + if (argcheck(argc, argv, ARG_WINDOWS) == 1) { + argc--; + argv++; + } if (argc > 1 && !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 */ argc--; argv++; - dir = argv[0] + 2; + const char * dir = argv[0] + 2; if (*dir == '=' || *dir == ':') dir++; if (!*dir && argc > 1) { @@ -560,6 +816,9 @@ nhusage() #ifdef NEWS ADD_USAGE(" [-n]"); #endif + (void) Sprintf(buf2, "\n or\n%s [--showpaths]", + g.hname); + ADD_USAGE(buf2); if (!iflags.window_inited) raw_printf("%s\n", buf1); else @@ -665,35 +924,85 @@ void freefakeconsole() } #endif -#define EXEPATHBUFSZ 256 -char exepathbuf[EXEPATHBUFSZ]; - char * -exepath(str) -char *str; +get_executable_path() { - char *tmp, *tmp2; - int bsize; + static char path_buffer[MAX_PATH]; - if (!str) - return (char *) 0; - bsize = EXEPATHBUFSZ; - tmp = exepathbuf; #ifdef UNICODE { TCHAR wbuf[BUFSZ]; GetModuleFileName((HANDLE) 0, wbuf, BUFSZ); - WideCharToMultiByte(CP_ACP, 0, wbuf, -1, tmp, bsize, NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, wbuf, -1, path_buffer, sizeof(path_buffer), NULL, NULL); } #else - *(tmp + GetModuleFileName((HANDLE) 0, tmp, bsize)) = '\0'; + DWORD length = GetModuleFileName((HANDLE) 0, path_buffer, MAX_PATH); + if (length == ERROR_INSUFFICIENT_BUFFER) error("Unable to get module name"); + path_buffer[length] = '\0'; #endif - tmp2 = strrchr(tmp, PATH_SEPARATOR); - if (tmp2) - *tmp2 = '\0'; - return tmp; + + char * seperator = strrchr(path_buffer, PATH_SEPARATOR); + if (seperator) + *seperator = '\0'; + + return path_buffer; } +char * +translate_path_variables(str, buf) +const char *str; +char *buf; +{ + const char *src; + char evar[BUFSZ], *dest, *envp, *eptr = (char *) 0; + boolean in_evar; + size_t ccount, ecount, destcount, slen = str ? strlen(str) : 0; + + if (!slen || !buf) { + if (buf) + *buf = '\0'; + return buf; + } + + dest = buf; + src = str; + in_evar = FALSE; + destcount = ecount = 0; + for (ccount = 0; ccount < slen && destcount < (BUFSZ - 1) && + ecount < (BUFSZ - 1); ++ccount, ++src) { + if (*src == '%') { + if (in_evar) { + *eptr = '\0'; + envp = nh_getenv(evar); + if (envp) { + size_t elen = strlen(envp); + + if ((elen + destcount) < (size_t) (BUFSZ - 1)) { + Strcpy(dest, envp); + dest += elen; + destcount += elen; + } + } + } else { + eptr = evar; + ecount = 0; + } + in_evar = !in_evar; + continue; + } + if (in_evar) { + *eptr++ = *src; + ecount++; + } else { + *dest++ = *src; + destcount++; + } + } + *dest = '\0'; + return buf; +} + + /*ARGSUSED*/ void windows_raw_print(str) @@ -778,10 +1087,10 @@ eraseoldlocks() return (1); /* success! */ } -void +int getlock() { - register int fd, c, ci, ct, ern; + register int fd, ern, prompt_result = 0; int fcmask = FCMASK; #ifndef SELF_RECOVER char tbuf[BUFSZ]; @@ -789,6 +1098,7 @@ getlock() const char *fq_lock; #define OOPS_BUFSZ 512 char oops[OOPS_BUFSZ]; + boolean istty = WINDOWPORT("tty"); /* we ignore QUIT and INT at this point */ if (!lock_file(HLOCK, LOCKPREFIX, 10)) { @@ -819,56 +1129,41 @@ getlock() (void) nhclose(fd); - if (iflags.window_inited || WINDOWPORT("curses")) { -#ifdef SELF_RECOVER - c = yn("There are files from a game in progress under your name. " - "Recover?"); -#else - pline("There is already a game in progress under your name."); - pline("You may be able to use \"recover %s\" to get it back.\n", - tbuf); - c = yn("Do you want to destroy the old game?"); -#endif - } else { - c = 'n'; - ct = 0; -#ifdef SELF_RECOVER - raw_print("There are files from a game in progress under your name. " - "Recover? [yn]"); -#else - raw_print("\nThere is already a game in progress under your name.\n"); - raw_print("If this is unexpected, you may be able to use \n"); - raw_print("\"recover %s\" to get it back.", tbuf); - raw_print("\nDo you want to destroy the old game? [yn] "); -#endif - while ((ci = nhgetch()) != '\n') { - if (ct > 0) { - raw_print("\b \b"); - ct = 0; - c = 'n'; - } - if (ci == 'y' || ci == 'n' || ci == 'Y' || ci == 'N') { - ct = 1; - c = ci; - } - } - } - if (c == 'y' || c == 'Y') -#ifndef SELF_RECOVER - if (eraseoldlocks()) { - if (WINDOWPORT("tty")) - clear_screen(); /* display gets fouled up otherwise */ - goto gotlock; - } else { - unlock_file(HLOCK); -#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS) - chdirx(orgdir, 0); -#endif - raw_print("Couldn't destroy old game."); - } -#else /*SELF_RECOVER*/ + if (WINDOWPORT("tty")) + prompt_result = tty_self_recover_prompt(); + else + prompt_result = other_self_recover_prompt(); + /* + * prompt_result == 1 means recover old game. + * prompt_result == -1 means willfully destroy the old game. + * prompt_result == 0 should just exit. + */ + Sprintf(oops, "You chose to %s.", + (prompt_result == -1) + ? "destroy the old game and start a new one" + : (prompt_result == 1) + ? "recover the old game" + : "not start a new game"); + if (istty) + clear_screen(); + pline(oops); + if (prompt_result == 1) { /* recover */ if (recover_savefile()) { - if (WINDOWPORT("tty")) +#if 0 + if (istty) + clear_screen(); /* display gets fouled up otherwise */ +#endif + goto gotlock; + } else { + unlock_file(HLOCK); +#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS) + chdirx(orgdir, 0); +#endif + raw_print("Couldn't recover the old game."); + } + } else if (prompt_result < 0) { /* destroy old game */ + if (eraseoldlocks()) { + if (istty) clear_screen(); /* display gets fouled up otherwise */ goto gotlock; } else { @@ -876,16 +1171,15 @@ getlock() #if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS) chdirx(orgdir, 0); #endif - raw_print("Couldn't recover old game."); + raw_print("Couldn't destroy the old game."); + return 0; } -#endif /*SELF_RECOVER*/ - else { + } else { unlock_file(HLOCK); #if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS) chdirx(orgdir, 0); #endif - Sprintf(oops, "%s", "Cannot start a new game."); - raw_print(oops); + return 0; } gotlock: @@ -916,6 +1210,7 @@ gotlock: error("cannot close lock (%s)", fq_lock); } } + return 1; } #endif /* PC_LOCKING */ @@ -932,4 +1227,159 @@ const char *path; return TRUE; } +/* + file_newer returns TRUE if the file at a_path is newer then the file + at b_path. If a_path does not exist, it returns FALSE. If b_path + does not exist, it returns TRUE. + */ +boolean +file_newer(a_path, b_path) +const char * a_path; +const char * b_path; +{ + struct stat a_sb; + struct stat b_sb; + + if (stat(a_path, &a_sb)) + return FALSE; + + if (stat(b_path, &b_sb)) + return TRUE; + + if(difftime(a_sb.st_mtime, b_sb.st_mtime) < 0) + return TRUE; + return FALSE; +} + +/* + * returns: + * 1 if game should be recovered + * -1 if old game should be destroyed, allowing new game to proceed. + */ +int +tty_self_recover_prompt() +{ + register int c, ci, ct, pl, retval = 0; + /* for saving/replacing functions, if needed */ + struct window_procs saved_procs = {0}; + + pl = 1; + c = 'n'; + ct = 0; + saved_procs = windowprocs; + if (!WINDOWPORT("safe-startup")) + windowprocs = *get_safe_procs(2); /* arg 2 uses no-newline variant */ + windowprocs.win_nhgetch = windows_console_custom_nhgetch; + raw_print("\n"); + raw_print("\n"); + raw_print("\n"); + raw_print("\n"); + raw_print("\n"); + raw_print("There are files from a game in progress under your name. "); + raw_print("Recover? [yn] "); + + tty_ask_again: + + while ((ci = nhgetch()) && !(ci == '\n' || ci == 13)) { + if (ct > 0) { + /* invalid answer */ + raw_print("\b \b"); + ct = 0; + c = 'n'; + } + if (ci == 'y' || ci == 'n' || ci == 'Y' || ci == 'N') { + ct = 1; + c = ci; +#ifdef _MSC_VER + _putch(ci); +#endif + } + } + + if (pl == 1 && (c == 'n' || c == 'N')) { + /* no to recover */ + raw_print("\n\nAre you sure you wish to destroy the old game rather than try to\n"); + raw_print("recover it? [yn] "); + c = 'n'; + ct = 0; + pl = 2; + goto tty_ask_again; + } + + if (pl == 2 && (c == 'n' || c == 'N')) { + /* no to destruction of old game */ + retval = 0; + } else { + /* only yes answers get here */ + if (pl == 2) + retval = -1; /* yes, do destroy the old game anyway */ + else + retval = 1; /* yes, do recover the old game */ + } + if (saved_procs.name[0]) { + windowprocs = saved_procs; + raw_clear_screen(); + } + return retval; +} + +int +other_self_recover_prompt() +{ + register int c, ci, ct, pl, retval = 0; + boolean ismswin = WINDOWPORT("mswin"), + iscurses = WINDOWPORT("curses"); + + pl = 1; + c = 'n'; + ct = 0; + if (iflags.window_inited || WINDOWPORT("curses")) { + c = yn("There are files from a game in progress under your name. " + "Recover?"); + } else { + c = 'n'; + ct = 0; + raw_print("There are files from a game in progress under your name. " + "Recover? [yn]"); + } + + other_ask_again: + + if (!ismswin && !iscurses) { + while ((ci = nhgetch()) && !(ci == '\n' || ci == 13)) { + if (ct > 0) { + /* invalid answer */ + raw_print("\b \b"); + ct = 0; + c = 'n'; + } + if (ci == 'y' || ci == 'n' || ci == 'Y' || ci == 'N') { + ct = 1; + c = ci; + } + } + } + if (pl == 1 && (c == 'n' || c == 'N')) { + /* no to recover */ + c = yn("Are you sure you wish to destroy the old game, rather than try to " + "recover it? [yn] "); + pl = 2; + if (!ismswin && !iscurses) { + c = 'n'; + ct = 0; + goto other_ask_again; + } + } + if (pl == 2 && (c == 'n' || c == 'N')) { + /* no to destruction of old game */ + retval = 0; + } else { + /* only yes answers get here */ + if (pl == 2) + retval = -1; /* yes, do destroy the old game anyway */ + else + retval = 1; /* yes, do recover the old game */ + } + return retval; +} /*windmain.c*/ diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index f06775a4b..af1944678 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -11,6 +11,7 @@ * */ +#include "win10.h" #include "winos.h" #define NEED_VARARGS @@ -188,15 +189,26 @@ get_username(lan_username_size) int *lan_username_size; { static TCHAR username_buffer[BUFSZ]; - unsigned int status; DWORD i = BUFSZ - 1; + BOOL allowUserName = TRUE; + + Strcpy(username_buffer, "NetHack"); + +#ifndef WIN32CON + /* Our privacy policy for the windows store version of nethack makes + * a promise about not collecting any personally identifiable information. + * Do not allow getting user name if we being run from windows store + * version of nethack. In 3.7, we should remove use of username. + */ + allowUserName = !win10_is_desktop_bridge_application(); +#endif + + if (allowUserName) { + /* i gets updated with actual size */ + if (GetUserName(username_buffer, &i)) + username_buffer[i] = '\0'; + } - /* i gets updated with actual size */ - status = GetUserName(username_buffer, &i); - if (status) - username_buffer[i] = '\0'; - else - Strcpy(username_buffer, "NetHack"); if (lan_username_size) *lan_username_size = strlen(username_buffer); return username_buffer; diff --git a/test/test_des.lua b/test/test_des.lua new file mode 100644 index 000000000..1e8487530 --- /dev/null +++ b/test/test_des.lua @@ -0,0 +1,411 @@ + +-- Test the des-file commands +-- reset_level is only needed here, not in normal special level scripts. + +function is_map_at(x,y, mapch, lit) + local rm = nh.getmap(x + 1, y); -- + 1 == g.xstart + if rm.mapchr ~= mapch then + error("Terrain at (" .. x .. "," .. y .. ") is not \"" .. mapch .. "\", but \"" .. rm.mapchr .. "\""); + end + if lit ~= nil then + if rm.lit ~= lit then + error("light state at (" .. x .. "," .. y .. ") is not \"" .. lit .. "\", but \"" .. tostring(rm.lit) .. "\""); + end + end +end + +function check_loc_name(x, y, name) + local loc = nh.getmap(x,y); + if (loc.typ_name ~= name) then + error("No " .. name .. " at " .. x .. "," .. y .. " (" .. loc.typ_name .. ")"); + end +end + +function check_trap_at(x,y, name) + local t = nh.gettrap(x + 1, y); -- + 1 == g.xstart + if (t.ttyp_name ~= name) then + error("Trap at " .. x .. "," .. y .. " is " .. t.ttyp_name .. ", not " .. name); + end +end + +function test_level_init() + des.reset_level(); + des.level_init(); + + des.reset_level(); + des.level_init({ style = "solidfill" }); + + des.reset_level(); + des.level_init({ style = "solidfill", fg = " " }); + + des.reset_level(); + des.level_init({ style = "mazegrid", bg ="-" }); + + des.reset_level(); + des.level_init({ style = "rogue" }); + + des.reset_level(); + des.level_init({ style = "mines" }); + + des.reset_level(); + des.level_init({ style = "mines", fg = ".", bg = " ", smoothed = true }); + + des.reset_level(); + des.level_init({ style = "mines", fg = ".", bg = "}", joined = true }); + + des.reset_level(); + des.level_init({ style = "mines", fg = ".", bg = "L", smoothed = 1, joined = 1, lit = 0 }); + + des.reset_level(); + des.level_init({ style = "mines", fg = ".", bg = " ", smoothed = true, joined = true, walled = true }); + + des.reset_level(); + des.level_init({ style = "solidfill", fg = ".", lit = 1 }); +end + +function test_message() + des.message("Test message"); + des.message("Message 2"); +end + +function test_monster() + des.monster(); + des.monster("gnome") + des.monster("S") + des.monster("giant eel",11,06); + des.monster("hill giant", {08,06}); + des.monster({ id = "ogre" }) + des.monster({ class = "D" }) + des.monster({ id = "ogre", x = 10, y = 15 }) + des.monster({ class = "D", coord = {11,16} }) + des.monster({ x = 73, y = 16 }); + des.monster({ id = "watchman", peaceful = 1 }) + des.monster({ class = "H", peaceful = 0 }) + des.monster({ id = "giant mimic", appear_as = "obj:boulder" }); + des.monster({ id = "giant mimic", appear_as = "ter:altar" }); + des.monster({ id = "chameleon", appear_as = "mon:bat" }); + des.monster({ class = "H", asleep = 1, female = 1, invisible = 1, cancelled = 1, revived = 1, avenge = 1, fleeing = 20, blinded = 20, paralyzed = 20, stunned = 20, confused = 20 }) + des.monster({ id = "ogre", x = 10, y = 15, name = "Fred", + inventory = function() + des.object(); + des.object("["); + des.object({ class = "/" }); + des.object({ id = "statue", contents=0 }) + end + }); + des.reset_level(); + des.level_init(); +end + +function test_object() + des.reset_level(); + des.level_init(); + des.object() + des.object("*") + des.object({ class = "%" }); + des.object({ id = "statue", contents=0 }) + des.object("sack") + des.object({ x = 41, y = 03 }) + des.object({ coord = {42, 03} }); + des.object({ id = "boulder", coord = {03,12} }); + des.object("diamond", 69, 04) + des.object("diamond", {68, 04}) + des.object({ id = "egg", x = 05, y = 04, montype = "yellow dragon" }); + des.object({ id = "egg", x = 06, y = 04, montype = "yellow dragon", laid_by_you = true }); + des.object({ id = "corpse", montype = "valkyrie" }) + des.object({ id = "statue", montype = "C", historic = true, male = true }); + des.object({ id = "statue", montype = "C", historic = true, female = true }); + des.object({ id = "chest", buried = true, locked = true, + contents = function() + des.object(); + des.object("*") + des.object({ class = "%" }); + des.object({ id = "statue", contents=0 }) + end + }); + des.object({ id = "chest", greased = true, broken = true, contents = 0 }); + des.object({ id = "chest", trapped = 1, broken = true, contents = 0 }); + des.object({ id = "oil lamp", lit = 1 }); + des.object({ id = "silver dagger", spe = 127, buc = "cursed" }); + des.object({ id = "silver dagger", spe = -127, buc = "blessed" }); + des.object({ id = "bamboo arrow", quantity = 100 }); + des.object({ id = "leather armor", eroded = 1 }); + des.object({ id = "probing", recharged = 2, spe = 3 }); + des.object({ name = "Random object" }); + des.object({ class = "*", name = "Random stone" }); + des.object({ id ="broadsword", name = "Dragonbane" }) + des.reset_level(); + des.level_init(); +end + +function test_level_flags() + des.level_flags("noteleport") + des.level_flags("noteleport", "hardfloor", "nommap", "shortsighted", "arboreal") + des.level_flags("mazelevel", "shroud", "graveyard", "icedpools", "corrmaze") + des.level_flags("premapped", "solidify", "inaccessibles") +end + +function test_engraving() + des.engraving({02,04},"engrave","Trespassers will be persecuted!") + des.engraving({ x = 1, y = 2, type = "burn", text = "Elbereth" }); + des.engraving({ type = "dust", text = "X marks the spot." }) + des.engraving({ text = "Foobar" }) + des.engraving({ type = "mark", text = "X" }) + des.engraving({ type = "blood", text = "redrum" }) +end + +function test_mineralize() + des.mineralize(); + des.mineralize({ gem_prob = 1, gold_prob = 10, kelp_moat = 25, kelp_pool = 100 }) +end + +function test_grave() + des.grave(); + des.grave({ text = "Lil Miss Marker" }); + des.grave({ x = 40, y = 11 }); + des.grave({ x = 41, y = 12, text = "Bongo" }); + des.grave({ x = 42, y = 13, text = "" }); +end + +function test_altar() + des.altar(); + des.altar({ x = 44, y = 20 }); + des.altar({ coord = {46, 20 } }); + des.altar({ coord = {48, 20 }, type = "altar", align = "law" }); + des.altar({ coord = {50, 20 }, type = "shrine", align = "noalign" }); + des.altar({ coord = {52, 20 }, type = "sanctum", align = "coaligned" }); +end + +function test_map() + des.map([[ +TTT +LTL +LTL]]) + des.map({ x = 60, y = 5, map = [[ +FFF +F.F +FFF]] }) + for x = 60, 62 do + for y = 5, 7 do + local nam = "iron bars"; + if (x == 61 and y == 6) then + nam = "room"; + end + check_loc_name(x, y, nam); + end + end + des.map({ halign = "left", valign = "bottom", map = [[ +III +.I. +III]] }) +end + +function test_feature() + des.feature("fountain", 40, 08); + check_loc_name(40 + 1, 08, "fountain"); + des.feature("sink", {41, 08}); + check_loc_name(41 + 1, 08, "sink"); + des.feature({ type = "pool", x = 42, y = 08 }); + check_loc_name(42 + 1, 08, "pool"); +end + +function test_gold() + des.gold({ amount = 999, x = 40, y = 07 }); +end + +function test_trap() + des.trap("pit", 41, 06); + check_trap_at(41, 06, "pit"); + + des.trap("level teleport", {42, 06}); + check_trap_at(42, 06, "level teleport"); + + des.trap({ type = "falling rock", x = 43, y = 06 }); + check_trap_at(43, 06, "falling rock"); + + des.trap({ type = "dart", coord = {44, 06} }); + check_trap_at(44, 06, "dart"); + + des.trap(); + des.trap("rust"); +end + +function test_wall_prop() + des.wall_property({ x1 = 0, y1 = 0, x2 = 78, y2 = 20, property = "nondiggable" }); + des.wall_property({ region={0,0, 78,20}, property = "nondiggable" }); + des.non_diggable(); + des.non_diggable(selection.area(5,5, 15, 15)); + des.non_passwall(); + des.non_passwall(selection.area(5,5, 15, 15)); +end + +function test_wallify() + des.wallify(); + des.wallify({ x1 = 0, y1 = 0, x2 = 78, y2 = 20 }); +end + +function test_teleport_region() + des.teleport_region({ region = {69,00,79,20} }) + des.teleport_region({ region = {69,00,79,20}, dir="up" }) + des.teleport_region({ region = {69,00,79,20}, region_islev=1, dir="up" }) + des.teleport_region({ region = {01,00,10,20}, region_islev=1, exclude={1,1,61,15}, dir="down" }) + des.teleport_region({ region = {01,00,10,20}, region_islev=1, exclude={1,1,61,15}, exclude_islev=1 }) +end + +function test_region() + des.region(selection.area(08,03,54,03),"unlit") + des.region(selection.area(56,02,60,03),"lit") + des.region({ region={16,05, 25,06}, lit=1, type="barracks", prefilled=0 }) + des.region({ region={1,5, 3,7}, lit=1, irregular=true, prefilled=true, joined=false }) +end + +function test_door() + des.door("nodoor", 12,12); + des.door({ x = 13, y = 12, state = "open" }); + des.room({ type = "graveyard", contents = function() + des.door({ wall = "north", pos = 1 }); + des.door({ wall = "random", state = "locked" }); + end + }); +end + +function test_mazewalk() + des.reset_level(); + des.level_init({ style = "mazegrid", bg ="-" }); + des.mazewalk(01,10,"east") + + des.reset_level(); + des.level_init({ style = "mazegrid", bg ="-" }); + des.mazewalk({ x=2,y=10, dir="north", typ="L", stocked=true }); +end + +function test_room() + des.reset_level(); + des.level_init({ style = "solidfill", fg=" " }); + des.room({ type = " ordinary", lit = 1, + x=3, y=3, xalign="center", yalign="center", + w=11, h=9, contents = function() + des.room({ x=4, y=3, w=3,h=3 }); + end + }); + des.room(); + des.room({ contents = function() + des.object(); + des.monster(); + end + }); + des.random_corridors(); +end + +function test_stair() + des.reset_level(); + des.level_init(); + + des.stair("up"); + des.stair("down", 4, 7); + des.stair({ dir = "down", x = 5, y = 7 }); + des.stair({ dir = "down", coord = {6, 7} }); +end + +function test_ladder() + des.reset_level(); + des.level_init(); + + des.ladder("up"); + des.ladder("down", 4, 7); + des.ladder({ dir = "down", x = 5, y = 7 }); + des.ladder({ dir = "down", coord = {6, 7} }); +end + +function test_terrain() + des.reset_level(); + des.level_init(); + + des.terrain(2, 2, "L"); + is_map_at(2,2, "L"); + + des.terrain({6,7}, "L"); + is_map_at(6,7, "L"); + + des.terrain({ x = 5, y = 5, typ = "L" }); + is_map_at(5,5, "L"); + + -- TODO: allow lit = false + -- des.terrain({ x = 5, y = 5, typ = ".", lit = false }); + -- is_map_at(5,5, ".", false); + + des.terrain({ x = 5, y = 5, typ = ".", lit = 1 }); + is_map_at(5,5, ".", true); + + des.terrain({ x = 5, y = 5, typ = " ", lit = 0 }); + is_map_at(5,5, " ", false); + + des.terrain({ selection = selection.area(4,4, 6,6), typ = "L", lit = 0 }); + for x = 4,6 do + for y = 4,6 do + is_map_at(x,y, "L", true); + end + end + + des.terrain(selection.area(2,2, 4,4), "T"); + for x = 2,4 do + for y = 2,4 do + is_map_at(x,y, "T"); + end + end +end + +function test_replace_terrain() + des.replace_terrain({ x1=1, y1=1, x2=70,y2=19, fromterrain=".", toterrain="I", lit=1 }); + des.replace_terrain({ x1=1, y1=1, x2=70,y2=19, fromterrain=".", toterrain="I", chance=50 }); + des.replace_terrain({ region={1,1, 70,19}, fromterrain=".", toterrain="L", chance=25 }); +end + +function test_corridor() + des.reset_level(); + des.level_init({ style = "solidfill", fg=" " }); + des.room({ x=2, y=2, xalign="center", yalign="center", w=4, h=4, + contents = function() + des.door({ wall = "south", pos = 2 }); + end + }); + des.room({ x=1, y=3, xalign="center", yalign="center", w=6, h=6, + contents = function() + des.door({ wall = "north", pos = 1 }); + end + }); + des.corridor({ srcroom=0, srcwall="south", srcdoor=0, destroom=1, destwall="north", destdoor=0 }); +end + +function run_tests() + test_level_init(); + test_message(); + test_monster(); + test_object(); + test_level_flags(); + test_engraving(); + test_mineralize(); + test_grave(); + test_altar(); + test_feature(); + test_gold(); + test_trap(); + test_door(); + test_map(); + test_wall_prop(); + test_wallify(); + test_teleport_region(); + test_region(); + test_mazewalk(); + test_room(); + test_stair(); + test_ladder(); + test_terrain(); + test_replace_terrain(); + test_corridor(); + + des.reset_level(); + des.level_init(); +end + +run_tests(); diff --git a/test/test_lev.lua b/test/test_lev.lua new file mode 100644 index 000000000..076689a26 --- /dev/null +++ b/test/test_lev.lua @@ -0,0 +1,75 @@ + +-- Test all of the special levels + +local special_levels = { +"air", +"asmodeus", +"astral", +"baalz", +"bigrm-10", +"bigrm-1", +"bigrm-2", +"bigrm-3", +"bigrm-4", +"bigrm-5", +"bigrm-6", +"bigrm-7", +"bigrm-8", +"bigrm-9", +"castle", +"earth", +"fakewiz1", +"fakewiz2", +"fire", +"juiblex", +"knox", +"medusa-1", +"medusa-2", +"medusa-3", +"medusa-4", +"minefill", +"minend-1", +"minend-2", +"minend-3", +"minetn-1", +"minetn-2", +"minetn-3", +"minetn-4", +"minetn-5", +"minetn-6", +"minetn-7", +"oracle", +"orcus", +"sanctum", +"soko1-1", +"soko1-2", +"soko2-1", +"soko2-2", +"soko3-1", +"soko3-2", +"soko4-1", +"soko4-2", +"tower1", +"tower2", +"tower3", +"valley", +"water", +"wizard1", +"wizard2", +"wizard3" +} + +local roles = { "Arc", "Bar", "Cav", "Hea", "Kni", "Mon", "Pri", "Ran", "Rog", "Sam", "Tou", "Val", "Wiz" } +local questlevs = { "fila", "filb", "goal", "loca", "strt" } + +for _,role in ipairs(roles) do + for _,qlev in ipairs(questlevs) do + local lev = role .. "-" .. qlev + table.insert(special_levels, lev) + end +end + +for _,lev in ipairs(special_levels) do + des.reset_level(); + require(lev) +end diff --git a/test/test_obj.lua b/test/test_obj.lua new file mode 100644 index 000000000..a72232465 --- /dev/null +++ b/test/test_obj.lua @@ -0,0 +1,66 @@ + +local o = obj.new("rock"); +o:placeobj(u.ux, u.uy); + +local o2 = obj.at(u.ux, u.uy); +local o2tbl = o2:totable(); +if (o2tbl.otyp_name ~= "rock") then + error("no rock under you"); +end + + +local box = obj.new("empty large box"); +local boxtbl = box:totable(); +if (boxtbl.has_contents ~= 0) then + error("empty box has contents"); +end + +box:addcontent(obj.new("diamond")); +boxtbl = box:totable(); +if (boxtbl.has_contents ~= 1) then + error("box has no contents"); +end + +local diamond = box:contents():totable(); +if (diamond.otyp_name ~= "diamond") then + error("box contents is not a diamond"); +end + +box:placeobj(u.ux, u.uy); + +local o3 = obj.at(u.ux, u.uy); +local o3tbl = o3:totable(); +if (o3tbl.otyp_name ~= "large box") then + error("no large box under you"); +end + +local o4 = o3:next(); +local o4tbl = o4:totable(); +if (o4tbl.otyp_name ~= "rock") then + error("no rock under the large box"); +end + + +local oc = obj.class(o4tbl.otyp); +if (oc.name ~= "rock") then + error("object class is not rock, part 1"); +end +if (oc.class ~= "*") then + error("object class is not *, part 1"); +end + +local oc2 = obj.class(o); +if (oc2.name ~= "rock") then + error("object class is not rock, part 2"); +end +if (oc2.class ~= "*") then + error("object class is not *, part 2"); +end + +local oc3 = obj.class(obj.new("rock")); +if (oc3.name ~= "rock") then + error("object class is not rock, part 3"); +end +if (oc3.class ~= "*") then + error("object class is not *, part 3"); +end diff --git a/test/test_sel.lua b/test/test_sel.lua new file mode 100644 index 000000000..8d71eec2b --- /dev/null +++ b/test/test_sel.lua @@ -0,0 +1,85 @@ + + +-- Test the selection + +function test_selection() + local sel = selection.new(); + + -- test set & get + local ret = sel:get(1,2) + if ret == 1 then + error("sel:get returned " .. ret .. " instead of 0"); + end + + sel:set(1, 2); + ret = sel:get(1, 2); + if ret ~= 1 then + error("sel:get returned " .. ret .. " instead of 1"); + end + + local x,y = sel:rndcoord(1); + if x ~= 1 or y ~= 2 then + error("sel:rndcoord returned unset coordinate"); + end + + x,y = sel:rndcoord(1); + if x ~= -2 and y ~= -1 then + error("sel:rndcoord returned (" .. x .. "," .. y .. ") coordinate"); + end + + -- OO style + sel:negate(); + sel:percentage(50); + sel:rndcoord(1); + sel:line(1,2, 50,20); + sel:randline(1,2, 50,20, 7); + sel:rect(1,2, 7,8); + sel:fillrect(1,2, 7,8); + sel:area(1,2, 7,8); + sel:grow(); + sel:filter_mapchar(' '); + sel:floodfill(1,1); + sel:circle(40, 10, 9); + sel:circle(40, 10, 9, 1); + sel:ellipse(40, 10, 20, 8); + sel:ellipse(40, 10, 20, 8, 1); + + -- variable as param + selection.get(sel, 1, 2); + selection.set(sel, 1, 2); + selection.negate(sel); + selection.percentage(sel, 50); + selection.rndcoord(sel, 1); + selection.line(sel, 1,2, 50,20); + selection.randline(sel, 1,2, 50,20, 7); + selection.rect(sel, 1,2, 7,8); + selection.fillrect(sel, 1,2, 7,8); + selection.area(sel, 1,2, 7,8); + selection.grow(sel); + selection.filter_mapchar(sel, ' '); + selection.floodfill(sel, 1,1); + selection.circle(sel, 40, 10, 9); + selection.circle(sel, 40, 10, 9, 1); + selection.ellipse(sel, 40, 10, 20, 8); + selection.ellipse(sel, 40, 10, 20, 8, 1); + + -- initializers + selection.set(1, 2); + selection.negate(); + selection.line(1,2, 50,20); + selection.randline(1,2, 50,20, 7); + selection.rect(1,2, 7,8); + selection.fillrect(1,2, 7,8); + selection.area(1,2, 7,8); + selection.floodfill(1,1); + selection.circle(40, 10, 9); + selection.circle(40, 10, 9, 1); + selection.ellipse(40, 10, 20, 8); + selection.ellipse(40, 10, 20, 8, 1); + + local sel2 = selection.clone(sel); + local sel3 = sel2:clone(); +end -- selection_tests() + + +test_selection(); diff --git a/test/test_src.lua b/test/test_src.lua new file mode 100644 index 000000000..7c549679b --- /dev/null +++ b/test/test_src.lua @@ -0,0 +1,92 @@ + +-- Test different src functions + +local tests = { + makeplural = { + algae = "algae", + amoeba = "amoebae", + baluchitherium = "baluchitheria", + bordeau = "bordeaus", + ["bunch of grapes"] = "bunches of grapes", + bus = "buses", + candelabrum = "candelabra", + caveman = "cavemen", + child = "children", + cookie = "cookies", + deer = "deer", + dingo = "dingoes", + epoch = "epochs", + fish = "fish", + foot = "feet", + fox = "foxes", + fungus = "fungi", + gateau = "gateaus", + gateaux = "gateauxes", + gauntlet = "gauntlets", + ["gauntlet of power"] = "gauntlets of power", + goose = "geese", + homunculus = "homunculi", + hoof = "hooves", + hyphae = "hyphae", + knife = "knives", + larvae = "larvae", + loch = "lochs", + lotus = "lotuses", + louse = "lice", + manes = "manes", + matzah = "matzot", + matzoh = "matzot", + mech = "mechs", + mouse = "mice", + mycelium = "mycelia", + nemesis = "nemeses", + nerf = "nerfs", + ninja = "ninja", + ox = "oxen", + potato = "potatoes", + priestess = "priestesses", + ronin = "ronin", + roshi = "roshi", + scale = "scales", + serf = "serfs", + shaman = "shamans", + sheep = "sheep", + shito = "shito", + ["slice of cake"] = "slices of cake", + stamen = "stamens", + tech = "techs", + tengu = "tengu", + tomato = "tomatoes", + tooth = "teeth", + tuna = "tuna", + valkyrie = "valkyries", + VAX = "VAXES", + vertebra = "vertebrae", + vortex = "vortices", + woman = "women", + wumpus = "wumpuses", + zorkmid = "zorkmids", + }, + an = { + a = "an a", + b = "a b", + ["the foo"] = "the foo", + ["molten lava"] = "molten lava", + ["iron bars"] = "iron bars", + ice = "ice", + unicorn = "a unicorn", + uranium = "a uranium", + ["one-eyed"] = "a one-eyed", + candy = "a candy", + eucalyptus = "a eucalyptus", + } +} + +for func, fval in pairs(tests) do + for instr, outstr in pairs(fval) do + local ret = nh[func](instr) + if ret ~= outstr then + error(func .. "(\"" .. instr .. "\") != \"" .. outstr .. "\" (returned \"" .. ret .. "\") instead") + end + end +end diff --git a/test/testwish.lua b/test/testwish.lua new file mode 100644 index 000000000..0f301e25f --- /dev/null +++ b/test/testwish.lua @@ -0,0 +1,64 @@ + +local wishtest_objects = { + ["a rock"] = { otyp_name = "rock", quan = 1, oclass = "*" }, + ["5 +3 blessed silver daggers"] = { otyp_name = "silver dagger", blessed = 1, cursed = 0, spe = 3, quan = 5 }, + ["an empty locked large box"] = { otyp_name = "large box", is_container = 1, has_contents = 0, olocked = 1 }, + ["an empty trapped unlocked chest"] = { otyp_name = "chest", is_container = 1, has_contents = 0, olocked = 0, otrapped = 1 }, + ["an empty untrapped locked chest"] = { otyp_name = "chest", is_container = 1, has_contents = 0, olocked = 1, otrapped = 0 }, + ["an empty locked broken chest"] = { otyp_name = "chest", is_container = 1, has_contents = 0, olocked = 0, obroken = 1 }, + ["broken empty chest"] = { otyp_name = "chest", obroken = 1 }, + ["potion of holy water"] = { otyp_name = "water", oclass = "!", blessed = 1, cursed = 0 }, + ["potion of unholy water"] = { otyp_name = "water", oclass = "!", blessed = 0, cursed = 1 }, + ["cursed greased +2 grey dragon scale mail"] = { otyp_name = "gray dragon scale mail", oclass = "[", blessed = 0, cursed = 1, spe = 2, greased = 1 }, + ["uncursed magic marker (11)"] = { otyp_name = "magic marker", blessed = 0, cursed = 0, spe = 11 }, + ["lit oil lamp"] = { otyp_name = "oil lamp", lamplit = 1 }, + ["6 burning tallow candles"] = { otyp_name = "tallow candle", lamplit = 1, quan = 6 }, + ["unlit oil lamp"] = { otyp_name = "oil lamp", lamplit = 0 }, + ["7 extinguished wax candles"] = { otyp_name = "wax candle", lamplit = 0, quan = 7 }, + ["2 blank scrolls"] = { otyp_name = "blank paper", quan = 2 }, + ["3 unlabeled scrolls"] = { otyp_name = "blank paper", quan = 3 }, + ["1 unlabelled scroll"] = { otyp_name = "blank paper", quan = 1 }, + ["3 rusty poisoned darts"] = { otyp_name = "dart", quan = 3, opoisoned = 1, oeroded = 1 }, + ["4 diluted dark green potions named whisky"] = { otyp_descr = "dark green", oclass = "!", quan = 4, odiluted = 1, has_oname = 1, oname = "whisky" }, + ["poisoned food ration"] = { otyp_name = "food ration", oclass = "%", age = 1 }, + ["empty tin"] = { otyp_name = "tin", oclass = "%", corpsenm = -1, spe = 0 }, + ["blessed tin of spinach"] = { otyp_name = "tin", oclass = "%", corpsenm = -1, spe = 1, blessed = 1 }, + ["trapped tin of floating eye meat"] = { otyp_name = "tin", oclass = "%", otrapped = 1, corpsenm_name = "floating eye" }, + ["hill orc corpse"] = { otyp_name = "corpse", oclass = "%", corpsenm_name = "hill orc" }, + ["destroy armor"] = { otyp_name = "destroy armor", oclass = "?" }, + ["enchant weapon"] = { otyp_name = "enchant weapon", oclass = "?" }, + ["scroll of food detection"] = { otyp_name = "food detection", oclass = "?" }, + ["scroll of detect food"] = { otyp_name = "food detection", oclass = "?" }, + ["spellbook of food detection"] = { otyp_name = "detect food", oclass = "+" }, + ["spell"] = { NO_OBJ = 1 }, + ["-1 ring mail"] = { otyp_name = "ring mail", oclass = "[", spe = -1 }, + ["studded leather armor"] = { otyp_name = "studded leather armor", oclass = "[" }, + ["leather armor"] = { otyp_name = "leather armor", oclass = "[" }, + ["tooled horn"] = { otyp_name = "tooled horn", oclass = "(" }, + ["meat ring"] = { otyp_name = "meat ring", oclass = "%" }, + ["beartrap"] = { otyp_name = "beartrap", oclass = "(" }, + ["bear trap"] = { otyp_name = "beartrap", oclass = "(" }, + ["landmine"] = { otyp_name = "land mine", oclass = "(" }, + ["land mine"] = { otyp_name = "land mine", oclass = "(" }, + ["blessed historic statue of woodland-elf named Foo"] = { otyp_name = "statue", blessed = 1, historic = 1, corpsenm_name = "Woodland-elf", oname = "Foo" }, + ["blessed figurine of a ki-rin"] = { otyp_name = "figurine", blessed = 1, corpsenm_name = "ki-rin" }, + ["partly eaten orange"] = { otyp_name = "orange", oclass = "%", oeaten = function () + local oc = obj.class(obj.new("orange")); + return (oc.nutrition // 2); + end }, +}; + +for str, tbl in pairs(wishtest_objects) do + local o = obj.new(str):totable(); + for field, value in pairs(tbl) do + local val; + if (type(value) == "function") then + val = value(); + else + val = value; + end + if (o[field] ~= val) then + error("wished " .. str .. ", but " .. field .. " is " .. o[field] .. ", not " .. val); + end + end +end diff --git a/util/.gitignore b/util/.gitignore index c211d0a77..81e8a1144 100644 --- a/util/.gitignore +++ b/util/.gitignore @@ -9,6 +9,7 @@ makedefs dgn_comp lev_comp dlb +dlb_main recover tilemap tileedit @@ -19,6 +20,8 @@ gif2txt txt2ppm tile2img.ttp xpm2ppm.ttp +nethack.tags +readtags # dev tool for analyzing data collected by nethack's #define MONITOR_HEAP heaputil heaputil.c diff --git a/util/dgn_comp.l b/util/dgn_comp.l deleted file mode 100644 index 99c8527a1..000000000 --- a/util/dgn_comp.l +++ /dev/null @@ -1,144 +0,0 @@ -%{ -/* NetHack 3.6 dgn_comp.l $NHDT-Date: 1455415007 2016/02/14 01:56:47 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.13 $ */ -/* Copyright (c) 1989 by Jean-Christophe Collet */ -/* Copyright (c) 1990 by M. Stephenson */ -/* NetHack may be freely redistributed. See license for details. */ - -#define DGN_COMP - -#include "config.h" -#include "dgn_comp.h" -#include "dgn_file.h" - -/* - * Most of these don't exist in flex, yywrap is macro and - * yyunput is properly declared in flex.skel. - */ -#if !defined(FLEX_SCANNER) && !defined(FLEXHACK_SCANNER) -int FDECL(yyback, (int *,int)); -int NDECL(yylook); -int NDECL(yyinput); -int NDECL(yywrap); -int NDECL(yylex); - /* Traditional lexes let yyunput() and yyoutput() default to int; - * newer ones may declare them as void since they don't return - * values. For even more fun, the lex supplied as part of the - * newer unbundled compiler for SunOS 4.x adds the void declarations - * (under __STDC__ or _cplusplus ifdefs -- otherwise they remain - * int) while the bundled lex and the one with the older unbundled - * compiler do not. To detect this, we need help from outside -- - * sys/unix/Makefile.utl. - * - * Digital UNIX is difficult and still has int in spite of all - * other signs. - */ -# if defined(NeXT) || defined(SVR4) || defined(_AIX32) -# define VOIDYYPUT -# endif -# if !defined(VOIDYYPUT) && defined(POSIX_TYPES) -# if !defined(BOS) && !defined(HISX) && !defined(_M_UNIX) && !defined(VMS) -# define VOIDYYPUT -# endif -# endif -# if !defined(VOIDYYPUT) && defined(WEIRD_LEX) -# if defined(SUNOS4) && defined(__STDC__) && (WEIRD_LEX > 1) -# define VOIDYYPUT -# endif -# endif -# if defined(VOIDYYPUT) && defined(__osf__) -# undef VOIDYYPUT -# endif -# ifdef VOIDYYPUT -void FDECL(yyunput, (int)); -void FDECL(yyoutput, (int)); -# else -int FDECL(yyunput, (int)); -int FDECL(yyoutput, (int)); -# endif - -#else /* !FLEX_SCANNER && !FLEXHACK_SCANNER */ -/* most recent flex allows suppressing yyunput() altogether when not needed */ -#define YY_NO_UNPUT -#define YY_NO_INPUT -#endif - -#if defined(FLEX_SCANNER) || defined(FLEXHACK_SCANNER) -/* older flex wants this */ -#define YY_MALLOC_DECL genericptr_t FDECL(malloc, (size_t)); \ - genericptr_t FDECL(realloc, (genericptr_t, size_t)); -/* newer flex assumes so needs this in case it's been suppressed */ -YY_MALLOC_DECL -#endif - -void FDECL(init_yyin, (FILE *)); -void FDECL(init_yyout, (FILE *)); - -/* this doesn't always get put in dgn_comp.h - * (esp. when using older versions of bison) - */ -extern YYSTYPE yylval; - -int nh_line_number = 1; - -%} -%% -DUNGEON return(A_DUNGEON); -up { yylval.i=1; return(UP_OR_DOWN); } -down { yylval.i=0; return(UP_OR_DOWN); } -ENTRY return(ENTRY); -stair return(STAIR); -no_up return(NO_UP); -no_down return(NO_DOWN); -portal return(PORTAL); -PROTOFILE return(PROTOFILE); -DESCRIPTION return(DESCRIPTION); -LEVELDESC return(LEVELDESC); -ALIGNMENT return(ALIGNMENT); -LEVALIGN return(LEVALIGN); -town { yylval.i=TOWN ; return(DESCRIPTOR); } -hellish { yylval.i=HELLISH ; return(DESCRIPTOR); } -mazelike { yylval.i=MAZELIKE ; return(DESCRIPTOR); } -roguelike { yylval.i=ROGUELIKE ; return(DESCRIPTOR); } -unaligned { yylval.i=D_ALIGN_NONE ; return(DESCRIPTOR); } -noalign { yylval.i=D_ALIGN_NONE ; return(DESCRIPTOR); } -lawful { yylval.i=D_ALIGN_LAWFUL ; return(DESCRIPTOR); } -neutral { yylval.i=D_ALIGN_NEUTRAL ; return(DESCRIPTOR); } -chaotic { yylval.i=D_ALIGN_CHAOTIC ; return(DESCRIPTOR); } -BRANCH return(BRANCH); -CHAINBRANCH return(CHBRANCH); -LEVEL return(LEVEL); -RNDLEVEL return(RNDLEVEL); -CHAINLEVEL return(CHLEVEL); -RNDCHLEVEL return(RNDCHLEVEL); -[-0-9]+ { yylval.i=atoi(yytext); return(INTEGER); } -\"[^"]*\" { yytext[yyleng - 1] = '\0'; /* discard the trailing \" */ - yylval.str = dupstr(yytext + 1); /* skip the first \" */ - return STRING; } -^#.*\n { nh_line_number++; } -\r?\n { nh_line_number++; } -[ \t]+ ; /* skip trailing tabs & spaces */ -. { return yytext[0]; } -%% - -/* routine to switch to another input file; needed for flex */ -void -init_yyin( input_f ) -FILE *input_f; -{ -#if defined(FLEX_SCANNER) || defined(FLEXHACK_SCANNER) - if (yyin) - yyrestart(input_f); - else -#endif - yyin = input_f; -} - -/* analogous routine (for completeness) */ -void -init_yyout( output_f ) -FILE *output_f; -{ - yyout = output_f; -} - -/*dgn_comp.l*/ diff --git a/util/dgn_comp.y b/util/dgn_comp.y deleted file mode 100644 index a00ff7559..000000000 --- a/util/dgn_comp.y +++ /dev/null @@ -1,678 +0,0 @@ -%{ -/* NetHack 3.6 dgn_comp.y $NHDT-Date: 1432512785 2015/05/25 00:13:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */ -/* Copyright (c) 1989 by Jean-Christophe Collet */ -/* Copyright (c) 1990 by M. Stephenson */ -/* NetHack may be freely redistributed. See license for details. */ - -/* - * This file contains the Dungeon Compiler code - */ - -/* In case we're using bison in AIX. This definition must be - * placed before any other C-language construct in the file - * excluding comments and preprocessor directives (thanks IBM - * for this wonderful feature...). - * - * Note: some cpps barf on this 'undefined control' (#pragma). - * Addition of the leading space seems to prevent barfage for now, - * and AIX will still see the directive in its non-standard locale. - */ - -#ifdef _AIX - #pragma alloca /* keep leading space! */ -#endif - -#include "config.h" -#include "date.h" -#include "dgn_file.h" - -void FDECL(yyerror, (const char *)); -void FDECL(yywarning, (const char *)); -int NDECL(yylex); -int NDECL(yyparse); -int FDECL(getchain, (char *)); -int NDECL(check_dungeon); -int NDECL(check_branch); -int NDECL(check_level); -void NDECL(init_dungeon); -void NDECL(init_branch); -void NDECL(init_level); -void NDECL(output_dgn); - -#define Free(ptr) free((genericptr_t)ptr) - -#ifdef AMIGA -# undef printf -#ifndef LATTICE -# define memset(addr,val,len) setmem(addr,len,val) -#endif -#endif - -#define ERR (-1) - -static struct couple couple; -static struct tmpdungeon tmpdungeon[MAXDUNGEON]; -static struct tmplevel tmplevel[LEV_LIMIT]; -static struct tmpbranch tmpbranch[BRANCH_LIMIT]; - -static int in_dungeon = 0, n_dgns = -1, n_levs = -1, n_brs = -1; - -extern int fatal_error; -extern const char *fname; -extern FILE *yyin, *yyout; /* from dgn_lex.c */ - -%} - -%union -{ - int i; - char* str; -} - -%token INTEGER -%token A_DUNGEON BRANCH CHBRANCH LEVEL RNDLEVEL CHLEVEL RNDCHLEVEL -%token UP_OR_DOWN PROTOFILE DESCRIPTION DESCRIPTOR LEVELDESC -%token ALIGNMENT LEVALIGN ENTRY STAIR NO_UP NO_DOWN PORTAL -%token STRING -%type optional_int direction branch_type bones_tag -%start file - -%% -file : /* nothing */ - | dungeons - { - output_dgn(); - } - ; - -dungeons : dungeon - | dungeons dungeon - ; - -dungeon : dungeonline - | dungeondesc - | branches - | levels - ; - -dungeonline : A_DUNGEON ':' STRING bones_tag rcouple optional_int - { - init_dungeon(); - Strcpy(tmpdungeon[n_dgns].name, $3); - tmpdungeon[n_dgns].boneschar = (char)$4; - tmpdungeon[n_dgns].lev.base = couple.base; - tmpdungeon[n_dgns].lev.rand = couple.rand; - tmpdungeon[n_dgns].chance = $6; - Free($3); - } - ; - -optional_int : /* nothing */ - { - $$ = 0; - } - | INTEGER - { - $$ = $1; - } - ; - -dungeondesc : entry - | descriptions - | prototype - ; - -entry : ENTRY ':' INTEGER - { - tmpdungeon[n_dgns].entry_lev = $3; - } - ; - -descriptions : desc - ; - -desc : DESCRIPTION ':' DESCRIPTOR - { - if($3 <= TOWN || $3 >= D_ALIGN_CHAOTIC) - yyerror("Illegal description - ignoring!"); - else - tmpdungeon[n_dgns].flags |= $3 ; - } - | ALIGNMENT ':' DESCRIPTOR - { - if($3 && $3 < D_ALIGN_CHAOTIC) - yyerror("Illegal alignment - ignoring!"); - else - tmpdungeon[n_dgns].flags |= $3 ; - } - ; - -prototype : PROTOFILE ':' STRING - { - Strcpy(tmpdungeon[n_dgns].protoname, $3); - Free($3); - } - ; - -levels : level1 - | level2 - | levdesc - | chlevel1 - | chlevel2 - ; - -level1 : LEVEL ':' STRING bones_tag '@' acouple - { - init_level(); - Strcpy(tmplevel[n_levs].name, $3); - tmplevel[n_levs].boneschar = (char)$4; - tmplevel[n_levs].lev.base = couple.base; - tmplevel[n_levs].lev.rand = couple.rand; - tmpdungeon[n_dgns].levels++; - Free($3); - } - | RNDLEVEL ':' STRING bones_tag '@' acouple INTEGER - { - init_level(); - Strcpy(tmplevel[n_levs].name, $3); - tmplevel[n_levs].boneschar = (char)$4; - tmplevel[n_levs].lev.base = couple.base; - tmplevel[n_levs].lev.rand = couple.rand; - tmplevel[n_levs].rndlevs = $7; - tmpdungeon[n_dgns].levels++; - Free($3); - } - ; - -level2 : LEVEL ':' STRING bones_tag '@' acouple INTEGER - { - init_level(); - Strcpy(tmplevel[n_levs].name, $3); - tmplevel[n_levs].boneschar = (char)$4; - tmplevel[n_levs].lev.base = couple.base; - tmplevel[n_levs].lev.rand = couple.rand; - tmplevel[n_levs].chance = $7; - tmpdungeon[n_dgns].levels++; - Free($3); - } - | RNDLEVEL ':' STRING bones_tag '@' acouple INTEGER INTEGER - { - init_level(); - Strcpy(tmplevel[n_levs].name, $3); - tmplevel[n_levs].boneschar = (char)$4; - tmplevel[n_levs].lev.base = couple.base; - tmplevel[n_levs].lev.rand = couple.rand; - tmplevel[n_levs].chance = $7; - tmplevel[n_levs].rndlevs = $8; - tmpdungeon[n_dgns].levels++; - Free($3); - } - ; - -levdesc : LEVELDESC ':' DESCRIPTOR - { - if($3 >= D_ALIGN_CHAOTIC) - yyerror("Illegal description - ignoring!"); - else - tmplevel[n_levs].flags |= $3 ; - } - | LEVALIGN ':' DESCRIPTOR - { - if($3 && $3 < D_ALIGN_CHAOTIC) - yyerror("Illegal alignment - ignoring!"); - else - tmplevel[n_levs].flags |= $3 ; - } - ; - -chlevel1 : CHLEVEL ':' STRING bones_tag STRING '+' rcouple - { - init_level(); - Strcpy(tmplevel[n_levs].name, $3); - tmplevel[n_levs].boneschar = (char)$4; - tmplevel[n_levs].chain = getchain($5); - tmplevel[n_levs].lev.base = couple.base; - tmplevel[n_levs].lev.rand = couple.rand; - if(!check_level()) n_levs--; - else tmpdungeon[n_dgns].levels++; - Free($3); - Free($5); - } - | RNDCHLEVEL ':' STRING bones_tag STRING '+' rcouple INTEGER - { - init_level(); - Strcpy(tmplevel[n_levs].name, $3); - tmplevel[n_levs].boneschar = (char)$4; - tmplevel[n_levs].chain = getchain($5); - tmplevel[n_levs].lev.base = couple.base; - tmplevel[n_levs].lev.rand = couple.rand; - tmplevel[n_levs].rndlevs = $8; - if(!check_level()) n_levs--; - else tmpdungeon[n_dgns].levels++; - Free($3); - Free($5); - } - ; - -chlevel2 : CHLEVEL ':' STRING bones_tag STRING '+' rcouple INTEGER - { - init_level(); - Strcpy(tmplevel[n_levs].name, $3); - tmplevel[n_levs].boneschar = (char)$4; - tmplevel[n_levs].chain = getchain($5); - tmplevel[n_levs].lev.base = couple.base; - tmplevel[n_levs].lev.rand = couple.rand; - tmplevel[n_levs].chance = $8; - if(!check_level()) n_levs--; - else tmpdungeon[n_dgns].levels++; - Free($3); - Free($5); - } - | RNDCHLEVEL ':' STRING bones_tag STRING '+' rcouple INTEGER INTEGER - { - init_level(); - Strcpy(tmplevel[n_levs].name, $3); - tmplevel[n_levs].boneschar = (char)$4; - tmplevel[n_levs].chain = getchain($5); - tmplevel[n_levs].lev.base = couple.base; - tmplevel[n_levs].lev.rand = couple.rand; - tmplevel[n_levs].chance = $8; - tmplevel[n_levs].rndlevs = $9; - if(!check_level()) n_levs--; - else tmpdungeon[n_dgns].levels++; - Free($3); - Free($5); - } - ; - -branches : branch - | chbranch - ; - -branch : BRANCH ':' STRING '@' acouple branch_type direction - { - init_branch(); - Strcpy(tmpbranch[n_brs].name, $3); - tmpbranch[n_brs].lev.base = couple.base; - tmpbranch[n_brs].lev.rand = couple.rand; - tmpbranch[n_brs].type = $6; - tmpbranch[n_brs].up = $7; - if(!check_branch()) n_brs--; - else tmpdungeon[n_dgns].branches++; - Free($3); - } - ; - -chbranch : CHBRANCH ':' STRING STRING '+' rcouple branch_type direction - { - init_branch(); - Strcpy(tmpbranch[n_brs].name, $3); - tmpbranch[n_brs].chain = getchain($4); - tmpbranch[n_brs].lev.base = couple.base; - tmpbranch[n_brs].lev.rand = couple.rand; - tmpbranch[n_brs].type = $7; - tmpbranch[n_brs].up = $8; - if(!check_branch()) n_brs--; - else tmpdungeon[n_dgns].branches++; - Free($3); - Free($4); - } - ; - -branch_type : /* nothing */ - { - $$ = TBR_STAIR; /* two way stair */ - } - | STAIR - { - $$ = TBR_STAIR; /* two way stair */ - } - | NO_UP - { - $$ = TBR_NO_UP; /* no up staircase */ - } - | NO_DOWN - { - $$ = TBR_NO_DOWN; /* no down staircase */ - } - | PORTAL - { - $$ = TBR_PORTAL; /* portal connection */ - } - ; - -direction : /* nothing */ - { - $$ = 0; /* defaults to down */ - } - | UP_OR_DOWN - { - $$ = $1; - } - ; - -bones_tag : STRING - { - char *p = $1; - if (strlen(p) != 1) { - if (strcmp(p, "none") != 0) - yyerror("Bones marker must be a single char, or \"none\"!"); - *p = '\0'; - } - $$ = *p; - Free(p); - } - ; - -/* - * acouple rules: - * - * (base, range) where: - * - * base is either a positive or negative integer with a value - * less than or equal to MAXLEVEL. - * base > 0 indicates the base level. - * base < 0 indicates reverse index (-1 == lowest level) - * - * range is the random component. - * if range is zero, there is no random component. - * if range is -1 the dungeon loader will randomize between - * the base and the end of the dungeon. - * during dungeon load, range is always *added* to the base, - * therefore range + base(converted) must not exceed MAXLEVEL. - */ -acouple : '(' INTEGER ',' INTEGER ')' - { - if ($2 < -MAXLEVEL || $2 > MAXLEVEL) { - yyerror("Abs base out of dlevel range - zeroing!"); - couple.base = couple.rand = 0; - } else if ($4 < -1 || - (($2 < 0) ? (MAXLEVEL + $2 + $4 + 1) > MAXLEVEL : - ($2 + $4) > MAXLEVEL)) { - yyerror("Abs range out of dlevel range - zeroing!"); - couple.base = couple.rand = 0; - } else { - couple.base = $2; - couple.rand = $4; - } - } - ; - -/* - * rcouple rules: - * - * (base, range) where: - * - * base is either a positive or negative integer with a value - * less than or equal to MAXLEVEL. - * base > 0 indicates a forward index. - * base < 0 indicates a reverse index. - * base == 0 indicates on the parent level. - * - * range is the random component. - * if range is zero, there is no random component. - * during dungeon load, range is always *added* to the base, - * range + base(converted) may be very large. The dungeon - * loader will then correct to "between here and the top/bottom". - * - * There is no practical way of specifying "between here and the - * nth / nth last level". - */ -rcouple : '(' INTEGER ',' INTEGER ')' - { - if ($2 < -MAXLEVEL || $2 > MAXLEVEL) { - yyerror("Rel base out of dlevel range - zeroing!"); - couple.base = couple.rand = 0; - } else { - couple.base = $2; - couple.rand = $4; - } - } - ; -%% - -void -init_dungeon() -{ - if(++n_dgns > MAXDUNGEON) { - (void) fprintf(stderr, "FATAL - Too many dungeons (limit: %d).\n", - MAXDUNGEON); - (void) fprintf(stderr, "To increase the limit edit MAXDUNGEON in global.h\n"); - exit(EXIT_FAILURE); - } - - in_dungeon = 1; - tmpdungeon[n_dgns].lev.base = 0; - tmpdungeon[n_dgns].lev.rand = 0; - tmpdungeon[n_dgns].chance = 100; - Strcpy(tmpdungeon[n_dgns].name, ""); - Strcpy(tmpdungeon[n_dgns].protoname, ""); - tmpdungeon[n_dgns].flags = 0; - tmpdungeon[n_dgns].levels = 0; - tmpdungeon[n_dgns].branches = 0; - tmpdungeon[n_dgns].entry_lev = 0; -} - -void -init_level() -{ - if(++n_levs > LEV_LIMIT) { - - yyerror("FATAL - Too many special levels defined."); - exit(EXIT_FAILURE); - } - tmplevel[n_levs].lev.base = 0; - tmplevel[n_levs].lev.rand = 0; - tmplevel[n_levs].chance = 100; - tmplevel[n_levs].rndlevs = 0; - tmplevel[n_levs].flags = 0; - Strcpy(tmplevel[n_levs].name, ""); - tmplevel[n_levs].chain = -1; -} - -void -init_branch() -{ - if(++n_brs > BRANCH_LIMIT) { - - yyerror("FATAL - Too many special levels defined."); - exit(EXIT_FAILURE); - } - tmpbranch[n_brs].lev.base = 0; - tmpbranch[n_brs].lev.rand = 0; - Strcpy(tmpbranch[n_brs].name, ""); - tmpbranch[n_brs].chain = -1; -} - -int -getchain(s) - char *s; -{ - int i; - - if(strlen(s)) { - - for(i = n_levs - tmpdungeon[n_dgns].levels + 1; i <= n_levs; i++) - if(!strcmp(tmplevel[i].name, s)) return i; - - yyerror("Can't locate the specified chain level."); - return(-2); - } - return(-1); -} - -/* - * Consistancy checking routines: - * - * - A dungeon must have a unique name. - * - A dungeon must have a originating "branch" command - * (except, of course, for the first dungeon). - * - A dungeon must have a proper depth (at least (1, 0)). - */ - -int -check_dungeon() -{ - int i; - - for(i = 0; i < n_dgns; i++) - if(!strcmp(tmpdungeon[i].name, tmpdungeon[n_dgns].name)) { - yyerror("Duplicate dungeon name."); - return(0); - } - - if(n_dgns) - for(i = 0; i < n_brs - tmpdungeon[n_dgns].branches; i++) { - if(!strcmp(tmpbranch[i].name, tmpdungeon[n_dgns].name)) break; - - if(i >= n_brs - tmpdungeon[n_dgns].branches) { - yyerror("Dungeon cannot be reached."); - return(0); - } - } - - if(tmpdungeon[n_dgns].lev.base <= 0 || - tmpdungeon[n_dgns].lev.rand < 0) { - yyerror("Invalid dungeon depth specified."); - return(0); - } - return(1); /* OK */ -} - -/* - * - A level must have a unique level name. - * - If chained, the level used as reference for the chain - * must be in this dungeon, must be previously defined, and - * the level chained from must be "non-probabilistic" (ie. - * have a 100% chance of existing). - */ - -int -check_level() -{ - int i; - - if(!in_dungeon) { - yyerror("Level defined outside of dungeon."); - return(0); - } - - for(i = 0; i < n_levs; i++) - if(!strcmp(tmplevel[i].name, tmplevel[n_levs].name)) { - yyerror("Duplicate level name."); - return(0); - } - - if(tmplevel[i].chain == -2) { - yyerror("Invaild level chain reference."); - return(0); - } else if(tmplevel[i].chain != -1) { /* there is a chain */ - /* KMH -- tmplevel[tmpbranch[i].chain].chance was in error */ - if(tmplevel[tmplevel[i].chain].chance != 100) { - yyerror("Level cannot chain from a probabilistic level."); - return(0); - } else if(tmplevel[i].chain == n_levs) { - yyerror("A level cannot chain to itself!"); - return(0); - } - } - return(1); /* OK */ -} - -/* - * - A branch may not branch backwards - to avoid branch loops. - * - A branch name must be unique. - * (ie. You can only have one entry point to each dungeon). - * - If chained, the level used as reference for the chain - * must be in this dungeon, must be previously defined, and - * the level chained from must be "non-probabilistic" (ie. - * have a 100% chance of existing). - */ - -int -check_branch() -{ - int i; - - if(!in_dungeon) { - yyerror("Branch defined outside of dungeon."); - return(0); - } - - for(i = 0; i < n_dgns; i++) - if(!strcmp(tmpdungeon[i].name, tmpbranch[n_brs].name)) { - - yyerror("Reverse branching not allowed."); - return(0); - } - - if(tmpbranch[i].chain == -2) { - - yyerror("Invaild branch chain reference."); - return(0); - } else if(tmpbranch[i].chain != -1) { /* it is chained */ - - if(tmplevel[tmpbranch[i].chain].chance != 100) { - yyerror("Branch cannot chain from a probabilistic level."); - return(0); - } - } - return(1); /* OK */ -} - -/* - * Output the dungon definition into a file. - * - * The file will have the following format: - * - * [ nethack version ID ] - * [ number of dungeons ] - * [ first dungeon struct ] - * [ levels for the first dungeon ] - * ... - * [ branches for the first dungeon ] - * ... - * [ second dungeon struct ] - * ... - */ - -void -output_dgn() -{ - int nd, cl = 0, nl = 0, - cb = 0, nb = 0; - static struct version_info version_data = { - VERSION_NUMBER, VERSION_FEATURES, - VERSION_SANITY1, VERSION_SANITY2, VERSION_SANITY3 - }; - - if(++n_dgns <= 0) { - yyerror("FATAL - no dungeons were defined."); - exit(EXIT_FAILURE); - } - - if (fwrite((char *)&version_data, sizeof version_data, 1, yyout) != 1) { - yyerror("FATAL - output failure."); - exit(EXIT_FAILURE); - } - - (void) fwrite((char *)&n_dgns, sizeof(int), 1, yyout); - for (nd = 0; nd < n_dgns; nd++) { - (void) fwrite((char *)&tmpdungeon[nd], sizeof(struct tmpdungeon), - 1, yyout); - - nl += tmpdungeon[nd].levels; - for(; cl < nl; cl++) - (void) fwrite((char *)&tmplevel[cl], sizeof(struct tmplevel), - 1, yyout); - - nb += tmpdungeon[nd].branches; - for(; cb < nb; cb++) - (void) fwrite((char *)&tmpbranch[cb], sizeof(struct tmpbranch), - 1, yyout); - } - /* apparently necessary for Think C 5.x, otherwise harmless */ - (void) fflush(yyout); -} - -/*dgn_comp.y*/ diff --git a/util/dgn_main.c b/util/dgn_main.c deleted file mode 100644 index e3e5e5939..000000000 --- a/util/dgn_main.c +++ /dev/null @@ -1,193 +0,0 @@ -/* NetHack 3.6 dgn_main.c $NHDT-Date: 1432512785 2015/05/25 00:13:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ */ -/* Copyright (c) 1989 by Jean-Christophe Collet */ -/* Copyright (c) 1990 by M. Stephenson */ -/* NetHack may be freely redistributed. See license for details. */ - -/* - * This file contains the main function for the parser - * and some useful functions needed by yacc - */ - -#include "config.h" -#include "dlb.h" - -/* Macintosh-specific code */ -#if defined(__APPLE__) && defined(__MACH__) -/* MacOS X has Unix-style files and processes */ -#undef MAC -#endif -#ifdef MAC -#if defined(__SC__) || defined(__MRC__) -#define MPWTOOL -#include -#else -/* put dungeon file in library location */ -#define PREFIX ":lib:" -#endif -#endif - -#ifndef MPWTOOL -#define SpinCursor(x) -#endif - -#define MAX_ERRORS 25 - -extern int NDECL(yyparse); -extern int nh_line_number; -const char *fname = "(stdin)"; -int fatal_error = 0; - -int FDECL(main, (int, char **)); -void FDECL(yyerror, (const char *)); -void FDECL(yywarning, (const char *)); -int NDECL(yywrap); -void FDECL(init_yyin, (FILE *)); -void FDECL(init_yyout, (FILE *)); - -#ifdef AZTEC_36 -FILE *FDECL(freopen, (char *, char *, FILE *)); -#endif -#define Fprintf (void) fprintf - -#if defined(__BORLANDC__) && !defined(_WIN32) -extern unsigned _stklen = STKSIZ; -#endif -int -main(argc, argv) -int argc; -char **argv; -{ - char infile[64], outfile[64], basename[64]; - FILE *fin, *fout; - int i, len; - boolean errors_encountered = FALSE; -#if defined(MAC) && (defined(THINK_C) || defined(__MWERKS__)) - char *mark; - static char *mac_argv[] = { "dgn_comp", /* dummy argv[0] */ - ":dat:dungeon.pdf" }; - - argc = SIZE(mac_argv); - argv = mac_argv; -#endif - - Strcpy(infile, "(stdin)"); - fin = stdin; - Strcpy(outfile, "(stdout)"); - fout = stdout; - - if (argc == 1) { /* Read standard input */ - init_yyin(fin); - init_yyout(fout); - (void) yyparse(); - if (fatal_error > 0) - errors_encountered = TRUE; - } else { /* Otherwise every argument is a filename */ - for (i = 1; i < argc; i++) { - fname = strcpy(infile, argv[i]); - /* the input file had better be a .pdf file */ - len = strlen(fname) - 4; /* length excluding suffix */ - if (len < 0 || strncmp(".pdf", fname + len, 4)) { - Fprintf(stderr, "Error - file name \"%s\" in wrong format.\n", - fname); - errors_encountered = TRUE; - continue; - } - -/* build output file name */ -#if defined(MAC) && (defined(THINK_C) || defined(__MWERKS__)) - /* extract basename from path to infile */ - mark = strrchr(infile, ':'); - strcpy(basename, mark ? mark + 1 : infile); - mark = strchr(basename, '.'); - if (mark) - *mark = '\0'; -#else -/* Use the whole name - strip off the last 3 or 4 chars. */ - -#ifdef VMS /* avoid possible interaction with logical name */ - len++; /* retain "." as trailing punctuation */ -#endif - (void) strncpy(basename, infile, len); - basename[len] = '\0'; -#endif - - outfile[0] = '\0'; -#ifdef PREFIX - (void) strcat(outfile, PREFIX); -#endif - (void) strcat(outfile, basename); - - fin = freopen(infile, "r", stdin); - if (!fin) { - Fprintf(stderr, "Can't open %s for input.\n", infile); - perror(infile); - errors_encountered = TRUE; - continue; - } - fout = freopen(outfile, WRBMODE, stdout); - if (!fout) { - Fprintf(stderr, "Can't open %s for output.\n", outfile); - perror(outfile); - errors_encountered = TRUE; - continue; - } - init_yyin(fin); - init_yyout(fout); - (void) yyparse(); - nh_line_number = 1; - if (fatal_error > 0) { - errors_encountered = TRUE; - fatal_error = 0; - } - } - } - if (fout && fclose(fout) < 0) { - Fprintf(stderr, "Can't finish output file."); - perror(outfile); - errors_encountered = TRUE; - } - exit(errors_encountered ? EXIT_FAILURE : EXIT_SUCCESS); - /*NOTREACHED*/ - return 0; -} - -/* - * Each time the parser detects an error, it uses this function. - * Here we take count of the errors. To continue farther than - * MAX_ERRORS wouldn't be reasonable. - */ - -void -yyerror(s) -const char *s; -{ - (void) fprintf(stderr, "%s : line %d : %s\n", fname, nh_line_number, s); - if (++fatal_error > MAX_ERRORS) { - (void) fprintf(stderr, "Too many errors, good bye!\n"); - exit(EXIT_FAILURE); - } -} - -/* - * Just display a warning (that is : a non fatal error) - */ - -void -yywarning(s) -const char *s; -{ - (void) fprintf(stderr, "%s : line %d : WARNING : %s\n", fname, - nh_line_number, s); -} - -int -yywrap() -{ - SpinCursor(3); /* Don't know if this is a good place to put it ? - Is it called for our grammar ? - Often enough ? - Too often ? -- h+ */ - return 1; -} - -/*dgn_main.c*/ diff --git a/util/dlb_main.c b/util/dlb_main.c index 2af5bbe92..120de616c 100644 --- a/util/dlb_main.c +++ b/util/dlb_main.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dlb_main.c $NHDT-Date: 1432512785 2015/05/25 00:13:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */ +/* NetHack 3.6 dlb_main.c $NHDT-Date: 1570258542 2019/10/05 06:55:42 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.13 $ */ /* Copyright (c) Kenneth Lorber, Bethesda, Maryland, 1993. */ /* NetHack may be freely redistributed. See license for details. */ @@ -15,7 +15,7 @@ #endif static void FDECL(grow_ld, (libdir **, int *, int)); -static void FDECL(xexit, (int)); +static void FDECL(xexit, (int)) NORETURN; #ifdef DLB #ifdef DLBLIB @@ -31,10 +31,9 @@ char *FDECL(eos, (char *)); /* also used by dlb.c */ FILE *FDECL(fopen_datafile, (const char *, const char *)); static void FDECL(Write, (int, char *, long)); -static void NDECL(usage); -static void NDECL(verbose_help); -static void FDECL(write_dlb_directory, - (int, int, libdir *, long, long, long)); +static void NDECL(usage) NORETURN; +static void NDECL(verbose_help) NORETURN; +static void FDECL(write_dlb_directory, (int, int, libdir *, long, long, long)); static char default_progname[] = "dlb"; static char *progname = default_progname; @@ -84,12 +83,13 @@ usage() (void) printf(" default library is %s\n", library_file); (void) printf(" default list file is %s\n", list_file); xexit(EXIT_FAILURE); + /*NOTREACHED*/ } static void verbose_help() { - static const char *long_help[] = { + static const char *const long_help[] = { "", "dlb COMMANDoptions args... files...", " commands:", " dlb ? print this text", " dlb h ditto", " dlb x extract all files", " dlb c create the archive", @@ -100,11 +100,12 @@ verbose_help() " C dir change directory before processing any files", "", (char *) 0 }; - const char **str; + const char *const *str; for (str = long_help; *str; str++) (void) printf("%s\n", *str); usage(); + /*NOTREACHED*/ } static void @@ -180,11 +181,14 @@ char **argv; switch (argv[1][cp]) { default: usage(); /* doesn't return */ + /*NOTREACHED*/ + break; case '-': /* silently ignore */ break; case '?': case 'h': verbose_help(); + /*NOTREACHED*/ break; case 'I': if (ap == argc) @@ -243,7 +247,9 @@ char **argv; default: printf("Internal error - action.\n"); xexit(EXIT_FAILURE); + /*NOTREACHED*/ break; + case 't': /* list archive */ if (!open_library(library_file, &lib)) { printf("Can't open dlb file\n"); @@ -263,7 +269,8 @@ char **argv; lib.nentries, lib.strsize); close_library(&lib); - xexit(EXIT_SUCCESS); + /* xexit(EXIT_SUCCESS); */ + break; case 'x': { /* extract archive contents */ int f, n; @@ -331,7 +338,8 @@ char **argv; } close_library(&lib); - xexit(EXIT_SUCCESS); + /* xexit(EXIT_SUCCESS); */ + break; } case 'c': /* create archive */ @@ -403,8 +411,8 @@ char **argv; } /* open output file */ - out = - open(library_file, O_RDWR | O_TRUNC | O_BINARY | O_CREAT, FCMASK); + out = open(library_file, + O_RDWR | O_TRUNC | O_BINARY | O_CREAT, FCMASK); if (out < 0) { printf("Can't open %s for output\n", library_file); xexit(EXIT_FAILURE); @@ -462,9 +470,10 @@ char **argv; free((genericptr_t) ld), ldlimit = 0; (void) close(out); - xexit(EXIT_SUCCESS); - } - } + /* xexit(EXIT_SUCCESS); */ + break; + } /* case 'c' */ + } /* switch */ #endif /* DLBLIB */ #endif /* DLB */ @@ -540,6 +549,7 @@ int retcd; #endif #endif exit(retcd); + /*NOTREACHED*/ } #ifdef AMIGA diff --git a/util/lev_comp.l b/util/lev_comp.l deleted file mode 100644 index 8866e3f6f..000000000 --- a/util/lev_comp.l +++ /dev/null @@ -1,437 +0,0 @@ -%{ -/* NetHack 3.6 lev_comp.l $NHDT-Date: 1543371690 2018/11/28 02:21:30 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.25 $ */ -/* Copyright (c) 1989 by Jean-Christophe Collet */ -/* NetHack may be freely redistributed. See license for details. */ - -#define LEV_LEX_C - -#include "hack.h" -#include "lev_comp.h" -#include "sp_lev.h" - -/* Most of these don't exist in flex, yywrap is macro and - * yyunput is properly declared in flex.skel. - */ -#if !defined(FLEX_SCANNER) && !defined(FLEXHACK_SCANNER) -int FDECL(yyback, (int *,int)); -int NDECL(yylook); -int NDECL(yyinput); -int NDECL(yywrap); -int NDECL(yylex); - /* Traditional lexes let yyunput() and yyoutput() default to int; - * newer ones may declare them as void since they don't return - * values. For even more fun, the lex supplied as part of the - * newer unbundled compiler for SunOS 4.x adds the void declarations - * (under __STDC__ or _cplusplus ifdefs -- otherwise they remain - * int) while the bundled lex and the one with the older unbundled - * compiler do not. To detect this, we need help from outside -- - * sys/unix/Makefile.utl. - * - * Digital UNIX is difficult and still has int in spite of all - * other signs. - */ -# if defined(NeXT) || defined(SVR4) || defined(_AIX32) -# define VOIDYYPUT -# endif -# if !defined(VOIDYYPUT) && defined(POSIX_TYPES) -# if !defined(BOS) && !defined(HISX) && !defined(_M_UNIX) && !defined(VMS) -# define VOIDYYPUT -# endif -# endif -# if !defined(VOIDYYPUT) && defined(WEIRD_LEX) -# if defined(SUNOS4) && defined(__STDC__) && (WEIRD_LEX > 1) -# define VOIDYYPUT -# endif -# endif -# if defined(VOIDYYPUT) && defined(__osf__) -# undef VOIDYYPUT -# endif -# ifdef VOIDYYPUT -void FDECL(yyunput, (int)); -void FDECL(yyoutput, (int)); -# else -int FDECL(yyunput, (int)); -int FDECL(yyoutput, (int)); -# endif - -#else /* !FLEX_SCANNER && !FLEXHACK_SCANNER */ -/* most recent flex allows suppressing yyunput() altogether when not needed */ -#define YY_NO_UNPUT -#define YY_NO_INPUT -#endif - -#if defined(FLEX_SCANNER) || defined(FLEXHACK_SCANNER) -/* older flex wants this */ -#define YY_MALLOC_DECL genericptr_t FDECL(malloc, (size_t)); \ - genericptr_t FDECL(realloc, (genericptr_t, size_t)); -/* newer flex assumes so needs this in case it's been suppressed */ -YY_MALLOC_DECL -#endif - -void FDECL(init_yyin, (FILE *)); -void FDECL(init_yyout, (FILE *)); - -long NDECL(handle_varstring_check); -long FDECL(corefunc_str_check, (char *, long)); - -extern void VDECL(lc_error, (const char *, ...)); -extern struct lc_vardefs *FDECL(vardef_defined,(struct lc_vardefs *,char *, int)); - -extern struct lc_vardefs *vardefs; - -extern long FDECL(method_defined, (char *, long, long *)); - -void FDECL(savetoken, (char *)); -void NDECL(newline); -void FDECL(advancepos, (char *)); - -/* - * This doesn't always get put in lev_comp.h - * (esp. when using older versions of bison). - */ -extern YYSTYPE yylval; - -int nh_line_number = 1; -int token_start_pos = 0; -char curr_token[512]; -static char map[4096]; -static int map_cnt = 0; - -FILE *orig_yyin = NULL; - -#define ST_RET(x) do { savetoken(yytext); return x; } while (0); -#define ST_RETF(y, x) do { savetoken(yytext); y; return x; } while (0); - -%} -%e 2500 -%p 10000 -%n 1500 -%s MAPC -%% -ENDMAP { - savetoken(yytext); - BEGIN(INITIAL); - yylval.map = (char *) alloc(map_cnt + 1); - (void) strncpy(yylval.map, map, map_cnt); - yylval.map[map_cnt] = 0; - map_cnt = 0; - return MAP_ID; - } -[-|}{+xABCISHKPLWTF\\#. 0123456789]*\r?\n { - int len = yyleng; - savetoken(yytext); - /* convert \r\n to \n */ - if (len >= 2 && yytext[len - 2] == '\r') - len -= 1; - (void) strncpy(map + map_cnt, yytext, len); - map_cnt += len; - map[map_cnt - 1] = '\n'; - map[map_cnt] = '\0'; - newline(); - } -^[ \t]*#.*\n { savetoken(yytext); newline(); } -MESSAGE ST_RET(MESSAGE_ID); -NOMAP ST_RET(NOMAP_ID); -MAZE ST_RET(MAZE_ID); -LEVEL ST_RET(LEVEL_ID); -INIT_MAP ST_RET(LEV_INIT_ID); -mazegrid ST_RET(MAZE_GRID_ID); -solidfill ST_RET(SOLID_FILL_ID); -mines ST_RET(MINES_ID); -rogue ST_RET(ROGUELEV_ID); -FLAGS ST_RET(FLAGS_ID); -GEOMETRY ST_RET(GEOMETRY_ID); -^MAP\r?\n { savetoken(yytext); BEGIN(MAPC); newline(); } -obj(ect)? ST_RET(object_ID); -OBJECT ST_RET(OBJECT_ID); -CONTAINER ST_RET(COBJECT_ID); -MONSTER ST_RET(MONSTER_ID); -monster ST_RET(monster_ID); -TRAP ST_RET(TRAP_ID); -DOOR ST_RET(DOOR_ID); -ROOMDOOR ST_RET(ROOMDOOR_ID); -DRAWBRIDGE ST_RET(DRAWBRIDGE_ID); -MAZEWALK ST_RET(MAZEWALK_ID); -WALLIFY ST_RET(WALLIFY_ID); -REGION ST_RET(REGION_ID); -ALTAR ST_RET(ALTAR_ID); -LADDER ST_RET(LADDER_ID); -STAIR ST_RET(STAIR_ID); -PORTAL ST_RET(PORTAL_ID); -TELEPORT_REGION ST_RET(TELEPRT_ID); -BRANCH ST_RET(BRANCH_ID); -FOUNTAIN ST_RET(FOUNTAIN_ID); -SINK ST_RET(SINK_ID); -POOL ST_RET(POOL_ID); -NON_DIGGABLE ST_RET(NON_DIGGABLE_ID); -NON_PASSWALL ST_RET(NON_PASSWALL_ID); -IF ST_RET(IF_ID); -ELSE ST_RET(ELSE_ID); -EXIT ST_RET(EXIT_ID); -ROOM ST_RET(ROOM_ID); -SUBROOM ST_RET(SUBROOM_ID); -RANDOM_CORRIDORS ST_RET(RAND_CORRIDOR_ID); -CORRIDOR ST_RET(CORRIDOR_ID); -TERRAIN ST_RET(TERRAIN_ID); -terrain ST_RET(terrain_ID); -REPLACE_TERRAIN ST_RET(REPLACE_TERRAIN_ID); -GOLD ST_RET(GOLD_ID); -GRAVE ST_RET(GRAVE_ID); -ENGRAVING ST_RET(ENGRAVING_ID); -MINERALIZE ST_RET(MINERALIZE_ID); -(NAME|name) ST_RET(NAME_ID); -FOR ST_RET(FOR_ID); -TO ST_RET(TO_ID); -LOOP ST_RET(LOOP_ID); -SWITCH ST_RET(SWITCH_ID); -CASE ST_RET(CASE_ID); -BREAK ST_RET(BREAK_ID); -DEFAULT ST_RET(DEFAULT_ID); -FUNCTION ST_RET(FUNCTION_ID); -SHUFFLE ST_RET(SHUFFLE_ID); -montype ST_RET(MONTYPE_ID); -selection ST_RET(selection_ID); -rect ST_RET(rect_ID); -fillrect ST_RET(fillrect_ID); -line ST_RET(line_ID); -randline ST_RET(randline_ID); -grow ST_RET(grow_ID); -floodfill ST_RET(flood_ID); -rndcoord ST_RET(rndcoord_ID); -circle ST_RET(circle_ID); -ellipse ST_RET(ellipse_ID); -filter ST_RET(filter_ID); -gradient ST_RET(gradient_ID); -complement ST_RET(complement_ID); -radial { savetoken(yytext); yylval.i=SEL_GRADIENT_RADIAL; return GRADIENT_TYPE; } -square { savetoken(yytext); yylval.i=SEL_GRADIENT_SQUARE; return GRADIENT_TYPE; } -dry { savetoken(yytext); yylval.i=DRY; return HUMIDITY_TYPE; } -wet { savetoken(yytext); yylval.i=WET; return HUMIDITY_TYPE; } -hot { savetoken(yytext); yylval.i=HOT; return HUMIDITY_TYPE; } -solid { savetoken(yytext); yylval.i=SOLID; return HUMIDITY_TYPE; } -any { savetoken(yytext); yylval.i=ANY_LOC; return HUMIDITY_TYPE; } -levregion ST_RET(LEV); -quantity ST_RET(QUANTITY_ID); -buried ST_RET(BURIED_ID); -eroded ST_RET(ERODED_ID); -erodeproof ST_RET(ERODEPROOF_ID); -trapped { savetoken(yytext); yylval.i=1; return TRAPPED_STATE; } -not_trapped { savetoken(yytext); yylval.i=0; return TRAPPED_STATE; } -recharged ST_RET(RECHARGED_ID); -invisible ST_RET(INVIS_ID); -greased ST_RET(GREASED_ID); -female ST_RET(FEMALE_ID); -cancelled ST_RET(CANCELLED_ID); -revived ST_RET(REVIVED_ID); -avenge ST_RET(AVENGE_ID); -fleeing ST_RET(FLEEING_ID); -blinded ST_RET(BLINDED_ID); -paralyzed ST_RET(PARALYZED_ID); -stunned ST_RET(STUNNED_ID); -confused ST_RET(CONFUSED_ID); -seen_traps ST_RET(SEENTRAPS_ID); -all ST_RET(ALL_ID); -horizontal ST_RETF((yylval.i=1), HORIZ_OR_VERT); -vertical { savetoken(yytext); yylval.i=2; return HORIZ_OR_VERT; } -open { savetoken(yytext); yylval.i=D_ISOPEN; return DOOR_STATE; } -closed { savetoken(yytext); yylval.i=D_CLOSED; return DOOR_STATE; } -locked { savetoken(yytext); yylval.i=D_LOCKED; return DOOR_STATE; } -nodoor { savetoken(yytext); yylval.i=D_NODOOR; return DOOR_STATE; } -broken { savetoken(yytext); yylval.i=D_BROKEN; return DOOR_STATE; } -secret { savetoken(yytext); yylval.i=D_SECRET; return DOOR_STATE; } -north { savetoken(yytext); yylval.i=W_NORTH; return DIRECTION; } -east { savetoken(yytext); yylval.i=W_EAST; return DIRECTION; } -south { savetoken(yytext); yylval.i=W_SOUTH; return DIRECTION; } -west { savetoken(yytext); yylval.i=W_WEST; return DIRECTION; } -random { savetoken(yytext); yylval.i = -1; return RANDOM_TYPE; } -random\[ { savetoken(yytext); yylval.i = -1; return RANDOM_TYPE_BRACKET; } -none { savetoken(yytext); yylval.i = -2; return NONE; } -align ST_RET(A_REGISTER); -left { savetoken(yytext); yylval.i=1; return LEFT_OR_RIGHT; } -half-left { savetoken(yytext); yylval.i=2; return LEFT_OR_RIGHT; } -center { savetoken(yytext); yylval.i=3; return CENTER; } -half-right { savetoken(yytext); yylval.i=4; return LEFT_OR_RIGHT; } -right { savetoken(yytext); yylval.i=5; return LEFT_OR_RIGHT; } -top { savetoken(yytext); yylval.i=1; return TOP_OR_BOT; } -bottom { savetoken(yytext); yylval.i=5; return TOP_OR_BOT; } -lit { savetoken(yytext); yylval.i=1; return LIGHT_STATE; } -unlit { savetoken(yytext); yylval.i=0; return LIGHT_STATE; } -filled { savetoken(yytext); yylval.i=1; return FILLING; } -unfilled { savetoken(yytext); yylval.i=0; return FILLING; } -regular { savetoken(yytext); yylval.i=0; return IRREGULAR; } -irregular { savetoken(yytext); yylval.i=1; return IRREGULAR; } -unjoined { savetoken(yytext); yylval.i=1; return JOINED; } -joined { savetoken(yytext); yylval.i=0; return JOINED; } -limited { savetoken(yytext); yylval.i=1; return LIMITED; } -unlimited { savetoken(yytext); yylval.i=0; return LIMITED; } -noalign { savetoken(yytext); yylval.i= AM_NONE; return ALIGNMENT; } -law { savetoken(yytext); yylval.i= AM_LAWFUL; return ALIGNMENT; } -neutral { savetoken(yytext); yylval.i= AM_NEUTRAL; return ALIGNMENT; } -chaos { savetoken(yytext); yylval.i= AM_CHAOTIC; return ALIGNMENT; } -coaligned { savetoken(yytext); yylval.i= AM_SPLEV_CO; return ALIGNMENT; } -noncoaligned { savetoken(yytext); yylval.i= AM_SPLEV_NONCO; return ALIGNMENT; } -peaceful { savetoken(yytext); yylval.i=1; return MON_ATTITUDE; } -hostile { savetoken(yytext); yylval.i=0; return MON_ATTITUDE; } -asleep { savetoken(yytext); yylval.i=1; return MON_ALERTNESS; } -awake { savetoken(yytext); yylval.i=0; return MON_ALERTNESS; } -m_feature { savetoken(yytext); yylval.i= M_AP_FURNITURE; return MON_APPEARANCE; } -m_monster { savetoken(yytext); yylval.i= M_AP_MONSTER; return MON_APPEARANCE; } -m_object { savetoken(yytext); yylval.i= M_AP_OBJECT; return MON_APPEARANCE; } -sanctum { savetoken(yytext); yylval.i=2; return ALTAR_TYPE; } -shrine { savetoken(yytext); yylval.i=1; return ALTAR_TYPE; } -altar { savetoken(yytext); yylval.i=0; return ALTAR_TYPE; } -up { savetoken(yytext); yylval.i=1; return UP_OR_DOWN; } -down { savetoken(yytext); yylval.i=0; return UP_OR_DOWN; } -false { savetoken(yytext); yylval.i=0; return BOOLEAN; } -true { savetoken(yytext); yylval.i=1; return BOOLEAN; } -dust { savetoken(yytext); yylval.i=DUST; return ENGRAVING_TYPE; } -engrave { savetoken(yytext); yylval.i=ENGRAVE; return ENGRAVING_TYPE; } -burn { savetoken(yytext); yylval.i=BURN; return ENGRAVING_TYPE; } -mark { savetoken(yytext); yylval.i=MARK; return ENGRAVING_TYPE; } -blood { savetoken(yytext); yylval.i=ENGR_BLOOD; return ENGRAVING_TYPE; } -blessed { savetoken(yytext); yylval.i=1; return CURSE_TYPE; } -uncursed { savetoken(yytext); yylval.i=2; return CURSE_TYPE; } -cursed { savetoken(yytext); yylval.i=3; return CURSE_TYPE; } -noteleport { savetoken(yytext); yylval.i=NOTELEPORT; return FLAG_TYPE; } -hardfloor { savetoken(yytext); yylval.i=HARDFLOOR; return FLAG_TYPE; } -nommap { savetoken(yytext); yylval.i=NOMMAP; return FLAG_TYPE; } -arboreal { savetoken(yytext); yylval.i=ARBOREAL; return FLAG_TYPE; } /* KMH */ -shortsighted { savetoken(yytext); yylval.i=SHORTSIGHTED; return FLAG_TYPE; } -mazelevel { savetoken(yytext); yylval.i=MAZELEVEL; return FLAG_TYPE; } -premapped { savetoken(yytext); yylval.i=PREMAPPED; return FLAG_TYPE; } -shroud { savetoken(yytext); yylval.i=SHROUD; return FLAG_TYPE; } -graveyard { savetoken(yytext); yylval.i=GRAVEYARD; return FLAG_TYPE; } -icedpools { savetoken(yytext); yylval.i=ICEDPOOLS; return FLAG_TYPE; } -solidify { savetoken(yytext); yylval.i=SOLIDIFY; return FLAG_TYPE; } -corrmaze { savetoken(yytext); yylval.i=CORRMAZE; return FLAG_TYPE; } -inaccessibles { savetoken(yytext); yylval.i=CHECK_INACCESSIBLES; return FLAG_TYPE; } -[0-9]+d[0-9]+ { char *p = index(yytext, 'd'); - savetoken(yytext); - if (p) { - *p++ = '\0'; - yylval.dice.num = atoi(yytext); - yylval.dice.die = atoi(p); - } else { - yylval.dice.num = yylval.dice.die = 1; - } - return DICE; - } -\[\ *[0-9]+\%\ *\] { savetoken(yytext); yylval.i = atoi(yytext + 1); - if (yylval.i < 0 || yylval.i > 100) - lc_error("Unexpected percentile '%li%%'", yylval.i); - return PERCENT; } --[0-9]+ { savetoken(yytext); yylval.i=atoi(yytext); return MINUS_INTEGER; } -\+[0-9]+ { savetoken(yytext); yylval.i=atoi(yytext); return PLUS_INTEGER; } -[0-9]+\% { savetoken(yytext); yylval.i = atoi(yytext); - if (yylval.i < 0 || yylval.i > 100) - lc_error("Unexpected percentile '%li%%'", yylval.i); - return SPERCENT; } -[0-9]+ { savetoken(yytext); yylval.i=atoi(yytext); return INTEGER; } -\"[^"]*\" { savetoken(yytext); - yytext[yyleng - 1] = '\0'; /* discard the trailing \" */ - yylval.map = dupstr(yytext + 1); /* skip the first \" */ - return STRING; } -\$[a-zA-Z_]+ { savetoken(yytext); return handle_varstring_check(); } -"==" { savetoken(yytext); yylval.i = SPO_JE; return COMPARE_TYPE; } -"!=" { savetoken(yytext); yylval.i = SPO_JNE; return COMPARE_TYPE; } -"<>" { savetoken(yytext); yylval.i = SPO_JNE; return COMPARE_TYPE; } -"<=" { savetoken(yytext); yylval.i = SPO_JLE; return COMPARE_TYPE; } -">=" { savetoken(yytext); yylval.i = SPO_JGE; return COMPARE_TYPE; } -"<" { savetoken(yytext); yylval.i = SPO_JL; return COMPARE_TYPE; } -">" { savetoken(yytext); yylval.i = SPO_JG; return COMPARE_TYPE; } -\r?\n { newline(); } -[ \t]+ { advancepos(yytext); } -'\\.' { savetoken(yytext); yylval.i = yytext[2]; return CHAR; } -'.' { savetoken(yytext); yylval.i = yytext[1]; return CHAR; } -[-_a-zA-Z0-9]+ ST_RET(UNKNOWN_TYPE); -. { savetoken(yytext); return yytext[0]; } -%% -#ifdef AMIGA -long * -alloc(n) - unsigned n; -{ - return (long *) malloc(n); -} -#endif - -/* routine to switch to another input file; needed for flex */ -void -init_yyin( input_f ) -FILE *input_f; -{ -#if defined(FLEX_SCANNER) || defined(FLEXHACK_SCANNER) - if (yyin) - yyrestart(input_f); - else -#endif - yyin = input_f; - - if (!orig_yyin) - orig_yyin = yyin; -} -/* analogous routine (for completeness) */ -void -init_yyout( output_f ) -FILE *output_f; -{ - yyout = output_f; -} - -long -handle_varstring_check() -{ - struct lc_vardefs *vd; - - yylval.map = dupstr(yytext); - if ((vd = vardef_defined(vardefs, yytext, 1)) != 0) { - long l = vd->var_type; - int a = ((l & SPOVAR_ARRAY) == SPOVAR_ARRAY); - - l &= ~SPOVAR_ARRAY; - if (l == SPOVAR_INT) - return (a ? VARSTRING_INT_ARRAY : VARSTRING_INT); - if (l == SPOVAR_STRING) - return (a ? VARSTRING_STRING_ARRAY : VARSTRING_STRING); - if (l == SPOVAR_VARIABLE) - return (a ? VARSTRING_VAR_ARRAY : VARSTRING_VAR); - if (l == SPOVAR_COORD) - return (a ? VARSTRING_COORD_ARRAY : VARSTRING_COORD); - if (l == SPOVAR_REGION) - return (a ? VARSTRING_REGION_ARRAY : VARSTRING_REGION); - if (l == SPOVAR_MAPCHAR) - return (a ? VARSTRING_MAPCHAR_ARRAY : VARSTRING_MAPCHAR); - if (l == SPOVAR_MONST) - return (a ? VARSTRING_MONST_ARRAY : VARSTRING_MONST); - if (l == SPOVAR_OBJ) - return (a ? VARSTRING_OBJ_ARRAY : VARSTRING_OBJ); - if (l == SPOVAR_SEL) - return (a ? VARSTRING_SEL_ARRAY : VARSTRING_SEL); - } - return VARSTRING; -} - -void -newline() -{ - nh_line_number++; - token_start_pos = 0; - (void) memset((genericptr_t) curr_token, 0, 512); -} - -void -savetoken(s) -char *s; -{ - Sprintf(curr_token, "%s", s); - advancepos(s); -} - -void -advancepos(s) -char *s; -{ - token_start_pos += strlen(s); -} - -/*lev_comp.l*/ diff --git a/util/lev_comp.y b/util/lev_comp.y deleted file mode 100644 index 1b1c93056..000000000 --- a/util/lev_comp.y +++ /dev/null @@ -1,2721 +0,0 @@ -%{ -/* NetHack 3.6 lev_comp.y $NHDT-Date: 1543371691 2018/11/28 02:21:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.22 $ */ -/* Copyright (c) 1989 by Jean-Christophe Collet */ -/* NetHack may be freely redistributed. See license for details. */ - -/* - * This file contains the Level Compiler code - * It may handle special mazes & special room-levels - */ - -/* In case we're using bison in AIX. This definition must be - * placed before any other C-language construct in the file - * excluding comments and preprocessor directives (thanks IBM - * for this wonderful feature...). - * - * Note: some cpps barf on this 'undefined control' (#pragma). - * Addition of the leading space seems to prevent barfage for now, - * and AIX will still see the directive. - */ -#ifdef _AIX - #pragma alloca /* keep leading space! */ -#endif - -#define SPEC_LEV /* for USE_OLDARGS (sp_lev.h) */ -#include "hack.h" -#include "sp_lev.h" - -#define ERR (-1) -/* many types of things are put in chars for transference to NetHack. - * since some systems will use signed chars, limit everybody to the - * same number for portability. - */ -#define MAX_OF_TYPE 128 - -#define MAX_NESTED_IFS 20 -#define MAX_SWITCH_CASES 20 - -#define New(type) \ - (type *) memset((genericptr_t) alloc(sizeof (type)), 0, sizeof (type)) -#define NewTab(type, size) (type **) alloc(sizeof (type *) * size) -#define Free(ptr) free((genericptr_t) ptr) - -extern void VDECL(lc_error, (const char *, ...)); -extern void VDECL(lc_warning, (const char *, ...)); -extern void FDECL(yyerror, (const char *)); -extern void FDECL(yywarning, (const char *)); -extern int NDECL(yylex); -int NDECL(yyparse); - -extern int FDECL(get_floor_type, (CHAR_P)); -extern int FDECL(get_room_type, (char *)); -extern int FDECL(get_trap_type, (char *)); -extern int FDECL(get_monster_id, (char *,CHAR_P)); -extern int FDECL(get_object_id, (char *,CHAR_P)); -extern boolean FDECL(check_monster_char, (CHAR_P)); -extern boolean FDECL(check_object_char, (CHAR_P)); -extern char FDECL(what_map_char, (CHAR_P)); -extern void FDECL(scan_map, (char *, sp_lev *)); -extern void FDECL(add_opcode, (sp_lev *, int, genericptr_t)); -extern genericptr_t FDECL(get_last_opcode_data1, (sp_lev *, int)); -extern genericptr_t FDECL(get_last_opcode_data2, (sp_lev *, int, int)); -extern boolean FDECL(check_subrooms, (sp_lev *)); -extern boolean FDECL(write_level_file, (char *,sp_lev *)); -extern struct opvar *FDECL(set_opvar_int, (struct opvar *, long)); -extern void VDECL(add_opvars, (sp_lev *, const char *, ...)); -extern void FDECL(start_level_def, (sp_lev * *, char *)); - -extern struct lc_funcdefs *FDECL(funcdef_new, (long,char *)); -extern void FDECL(funcdef_free_all, (struct lc_funcdefs *)); -extern struct lc_funcdefs *FDECL(funcdef_defined, (struct lc_funcdefs *, - char *, int)); -extern char *FDECL(funcdef_paramtypes, (struct lc_funcdefs *)); -extern char *FDECL(decode_parm_str, (char *)); - -extern struct lc_vardefs *FDECL(vardef_new, (long,char *)); -extern void FDECL(vardef_free_all, (struct lc_vardefs *)); -extern struct lc_vardefs *FDECL(vardef_defined, (struct lc_vardefs *, - char *, int)); - -extern void NDECL(break_stmt_start); -extern void FDECL(break_stmt_end, (sp_lev *)); -extern void FDECL(break_stmt_new, (sp_lev *, long)); - -extern void FDECL(splev_add_from, (sp_lev *, sp_lev *)); - -extern void FDECL(check_vardef_type, (struct lc_vardefs *, char *, long)); -extern void FDECL(vardef_used, (struct lc_vardefs *, char *)); -extern struct lc_vardefs *FDECL(add_vardef_type, (struct lc_vardefs *, - char *, long)); - -extern int FDECL(reverse_jmp_opcode, (int)); - -struct coord { - long x; - long y; -}; - -struct forloopdef { - char *varname; - long jmp_point; -}; -static struct forloopdef forloop_list[MAX_NESTED_IFS]; -static short n_forloops = 0; - - -sp_lev *splev = NULL; - -static struct opvar *if_list[MAX_NESTED_IFS]; - -static short n_if_list = 0; - -unsigned int max_x_map, max_y_map; -int obj_containment = 0; - -int in_container_obj = 0; - -/* integer value is possibly an inconstant value (eg. dice notation - or a variable) */ -int is_inconstant_number = 0; - -int in_switch_statement = 0; -static struct opvar *switch_check_jump = NULL; -static struct opvar *switch_default_case = NULL; -static struct opvar *switch_case_list[MAX_SWITCH_CASES]; -static long switch_case_value[MAX_SWITCH_CASES]; -int n_switch_case_list = 0; - -int allow_break_statements = 0; -struct lc_breakdef *break_list = NULL; - -extern struct lc_vardefs *vardefs; /* variable definitions */ - - -struct lc_vardefs *function_tmp_var_defs = NULL; -extern struct lc_funcdefs *function_definitions; -struct lc_funcdefs *curr_function = NULL; -struct lc_funcdefs_parm * curr_function_param = NULL; -int in_function_definition = 0; -sp_lev *function_splev_backup = NULL; - -extern int fatal_error; -extern int got_errors; -extern int line_number; -extern const char *fname; - -extern char curr_token[512]; - -%} - -%union -{ - long i; - char *map; - struct { - long room; - long wall; - long door; - } corpos; - struct { - long area; - long x1; - long y1; - long x2; - long y2; - } lregn; - struct { - long x; - long y; - } crd; - struct { - long ter; - long lit; - } terr; - struct { - long height; - long width; - } sze; - struct { - long die; - long num; - } dice; - struct { - long cfunc; - char *varstr; - } meth; -} - - -%token CHAR INTEGER BOOLEAN PERCENT SPERCENT -%token MINUS_INTEGER PLUS_INTEGER -%token MAZE_GRID_ID SOLID_FILL_ID MINES_ID ROGUELEV_ID -%token MESSAGE_ID MAZE_ID LEVEL_ID LEV_INIT_ID GEOMETRY_ID NOMAP_ID -%token OBJECT_ID COBJECT_ID MONSTER_ID TRAP_ID DOOR_ID DRAWBRIDGE_ID -%token object_ID monster_ID terrain_ID -%token MAZEWALK_ID WALLIFY_ID REGION_ID FILLING IRREGULAR JOINED -%token ALTAR_ID LADDER_ID STAIR_ID NON_DIGGABLE_ID NON_PASSWALL_ID ROOM_ID -%token PORTAL_ID TELEPRT_ID BRANCH_ID LEV MINERALIZE_ID -%token CORRIDOR_ID GOLD_ID ENGRAVING_ID FOUNTAIN_ID POOL_ID SINK_ID NONE -%token RAND_CORRIDOR_ID DOOR_STATE LIGHT_STATE CURSE_TYPE ENGRAVING_TYPE -%token DIRECTION RANDOM_TYPE RANDOM_TYPE_BRACKET A_REGISTER -%token ALIGNMENT LEFT_OR_RIGHT CENTER TOP_OR_BOT ALTAR_TYPE UP_OR_DOWN -%token SUBROOM_ID NAME_ID FLAGS_ID FLAG_TYPE MON_ATTITUDE MON_ALERTNESS -%token MON_APPEARANCE ROOMDOOR_ID IF_ID ELSE_ID -%token TERRAIN_ID HORIZ_OR_VERT REPLACE_TERRAIN_ID -%token EXIT_ID SHUFFLE_ID -%token QUANTITY_ID BURIED_ID LOOP_ID -%token FOR_ID TO_ID -%token SWITCH_ID CASE_ID BREAK_ID DEFAULT_ID -%token ERODED_ID TRAPPED_STATE RECHARGED_ID INVIS_ID GREASED_ID -%token FEMALE_ID CANCELLED_ID REVIVED_ID AVENGE_ID FLEEING_ID BLINDED_ID -%token PARALYZED_ID STUNNED_ID CONFUSED_ID SEENTRAPS_ID ALL_ID -%token MONTYPE_ID -%token GRAVE_ID ERODEPROOF_ID -%token FUNCTION_ID -%token MSG_OUTPUT_TYPE -%token COMPARE_TYPE -%token UNKNOWN_TYPE -%token rect_ID fillrect_ID line_ID randline_ID grow_ID -%token selection_ID flood_ID -%token rndcoord_ID circle_ID ellipse_ID filter_ID complement_ID -%token gradient_ID GRADIENT_TYPE LIMITED HUMIDITY_TYPE -%token ',' ':' '(' ')' '[' ']' '{' '}' -%token STRING MAP_ID -%token NQSTRING VARSTRING -%token CFUNC CFUNC_INT CFUNC_STR CFUNC_COORD CFUNC_REGION -%token VARSTRING_INT VARSTRING_INT_ARRAY -%token VARSTRING_STRING VARSTRING_STRING_ARRAY -%token VARSTRING_VAR VARSTRING_VAR_ARRAY -%token VARSTRING_COORD VARSTRING_COORD_ARRAY -%token VARSTRING_REGION VARSTRING_REGION_ARRAY -%token VARSTRING_MAPCHAR VARSTRING_MAPCHAR_ARRAY -%token VARSTRING_MONST VARSTRING_MONST_ARRAY -%token VARSTRING_OBJ VARSTRING_OBJ_ARRAY -%token VARSTRING_SEL VARSTRING_SEL_ARRAY -%token METHOD_INT METHOD_INT_ARRAY -%token METHOD_STRING METHOD_STRING_ARRAY -%token METHOD_VAR METHOD_VAR_ARRAY -%token METHOD_COORD METHOD_COORD_ARRAY -%token METHOD_REGION METHOD_REGION_ARRAY -%token METHOD_MAPCHAR METHOD_MAPCHAR_ARRAY -%token METHOD_MONST METHOD_MONST_ARRAY -%token METHOD_OBJ METHOD_OBJ_ARRAY -%token METHOD_SEL METHOD_SEL_ARRAY -%token DICE -%type h_justif v_justif trap_name room_type door_state light_state -%type alignment altar_type a_register roomfill door_pos -%type alignment_prfx -%type door_wall walled secret -%type dir_list teleprt_detail -%type object_infos object_info monster_infos monster_info -%type levstatements stmt_block region_detail_end -%type engraving_type flag_list roomregionflag roomregionflags -%type optroomregionflags -%type humidity_flags -%type comparestmt encodecoord encoderegion mapchar -%type seen_trap_mask -%type encodemonster encodeobj encodeobj_list -%type integer_list string_list encodecoord_list encoderegion_list -%type mapchar_list encodemonster_list -%type opt_percent opt_fillchar -%type all_integers -%type ter_selection ter_selection_x -%type func_param_type -%type objectid monsterid terrainid -%type opt_coord_or_var opt_limited -%type mazefiller -%type level_def -%type any_var any_var_array any_var_or_arr any_var_or_unk -%type func_call_params_list func_call_param_list -%type func_call_param_part -%type corr_spec -%type region lev_region -%type room_pos subroom_pos room_align -%type room_size -%type terrain_type -%left '+' '-' -%left '*' '/' '%' -%start file - -%% -file : /* nothing */ - | levels - ; - -levels : level - | level levels - ; - -level : level_def flags levstatements - { - if (fatal_error > 0) { - (void) fprintf(stderr, - "%s: %d errors detected for level \"%s\". No output created!\n", - fname, fatal_error, $1); - fatal_error = 0; - got_errors++; - } else if (!got_errors) { - if (!write_level_file($1, splev)) { - lc_error("Can't write output file for '%s'!", - $1); - exit(EXIT_FAILURE); - } - } - Free($1); - Free(splev); - splev = NULL; - vardef_free_all(vardefs); - vardefs = NULL; - } - ; - -level_def : LEVEL_ID ':' STRING - { - start_level_def(&splev, $3); - $$ = $3; - } - | MAZE_ID ':' STRING ',' mazefiller - { - start_level_def(&splev, $3); - if ($5 == -1) { - add_opvars(splev, "iiiiiiiio", - VA_PASS9(LVLINIT_MAZEGRID, HWALL, 0,0, - 0,0,0,0, SPO_INITLEVEL)); - } else { - int bg = (int) what_map_char((char) $5); - - add_opvars(splev, "iiiiiiiio", - VA_PASS9(LVLINIT_SOLIDFILL, bg, 0,0, - 0,0,0,0, SPO_INITLEVEL)); - } - add_opvars(splev, "io", - VA_PASS2(MAZELEVEL, SPO_LEVEL_FLAGS)); - max_x_map = COLNO-1; - max_y_map = ROWNO; - $$ = $3; - } - ; - -mazefiller : RANDOM_TYPE - { - $$ = -1; - } - | CHAR - { - $$ = what_map_char((char) $1); - } - ; - -lev_init : LEV_INIT_ID ':' SOLID_FILL_ID ',' terrain_type - { - int filling = (int) $5.ter; - - if (filling == INVALID_TYPE || filling >= MAX_TYPE) - lc_error("INIT_MAP: Invalid fill char type."); - add_opvars(splev, "iiiiiiiio", - VA_PASS9(LVLINIT_SOLIDFILL, filling, - 0, (int) $5.lit, - 0,0,0,0, SPO_INITLEVEL)); - max_x_map = COLNO-1; - max_y_map = ROWNO; - } - | LEV_INIT_ID ':' MAZE_GRID_ID ',' CHAR - { - int filling = (int) what_map_char((char) $5); - - if (filling == INVALID_TYPE || filling >= MAX_TYPE) - lc_error("INIT_MAP: Invalid fill char type."); - add_opvars(splev, "iiiiiiiio", - VA_PASS9(LVLINIT_MAZEGRID, filling, 0,0, - 0,0,0,0, SPO_INITLEVEL)); - max_x_map = COLNO-1; - max_y_map = ROWNO; - } - | LEV_INIT_ID ':' ROGUELEV_ID - { - add_opvars(splev, "iiiiiiiio", - VA_PASS9(LVLINIT_ROGUE,0,0,0, - 0,0,0,0, SPO_INITLEVEL)); - } - | LEV_INIT_ID ':' MINES_ID ',' CHAR ',' CHAR ',' BOOLEAN ',' BOOLEAN ',' light_state ',' walled opt_fillchar - { - int fg = (int) what_map_char((char) $5), - bg = (int) what_map_char((char) $7); - int smoothed = (int) $9, - joined = (int) $11, - lit = (int) $13, - walled = (int) $15, - filling = (int) $16; - - if (fg == INVALID_TYPE || fg >= MAX_TYPE) - lc_error("INIT_MAP: Invalid foreground type."); - if (bg == INVALID_TYPE || bg >= MAX_TYPE) - lc_error("INIT_MAP: Invalid background type."); - if (joined && fg != CORR && fg != ROOM) - lc_error("INIT_MAP: Invalid foreground type for joined map."); - - if (filling == INVALID_TYPE) - lc_error("INIT_MAP: Invalid fill char type."); - - add_opvars(splev, "iiiiiiiio", - VA_PASS9(LVLINIT_MINES, filling, walled, lit, - joined, smoothed, bg, fg, - SPO_INITLEVEL)); - max_x_map = COLNO-1; - max_y_map = ROWNO; - } - ; - -opt_limited : /* nothing */ - { - $$ = 0; - } - | ',' LIMITED - { - $$ = $2; - } - ; - -opt_coord_or_var : /* nothing */ - { - add_opvars(splev, "o", VA_PASS1(SPO_COPY)); - $$ = 0; - } - | ',' coord_or_var - { - $$ = 1; - } - ; - -opt_fillchar : /* nothing */ - { - $$ = -1; - } - | ',' CHAR - { - $$ = what_map_char((char) $2); - } - ; - - -walled : BOOLEAN - | RANDOM_TYPE - ; - -flags : /* nothing */ - { - add_opvars(splev, "io", VA_PASS2(0, SPO_LEVEL_FLAGS)); - } - | FLAGS_ID ':' flag_list - { - add_opvars(splev, "io", - VA_PASS2((int) $3, SPO_LEVEL_FLAGS)); - } - ; - -flag_list : FLAG_TYPE ',' flag_list - { - $$ = ($1 | $3); - } - | FLAG_TYPE - { - $$ = $1; - } - ; - -levstatements : /* nothing */ - { - $$ = 0; - } - | levstatement levstatements - { - $$ = 1 + $2; - } - ; - -stmt_block : '{' levstatements '}' - { - $$ = $2; - } - ; - -levstatement : message - | lev_init - | altar_detail - | grave_detail - | branch_region - | corridor - | variable_define - | shuffle_detail - | diggable_detail - | door_detail - | drawbridge_detail - | engraving_detail - | mineralize - | fountain_detail - | gold_detail - | switchstatement - | forstatement - | loopstatement - | ifstatement - | chancestatement - | exitstatement - | breakstatement - | function_define - | function_call - | ladder_detail - | map_definition - | mazewalk_detail - | monster_detail - | object_detail - | passwall_detail - | pool_detail - | portal_region - | random_corridors - | region_detail - | room_def - | subroom_def - | sink_detail - | terrain_detail - | replace_terrain_detail - | stair_detail - | stair_region - | teleprt_region - | trap_detail - | wallify_detail - ; - -any_var_array : VARSTRING_INT_ARRAY - | VARSTRING_STRING_ARRAY - | VARSTRING_VAR_ARRAY - | VARSTRING_COORD_ARRAY - | VARSTRING_REGION_ARRAY - | VARSTRING_MAPCHAR_ARRAY - | VARSTRING_MONST_ARRAY - | VARSTRING_OBJ_ARRAY - | VARSTRING_SEL_ARRAY - ; - -any_var : VARSTRING_INT - | VARSTRING_STRING - | VARSTRING_VAR - | VARSTRING_COORD - | VARSTRING_REGION - | VARSTRING_MAPCHAR - | VARSTRING_MONST - | VARSTRING_OBJ - | VARSTRING_SEL - ; - -any_var_or_arr : any_var_array - | any_var - | VARSTRING - ; - -any_var_or_unk : VARSTRING - | any_var - ; - -shuffle_detail : SHUFFLE_ID ':' any_var_array - { - struct lc_vardefs *vd; - - if ((vd = vardef_defined(vardefs, $3, 1))) { - if (!(vd->var_type & SPOVAR_ARRAY)) - lc_error("Trying to shuffle non-array variable '%s'", - $3); - } else - lc_error("Trying to shuffle undefined variable '%s'", - $3); - add_opvars(splev, "so", VA_PASS2($3, SPO_SHUFFLE_ARRAY)); - Free($3); - } - ; - -variable_define : any_var_or_arr '=' math_expr_var - { - vardefs = add_vardef_type(vardefs, $1, SPOVAR_INT); - add_opvars(splev, "iso", VA_PASS3(0, $1, SPO_VAR_INIT)); - Free($1); - } - | any_var_or_arr '=' selection_ID ':' ter_selection - { - vardefs = add_vardef_type(vardefs, $1, SPOVAR_SEL); - add_opvars(splev, "iso", VA_PASS3(0, $1, SPO_VAR_INIT)); - Free($1); - } - | any_var_or_arr '=' string_expr - { - vardefs = add_vardef_type(vardefs, $1, SPOVAR_STRING); - add_opvars(splev, "iso", VA_PASS3(0, $1, SPO_VAR_INIT)); - Free($1); - } - | any_var_or_arr '=' terrainid ':' mapchar_or_var - { - vardefs = add_vardef_type(vardefs, $1, SPOVAR_MAPCHAR); - add_opvars(splev, "iso", VA_PASS3(0, $1, SPO_VAR_INIT)); - Free($1); - } - | any_var_or_arr '=' monsterid ':' monster_or_var - { - vardefs = add_vardef_type(vardefs, $1, SPOVAR_MONST); - add_opvars(splev, "iso", VA_PASS3(0, $1, SPO_VAR_INIT)); - Free($1); - } - | any_var_or_arr '=' objectid ':' object_or_var - { - vardefs = add_vardef_type(vardefs, $1, SPOVAR_OBJ); - add_opvars(splev, "iso", VA_PASS3(0, $1, SPO_VAR_INIT)); - Free($1); - } - | any_var_or_arr '=' coord_or_var - { - vardefs = add_vardef_type(vardefs, $1, SPOVAR_COORD); - add_opvars(splev, "iso", VA_PASS3(0, $1, SPO_VAR_INIT)); - Free($1); - } - | any_var_or_arr '=' region_or_var - { - vardefs = add_vardef_type(vardefs, $1, SPOVAR_REGION); - add_opvars(splev, "iso", VA_PASS3(0, $1, SPO_VAR_INIT)); - Free($1); - } - | any_var_or_arr '=' '{' integer_list '}' - { - int n_items = (int) $4; - - vardefs = add_vardef_type(vardefs, $1, - SPOVAR_INT | SPOVAR_ARRAY); - add_opvars(splev, "iso", - VA_PASS3(n_items, $1, SPO_VAR_INIT)); - Free($1); - } - | any_var_or_arr '=' '{' encodecoord_list '}' - { - int n_items = (int) $4; - - vardefs = add_vardef_type(vardefs, $1, - SPOVAR_COORD | SPOVAR_ARRAY); - add_opvars(splev, "iso", - VA_PASS3(n_items, $1, SPO_VAR_INIT)); - Free($1); - } - | any_var_or_arr '=' '{' encoderegion_list '}' - { - int n_items = (int) $4; - - vardefs = add_vardef_type(vardefs, $1, - SPOVAR_REGION | SPOVAR_ARRAY); - add_opvars(splev, "iso", - VA_PASS3(n_items, $1, SPO_VAR_INIT)); - Free($1); - } - | any_var_or_arr '=' terrainid ':' '{' mapchar_list '}' - { - int n_items = (int) $6; - - vardefs = add_vardef_type(vardefs, $1, - SPOVAR_MAPCHAR | SPOVAR_ARRAY); - add_opvars(splev, "iso", - VA_PASS3(n_items, $1, SPO_VAR_INIT)); - Free($1); - } - | any_var_or_arr '=' monsterid ':' '{' encodemonster_list '}' - { - int n_items = (int) $6; - - vardefs = add_vardef_type(vardefs, $1, - SPOVAR_MONST | SPOVAR_ARRAY); - add_opvars(splev, "iso", - VA_PASS3(n_items, $1, SPO_VAR_INIT)); - Free($1); - } - | any_var_or_arr '=' objectid ':' '{' encodeobj_list '}' - { - int n_items = (int) $6; - - vardefs = add_vardef_type(vardefs, $1, - SPOVAR_OBJ | SPOVAR_ARRAY); - add_opvars(splev, "iso", - VA_PASS3(n_items, $1, SPO_VAR_INIT)); - Free($1); - } - | any_var_or_arr '=' '{' string_list '}' - { - int n_items = (int) $4; - - vardefs = add_vardef_type(vardefs, $1, - SPOVAR_STRING | SPOVAR_ARRAY); - add_opvars(splev, "iso", - VA_PASS3(n_items, $1, SPO_VAR_INIT)); - Free($1); - } - ; - -encodeobj_list : encodeobj - { - add_opvars(splev, "O", VA_PASS1($1)); - $$ = 1; - } - | encodeobj_list ',' encodeobj - { - add_opvars(splev, "O", VA_PASS1($3)); - $$ = 1 + $1; - } - ; - -encodemonster_list : encodemonster - { - add_opvars(splev, "M", VA_PASS1($1)); - $$ = 1; - } - | encodemonster_list ',' encodemonster - { - add_opvars(splev, "M", VA_PASS1($3)); - $$ = 1 + $1; - } - ; - -mapchar_list : mapchar - { - add_opvars(splev, "m", VA_PASS1($1)); - $$ = 1; - } - | mapchar_list ',' mapchar - { - add_opvars(splev, "m", VA_PASS1($3)); - $$ = 1 + $1; - } - ; - -encoderegion_list : encoderegion - { - $$ = 1; - } - | encoderegion_list ',' encoderegion - { - $$ = 1 + $1; - } - ; - -encodecoord_list : encodecoord - { - add_opvars(splev, "c", VA_PASS1($1)); - $$ = 1; - } - | encodecoord_list ',' encodecoord - { - add_opvars(splev, "c", VA_PASS1($3)); - $$ = 1 + $1; - } - ; - -integer_list : math_expr_var - { - $$ = 1; - } - | integer_list ',' math_expr_var - { - $$ = 1 + $1; - } - ; - -string_list : string_expr - { - $$ = 1; - } - | string_list ',' string_expr - { - $$ = 1 + $1; - } - ; - -function_define : FUNCTION_ID NQSTRING '(' - { - struct lc_funcdefs *funcdef; - - if (in_function_definition) - lc_error("Recursively defined functions not allowed (function %s).", $2); - - in_function_definition++; - - if (funcdef_defined(function_definitions, $2, 1)) - lc_error("Function '%s' already defined once.", $2); - - funcdef = funcdef_new(-1, $2); - funcdef->next = function_definitions; - function_definitions = funcdef; - function_splev_backup = splev; - splev = &(funcdef->code); - Free($2); - curr_function = funcdef; - function_tmp_var_defs = vardefs; - vardefs = NULL; - } - func_params_list ')' - { - /* nothing */ - } - stmt_block - { - add_opvars(splev, "io", VA_PASS2(0, SPO_RETURN)); - splev = function_splev_backup; - in_function_definition--; - curr_function = NULL; - vardef_free_all(vardefs); - vardefs = function_tmp_var_defs; - } - ; - -function_call : NQSTRING '(' func_call_params_list ')' - { - struct lc_funcdefs *tmpfunc; - - tmpfunc = funcdef_defined(function_definitions, $1, 1); - if (tmpfunc) { - int l; - int nparams = (int) strlen($3); - char *fparamstr = funcdef_paramtypes(tmpfunc); - - if (strcmp($3, fparamstr)) { - char *tmps = strdup(decode_parm_str(fparamstr)); - - lc_error("Function '%s' requires params '%s', got '%s' instead.", - $1, tmps, decode_parm_str($3)); - Free(tmps); - } - Free(fparamstr); - Free($3); - if (!(tmpfunc->n_called)) { - /* we haven't called the function yet, so insert it in the code */ - struct opvar *jmp = New(struct opvar); - - set_opvar_int(jmp, splev->n_opcodes+1); - add_opcode(splev, SPO_PUSH, jmp); - /* we must jump past it first, then CALL it, due to RETURN. */ - add_opcode(splev, SPO_JMP, NULL); - - tmpfunc->addr = splev->n_opcodes; - - { /* init function parameter variables */ - struct lc_funcdefs_parm *tfp = tmpfunc->params; - while (tfp) { - add_opvars(splev, "iso", - VA_PASS3(0, tfp->name, - SPO_VAR_INIT)); - tfp = tfp->next; - } - } - - splev_add_from(splev, &(tmpfunc->code)); - set_opvar_int(jmp, - splev->n_opcodes - jmp->vardata.l); - } - l = (int) (tmpfunc->addr - splev->n_opcodes - 2); - add_opvars(splev, "iio", - VA_PASS3(nparams, l, SPO_CALL)); - tmpfunc->n_called++; - } else { - lc_error("Function '%s' not defined.", $1); - } - Free($1); - } - ; - -exitstatement : EXIT_ID - { - add_opcode(splev, SPO_EXIT, NULL); - } - ; - -opt_percent : /* nothing */ - { - $$ = 100; - } - | PERCENT - { - $$ = $1; - } - ; - -comparestmt : PERCENT - { - /* val > rn2(100) */ - add_opvars(splev, "iio", - VA_PASS3((int) $1, 100, SPO_RN2)); - $$ = SPO_JG; - } - | '[' math_expr_var COMPARE_TYPE math_expr_var ']' - { - $$ = $3; - } - | '[' math_expr_var ']' - { - /* boolean, explicit foo != 0 */ - add_opvars(splev, "i", VA_PASS1(0)); - $$ = SPO_JNE; - } - ; - -switchstatement : SWITCH_ID - { - is_inconstant_number = 0; - } - '[' integer_or_var ']' - { - struct opvar *chkjmp; - - if (in_switch_statement > 0) - lc_error("Cannot nest switch-statements."); - - in_switch_statement++; - - n_switch_case_list = 0; - switch_default_case = NULL; - - if (!is_inconstant_number) - add_opvars(splev, "o", VA_PASS1(SPO_RN2)); - is_inconstant_number = 0; - - chkjmp = New(struct opvar); - set_opvar_int(chkjmp, splev->n_opcodes+1); - switch_check_jump = chkjmp; - add_opcode(splev, SPO_PUSH, chkjmp); - add_opcode(splev, SPO_JMP, NULL); - break_stmt_start(); - } - '{' switchcases '}' - { - struct opvar *endjump = New(struct opvar); - int i; - - set_opvar_int(endjump, splev->n_opcodes+1); - - add_opcode(splev, SPO_PUSH, endjump); - add_opcode(splev, SPO_JMP, NULL); - - set_opvar_int(switch_check_jump, - splev->n_opcodes - switch_check_jump->vardata.l); - - for (i = 0; i < n_switch_case_list; i++) { - add_opvars(splev, "oio", - VA_PASS3(SPO_COPY, - switch_case_value[i], SPO_CMP)); - set_opvar_int(switch_case_list[i], - switch_case_list[i]->vardata.l - splev->n_opcodes-1); - add_opcode(splev, SPO_PUSH, switch_case_list[i]); - add_opcode(splev, SPO_JE, NULL); - } - - if (switch_default_case) { - set_opvar_int(switch_default_case, - switch_default_case->vardata.l - splev->n_opcodes-1); - add_opcode(splev, SPO_PUSH, switch_default_case); - add_opcode(splev, SPO_JMP, NULL); - } - - set_opvar_int(endjump, splev->n_opcodes - endjump->vardata.l); - - break_stmt_end(splev); - - add_opcode(splev, SPO_POP, NULL); /* get rid of the value in stack */ - in_switch_statement--; - - - } - ; - -switchcases : /* nothing */ - | switchcase switchcases - ; - -switchcase : CASE_ID all_integers ':' - { - if (n_switch_case_list < MAX_SWITCH_CASES) { - struct opvar *tmppush = New(struct opvar); - - set_opvar_int(tmppush, splev->n_opcodes); - switch_case_value[n_switch_case_list] = $2; - switch_case_list[n_switch_case_list++] = tmppush; - } else lc_error("Too many cases in a switch."); - } - levstatements - { - } - | DEFAULT_ID ':' - { - struct opvar *tmppush = New(struct opvar); - - if (switch_default_case) - lc_error("Switch default case already used."); - - set_opvar_int(tmppush, splev->n_opcodes); - switch_default_case = tmppush; - } - levstatements - { - } - ; - -breakstatement : BREAK_ID - { - if (!allow_break_statements) - lc_error("Cannot use BREAK outside a statement block."); - else { - break_stmt_new(splev, splev->n_opcodes); - } - } - ; - -for_to_span : '.' '.' - | TO_ID - ; - -forstmt_start : FOR_ID any_var_or_unk '=' math_expr_var for_to_span math_expr_var - { - char buf[256], buf2[256]; - - if (n_forloops >= MAX_NESTED_IFS) { - lc_error("FOR: Too deeply nested loops."); - n_forloops = MAX_NESTED_IFS - 1; - } - - /* first, define a variable for the for-loop end value */ - Sprintf(buf, "%s end", $2); - /* the value of which is already in stack (the 2nd math_expr) */ - add_opvars(splev, "iso", VA_PASS3(0, buf, SPO_VAR_INIT)); - - vardefs = add_vardef_type(vardefs, $2, SPOVAR_INT); - /* define the for-loop variable. value is in stack (1st math_expr) */ - add_opvars(splev, "iso", VA_PASS3(0, $2, SPO_VAR_INIT)); - - /* calculate value for the loop "step" variable */ - Sprintf(buf2, "%s step", $2); - /* end - start */ - add_opvars(splev, "vvo", - VA_PASS3(buf, $2, SPO_MATH_SUB)); - /* sign of that */ - add_opvars(splev, "o", VA_PASS1(SPO_MATH_SIGN)); - /* save the sign into the step var */ - add_opvars(splev, "iso", - VA_PASS3(0, buf2, SPO_VAR_INIT)); - - forloop_list[n_forloops].varname = strdup($2); - forloop_list[n_forloops].jmp_point = splev->n_opcodes; - - n_forloops++; - Free($2); - } - ; - -forstatement : forstmt_start - { - /* nothing */ - break_stmt_start(); - } - stmt_block - { - int l; - char buf[256], buf2[256]; - - n_forloops--; - Sprintf(buf, "%s step", forloop_list[n_forloops].varname); - Sprintf(buf2, "%s end", forloop_list[n_forloops].varname); - /* compare for-loop var to end value */ - add_opvars(splev, "vvo", - VA_PASS3(forloop_list[n_forloops].varname, - buf2, SPO_CMP)); - /* var + step */ - add_opvars(splev, "vvo", - VA_PASS3(buf, forloop_list[n_forloops].varname, - SPO_MATH_ADD)); - /* for-loop var = (for-loop var + step) */ - add_opvars(splev, "iso", - VA_PASS3(0, forloop_list[n_forloops].varname, - SPO_VAR_INIT)); - /* jump back if compared values were not equal */ - l = (int) (forloop_list[n_forloops].jmp_point - - splev->n_opcodes - 1); - add_opvars(splev, "io", VA_PASS2(l, SPO_JNE)); - Free(forloop_list[n_forloops].varname); - break_stmt_end(splev); - } - ; - -loopstatement : LOOP_ID '[' integer_or_var ']' - { - struct opvar *tmppush = New(struct opvar); - - if (n_if_list >= MAX_NESTED_IFS) { - lc_error("LOOP: Too deeply nested conditionals."); - n_if_list = MAX_NESTED_IFS - 1; - } - set_opvar_int(tmppush, splev->n_opcodes); - if_list[n_if_list++] = tmppush; - - add_opvars(splev, "o", VA_PASS1(SPO_DEC)); - break_stmt_start(); - } - stmt_block - { - struct opvar *tmppush; - - add_opvars(splev, "oio", VA_PASS3(SPO_COPY, 0, SPO_CMP)); - - tmppush = (struct opvar *) if_list[--n_if_list]; - set_opvar_int(tmppush, - tmppush->vardata.l - splev->n_opcodes-1); - add_opcode(splev, SPO_PUSH, tmppush); - add_opcode(splev, SPO_JG, NULL); - add_opcode(splev, SPO_POP, NULL); /* discard count */ - break_stmt_end(splev); - } - ; - -chancestatement : comparestmt ':' - { - struct opvar *tmppush2 = New(struct opvar); - - if (n_if_list >= MAX_NESTED_IFS) { - lc_error("IF: Too deeply nested conditionals."); - n_if_list = MAX_NESTED_IFS - 1; - } - - add_opcode(splev, SPO_CMP, NULL); - - set_opvar_int(tmppush2, splev->n_opcodes+1); - - if_list[n_if_list++] = tmppush2; - - add_opcode(splev, SPO_PUSH, tmppush2); - - add_opcode(splev, reverse_jmp_opcode( $1 ), NULL); - - } - levstatement - { - if (n_if_list > 0) { - struct opvar *tmppush; - - tmppush = (struct opvar *) if_list[--n_if_list]; - set_opvar_int(tmppush, - splev->n_opcodes - tmppush->vardata.l); - } else lc_error("IF: Huh?! No start address?"); - } - ; - -ifstatement : IF_ID comparestmt - { - struct opvar *tmppush2 = New(struct opvar); - - if (n_if_list >= MAX_NESTED_IFS) { - lc_error("IF: Too deeply nested conditionals."); - n_if_list = MAX_NESTED_IFS - 1; - } - - add_opcode(splev, SPO_CMP, NULL); - - set_opvar_int(tmppush2, splev->n_opcodes+1); - - if_list[n_if_list++] = tmppush2; - - add_opcode(splev, SPO_PUSH, tmppush2); - - add_opcode(splev, reverse_jmp_opcode( $2 ), NULL); - - } - if_ending - { - /* do nothing */ - } - ; - -if_ending : stmt_block - { - if (n_if_list > 0) { - struct opvar *tmppush; - - tmppush = (struct opvar *) if_list[--n_if_list]; - set_opvar_int(tmppush, - splev->n_opcodes - tmppush->vardata.l); - } else lc_error("IF: Huh?! No start address?"); - } - | stmt_block - { - if (n_if_list > 0) { - struct opvar *tmppush = New(struct opvar); - struct opvar *tmppush2; - - set_opvar_int(tmppush, splev->n_opcodes+1); - add_opcode(splev, SPO_PUSH, tmppush); - - add_opcode(splev, SPO_JMP, NULL); - - tmppush2 = (struct opvar *) if_list[--n_if_list]; - - set_opvar_int(tmppush2, - splev->n_opcodes - tmppush2->vardata.l); - if_list[n_if_list++] = tmppush; - } else lc_error("IF: Huh?! No else-part address?"); - } - ELSE_ID stmt_block - { - if (n_if_list > 0) { - struct opvar *tmppush; - tmppush = (struct opvar *) if_list[--n_if_list]; - set_opvar_int(tmppush, splev->n_opcodes - tmppush->vardata.l); - } else lc_error("IF: Huh?! No end address?"); - } - ; - -message : MESSAGE_ID ':' string_expr - { - add_opvars(splev, "o", VA_PASS1(SPO_MESSAGE)); - } - ; - -random_corridors: RAND_CORRIDOR_ID - { - add_opvars(splev, "iiiiiio", - VA_PASS7(-1, 0, -1, -1, -1, -1, SPO_CORRIDOR)); - } - | RAND_CORRIDOR_ID ':' all_integers - { - add_opvars(splev, "iiiiiio", - VA_PASS7(-1, $3, -1, -1, -1, -1, SPO_CORRIDOR)); - } - | RAND_CORRIDOR_ID ':' RANDOM_TYPE - { - add_opvars(splev, "iiiiiio", - VA_PASS7(-1, -1, -1, -1, -1, -1, SPO_CORRIDOR)); - } - ; - -corridor : CORRIDOR_ID ':' corr_spec ',' corr_spec - { - add_opvars(splev, "iiiiiio", - VA_PASS7($3.room, $3.door, $3.wall, - $5.room, $5.door, $5.wall, - SPO_CORRIDOR)); - } - | CORRIDOR_ID ':' corr_spec ',' all_integers - { - add_opvars(splev, "iiiiiio", - VA_PASS7($3.room, $3.door, $3.wall, - -1, -1, (long)$5, - SPO_CORRIDOR)); - } - ; - -corr_spec : '(' INTEGER ',' DIRECTION ',' door_pos ')' - { - $$.room = $2; - $$.wall = $4; - $$.door = $6; - } - ; - -room_begin : room_type opt_percent ',' light_state - { - if (($2 < 100) && ($1 == OROOM)) - lc_error("Only typed rooms can have a chance."); - else { - add_opvars(splev, "iii", - VA_PASS3((long)$1, (long)$2, (long)$4)); - } - } - ; - -subroom_def : SUBROOM_ID ':' room_begin ',' subroom_pos ',' room_size optroomregionflags - { - long rflags = $8; - - if (rflags == -1) rflags = (1 << 0); - add_opvars(splev, "iiiiiiio", - VA_PASS8(rflags, ERR, ERR, - $5.x, $5.y, $7.width, $7.height, - SPO_SUBROOM)); - break_stmt_start(); - } - stmt_block - { - break_stmt_end(splev); - add_opcode(splev, SPO_ENDROOM, NULL); - } - ; - -room_def : ROOM_ID ':' room_begin ',' room_pos ',' room_align ',' room_size optroomregionflags - { - long rflags = $8; - - if (rflags == -1) rflags = (1 << 0); - add_opvars(splev, "iiiiiiio", - VA_PASS8(rflags, - $7.x, $7.y, $5.x, $5.y, - $9.width, $9.height, SPO_ROOM)); - break_stmt_start(); - } - stmt_block - { - break_stmt_end(splev); - add_opcode(splev, SPO_ENDROOM, NULL); - } - ; - -roomfill : /* nothing */ - { - $$ = 1; - } - | ',' BOOLEAN - { - $$ = $2; - } - ; - -room_pos : '(' INTEGER ',' INTEGER ')' - { - if ( $2 < 1 || $2 > 5 || - $4 < 1 || $4 > 5 ) { - lc_error("Room positions should be between 1-5: (%li,%li)!", $2, $4); - } else { - $$.x = $2; - $$.y = $4; - } - } - | RANDOM_TYPE - { - $$.x = $$.y = ERR; - } - ; - -subroom_pos : '(' INTEGER ',' INTEGER ')' - { - if ( $2 < 0 || $4 < 0) { - lc_error("Invalid subroom position (%li,%li)!", $2, $4); - } else { - $$.x = $2; - $$.y = $4; - } - } - | RANDOM_TYPE - { - $$.x = $$.y = ERR; - } - ; - -room_align : '(' h_justif ',' v_justif ')' - { - $$.x = $2; - $$.y = $4; - } - | RANDOM_TYPE - { - $$.x = $$.y = ERR; - } - ; - -room_size : '(' INTEGER ',' INTEGER ')' - { - $$.width = $2; - $$.height = $4; - } - | RANDOM_TYPE - { - $$.height = $$.width = ERR; - } - ; - -door_detail : ROOMDOOR_ID ':' secret ',' door_state ',' door_wall ',' door_pos - { - /* ERR means random here */ - if ($7 == ERR && $9 != ERR) { - lc_error("If the door wall is random, so must be its pos!"); - } else { - add_opvars(splev, "iiiio", - VA_PASS5((long)$9, (long)$5, (long)$3, - (long)$7, SPO_ROOM_DOOR)); - } - } - | DOOR_ID ':' door_state ',' ter_selection - { - add_opvars(splev, "io", VA_PASS2((long)$3, SPO_DOOR)); - } - ; - -secret : BOOLEAN - | RANDOM_TYPE - ; - -door_wall : dir_list - | RANDOM_TYPE - ; - -dir_list : DIRECTION - { - $$ = $1; - } - | DIRECTION '|' dir_list - { - $$ = ($1 | $3); - } - ; - -door_pos : INTEGER - | RANDOM_TYPE - ; - -map_definition : NOMAP_ID - { - add_opvars(splev, "ciisiio", - VA_PASS7(0, 0, 1, (char *) 0, 0, 0, SPO_MAP)); - max_x_map = COLNO-1; - max_y_map = ROWNO; - } - | GEOMETRY_ID ':' h_justif ',' v_justif roomfill MAP_ID - { - add_opvars(splev, "cii", - VA_PASS3(SP_COORD_PACK(($3), ($5)), - 1, (int) $6)); - scan_map($7, splev); - Free($7); - } - | GEOMETRY_ID ':' coord_or_var roomfill MAP_ID - { - add_opvars(splev, "ii", VA_PASS2(2, (int) $4)); - scan_map($5, splev); - Free($5); - } - ; - -h_justif : LEFT_OR_RIGHT - | CENTER - ; - -v_justif : TOP_OR_BOT - | CENTER - ; - -monster_detail : MONSTER_ID ':' monster_desc - { - add_opvars(splev, "io", VA_PASS2(0, SPO_MONSTER)); - } - | MONSTER_ID ':' monster_desc - { - add_opvars(splev, "io", VA_PASS2(1, SPO_MONSTER)); - in_container_obj++; - break_stmt_start(); - } - stmt_block - { - break_stmt_end(splev); - in_container_obj--; - add_opvars(splev, "o", VA_PASS1(SPO_END_MONINVENT)); - } - ; - -monster_desc : monster_or_var ',' coord_or_var monster_infos - { - /* nothing */ - } - ; - -monster_infos : /* nothing */ - { - struct opvar *stopit = New(struct opvar); - - set_opvar_int(stopit, SP_M_V_END); - add_opcode(splev, SPO_PUSH, stopit); - $$ = 0x0000; - } - | monster_infos ',' monster_info - { - if (( $1 & $3 )) - lc_error("MONSTER extra info defined twice."); - $$ = ( $1 | $3 ); - } - ; - -monster_info : string_expr - { - add_opvars(splev, "i", VA_PASS1(SP_M_V_NAME)); - $$ = 0x0001; - } - | MON_ATTITUDE - { - add_opvars(splev, "ii", - VA_PASS2((int) $1, SP_M_V_PEACEFUL)); - $$ = 0x0002; - } - | MON_ALERTNESS - { - add_opvars(splev, "ii", - VA_PASS2((int) $1, SP_M_V_ASLEEP)); - $$ = 0x0004; - } - | alignment_prfx - { - add_opvars(splev, "ii", - VA_PASS2((int) $1, SP_M_V_ALIGN)); - $$ = 0x0008; - } - | MON_APPEARANCE string_expr - { - add_opvars(splev, "ii", - VA_PASS2((int) $1, SP_M_V_APPEAR)); - $$ = 0x0010; - } - | FEMALE_ID - { - add_opvars(splev, "ii", VA_PASS2(1, SP_M_V_FEMALE)); - $$ = 0x0020; - } - | INVIS_ID - { - add_opvars(splev, "ii", VA_PASS2(1, SP_M_V_INVIS)); - $$ = 0x0040; - } - | CANCELLED_ID - { - add_opvars(splev, "ii", VA_PASS2(1, SP_M_V_CANCELLED)); - $$ = 0x0080; - } - | REVIVED_ID - { - add_opvars(splev, "ii", VA_PASS2(1, SP_M_V_REVIVED)); - $$ = 0x0100; - } - | AVENGE_ID - { - add_opvars(splev, "ii", VA_PASS2(1, SP_M_V_AVENGE)); - $$ = 0x0200; - } - | FLEEING_ID ':' integer_or_var - { - add_opvars(splev, "i", VA_PASS1(SP_M_V_FLEEING)); - $$ = 0x0400; - } - | BLINDED_ID ':' integer_or_var - { - add_opvars(splev, "i", VA_PASS1(SP_M_V_BLINDED)); - $$ = 0x0800; - } - | PARALYZED_ID ':' integer_or_var - { - add_opvars(splev, "i", VA_PASS1(SP_M_V_PARALYZED)); - $$ = 0x1000; - } - | STUNNED_ID - { - add_opvars(splev, "ii", VA_PASS2(1, SP_M_V_STUNNED)); - $$ = 0x2000; - } - | CONFUSED_ID - { - add_opvars(splev, "ii", VA_PASS2(1, SP_M_V_CONFUSED)); - $$ = 0x4000; - } - | SEENTRAPS_ID ':' seen_trap_mask - { - add_opvars(splev, "ii", - VA_PASS2((int) $3, SP_M_V_SEENTRAPS)); - $$ = 0x8000; - } - ; - -seen_trap_mask : STRING - { - int token = get_trap_type($1); - - if (token == ERR || token == 0) - lc_error("Unknown trap type '%s'!", $1); - Free($1); - $$ = (1L << (token - 1)); - } - | ALL_ID - { - $$ = (long) ~0; - } - | STRING '|' seen_trap_mask - { - int token = get_trap_type($1); - if (token == ERR || token == 0) - lc_error("Unknown trap type '%s'!", $1); - - if ((1L << (token - 1)) & $3) - lc_error("Monster seen_traps, trap '%s' listed twice.", $1); - Free($1); - $$ = ((1L << (token - 1)) | $3); - } - ; - -object_detail : OBJECT_ID ':' object_desc - { - int cnt = 0; - - if (in_container_obj) - cnt |= SP_OBJ_CONTENT; - add_opvars(splev, "io", VA_PASS2(cnt, SPO_OBJECT)); - } - | COBJECT_ID ':' object_desc - { - int cnt = SP_OBJ_CONTAINER; - - if (in_container_obj) - cnt |= SP_OBJ_CONTENT; - add_opvars(splev, "io", VA_PASS2(cnt, SPO_OBJECT)); - in_container_obj++; - break_stmt_start(); - } - stmt_block - { - break_stmt_end(splev); - in_container_obj--; - add_opcode(splev, SPO_POP_CONTAINER, NULL); - } - ; - -object_desc : object_or_var object_infos - { - if (( $2 & 0x4000) && in_container_obj) - lc_error("Object cannot have a coord when contained."); - else if (!( $2 & 0x4000) && !in_container_obj) - lc_error("Object needs a coord when not contained."); - } - ; - -object_infos : /* nothing */ - { - struct opvar *stopit = New(struct opvar); - set_opvar_int(stopit, SP_O_V_END); - add_opcode(splev, SPO_PUSH, stopit); - $$ = 0x00; - } - | object_infos ',' object_info - { - if (( $1 & $3 )) - lc_error("OBJECT extra info '%s' defined twice.", curr_token); - $$ = ( $1 | $3 ); - } - ; - -object_info : CURSE_TYPE - { - add_opvars(splev, "ii", - VA_PASS2((int) $1, SP_O_V_CURSE)); - $$ = 0x0001; - } - | MONTYPE_ID ':' monster_or_var - { - add_opvars(splev, "i", VA_PASS1(SP_O_V_CORPSENM)); - $$ = 0x0002; - } - | all_ints_push - { - add_opvars(splev, "i", VA_PASS1(SP_O_V_SPE)); - $$ = 0x0004; - } - | NAME_ID ':' string_expr - { - add_opvars(splev, "i", VA_PASS1(SP_O_V_NAME)); - $$ = 0x0008; - } - | QUANTITY_ID ':' integer_or_var - { - add_opvars(splev, "i", VA_PASS1(SP_O_V_QUAN)); - $$ = 0x0010; - } - | BURIED_ID - { - add_opvars(splev, "ii", VA_PASS2(1, SP_O_V_BURIED)); - $$ = 0x0020; - } - | LIGHT_STATE - { - add_opvars(splev, "ii", VA_PASS2((int) $1, SP_O_V_LIT)); - $$ = 0x0040; - } - | ERODED_ID ':' integer_or_var - { - add_opvars(splev, "i", VA_PASS1(SP_O_V_ERODED)); - $$ = 0x0080; - } - | ERODEPROOF_ID - { - add_opvars(splev, "ii", VA_PASS2(-1, SP_O_V_ERODED)); - $$ = 0x0080; - } - | DOOR_STATE - { - if ($1 == D_LOCKED) { - add_opvars(splev, "ii", VA_PASS2(1, SP_O_V_LOCKED)); - $$ = 0x0100; - } else if ($1 == D_BROKEN) { - add_opvars(splev, "ii", VA_PASS2(1, SP_O_V_BROKEN)); - $$ = 0x0200; - } else - lc_error("DOOR state can only be locked or broken."); - } - | TRAPPED_STATE - { - add_opvars(splev, "ii", - VA_PASS2((int) $1, SP_O_V_TRAPPED)); - $$ = 0x0400; - } - | RECHARGED_ID ':' integer_or_var - { - add_opvars(splev, "i", VA_PASS1(SP_O_V_RECHARGED)); - $$ = 0x0800; - } - | INVIS_ID - { - add_opvars(splev, "ii", VA_PASS2(1, SP_O_V_INVIS)); - $$ = 0x1000; - } - | GREASED_ID - { - add_opvars(splev, "ii", VA_PASS2(1, SP_O_V_GREASED)); - $$ = 0x2000; - } - | coord_or_var - { - add_opvars(splev, "i", VA_PASS1(SP_O_V_COORD)); - $$ = 0x4000; - } - ; - -trap_detail : TRAP_ID ':' trap_name ',' coord_or_var - { - add_opvars(splev, "io", VA_PASS2((int) $3, SPO_TRAP)); - } - ; - -drawbridge_detail: DRAWBRIDGE_ID ':' coord_or_var ',' DIRECTION ',' door_state - { - long dir, state = 0; - - /* convert dir from a DIRECTION to a DB_DIR */ - dir = $5; - switch (dir) { - case W_NORTH: dir = DB_NORTH; break; - case W_SOUTH: dir = DB_SOUTH; break; - case W_EAST: dir = DB_EAST; break; - case W_WEST: dir = DB_WEST; break; - default: - lc_error("Invalid drawbridge direction."); - break; - } - - if ( $7 == D_ISOPEN ) - state = 1; - else if ( $7 == D_CLOSED ) - state = 0; - else if ( $7 == -1 ) - state = -1; - else - lc_error("A drawbridge can only be open, closed or random!"); - add_opvars(splev, "iio", - VA_PASS3(state, dir, SPO_DRAWBRIDGE)); - } - ; - -mazewalk_detail : MAZEWALK_ID ':' coord_or_var ',' DIRECTION - { - add_opvars(splev, "iiio", - VA_PASS4((int) $5, 1, 0, SPO_MAZEWALK)); - } - | MAZEWALK_ID ':' coord_or_var ',' DIRECTION ',' BOOLEAN opt_fillchar - { - add_opvars(splev, "iiio", - VA_PASS4((int) $5, (int) $7, - (int) $8, SPO_MAZEWALK)); - } - ; - -wallify_detail : WALLIFY_ID - { - add_opvars(splev, "rio", - VA_PASS3(SP_REGION_PACK(-1,-1,-1,-1), - 0, SPO_WALLIFY)); - } - | WALLIFY_ID ':' ter_selection - { - add_opvars(splev, "io", VA_PASS2(1, SPO_WALLIFY)); - } - ; - -ladder_detail : LADDER_ID ':' coord_or_var ',' UP_OR_DOWN - { - add_opvars(splev, "io", - VA_PASS2((int) $5, SPO_LADDER)); - } - ; - -stair_detail : STAIR_ID ':' coord_or_var ',' UP_OR_DOWN - { - add_opvars(splev, "io", - VA_PASS2((int) $5, SPO_STAIR)); - } - ; - -stair_region : STAIR_ID ':' lev_region ',' lev_region ',' UP_OR_DOWN - { - add_opvars(splev, "iiiii iiiii iiso", - VA_PASS14($3.x1, $3.y1, $3.x2, $3.y2, $3.area, - $5.x1, $5.y1, $5.x2, $5.y2, $5.area, - (long) (($7) ? LR_UPSTAIR : LR_DOWNSTAIR), - 0, (char *) 0, SPO_LEVREGION)); - } - ; - -portal_region : PORTAL_ID ':' lev_region ',' lev_region ',' STRING - { - add_opvars(splev, "iiiii iiiii iiso", - VA_PASS14($3.x1, $3.y1, $3.x2, $3.y2, $3.area, - $5.x1, $5.y1, $5.x2, $5.y2, $5.area, - LR_PORTAL, 0, $7, SPO_LEVREGION)); - Free($7); - } - ; - -teleprt_region : TELEPRT_ID ':' lev_region ',' lev_region teleprt_detail - { - long rtyp = 0; - switch($6) { - case -1: rtyp = LR_TELE; break; - case 0: rtyp = LR_DOWNTELE; break; - case 1: rtyp = LR_UPTELE; break; - } - add_opvars(splev, "iiiii iiiii iiso", - VA_PASS14($3.x1, $3.y1, $3.x2, $3.y2, $3.area, - $5.x1, $5.y1, $5.x2, $5.y2, $5.area, - rtyp, 0, (char *)0, SPO_LEVREGION)); - } - ; - -branch_region : BRANCH_ID ':' lev_region ',' lev_region - { - add_opvars(splev, "iiiii iiiii iiso", - VA_PASS14($3.x1, $3.y1, $3.x2, $3.y2, $3.area, - $5.x1, $5.y1, $5.x2, $5.y2, $5.area, - (long) LR_BRANCH, 0, - (char *) 0, SPO_LEVREGION)); - } - ; - -teleprt_detail : /* empty */ - { - $$ = -1; - } - | ',' UP_OR_DOWN - { - $$ = $2; - } - ; - -fountain_detail : FOUNTAIN_ID ':' ter_selection - { - add_opvars(splev, "o", VA_PASS1(SPO_FOUNTAIN)); - } - ; - -sink_detail : SINK_ID ':' ter_selection - { - add_opvars(splev, "o", VA_PASS1(SPO_SINK)); - } - ; - -pool_detail : POOL_ID ':' ter_selection - { - add_opvars(splev, "o", VA_PASS1(SPO_POOL)); - } - ; - -terrain_type : CHAR - { - $$.lit = -2; - $$.ter = what_map_char((char) $1); - } - | '(' CHAR ',' light_state ')' - { - $$.lit = $4; - $$.ter = what_map_char((char) $2); - } - ; - -replace_terrain_detail : REPLACE_TERRAIN_ID ':' region_or_var ',' mapchar_or_var ',' mapchar_or_var ',' SPERCENT - { - add_opvars(splev, "io", - VA_PASS2($9, SPO_REPLACETERRAIN)); - } - ; - -terrain_detail : TERRAIN_ID ':' ter_selection ',' mapchar_or_var - { - add_opvars(splev, "o", VA_PASS1(SPO_TERRAIN)); - } - ; - -diggable_detail : NON_DIGGABLE_ID ':' region_or_var - { - add_opvars(splev, "o", VA_PASS1(SPO_NON_DIGGABLE)); - } - ; - -passwall_detail : NON_PASSWALL_ID ':' region_or_var - { - add_opvars(splev, "o", VA_PASS1(SPO_NON_PASSWALL)); - } - ; - -region_detail : REGION_ID ':' region_or_var ',' light_state ',' room_type optroomregionflags - { - long irr; - long rt = $7; - long rflags = $8; - - if (rflags == -1) rflags = (1 << 0); - if (!(rflags & 1)) rt += MAXRTYPE+1; - irr = ((rflags & 2) != 0); - add_opvars(splev, "iiio", - VA_PASS4((long)$5, rt, rflags, SPO_REGION)); - $$ = (irr || (rflags & 1) || rt != OROOM); - break_stmt_start(); - } - region_detail_end - { - break_stmt_end(splev); - if ( $9 ) { - add_opcode(splev, SPO_ENDROOM, NULL); - } else if ( $10 ) - lc_error("Cannot use lev statements in non-permanent REGION"); - } - ; - -region_detail_end : /* nothing */ - { - $$ = 0; - } - | stmt_block - { - $$ = $1; - } - ; - -altar_detail : ALTAR_ID ':' coord_or_var ',' alignment ',' altar_type - { - add_opvars(splev, "iio", - VA_PASS3((long)$7, (long)$5, SPO_ALTAR)); - } - ; - -grave_detail : GRAVE_ID ':' coord_or_var ',' string_expr - { - add_opvars(splev, "io", VA_PASS2(2, SPO_GRAVE)); - } - | GRAVE_ID ':' coord_or_var ',' RANDOM_TYPE - { - add_opvars(splev, "sio", - VA_PASS3((char *)0, 1, SPO_GRAVE)); - } - | GRAVE_ID ':' coord_or_var - { - add_opvars(splev, "sio", - VA_PASS3((char *)0, 0, SPO_GRAVE)); - } - ; - -gold_detail : GOLD_ID ':' math_expr_var ',' coord_or_var - { - add_opvars(splev, "o", VA_PASS1(SPO_GOLD)); - } - ; - -engraving_detail: ENGRAVING_ID ':' coord_or_var ',' engraving_type ',' string_expr - { - add_opvars(splev, "io", - VA_PASS2((long)$5, SPO_ENGRAVING)); - } - ; - -mineralize : MINERALIZE_ID ':' integer_or_var ',' integer_or_var ',' integer_or_var ',' integer_or_var - { - add_opvars(splev, "o", VA_PASS1(SPO_MINERALIZE)); - } - | MINERALIZE_ID - { - add_opvars(splev, "iiiio", - VA_PASS5(-1L, -1L, -1L, -1L, SPO_MINERALIZE)); - } - ; - -trap_name : STRING - { - int token = get_trap_type($1); - if (token == ERR) - lc_error("Unknown trap type '%s'!", $1); - $$ = token; - Free($1); - } - | RANDOM_TYPE - ; - -room_type : STRING - { - int token = get_room_type($1); - if (token == ERR) { - lc_warning("Unknown room type \"%s\"! Making ordinary room...", $1); - $$ = OROOM; - } else - $$ = token; - Free($1); - } - | RANDOM_TYPE - ; - -optroomregionflags : /* empty */ - { - $$ = -1; - } - | ',' roomregionflags - { - $$ = $2; - } - ; - -roomregionflags : roomregionflag - { - $$ = $1; - } - | roomregionflag ',' roomregionflags - { - $$ = $1 | $3; - } - ; - -/* 0 is the "default" here */ -roomregionflag : FILLING - { - $$ = ($1 << 0); - } - | IRREGULAR - { - $$ = ($1 << 1); - } - | JOINED - { - $$ = ($1 << 2); - } - ; - -door_state : DOOR_STATE - | RANDOM_TYPE - ; - -light_state : LIGHT_STATE - | RANDOM_TYPE - ; - -alignment : ALIGNMENT - | a_register - | RANDOM_TYPE - { - $$ = - MAX_REGISTERS - 1; - } - ; - -alignment_prfx : ALIGNMENT - | a_register - | A_REGISTER ':' RANDOM_TYPE - { - $$ = - MAX_REGISTERS - 1; - } - ; - -altar_type : ALTAR_TYPE - | RANDOM_TYPE - ; - -a_register : A_REGISTER '[' INTEGER ']' - { - if ( $3 >= 3 ) - lc_error("Register Index overflow!"); - else - $$ = - $3 - 1; - } - ; - -string_or_var : STRING - { - add_opvars(splev, "s", VA_PASS1($1)); - Free($1); - } - | VARSTRING_STRING - { - check_vardef_type(vardefs, $1, SPOVAR_STRING); - vardef_used(vardefs, $1); - add_opvars(splev, "v", VA_PASS1($1)); - Free($1); - } - | VARSTRING_STRING_ARRAY '[' math_expr_var ']' - { - check_vardef_type(vardefs, $1, - SPOVAR_STRING | SPOVAR_ARRAY); - vardef_used(vardefs, $1); - add_opvars(splev, "v", VA_PASS1($1)); - Free($1); - } - ; - - -integer_or_var : math_expr_var - { - /* nothing */ - } - ; - -coord_or_var : encodecoord - { - add_opvars(splev, "c", VA_PASS1($1)); - } - | rndcoord_ID '(' ter_selection ')' - { - add_opvars(splev, "o", VA_PASS1(SPO_SEL_RNDCOORD)); - } - | VARSTRING_COORD - { - check_vardef_type(vardefs, $1, SPOVAR_COORD); - vardef_used(vardefs, $1); - add_opvars(splev, "v", VA_PASS1($1)); - Free($1); - } - | VARSTRING_COORD_ARRAY '[' math_expr_var ']' - { - check_vardef_type(vardefs, $1, - SPOVAR_COORD | SPOVAR_ARRAY); - vardef_used(vardefs, $1); - add_opvars(splev, "v", VA_PASS1($1)); - Free($1); - } - ; - -encodecoord : '(' INTEGER ',' INTEGER ')' - { - if ($2 < 0 || $4 < 0 || $2 >= COLNO || $4 >= ROWNO) - lc_error("Coordinates (%li,%li) out of map range!", - $2, $4); - $$ = SP_COORD_PACK($2, $4); - } - | RANDOM_TYPE - { - $$ = SP_COORD_PACK_RANDOM(0); - } - | RANDOM_TYPE_BRACKET humidity_flags ']' - { - $$ = SP_COORD_PACK_RANDOM($2); - } - ; - -humidity_flags : HUMIDITY_TYPE - { - $$ = $1; - } - | HUMIDITY_TYPE ',' humidity_flags - { - if (($1 & $3)) - lc_warning("Humidity flag used twice."); - $$ = ($1 | $3); - } - ; - -region_or_var : encoderegion - { - /* nothing */ - } - | VARSTRING_REGION - { - check_vardef_type(vardefs, $1, SPOVAR_REGION); - vardef_used(vardefs, $1); - add_opvars(splev, "v", VA_PASS1($1)); - Free($1); - } - | VARSTRING_REGION_ARRAY '[' math_expr_var ']' - { - check_vardef_type(vardefs, $1, - SPOVAR_REGION | SPOVAR_ARRAY); - vardef_used(vardefs, $1); - add_opvars(splev, "v", VA_PASS1($1)); - Free($1); - } - ; - -encoderegion : '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')' - { - long r = SP_REGION_PACK($2, $4, $6, $8); - - if ($2 > $6 || $4 > $8) - lc_error("Region start > end: (%ld,%ld,%ld,%ld)!", - $2, $4, $6, $8); - - add_opvars(splev, "r", VA_PASS1(r)); - $$ = r; - } - ; - -mapchar_or_var : mapchar - { - add_opvars(splev, "m", VA_PASS1($1)); - } - | VARSTRING_MAPCHAR - { - check_vardef_type(vardefs, $1, SPOVAR_MAPCHAR); - vardef_used(vardefs, $1); - add_opvars(splev, "v", VA_PASS1($1)); - Free($1); - } - | VARSTRING_MAPCHAR_ARRAY '[' math_expr_var ']' - { - check_vardef_type(vardefs, $1, - SPOVAR_MAPCHAR | SPOVAR_ARRAY); - vardef_used(vardefs, $1); - add_opvars(splev, "v", VA_PASS1($1)); - Free($1); - } - ; - -mapchar : CHAR - { - if (what_map_char((char) $1) != INVALID_TYPE) - $$ = SP_MAPCHAR_PACK(what_map_char((char) $1), -2); - else { - lc_error("Unknown map char type '%c'!", $1); - $$ = SP_MAPCHAR_PACK(STONE, -2); - } - } - | '(' CHAR ',' light_state ')' - { - if (what_map_char((char) $2) != INVALID_TYPE) - $$ = SP_MAPCHAR_PACK(what_map_char((char) $2), $4); - else { - lc_error("Unknown map char type '%c'!", $2); - $$ = SP_MAPCHAR_PACK(STONE, $4); - } - } - ; - -monster_or_var : encodemonster - { - add_opvars(splev, "M", VA_PASS1($1)); - } - | VARSTRING_MONST - { - check_vardef_type(vardefs, $1, SPOVAR_MONST); - vardef_used(vardefs, $1); - add_opvars(splev, "v", VA_PASS1($1)); - Free($1); - } - | VARSTRING_MONST_ARRAY '[' math_expr_var ']' - { - check_vardef_type(vardefs, $1, - SPOVAR_MONST | SPOVAR_ARRAY); - vardef_used(vardefs, $1); - add_opvars(splev, "v", VA_PASS1($1)); - Free($1); - } - ; - -encodemonster : STRING - { - long m = get_monster_id($1, (char)0); - if (m == ERR) { - lc_error("Unknown monster \"%s\"!", $1); - $$ = -1; - } else - $$ = SP_MONST_PACK(m, - def_monsyms[(int) mons[m].mlet].sym); - Free($1); - } - | CHAR - { - if (check_monster_char((char) $1)) - $$ = SP_MONST_PACK(-1, $1); - else { - lc_error("Unknown monster class '%c'!", $1); - $$ = -1; - } - } - | '(' CHAR ',' STRING ')' - { - long m = get_monster_id($4, (char) $2); - if (m == ERR) { - lc_error("Unknown monster ('%c', \"%s\")!", $2, $4); - $$ = -1; - } else - $$ = SP_MONST_PACK(m, $2); - Free($4); - } - | RANDOM_TYPE - { - $$ = -1; - } - ; - -object_or_var : encodeobj - { - add_opvars(splev, "O", VA_PASS1($1)); - } - | VARSTRING_OBJ - { - check_vardef_type(vardefs, $1, SPOVAR_OBJ); - vardef_used(vardefs, $1); - add_opvars(splev, "v", VA_PASS1($1)); - Free($1); - } - | VARSTRING_OBJ_ARRAY '[' math_expr_var ']' - { - check_vardef_type(vardefs, $1, - SPOVAR_OBJ | SPOVAR_ARRAY); - vardef_used(vardefs, $1); - add_opvars(splev, "v", VA_PASS1($1)); - Free($1); - } - ; - -encodeobj : STRING - { - long m = get_object_id($1, (char)0); - if (m == ERR) { - lc_error("Unknown object \"%s\"!", $1); - $$ = -1; - } else - /* obj class != 0 to force generation of a specific item */ - $$ = SP_OBJ_PACK(m, 1); - Free($1); - } - | CHAR - { - if (check_object_char((char) $1)) - $$ = SP_OBJ_PACK(-1, $1); - else { - lc_error("Unknown object class '%c'!", $1); - $$ = -1; - } - } - | '(' CHAR ',' STRING ')' - { - long m = get_object_id($4, (char) $2); - if (m == ERR) { - lc_error("Unknown object ('%c', \"%s\")!", $2, $4); - $$ = -1; - } else - $$ = SP_OBJ_PACK(m, $2); - Free($4); - } - | RANDOM_TYPE - { - $$ = -1; - } - ; - - -string_expr : string_or_var { } - | string_expr '.' string_or_var - { - add_opvars(splev, "o", VA_PASS1(SPO_MATH_ADD)); - } - ; - -math_expr_var : INTEGER - { - add_opvars(splev, "i", VA_PASS1($1)); - } - | dice - { - is_inconstant_number = 1; - } - | '(' MINUS_INTEGER ')' - { - add_opvars(splev, "i", VA_PASS1($2)); - } - | VARSTRING_INT - { - check_vardef_type(vardefs, $1, SPOVAR_INT); - vardef_used(vardefs, $1); - add_opvars(splev, "v", VA_PASS1($1)); - Free($1); - is_inconstant_number = 1; - } - | VARSTRING_INT_ARRAY '[' math_expr_var ']' - { - check_vardef_type(vardefs, $1, - SPOVAR_INT | SPOVAR_ARRAY); - vardef_used(vardefs, $1); - add_opvars(splev, "v", VA_PASS1($1)); - Free($1); - is_inconstant_number = 1; - } - | math_expr_var '+' math_expr_var - { - add_opvars(splev, "o", VA_PASS1(SPO_MATH_ADD)); - } - | math_expr_var '-' math_expr_var - { - add_opvars(splev, "o", VA_PASS1(SPO_MATH_SUB)); - } - | math_expr_var '*' math_expr_var - { - add_opvars(splev, "o", VA_PASS1(SPO_MATH_MUL)); - } - | math_expr_var '/' math_expr_var - { - add_opvars(splev, "o", VA_PASS1(SPO_MATH_DIV)); - } - | math_expr_var '%' math_expr_var - { - add_opvars(splev, "o", VA_PASS1(SPO_MATH_MOD)); - } - | '(' math_expr_var ')' { } - ; - -func_param_type : CFUNC_INT - { - if (!strcmp("int", $1) || !strcmp("integer", $1)) { - $$ = (int)'i'; - } else - lc_error("Unknown function parameter type '%s'", $1); - } - | CFUNC_STR - { - if (!strcmp("str", $1) || !strcmp("string", $1)) { - $$ = (int)'s'; - } else - lc_error("Unknown function parameter type '%s'", $1); - } - ; - -func_param_part : any_var_or_arr ':' func_param_type - { - struct lc_funcdefs_parm *tmp = New(struct lc_funcdefs_parm); - - if (!curr_function) { - lc_error("Function parameters outside function definition."); - } else if (!tmp) { - lc_error("Could not alloc function params."); - } else { - long vt = SPOVAR_NULL; - - tmp->name = strdup($1); - tmp->parmtype = (char) $3; - tmp->next = curr_function->params; - curr_function->params = tmp; - curr_function->n_params++; - switch (tmp->parmtype) { - case 'i': - vt = SPOVAR_INT; - break; - case 's': - vt = SPOVAR_STRING; - break; - default: - lc_error("Unknown func param conversion."); - break; - } - vardefs = add_vardef_type( vardefs, $1, vt); - } - Free($1); - } - ; - -func_param_list : func_param_part - | func_param_list ',' func_param_part - ; - -func_params_list : /* nothing */ - | func_param_list - ; - -func_call_param_part : math_expr_var - { - $$ = (int)'i'; - } - | string_expr - { - $$ = (int)'s'; - } - ; - - -func_call_param_list : func_call_param_part - { - char tmpbuf[2]; - tmpbuf[0] = (char) $1; - tmpbuf[1] = '\0'; - $$ = strdup(tmpbuf); - } - | func_call_param_list ',' func_call_param_part - { - long len = strlen( $1 ); - char *tmp = (char *) alloc(len + 2); - sprintf(tmp, "%c%s", (char) $3, $1 ); - Free( $1 ); - $$ = tmp; - } - ; - -func_call_params_list : /* nothing */ - { - $$ = strdup(""); - } - | func_call_param_list - { - char *tmp = strdup( $1 ); - Free( $1 ); - $$ = tmp; - } - ; - -ter_selection_x : coord_or_var - { - add_opvars(splev, "o", VA_PASS1(SPO_SEL_POINT)); - } - | rect_ID region_or_var - { - add_opvars(splev, "o", VA_PASS1(SPO_SEL_RECT)); - } - | fillrect_ID region_or_var - { - add_opvars(splev, "o", VA_PASS1(SPO_SEL_FILLRECT)); - } - | line_ID coord_or_var ',' coord_or_var - { - add_opvars(splev, "o", VA_PASS1(SPO_SEL_LINE)); - } - | randline_ID coord_or_var ',' coord_or_var ',' math_expr_var - { - /* randline (x1,y1),(x2,y2), roughness */ - add_opvars(splev, "o", VA_PASS1(SPO_SEL_RNDLINE)); - } - | grow_ID '(' ter_selection ')' - { - add_opvars(splev, "io", VA_PASS2(W_ANY, SPO_SEL_GROW)); - } - | grow_ID '(' dir_list ',' ter_selection ')' - { - add_opvars(splev, "io", VA_PASS2($3, SPO_SEL_GROW)); - } - | filter_ID '(' SPERCENT ',' ter_selection ')' - { - add_opvars(splev, "iio", - VA_PASS3($3, SPOFILTER_PERCENT, SPO_SEL_FILTER)); - } - | filter_ID '(' ter_selection ',' ter_selection ')' - { - add_opvars(splev, "io", - VA_PASS2(SPOFILTER_SELECTION, SPO_SEL_FILTER)); - } - | filter_ID '(' mapchar_or_var ',' ter_selection ')' - { - add_opvars(splev, "io", - VA_PASS2(SPOFILTER_MAPCHAR, SPO_SEL_FILTER)); - } - | flood_ID coord_or_var - { - add_opvars(splev, "o", VA_PASS1(SPO_SEL_FLOOD)); - } - | circle_ID '(' coord_or_var ',' math_expr_var ')' - { - add_opvars(splev, "oio", - VA_PASS3(SPO_COPY, 1, SPO_SEL_ELLIPSE)); - } - | circle_ID '(' coord_or_var ',' math_expr_var ',' FILLING ')' - { - add_opvars(splev, "oio", - VA_PASS3(SPO_COPY, $7, SPO_SEL_ELLIPSE)); - } - | ellipse_ID '(' coord_or_var ',' math_expr_var ',' math_expr_var ')' - { - add_opvars(splev, "io", VA_PASS2(1, SPO_SEL_ELLIPSE)); - } - | ellipse_ID '(' coord_or_var ',' math_expr_var ',' math_expr_var ',' FILLING ')' - { - add_opvars(splev, "io", VA_PASS2($9, SPO_SEL_ELLIPSE)); - } - | gradient_ID '(' GRADIENT_TYPE ',' '(' math_expr_var '-' math_expr_var opt_limited ')' ',' coord_or_var opt_coord_or_var ')' - { - add_opvars(splev, "iio", - VA_PASS3($9, $3, SPO_SEL_GRADIENT)); - } - | complement_ID ter_selection_x - { - add_opvars(splev, "o", VA_PASS1(SPO_SEL_COMPLEMENT)); - } - | VARSTRING_SEL - { - check_vardef_type(vardefs, $1, SPOVAR_SEL); - vardef_used(vardefs, $1); - add_opvars(splev, "v", VA_PASS1($1)); - Free($1); - } - | '(' ter_selection ')' - { - /* nothing */ - } - ; - -ter_selection : ter_selection_x - { - /* nothing */ - } - | ter_selection_x '&' ter_selection - { - add_opvars(splev, "o", VA_PASS1(SPO_SEL_ADD)); - } - ; - -dice : DICE - { - add_opvars(splev, "iio", - VA_PASS3($1.num, $1.die, SPO_DICE)); - } - ; - -all_integers : MINUS_INTEGER - | PLUS_INTEGER - | INTEGER - ; - -all_ints_push : MINUS_INTEGER - { - add_opvars(splev, "i", VA_PASS1($1)); - } - | PLUS_INTEGER - { - add_opvars(splev, "i", VA_PASS1($1)); - } - | INTEGER - { - add_opvars(splev, "i", VA_PASS1($1)); - } - | dice - { - /* nothing */ - } - ; - -objectid : object_ID - | OBJECT_ID - ; - -monsterid : monster_ID - | MONSTER_ID - ; - -terrainid : terrain_ID - | TERRAIN_ID - ; - -engraving_type : ENGRAVING_TYPE - | RANDOM_TYPE - ; - -lev_region : region - { - $$ = $1; - } - | LEV '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')' - { - if ($3 <= 0 || $3 >= COLNO) - lc_error( - "Region (%ld,%ld,%ld,%ld) out of level range (x1)!", - $3, $5, $7, $9); - else if ($5 < 0 || $5 >= ROWNO) - lc_error( - "Region (%ld,%ld,%ld,%ld) out of level range (y1)!", - $3, $5, $7, $9); - else if ($7 <= 0 || $7 >= COLNO) - lc_error( - "Region (%ld,%ld,%ld,%ld) out of level range (x2)!", - $3, $5, $7, $9); - else if ($9 < 0 || $9 >= ROWNO) - lc_error( - "Region (%ld,%ld,%ld,%ld) out of level range (y2)!", - $3, $5, $7, $9); - $$.x1 = $3; - $$.y1 = $5; - $$.x2 = $7; - $$.y2 = $9; - $$.area = 1; - } - ; - -region : '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')' - { -/* This series of if statements is a hack for MSC 5.1. It seems that its - tiny little brain cannot compile if these are all one big if statement. */ - if ($2 < 0 || $2 > (int) max_x_map) - lc_error( - "Region (%ld,%ld,%ld,%ld) out of map range (x1)!", - $2, $4, $6, $8); - else if ($4 < 0 || $4 > (int) max_y_map) - lc_error( - "Region (%ld,%ld,%ld,%ld) out of map range (y1)!", - $2, $4, $6, $8); - else if ($6 < 0 || $6 > (int) max_x_map) - lc_error( - "Region (%ld,%ld,%ld,%ld) out of map range (x2)!", - $2, $4, $6, $8); - else if ($8 < 0 || $8 > (int) max_y_map) - lc_error( - "Region (%ld,%ld,%ld,%ld) out of map range (y2)!", - $2, $4, $6, $8); - $$.area = 0; - $$.x1 = $2; - $$.y1 = $4; - $$.x2 = $6; - $$.y2 = $8; - } - ; - - -%% - -/*lev_comp.y*/ diff --git a/util/lev_main.c b/util/lev_main.c deleted file mode 100644 index b3dbbce0a..000000000 --- a/util/lev_main.c +++ /dev/null @@ -1,1639 +0,0 @@ -/* NetHack 3.6 lev_main.c $NHDT-Date: 1543371692 2018/11/28 02:21:32 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.56 $ */ -/* Copyright (c) 1989 by Jean-Christophe Collet */ -/* NetHack may be freely redistributed. See license for details. */ - -/* - * This file contains the main function for the parser - * and some useful functions needed by yacc - */ -#define SPEC_LEV /* for USE_OLDARGS (sp_lev.h) and for MPW (macconf.h) */ - -#define NEED_VARARGS -#include "hack.h" -#include "date.h" -#include "sp_lev.h" -#ifdef STRICT_REF_DEF -#include "tcap.h" -#endif -#include - -#ifdef MAC -#if defined(__SC__) || defined(__MRC__) -#define MPWTOOL -#define PREFIX ":dungeon:" /* place output files here */ -#include -#else -#if !defined(__MACH__) -#define PREFIX ":lib:" /* place output files here */ -#endif -#endif -#endif - -#ifdef WIN_CE -#define PREFIX "\\nethack\\dat\\" -#endif - -#ifndef MPWTOOL -#define SpinCursor(x) -#endif - -#if defined(AMIGA) && defined(DLB) -#define PREFIX "NH:slib/" -#endif - -#ifndef O_WRONLY -#include -#endif -#ifndef O_CREAT /* some older BSD systems do not define O_CREAT in \ - */ -#include -#endif -#ifndef O_BINARY /* used for micros, no-op for others */ -#define O_BINARY 0 -#endif - -#if defined(MICRO) || defined(WIN32) -#define OMASK FCMASK -#else -#define OMASK 0644 -#endif - -#define ERR (-1) - -#define NewTab(type, size) (type **) alloc(sizeof(type *) * size) -#define Free(ptr) \ - if (ptr) \ - free((genericptr_t)(ptr)) -/* write() returns a signed value but its size argument is unsigned; - types might be int and unsigned or ssize_t and size_t; casting - to long should be safe for all permutations (even if size_t is - bigger, since the values involved won't be too big for long) */ -#define Write(fd, item, size) \ - if ((long) write(fd, (genericptr_t)(item), size) != (long) (size)) \ - return FALSE; - -#if defined(__BORLANDC__) && !defined(_WIN32) -extern unsigned _stklen = STKSIZ; -#endif -#define MAX_ERRORS 25 - -extern int NDECL(yyparse); -extern void FDECL(init_yyin, (FILE *)); -extern void FDECL(init_yyout, (FILE *)); - -int FDECL(main, (int, char **)); -void FDECL(yyerror, (const char *)); -void FDECL(yywarning, (const char *)); -int NDECL(yywrap); -int FDECL(get_floor_type, (CHAR_P)); -int FDECL(get_room_type, (char *)); -int FDECL(get_trap_type, (char *)); -int FDECL(get_monster_id, (char *, CHAR_P)); -int FDECL(get_object_id, (char *, CHAR_P)); -boolean FDECL(check_monster_char, (CHAR_P)); -boolean FDECL(check_object_char, (CHAR_P)); -char FDECL(what_map_char, (CHAR_P)); -void FDECL(scan_map, (char *, sp_lev *)); -boolean NDECL(check_subrooms); -boolean FDECL(write_level_file, (char *, sp_lev *)); - -struct lc_funcdefs *FDECL(funcdef_new, (long, char *)); -void FDECL(funcdef_free_all, (struct lc_funcdefs *)); -struct lc_funcdefs *FDECL(funcdef_defined, - (struct lc_funcdefs *, char *, int)); - -struct lc_vardefs *FDECL(vardef_new, (long, char *)); -void FDECL(vardef_free_all, (struct lc_vardefs *)); -struct lc_vardefs *FDECL(vardef_defined, (struct lc_vardefs *, char *, int)); - -void FDECL(splev_add_from, (sp_lev *, sp_lev *)); - -void FDECL(add_opcode, (sp_lev *, int, genericptr_t)); - -static boolean FDECL(write_common_data, (int)); -static boolean FDECL(write_maze, (int, sp_lev *)); -static void NDECL(init_obj_classes); -static int FDECL(case_insensitive_comp, (const char *, const char *)); - -void VDECL(lc_pline, (const char *, ...)); -void VDECL(lc_error, (const char *, ...)); -void VDECL(lc_warning, (const char *, ...)); -char *FDECL(decode_parm_chr, (CHAR_P)); -char *FDECL(decode_parm_str, (char *)); -struct opvar *FDECL(set_opvar_int, (struct opvar *, long)); -struct opvar *FDECL(set_opvar_coord, (struct opvar *, long)); -struct opvar *FDECL(set_opvar_region, (struct opvar *, long)); -struct opvar *FDECL(set_opvar_mapchar, (struct opvar *, long)); -struct opvar *FDECL(set_opvar_monst, (struct opvar *, long)); -struct opvar *FDECL(set_opvar_obj, (struct opvar *, long)); -struct opvar *FDECL(set_opvar_str, (struct opvar *, const char *)); -struct opvar *FDECL(set_opvar_var, (struct opvar *, const char *)); -void VDECL(add_opvars, (sp_lev *, const char *, ...)); -void NDECL(break_stmt_start); -void FDECL(break_stmt_end, (sp_lev *)); -void FDECL(break_stmt_new, (sp_lev *, long)); -char *FDECL(funcdef_paramtypes, (struct lc_funcdefs *)); -const char *FDECL(spovar2str, (long)); -void FDECL(vardef_used, (struct lc_vardefs *, char *)); -void FDECL(check_vardef_type, (struct lc_vardefs *, char *, long)); -struct lc_vardefs *FDECL(add_vardef_type, - (struct lc_vardefs *, char *, long)); -int FDECL(reverse_jmp_opcode, (int)); -struct opvar *FDECL(opvar_clone, (struct opvar *)); -void FDECL(start_level_def, (sp_lev **, char *)); - -static struct { - const char *name; - int type; -} trap_types[] = { { "arrow", ARROW_TRAP }, - { "dart", DART_TRAP }, - { "falling rock", ROCKTRAP }, - { "board", SQKY_BOARD }, - { "bear", BEAR_TRAP }, - { "land mine", LANDMINE }, - { "rolling boulder", ROLLING_BOULDER_TRAP }, - { "sleep gas", SLP_GAS_TRAP }, - { "rust", RUST_TRAP }, - { "fire", FIRE_TRAP }, - { "pit", PIT }, - { "spiked pit", SPIKED_PIT }, - { "hole", HOLE }, - { "trap door", TRAPDOOR }, - { "teleport", TELEP_TRAP }, - { "level teleport", LEVEL_TELEP }, - { "magic portal", MAGIC_PORTAL }, - { "web", WEB }, - { "statue", STATUE_TRAP }, - { "magic", MAGIC_TRAP }, - { "anti magic", ANTI_MAGIC }, - { "polymorph", POLY_TRAP }, - { "vibrating square", VIBRATING_SQUARE }, - { 0, 0 } }; - -static struct { - const char *name; - int type; -} room_types[] = { - /* for historical reasons, room types are not contiguous numbers */ - /* (type 1 is skipped) */ - { "ordinary", OROOM }, - { "throne", COURT }, - { "swamp", SWAMP }, - { "vault", VAULT }, - { "beehive", BEEHIVE }, - { "morgue", MORGUE }, - { "barracks", BARRACKS }, - { "zoo", ZOO }, - { "delphi", DELPHI }, - { "temple", TEMPLE }, - { "anthole", ANTHOLE }, - { "cocknest", COCKNEST }, - { "leprehall", LEPREHALL }, - { "shop", SHOPBASE }, - { "armor shop", ARMORSHOP }, - { "scroll shop", SCROLLSHOP }, - { "potion shop", POTIONSHOP }, - { "weapon shop", WEAPONSHOP }, - { "food shop", FOODSHOP }, - { "ring shop", RINGSHOP }, - { "wand shop", WANDSHOP }, - { "tool shop", TOOLSHOP }, - { "book shop", BOOKSHOP }, - { "health food shop", FODDERSHOP }, - { "candle shop", CANDLESHOP }, - { 0, 0 } -}; - -const char *fname = "(stdin)"; -int fatal_error = 0; -int got_errors = 0; -int be_verbose = 0; -int fname_counter = 1; - -#ifdef FLEX23_BUG -/* Flex 2.3 bug work around; not needed for 2.3.6 or later */ -int yy_more_len = 0; -#endif - -extern unsigned int max_x_map, max_y_map; - -extern int nh_line_number; - -extern int token_start_pos; -extern char curr_token[512]; - -struct lc_vardefs *vardefs = NULL; -struct lc_funcdefs *function_definitions = NULL; - -extern int allow_break_statements; -extern struct lc_breakdef *break_list; - -int -main(argc, argv) -int argc; -char **argv; -{ - FILE *fin; - int i; - boolean errors_encountered = FALSE; -#if defined(MAC) && (defined(THINK_C) || defined(__MWERKS__)) - static char *mac_argv[] = { - "lev_comp", /* dummy argv[0] */ - ":dat:Arch.des", ":dat:Barb.des", ":dat:Caveman.des", - ":dat:Healer.des", ":dat:Knight.des", ":dat:Monk.des", - ":dat:Priest.des", ":dat:Ranger.des", ":dat:Rogue.des", - ":dat:Samurai.des", ":dat:Tourist.des", ":dat:Valkyrie.des", - ":dat:Wizard.des", ":dat:bigroom.des", ":dat:castle.des", - ":dat:endgame.des", ":dat:gehennom.des", ":dat:knox.des", - ":dat:medusa.des", ":dat:mines.des", ":dat:oracle.des", - ":dat:sokoban.des", ":dat:tower.des", ":dat:yendor.des" - }; - - argc = SIZE(mac_argv); - argv = mac_argv; -#endif - - decl_globals_init(); - objects_globals_init(); - monst_globals_init(); - - /* this one does something... */ - init_obj_classes(); - - init_yyout(stdout); - if (argc == 1) { /* Read standard input */ - init_yyin(stdin); - (void) yyparse(); - if (fatal_error > 0) { - errors_encountered = TRUE; - } - } else { /* Otherwise every argument is a filename */ - for (i = 1; i < argc; i++) { - fname = argv[i]; - if (!strcmp(fname, "-v")) { - be_verbose++; - continue; - } - fin = freopen(fname, "r", stdin); - if (!fin) { - lc_pline("Can't open \"%s\" for input.\n", VA_PASS1(fname)); - perror(fname); - errors_encountered = TRUE; - } else { - fname_counter = 1; - init_yyin(fin); - (void) yyparse(); - nh_line_number = 1; - if (fatal_error > 0 || got_errors > 0) { - errors_encountered = TRUE; - fatal_error = 0; - } - } - } - } - exit(errors_encountered ? EXIT_FAILURE : EXIT_SUCCESS); - /*NOTREACHED*/ - return 0; -} - -/* - * Each time the parser detects an error, it uses this function. - * Here we take count of the errors. To continue farther than - * MAX_ERRORS wouldn't be reasonable. - * Assume that explicit calls from lev_comp.y have the 1st letter - * capitalized, to allow printing of the line containing the start of - * the current declaration, instead of the beginning of the next declaration. - */ -void -yyerror(s) -const char *s; -{ - char *e = ((char *) s + strlen(s) - 1); - - (void) fprintf(stderr, "%s: line %d, pos %d: %s", fname, nh_line_number, - token_start_pos - (int) strlen(curr_token), s); - if (*e != '.' && *e != '!') - (void) fprintf(stderr, " at \"%s\"", curr_token); - (void) fprintf(stderr, "\n"); - - if (++fatal_error > MAX_ERRORS) { - (void) fprintf(stderr, "Too many errors, good bye!\n"); - exit(EXIT_FAILURE); - } -} - -/* - * Just display a warning (that is : a non fatal error) - */ -void -yywarning(s) -const char *s; -{ - (void) fprintf(stderr, "%s: line %d : WARNING : %s\n", fname, - nh_line_number, s); -} - -/* - * Stub needed for lex interface. - */ -int -yywrap() -{ - return 1; -} - -/* - * lc_pline(): lev_comp version of pline(), stripped down version of - * core's pline(), with convoluted handling for variadic arguments to - * support , , and neither of the above. - * - * Using state for message/warning/error mode simplifies calling interface. - */ -#define LC_PLINE_MESSAGE 0 -#define LC_PLINE_WARNING 1 -#define LC_PLINE_ERROR 2 -static int lc_pline_mode = LC_PLINE_MESSAGE; - -#if defined(USE_STDARG) || defined(USE_VARARGS) -static void FDECL(lc_vpline, (const char *, va_list)); - -void lc_pline -VA_DECL(const char *, line) -{ - VA_START(line); - VA_INIT(line, char *); - lc_vpline(line, VA_ARGS); - VA_END(); -} - -#ifdef USE_STDARG -static void -lc_vpline(const char *line, va_list the_args) -#else -static void -lc_vpline(line, the_args) -const char *line; -va_list the_args; -#endif - -#else /* USE_STDARG | USE_VARARG */ - -#define lc_vpline lc_pline - -void -lc_pline -VA_DECL(const char *, line) -#endif /* USE_STDARG | USE_VARARG */ -{ /* opening brace for lc_vpline, nested block for USE_OLDARGS lc_pline */ - - char pbuf[3 * BUFSZ]; - static char nomsg[] = "(no message)"; - /* Do NOT use VA_START and VA_END in here... see above */ - - if (!line || !*line) - line = nomsg; /* shouldn't happen */ - if (index(line, '%')) { - Vsprintf(pbuf, line, VA_ARGS); - pbuf[BUFSZ - 1] = '\0'; /* truncate if long */ - line = pbuf; - } - switch (lc_pline_mode) { - case LC_PLINE_ERROR: - yyerror(line); - break; - case LC_PLINE_WARNING: - yywarning(line); - break; - default: - (void) fprintf(stderr, "%s\n", line); - break; - } - lc_pline_mode = LC_PLINE_MESSAGE; /* reset to default */ - return; -#if !(defined(USE_STDARG) || defined(USE_VARARGS)) - VA_END(); /* closing brace ofr USE_OLDARGS's nested block */ -#endif -} - -/*VARARGS1*/ -void -lc_error -VA_DECL(const char *, line) -{ - VA_START(line); - VA_INIT(line, const char *); - lc_pline_mode = LC_PLINE_ERROR; - lc_vpline(line, VA_ARGS); - VA_END(); - return; -} - -/*VARARGS1*/ -void -lc_warning -VA_DECL(const char *, line) -{ - VA_START(line); - VA_INIT(line, const char *); - lc_pline_mode = LC_PLINE_WARNING; - lc_vpline(line, VA_ARGS); - VA_END(); - return; -} - -char * -decode_parm_chr(chr) -char chr; -{ - static char buf[32]; - - switch (chr) { - default: - Strcpy(buf, "unknown"); - break; - case 'i': - Strcpy(buf, "int"); - break; - case 'r': - Strcpy(buf, "region"); - break; - case 's': - Strcpy(buf, "str"); - break; - case 'O': - Strcpy(buf, "obj"); - break; - case 'c': - Strcpy(buf, "coord"); - break; - case ' ': - Strcpy(buf, "nothing"); - break; - case 'm': - Strcpy(buf, "mapchar"); - break; - case 'M': - Strcpy(buf, "monster"); - break; - } - return buf; -} - -char * -decode_parm_str(str) -char *str; -{ - static char tmpbuf[1024]; - char *p = str; - tmpbuf[0] = '\0'; - if (str) { - for (; *p; p++) { - Strcat(tmpbuf, decode_parm_chr(*p)); - if (*(p + 1)) - Strcat(tmpbuf, ", "); - } - } - return tmpbuf; -} - -struct opvar * -set_opvar_int(ov, val) -struct opvar *ov; -long val; -{ - if (ov) { - ov->spovartyp = SPOVAR_INT; - ov->vardata.l = val; - } - return ov; -} - -struct opvar * -set_opvar_coord(ov, val) -struct opvar *ov; -long val; -{ - if (ov) { - ov->spovartyp = SPOVAR_COORD; - ov->vardata.l = val; - } - return ov; -} - -struct opvar * -set_opvar_region(ov, val) -struct opvar *ov; -long val; -{ - if (ov) { - ov->spovartyp = SPOVAR_REGION; - ov->vardata.l = val; - } - return ov; -} - -struct opvar * -set_opvar_mapchar(ov, val) -struct opvar *ov; -long val; -{ - if (ov) { - ov->spovartyp = SPOVAR_MAPCHAR; - ov->vardata.l = val; - } - return ov; -} - -struct opvar * -set_opvar_monst(ov, val) -struct opvar *ov; -long val; -{ - if (ov) { - ov->spovartyp = SPOVAR_MONST; - ov->vardata.l = val; - } - return ov; -} - -struct opvar * -set_opvar_obj(ov, val) -struct opvar *ov; -long val; -{ - if (ov) { - ov->spovartyp = SPOVAR_OBJ; - ov->vardata.l = val; - } - return ov; -} - -struct opvar * -set_opvar_str(ov, val) -struct opvar *ov; -const char *val; -{ - if (ov) { - ov->spovartyp = SPOVAR_STRING; - ov->vardata.str = (val) ? strdup(val) : NULL; - } - return ov; -} - -struct opvar * -set_opvar_var(ov, val) -struct opvar *ov; -const char *val; -{ - if (ov) { - ov->spovartyp = SPOVAR_VARIABLE; - ov->vardata.str = (val) ? strdup(val) : NULL; - } - return ov; -} - -#define New(type) \ - (type *) memset((genericptr_t) alloc(sizeof(type)), 0, sizeof(type)) - -#if defined(USE_STDARG) || defined(USE_VARARGS) -static void FDECL(vadd_opvars, (sp_lev *, const char *, va_list)); - -void add_opvars -VA_DECL2(sp_lev *, sp, const char *, fmt) -{ - VA_START(fmt); - VA_INIT(fmt, char *); - vadd_opvars(sp, fmt, VA_ARGS); - VA_END(); -} - -#ifdef USE_STDARG -static void -vadd_opvars(sp_lev *sp, const char *fmt, va_list the_args) - -#else -static void -vadd_opvars(sp, fmt, the_args) -sp_lev *sp; -const char *fmt; -va_list the_args; - -#endif - -#else /* USE_STDARG | USE_VARARG */ - -#define vadd_opvars add_opvars - -void add_opvars -VA_DECL2(sp_lev *, sp, const char *, fmt) -#endif /* USE_STDARG | USE_VARARG */ -{ - const char *p, *lp; - long la; - /* Do NOT use VA_START and VA_END in here... see above */ - - for (p = fmt; *p != '\0'; p++) { - switch (*p) { - case ' ': - break; - case 'i': /* integer (via plain 'int') */ - { - struct opvar *ov = New(struct opvar); - - set_opvar_int(ov, (long) VA_NEXT(la, int)); - add_opcode(sp, SPO_PUSH, ov); - break; - } - case 'l': /* integer (via 'long int') */ - { - struct opvar *ov = New(struct opvar); - - set_opvar_int(ov, VA_NEXT(la, long)); - add_opcode(sp, SPO_PUSH, ov); - break; - } - case 'c': /* coordinate */ - { - struct opvar *ov = New(struct opvar); - set_opvar_coord(ov, VA_NEXT(la, long)); - add_opcode(sp, SPO_PUSH, ov); - break; - } - case 'r': /* region */ - { - struct opvar *ov = New(struct opvar); - set_opvar_region(ov, VA_NEXT(la, long)); - add_opcode(sp, SPO_PUSH, ov); - break; - } - case 'm': /* mapchar */ - { - struct opvar *ov = New(struct opvar); - set_opvar_mapchar(ov, VA_NEXT(la, long)); - add_opcode(sp, SPO_PUSH, ov); - break; - } - case 'M': /* monster */ - { - struct opvar *ov = New(struct opvar); - set_opvar_monst(ov, VA_NEXT(la, long)); - add_opcode(sp, SPO_PUSH, ov); - break; - } - case 'O': /* object */ - { - struct opvar *ov = New(struct opvar); - set_opvar_obj(ov, VA_NEXT(la, long)); - add_opcode(sp, SPO_PUSH, ov); - break; - } - case 's': /* string */ - { - struct opvar *ov = New(struct opvar); - set_opvar_str(ov, VA_NEXT(lp, const char *)); - add_opcode(sp, SPO_PUSH, ov); - break; - } - case 'v': /* variable */ - { - struct opvar *ov = New(struct opvar); - set_opvar_var(ov, VA_NEXT(lp, const char *)); - add_opcode(sp, SPO_PUSH, ov); - break; - } - case 'o': /* opcode */ - { - long i = VA_NEXT(la, int); - if (i < 0 || i >= MAX_SP_OPCODES) - lc_pline("add_opvars: unknown opcode '%ld'.", VA_PASS1(i)); - add_opcode(sp, i, NULL); - break; - } - default: - lc_pline("add_opvars: illegal format character '%ld'.", - VA_PASS1((long) *p)); - break; - } - } - -#if !(defined(USE_STDARG) || defined(USE_VARARGS)) - /* provide closing brace for USE_OLDARGS nested block from VA_DECL2() */ - VA_END(); -#endif -} - -void -break_stmt_start() -{ - allow_break_statements++; -} - -void -break_stmt_end(splev) -sp_lev *splev; -{ - struct lc_breakdef *tmp = break_list; - struct lc_breakdef *prv = NULL; - - while (tmp) { - if (tmp->break_depth == allow_break_statements) { - struct lc_breakdef *nxt = tmp->next; - set_opvar_int(tmp->breakpoint, - splev->n_opcodes - tmp->breakpoint->vardata.l - 1); - tmp->next = NULL; - Free(tmp); - if (!prv) - break_list = NULL; - else - prv->next = nxt; - tmp = nxt; - } else { - prv = tmp; - tmp = tmp->next; - } - } - allow_break_statements--; -} - -void -break_stmt_new(splev, i) -sp_lev *splev; -long i; -{ - struct lc_breakdef *tmp = New(struct lc_breakdef); - - tmp->breakpoint = New(struct opvar); - tmp->break_depth = allow_break_statements; - tmp->next = break_list; - break_list = tmp; - set_opvar_int(tmp->breakpoint, i); - add_opcode(splev, SPO_PUSH, tmp->breakpoint); - add_opcode(splev, SPO_JMP, NULL); -} - -struct lc_funcdefs * -funcdef_new(addr, name) -long addr; -char *name; -{ - struct lc_funcdefs *f = New(struct lc_funcdefs); - - if (!f) { - lc_error("Could not alloc function definition for '%s'.", - VA_PASS1(name)); - return NULL; - } - f->next = NULL; - f->addr = addr; - f->name = strdup(name); - f->n_called = 0; - f->n_params = 0; - f->params = NULL; - f->code.opcodes = NULL; - f->code.n_opcodes = 0; - return f; -} - -void -funcdef_free_all(fchain) -struct lc_funcdefs *fchain; -{ - struct lc_funcdefs *tmp = fchain; - struct lc_funcdefs *nxt; - struct lc_funcdefs_parm *tmpparam; - - while (tmp) { - nxt = tmp->next; - Free(tmp->name); - while (tmp->params) { - tmpparam = tmp->params->next; - Free(tmp->params->name); - tmp->params = tmpparam; - } - /* FIXME: free tmp->code */ - Free(tmp); - tmp = nxt; - } -} - -char * -funcdef_paramtypes(f) -struct lc_funcdefs *f; -{ - int i = 0; - struct lc_funcdefs_parm *fp = f->params; - char *tmp = (char *) alloc((f->n_params) + 1); - - if (!tmp) - return NULL; - while (fp) { - tmp[i++] = fp->parmtype; - fp = fp->next; - } - tmp[i] = '\0'; - return tmp; -} - -struct lc_funcdefs * -funcdef_defined(f, name, casesense) -struct lc_funcdefs *f; -char *name; -int casesense; -{ - while (f) { - if (casesense) { - if (!strcmp(name, f->name)) - return f; - } else { - if (!case_insensitive_comp(name, f->name)) - return f; - } - f = f->next; - } - return NULL; -} - -struct lc_vardefs * -vardef_new(typ, name) -long typ; -char *name; -{ - struct lc_vardefs *f = New(struct lc_vardefs); - - if (!f) { - lc_error("Could not alloc variable definition for '%s'.", - VA_PASS1(name)); - return NULL; - } - f->next = NULL; - f->var_type = typ; - f->name = strdup(name); - f->n_used = 0; - return f; -} - -void -vardef_free_all(fchain) -struct lc_vardefs *fchain; -{ - struct lc_vardefs *tmp = fchain; - struct lc_vardefs *nxt; - - while (tmp) { - if (be_verbose && (tmp->n_used == 0)) - lc_warning("Unused variable '%s'", VA_PASS1(tmp->name)); - nxt = tmp->next; - Free(tmp->name); - Free(tmp); - tmp = nxt; - } -} - -struct lc_vardefs * -vardef_defined(f, name, casesense) -struct lc_vardefs *f; -char *name; -int casesense; -{ - while (f) { - if (casesense) { - if (!strcmp(name, f->name)) - return f; - } else { - if (!case_insensitive_comp(name, f->name)) - return f; - } - f = f->next; - } - return NULL; -} - -const char * -spovar2str(spovar) -long spovar; -{ - static int togl = 0; - static char buf[2][128]; - const char *n = NULL; - int is_array = (spovar & SPOVAR_ARRAY); - - spovar &= ~SPOVAR_ARRAY; - switch (spovar) { - default: - lc_error("spovar2str(%ld)", VA_PASS1(spovar)); - break; - case SPOVAR_INT: - n = "integer"; - break; - case SPOVAR_STRING: - n = "string"; - break; - case SPOVAR_VARIABLE: - n = "variable"; - break; - case SPOVAR_COORD: - n = "coordinate"; - break; - case SPOVAR_REGION: - n = "region"; - break; - case SPOVAR_MAPCHAR: - n = "mapchar"; - break; - case SPOVAR_MONST: - n = "monster"; - break; - case SPOVAR_OBJ: - n = "object"; - break; - } - - togl = ((togl + 1) % 2); - - Sprintf(buf[togl], "%s%s", n, (is_array ? " array" : "")); - return buf[togl]; -} - -void -vardef_used(vd, varname) -struct lc_vardefs *vd; -char *varname; -{ - struct lc_vardefs *tmp; - - if ((tmp = vardef_defined(vd, varname, 1)) != 0) - tmp->n_used++; -} - -void -check_vardef_type(vd, varname, vartype) -struct lc_vardefs *vd; -char *varname; -long vartype; -{ - struct lc_vardefs *tmp; - - if ((tmp = vardef_defined(vd, varname, 1)) != 0) { - if (tmp->var_type != vartype) - lc_error("Trying to use variable '%s' as %s, when it is %s.", - VA_PASS3(varname, - spovar2str(vartype), - spovar2str(tmp->var_type))); - } else - lc_error("Variable '%s' not defined.", VA_PASS1(varname)); -} - -struct lc_vardefs * -add_vardef_type(vd, varname, vartype) -struct lc_vardefs *vd; -char *varname; -long vartype; -{ - struct lc_vardefs *tmp; - - if ((tmp = vardef_defined(vd, varname, 1)) != 0) { - if (tmp->var_type != vartype) - lc_error("Trying to redefine variable '%s' as %s, when it is %s.", - VA_PASS3(varname, - spovar2str(vartype), - spovar2str(tmp->var_type))); - } else { - tmp = vardef_new(vartype, varname); - tmp->next = vd; - return tmp; - } - return vd; -} - -int -reverse_jmp_opcode(opcode) -int opcode; -{ - switch (opcode) { - case SPO_JE: - return SPO_JNE; - case SPO_JNE: - return SPO_JE; - case SPO_JL: - return SPO_JGE; - case SPO_JG: - return SPO_JLE; - case SPO_JLE: - return SPO_JG; - case SPO_JGE: - return SPO_JL; - default: - lc_error("Cannot reverse comparison jmp opcode %ld.", - VA_PASS1((long) opcode)); - return SPO_NULL; - } -} - -/* basically copied from src/sp_lev.c */ -struct opvar * -opvar_clone(ov) -struct opvar *ov; -{ - if (ov) { - struct opvar *tmpov = (struct opvar *) alloc(sizeof(struct opvar)); - - if (!tmpov) { /* lint suppression */ - /*NOTREACHED*/ -#if 0 - /* not possible; alloc() never returns Null */ - panic("could not alloc opvar struct"); - /*NOTREACHED*/ -#endif - return (struct opvar *) 0; - } - switch (ov->spovartyp) { - case SPOVAR_COORD: - case SPOVAR_REGION: - case SPOVAR_MAPCHAR: - case SPOVAR_MONST: - case SPOVAR_OBJ: - case SPOVAR_INT: { - tmpov->spovartyp = ov->spovartyp; - tmpov->vardata.l = ov->vardata.l; - } break; - case SPOVAR_VARIABLE: - case SPOVAR_STRING: { - int len = strlen(ov->vardata.str); - tmpov->spovartyp = ov->spovartyp; - tmpov->vardata.str = (char *) alloc(len + 1); - (void) memcpy((genericptr_t) tmpov->vardata.str, - (genericptr_t) ov->vardata.str, len); - tmpov->vardata.str[len] = '\0'; - } break; - default: { - lc_error("Unknown opvar_clone value type (%ld)!", - VA_PASS1((long) ov->spovartyp)); - } /* default */ - } /* switch */ - return tmpov; - } - return (struct opvar *) 0; -} - -void -splev_add_from(splev, from_splev) -sp_lev *splev; -sp_lev *from_splev; -{ - int i; - - if (splev && from_splev) - for (i = 0; i < from_splev->n_opcodes; i++) - add_opcode(splev, from_splev->opcodes[i].opcode, - opvar_clone(from_splev->opcodes[i].opdat)); -} - -void -start_level_def(splev, ldfname) -sp_lev **splev; -char *ldfname; -{ - struct lc_funcdefs *f; - - if (index(ldfname, '.')) - lc_error("Invalid dot ('.') in level name '%s'.", VA_PASS1(ldfname)); - if ((int) strlen(ldfname) > 14) - lc_error("Level names limited to 14 characters ('%s').", - VA_PASS1(ldfname)); - f = function_definitions; - while (f) { - f->n_called = 0; - f = f->next; - } - *splev = (sp_lev *) alloc(sizeof(sp_lev)); - (*splev)->n_opcodes = 0; - (*splev)->opcodes = NULL; - - vardef_free_all(vardefs); - vardefs = NULL; -} - -/* - * Find the type of floor, knowing its char representation. - */ -int -get_floor_type(c) -char c; -{ - int val; - - SpinCursor(3); - val = what_map_char(c); - if (val == INVALID_TYPE) { - val = ERR; - yywarning("Invalid fill character in MAZE declaration"); - } - return val; -} - -/* - * Find the type of a room in the table, knowing its name. - */ -int -get_room_type(s) -char *s; -{ - register int i; - - SpinCursor(3); - for (i = 0; room_types[i].name; i++) - if (!strcmp(s, room_types[i].name)) - return ((int) room_types[i].type); - return ERR; -} - -/* - * Find the type of a trap in the table, knowing its name. - */ -int -get_trap_type(s) -char *s; -{ - register int i; - - SpinCursor(3); - for (i = 0; trap_types[i].name; i++) - if (!strcmp(s, trap_types[i].name)) - return trap_types[i].type; - return ERR; -} - -/* - * Find the index of a monster in the table, knowing its name. - */ -int -get_monster_id(s, c) -char *s; -char c; -{ - register int i, class; - - SpinCursor(3); - class = c ? def_char_to_monclass(c) : 0; - if (class == MAXMCLASSES) - return ERR; - - for (i = LOW_PM; i < NUMMONS; i++) - if (!class || class == mons[i].mlet) - if (!strcmp(s, mons[i].mname)) - return i; - /* didn't find it; lets try case insensitive search */ - for (i = LOW_PM; i < NUMMONS; i++) - if (!class || class == mons[i].mlet) - if (!case_insensitive_comp(s, mons[i].mname)) { - if (be_verbose) - lc_warning("Monster type \"%s\" matches \"%s\".", - VA_PASS2(s, mons[i].mname)); - return i; - } - return ERR; -} - -/* - * Find the index of an object in the table, knowing its name. - */ -int -get_object_id(s, c) -char *s; -char c; /* class */ -{ - int i, class; - const char *objname; - - SpinCursor(3); - class = (c > 0) ? def_char_to_objclass(c) : 0; - if (class == MAXOCLASSES) - return ERR; - - for (i = class ? g.bases[class] : 0; i < NUM_OBJECTS; i++) { - if (class && objects[i].oc_class != class) - break; - objname = obj_descr[i].oc_name; - if (objname && !strcmp(s, objname)) - return i; - } - for (i = class ? g.bases[class] : 0; i < NUM_OBJECTS; i++) { - if (class && objects[i].oc_class != class) - break; - objname = obj_descr[i].oc_name; - if (objname && !case_insensitive_comp(s, objname)) { - if (be_verbose) - lc_warning("Object type \"%s\" matches \"%s\".", - VA_PASS2(s, objname)); - return i; - } - } - return ERR; -} - -static void -init_obj_classes() -{ - int i, class, prev_class; - - prev_class = -1; - for (i = 0; i < NUM_OBJECTS; i++) { - class = objects[i].oc_class; - if (class != prev_class) { - g.bases[class] = i; - prev_class = class; - } - } -} - -/* - * Is the character 'c' a valid monster class ? - */ -boolean -check_monster_char(c) -char c; -{ - return (def_char_to_monclass(c) != MAXMCLASSES); -} - -/* - * Is the character 'c' a valid object class ? - */ -boolean -check_object_char(c) -char c; -{ - return (def_char_to_objclass(c) != MAXOCLASSES); -} - -/* - * Convert .des map letter into floor type. - */ -char -what_map_char(c) -char c; -{ - SpinCursor(3); - switch (c) { - case ' ': - return (STONE); - case '#': - return (CORR); - case '.': - return (ROOM); - case '-': - return (HWALL); - case '|': - return (VWALL); - case '+': - return (DOOR); - case 'A': - return (AIR); - case 'B': - return (CROSSWALL); /* hack: boundary location */ - case 'C': - return (CLOUD); - case 'S': - return (SDOOR); - case 'H': - return (SCORR); - case '{': - return (FOUNTAIN); - case '\\': - return (THRONE); - case 'K': - return (SINK); - case '}': - return (MOAT); - case 'P': - return (POOL); - case 'L': - return (LAVAPOOL); - case 'I': - return (ICE); - case 'W': - return (WATER); - case 'T': - return (TREE); - case 'F': - return (IRONBARS); /* Fe = iron */ - case 'x': - return (MAX_TYPE); /* "see-through" */ - } - return (INVALID_TYPE); -} - -void -add_opcode(sp, opc, dat) -sp_lev *sp; -int opc; -genericptr_t dat; -{ - long nop = sp->n_opcodes; - _opcode *tmp; - - if ((opc < 0) || (opc >= MAX_SP_OPCODES)) - lc_error("Unknown opcode '%ld'", VA_PASS1((long) opc)); - - tmp = (_opcode *) alloc(sizeof(_opcode) * (nop + 1)); - if (!tmp) { /* lint suppression */ - /*NOTREACHED*/ -#if 0 - /* not possible; alloc() never returns Null */ - lc_error("%s", VA_PASS1("Could not alloc opcode space")); -#endif - return; - } - - if (sp->opcodes && nop) { - (void) memcpy(tmp, sp->opcodes, sizeof(_opcode) * nop); - free(sp->opcodes); - } - sp->opcodes = tmp; - - sp->opcodes[nop].opcode = opc; - sp->opcodes[nop].opdat = dat; - - sp->n_opcodes++; -} - -/* - * Yep! LEX gives us the map in a raw mode. - * Just analyze it here. - */ -void -scan_map(map, sp) -char *map; -sp_lev *sp; -{ - register int i, len; - register char *s1, *s2; - int max_len = 0; - int max_hig = 0; - char *tmpmap[MAP_Y_LIM+1]; - int dx, dy; - char *mbuf; - - /* First, strip out digits 0-9 (line numbering) */ - for (s1 = s2 = map; *s1; s1++) - if (*s1 < '0' || *s1 > '9') - *s2++ = *s1; - *s2 = '\0'; - - /* Second, find the max width of the map */ - s1 = map; - while (s1 && *s1) { - s2 = index(s1, '\n'); - if (s2) { - len = (int) (s2 - s1); - s1 = s2 + 1; - } else { - len = (int) strlen(s1); - s1 = (char *) 0; - } - if (len > max_len) - max_len = len; - } - - /* Then parse it now */ - while (map && *map) { - if (max_hig > MAP_Y_LIM) - break; - tmpmap[max_hig] = (char *) alloc(max_len); - s1 = index(map, '\n'); - if (s1) { - len = (int) (s1 - map); - s1++; - } else { - len = (int) strlen(map); - s1 = map + len; - } - for (i = 0; i < len; i++) - if ((tmpmap[max_hig][i] = what_map_char(map[i])) - == INVALID_TYPE) { - lc_warning( - "Invalid character '%ld' @ (%ld, %ld) - replacing with stone", - VA_PASS3((long) map[i], (long) max_hig, (long) i)); - tmpmap[max_hig][i] = STONE; - } - while (i < max_len) - tmpmap[max_hig][i++] = STONE; - map = s1; - max_hig++; - } - - /* Memorize boundaries */ - - max_x_map = max_len - 1; - max_y_map = max_hig - 1; - - if (max_len > MAP_X_LIM || max_hig > MAP_Y_LIM) { - lc_error("Map too large at (%ld x %ld), max is (%ld x %ld)", - VA_PASS4((long) max_len, (long) max_hig, - (long) MAP_X_LIM, (long) MAP_Y_LIM)); - } - - mbuf = (char *) alloc(((max_hig - 1) * max_len) + (max_len - 1) + 2); - for (dy = 0; dy < max_hig; dy++) - for (dx = 0; dx < max_len; dx++) - mbuf[(dy * max_len) + dx] = (tmpmap[dy][dx] + 1); - - mbuf[((max_hig - 1) * max_len) + (max_len - 1) + 1] = '\0'; - - add_opvars(sp, "sllo", VA_PASS4(mbuf, (long) max_hig, (long) max_len, - SPO_MAP)); - - for (dy = 0; dy < max_hig; dy++) - Free(tmpmap[dy]); - Free(mbuf); -} - -/* - * Output some info common to all special levels. - */ -static boolean -write_common_data(fd) -int fd; -{ - static struct version_info version_data = { - VERSION_NUMBER, VERSION_FEATURES, VERSION_SANITY1, VERSION_SANITY2, - VERSION_SANITY3 - }; - - Write(fd, &version_data, sizeof version_data); - return TRUE; -} - -/* - * Here we write the sp_lev structure in the specified file (fd). - * Also, we have to free the memory allocated via alloc(). - */ -static boolean -write_maze(fd, maze) -int fd; -sp_lev *maze; -{ - int i; - - if (!write_common_data(fd)) - return FALSE; - - Write(fd, &(maze->n_opcodes), sizeof(maze->n_opcodes)); - - for (i = 0; i < maze->n_opcodes; i++) { - _opcode tmpo = maze->opcodes[i]; - - Write(fd, &(tmpo.opcode), sizeof(tmpo.opcode)); - - if (tmpo.opcode < SPO_NULL || tmpo.opcode >= MAX_SP_OPCODES) - panic("write_maze: unknown opcode (%d).", tmpo.opcode); - - if (tmpo.opcode == SPO_PUSH) { - genericptr_t opdat = tmpo.opdat; - if (opdat) { - struct opvar *ov = (struct opvar *) opdat; - int size; - Write(fd, &(ov->spovartyp), sizeof(ov->spovartyp)); - switch (ov->spovartyp) { - case SPOVAR_NULL: - break; - case SPOVAR_COORD: - case SPOVAR_REGION: - case SPOVAR_MAPCHAR: - case SPOVAR_MONST: - case SPOVAR_OBJ: - case SPOVAR_INT: - Write(fd, &(ov->vardata.l), sizeof(ov->vardata.l)); - break; - case SPOVAR_VARIABLE: - case SPOVAR_STRING: - if (ov->vardata.str) - size = strlen(ov->vardata.str); - else - size = 0; - Write(fd, &size, sizeof(size)); - if (size) { - Write(fd, ov->vardata.str, size); - Free(ov->vardata.str); - } - break; - default: - panic("write_maze: unknown data type (%d).", - ov->spovartyp); - } - } else - panic("write_maze: PUSH with no data."); - } else { - /* sanity check */ - genericptr_t opdat = tmpo.opdat; - if (opdat) - panic("write_maze: opcode (%d) has data.", tmpo.opcode); - } - - Free(tmpo.opdat); - } - /* clear the struct for next user */ - Free(maze->opcodes); - maze->opcodes = NULL; - /*(void) memset((genericptr_t) &maze->init_lev, 0, sizeof - * maze->init_lev);*/ - - return TRUE; -} - -/* - * Open and write maze or rooms file, based on which pointer is non-null. - * Return TRUE on success, FALSE on failure. - */ -boolean -write_level_file(filename, lvl) -char *filename; -sp_lev *lvl; -{ - int fout; - char lbuf[60]; - - lbuf[0] = '\0'; -#ifdef PREFIX - Strcat(lbuf, PREFIX); -#endif - Strcat(lbuf, filename); - Strcat(lbuf, LEV_EXT); - -#if defined(MAC) && (defined(__SC__) || defined(__MRC__)) - fout = open(lbuf, O_WRONLY | O_CREAT | O_BINARY); -#else - fout = open(lbuf, O_WRONLY | O_CREAT | O_BINARY, OMASK); -#endif - if (fout < 0) - return FALSE; - - if (!lvl) - panic("write_level_file"); - - if (be_verbose) - fprintf(stdout, "File: '%s', opcodes: %ld\n", lbuf, lvl->n_opcodes); - - if (!write_maze(fout, lvl)) - return FALSE; - - (void) close(fout); - - return TRUE; -} - -static int -case_insensitive_comp(s1, s2) -const char *s1; -const char *s2; -{ - uchar u1, u2; - - for (;; s1++, s2++) { - u1 = (uchar) *s1; - if (isupper(u1)) - u1 = tolower(u1); - u2 = (uchar) *s2; - if (isupper(u2)) - u2 = tolower(u2); - if (u1 == '\0' || u1 != u2) - break; - } - return u1 - u2; -} - -#ifdef STRICT_REF_DEF -/* - * Any globals declared in hack.h and descendents which aren't defined - * in the modules linked into lev_comp should be defined here. These - * definitions can be dummies: their sizes shouldn't matter as long as - * as their types are correct; actual values are irrelevant. - */ -#define ARBITRARY_SIZE 1 -/* attrib.c */ -struct attribs attrmax, attrmin; -/* files.c */ -const char *configfile; -/* termcap.c */ -struct tc_lcl_data tc_lcl_data; -#ifdef TEXTCOLOR -#ifdef TOS -const char *hilites[CLR_MAX]; -#else -char NEARDATA *hilites[CLR_MAX]; -#endif -#endif -/* trap.c */ -const char *traps[TRAPNUM]; -/* window.c */ -#ifdef HANGUPHANDLING -volatile -#endif - struct window_procs windowprocs; -/* xxxtty.c */ -#ifdef DEFINE_OSPEED -short ospeed; -#endif -#endif /* STRICT_REF_DEF */ - -/*lev_main.c*/ diff --git a/util/makedefs.c b/util/makedefs.c index 953fdddd1..d7c309cc3 100644 --- a/util/makedefs.c +++ b/util/makedefs.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 makedefs.c $NHDT-Date: 1562180226 2019/07/03 18:57:06 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.149 $ */ +/* NetHack 3.6 makedefs.c $NHDT-Date: 1575161967 2019/12/01 00:59:27 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.168 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */ /* Copyright (c) M. Stephenson, 1990, 1991. */ @@ -53,7 +53,7 @@ #endif #if defined(UNIX) && !defined(LINT) && !defined(GCC_WARN) -static const char SCCS_Id[] UNUSED = "@(#)makedefs.c\t3.6\t2019/05/07"; +static const char SCCS_Id[] UNUSED = "@(#)makedefs.c\t3.7\t2019/12/17"; #endif /* names of files to be generated */ @@ -69,8 +69,10 @@ static const char SCCS_Id[] UNUSED = "@(#)makedefs.c\t3.6\t2019/05/07"; #define DGN_I_FILE "dungeon.def" #define DGN_O_FILE "dungeon.pdf" #define MON_STR_C "monstr.c" +#if 0 #define QTXT_I_FILE "quest.txt" #define QTXT_O_FILE "quest.dat" +#endif #define VIS_TAB_H "vis_tab.h" #define VIS_TAB_C "vis_tab.c" #define GITINFO_FILE "gitinfo.txt" @@ -156,7 +158,6 @@ void FDECL(do_makedefs, (char *)); void NDECL(do_objs); void NDECL(do_data); void NDECL(do_dungeon); -void NDECL(do_date); void NDECL(do_options); void NDECL(do_monstr); void NDECL(do_permonst); @@ -164,6 +165,7 @@ void NDECL(do_questtxt); void NDECL(do_rumors); void NDECL(do_oracles); void NDECL(do_vision); +void NDECL(do_date); extern void NDECL(monst_globals_init); /* monst.c */ extern void NDECL(objects_globals_init); /* objects.c */ @@ -172,34 +174,14 @@ static char *FDECL(name_file, (const char *, const char *)); static void FDECL(delete_file, (const char *template, const char *)); static FILE *FDECL(getfp, (const char *, const char *, const char *)); static void FDECL(do_ext_makedefs, (int, char **)); - -static void NDECL(make_version); -static char *FDECL(version_string, (char *, const char *)); -static char *FDECL(version_id_string, (char *, const char *)); -static char *FDECL(bannerc_string, (char *, const char *)); static char *FDECL(xcrypt, (const char *)); static unsigned long FDECL(read_rumors_file, (const char *, int *, long *, unsigned long)); -static boolean FDECL(get_gitinfo, (char *, char *)); static void FDECL(do_rnd_access_file, (const char *)); static boolean FDECL(d_filter, (char *)); static boolean FDECL(h_filter, (char *)); -static void NDECL(build_savebones_compat_string); -static void NDECL(windowing_sanity); static void FDECL(opt_out_words, (char *, int *)); -static boolean FDECL(qt_comment, (char *)); -static boolean FDECL(qt_control, (char *)); -static int FDECL(get_hdr, (char *)); -static boolean FDECL(new_id, (char *)); -static boolean FDECL(known_msg, (int, int)); -static void FDECL(new_msg, (char *, int, int)); -static char *FDECL(valid_qt_summary, (char *, BOOLEAN_P)); -static void FDECL(do_qt_control, (char *)); -static void FDECL(do_qt_text, (char *)); -static void NDECL(adjust_qt_hdrs); -static void NDECL(put_qt_hdrs); - #ifdef VISION_TABLES static void NDECL(H_close_gen); static void NDECL(H_far_gen); @@ -211,8 +193,8 @@ static int FDECL(clear_path, (int, int, int, int)); static char *FDECL(fgetline, (FILE*)); static char *FDECL(tmpdup, (const char *)); static char *FDECL(limit, (char *, int)); -static char *FDECL(eos, (char *)); -static int FDECL(case_insensitive_comp, (const char *, const char *)); +static void NDECL(windowing_sanity); +static boolean FDECL(get_gitinfo, (char *, char *)); /* input, output, tmp */ static FILE *ifp, *ofp, *tfp; @@ -228,6 +210,15 @@ static boolean use_enum = extern unsigned _stklen = STKSIZ; #endif +/* + * Some of the routines in this source file were moved into .../src/mdlib + * to facilitate the use of a cross-compiler generation of some of the + * information for the target environment during the game compile portion + * under the cross-compiler and/or at runtime in some cases. + */ + +#include "../src/mdlib.c" + #ifdef MACsansMPWTOOL int main(void) @@ -295,7 +286,6 @@ char *argv[]; /*NOTREACHED*/ return 0; } - #endif void @@ -1069,180 +1059,10 @@ rumors_failure: exit(EXIT_FAILURE); } -/* - * Use this to explicitly mask out features during version checks. - * - * ZEROCOMP, RLECOMP, and ZLIB_COMP describe compression features - * that the port/plaform which wrote the savefile was capable of - * dealing with. Don't reject a savefile just because the port - * reading the savefile doesn't match on all/some of them. - * The actual compression features used to produce the savefile are - * recorded in the savefile_info structure immediately following the - * version_info, and that is what needs to be checked against the - * feature set of the port that is reading the savefile back in. - * That check is done in src/restore.c now. - * - */ -#define IGNORED_FEATURES \ - (0L | (1L << 19) /* SCORE_ON_BOTL */ \ - | (1L << 27) /* ZEROCOMP */ \ - | (1L << 28) /* RLECOMP */ \ - ) - -static void -make_version() -{ - register int i; - - /* - * integer version number - */ - version.incarnation = ((unsigned long) VERSION_MAJOR << 24) - | ((unsigned long) VERSION_MINOR << 16) - | ((unsigned long) PATCHLEVEL << 8) - | ((unsigned long) EDITLEVEL); - /* - * encoded feature list - * Note: if any of these magic numbers are changed or reassigned, - * EDITLEVEL in patchlevel.h should be incremented at the same time. - * The actual values have no special meaning, and the category - * groupings are just for convenience. - */ - version.feature_set = (unsigned long) (0L -/* levels and/or topology (0..4) */ -/* monsters (5..9) */ -#ifdef MAIL - | (1L << 6) -#endif -/* objects (10..14) */ -/* flag bits and/or other global variables (15..26) */ -#ifdef TEXTCOLOR - | (1L << 17) -#endif -#ifdef INSURANCE - | (1L << 18) -#endif -#ifdef SCORE_ON_BOTL - | (1L << 19) -#endif -/* data format (27..31) - * External compression methods such as COMPRESS and ZLIB_COMP - * do not affect the contents and are thus excluded from here */ -#ifdef ZEROCOMP - | (1L << 27) -#endif -#ifdef RLECOMP - | (1L << 28) -#endif - ); - /* - * Value used for object & monster sanity check. - * (NROFARTIFACTS<<24) | (NUM_OBJECTS<<12) | (NUMMONS<<0) - */ - for (i = 1; artifact_names[i]; i++) - continue; - version.entity_count = (unsigned long) (i - 1); - for (i = 1; objects[i].oc_class != ILLOBJ_CLASS; i++) - continue; - version.entity_count = (version.entity_count << 12) | (unsigned long) i; - for (i = 0; mons[i].mlet; i++) - continue; - version.entity_count = (version.entity_count << 12) | (unsigned long) i; - /* - * Value used for compiler (word size/field alignment/padding) check. - */ - version.struct_sizes1 = - (((unsigned long) sizeof(struct context_info) << 24) - | ((unsigned long) sizeof(struct obj) << 17) - | ((unsigned long) sizeof(struct monst) << 10) - | ((unsigned long) sizeof(struct you))); - version.struct_sizes2 = (((unsigned long) sizeof(struct flag) << 10) | -/* free bits in here */ -#ifdef SYSFLAGS - ((unsigned long) sizeof(struct sysflag))); +#if (NH_DEVEL_STATUS == NH_STATUS_WIP) #else - ((unsigned long) 0L)); + Strcat(subbuf, " post-release"); #endif - return; -} - -/* REPRODUCIBLE_BUILD will change this to TRUE */ -static boolean date_via_env = FALSE; - -static char * -version_string(outbuf, delim) -char *outbuf; -const char *delim; -{ - Sprintf(outbuf, "%d%s%d%s%d", VERSION_MAJOR, delim, VERSION_MINOR, delim, - PATCHLEVEL); -#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) - Sprintf(eos(outbuf), "-%d", EDITLEVEL); -#endif - return outbuf; -} - -static char * -version_id_string(outbuf, build_date) -char *outbuf; -const char *build_date; -{ - char subbuf[64], versbuf[64]; - char betabuf[64]; - -#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) -#if (NH_DEVEL_STATUS == NH_STATUS_BETA) - Strcpy(betabuf, " Beta"); -#else - Strcpy(betabuf, " Work-in-progress"); -#endif -#else - betabuf[0] = '\0'; -#endif - - subbuf[0] = '\0'; -#ifdef PORT_SUB_ID - subbuf[0] = ' '; - Strcpy(&subbuf[1], PORT_SUB_ID); -#endif - - Sprintf(outbuf, "%s NetHack%s Version %s%s - last %s %s.", PORT_ID, - subbuf, version_string(versbuf, "."), betabuf, - date_via_env ? "revision" : "build", build_date); - return outbuf; -} - -static char * -bannerc_string(outbuf, build_date) -char *outbuf; -const char *build_date; -{ - char subbuf[64], versbuf[64]; - - subbuf[0] = '\0'; -#ifdef PORT_SUB_ID - subbuf[0] = ' '; - Strcpy(&subbuf[1], PORT_SUB_ID); -#endif -#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) -#if (NH_DEVEL_STATUS == NH_STATUS_BETA) - Strcat(subbuf, " Beta"); -#else - Strcat(subbuf, " Work-in-progress"); -#endif -#endif - - Sprintf(outbuf, " Version %s %s%s, %s %s.", - version_string(versbuf, "."), PORT_ID, subbuf, - date_via_env ? "revised" : "built", &build_date[4]); -#if 0 - Sprintf(outbuf, "%s NetHack%s %s Copyright 1985-%s (built %s)", - PORT_ID, subbuf, version_string(versbuf,"."), RELEASE_YEAR, - &build_date[4]); -#endif - return outbuf; -} - void do_date() { @@ -1254,6 +1074,13 @@ do_date() char githash[BUFSZ], gitbranch[BUFSZ]; char *c, cbuf[60], buf[BUFSZ]; const char *ul_sfx; +#if defined(CROSSCOMPILE) && defined(CROSSCOMPILE_HOST) + int steps = 0; + const char ind[] = " "; + const char *xpref = "HOST_"; +#else + const char *xpref = (const char *) 0; +#endif /* CROSSCOMPILE && CROSSCOMPILE_HOST */ /* before creating date.h, make sure that xxx_GRAPHICS and DEFAULT_WINDOW_SYS have been set up in a viable fashion */ @@ -1345,7 +1172,7 @@ do_date() #else /* ordinary build: use current date+time */ Strcpy(cbuf, ctime(&clocktim)); -#endif +#endif /* REPRODUCIBLE_BUILD */ if ((c = index(cbuf, '\n')) != 0) *c = '\0'; /* strip off the '\n' */ @@ -1354,6 +1181,11 @@ do_date() #else ul_sfx = "L"; #endif + +#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_HOST) + Fprintf(ofp, + "\n#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_HOST)\n"); +#endif /* CROSSCOMPILE || CROSSCOMPILE_HOST */ if (date_via_env) Fprintf(ofp, "#define SOURCE_DATE_EPOCH (%lu%s) /* via getenv() */\n", (unsigned long) clocktim, ul_sfx); @@ -1368,9 +1200,9 @@ do_date() ul_sfx); Fprintf(ofp, "#define VERSION_FEATURES 0x%08lx%s\n", version.feature_set, ul_sfx); -#ifdef IGNORED_FEATURES +#ifdef MD_IGNORED_FEATURES Fprintf(ofp, "#define IGNORED_FEATURES 0x%08lx%s\n", - (unsigned long) IGNORED_FEATURES, ul_sfx); + (unsigned long) MD_IGNORED_FEATURES, ul_sfx); #endif Fprintf(ofp, "#define VERSION_SANITY1 0x%08lx%s\n", version.entity_count, ul_sfx); @@ -1384,11 +1216,19 @@ do_date() version_id_string(buf, cbuf)); Fprintf(ofp, "#define COPYRIGHT_BANNER_C \\\n \"%s\"\n", bannerc_string(buf, cbuf)); - Fprintf(ofp, "\n"); if (get_gitinfo(githash, gitbranch)) { Fprintf(ofp, "#define NETHACK_GIT_SHA \"%s\"\n", githash); Fprintf(ofp, "#define NETHACK_GIT_BRANCH \"%s\"\n", gitbranch); } + if (xpref && get_gitinfo(githash, gitbranch)) { + Fprintf(ofp, "#else /* !CROSSCOMPILE || CROSSCOMPILE_HOST */\n"); + Fprintf(ofp, "#define NETHACK_%sGIT_SHA \"%s\"\n", + xpref, githash); + Fprintf(ofp, "#define NETHACK_%sGIT_BRANCH \"%s\"\n", + xpref, gitbranch); + } + Fprintf(ofp, "#endif /* !CROSSCOMPILE || CROSSCOMPILE_HOST */\n"); + Fprintf(ofp, "\n"); #ifdef AMIGA { struct tm *tm = localtime((time_t *) &clocktim); @@ -1445,11 +1285,13 @@ char *githash, *gitbranch; *end = '\0'; len = strlen(opt); - if ((len >= strlen("gitbranch")) && !case_insensitive_comp(opt, "gitbranch")) { + if ((len >= strlen("gitbranch")) + && !case_insensitive_comp(opt, "gitbranch")) { Strcpy(gitbranch, strval); havebranch = TRUE; } - if ((len >= strlen("githash")) && !case_insensitive_comp(opt, "githash")) { + if ((len >= strlen("githash")) + && !case_insensitive_comp(opt, "githash")) { Strcpy(githash, strval); havehash = TRUE; } @@ -1462,281 +1304,28 @@ char *githash, *gitbranch; return FALSE; } -static int -case_insensitive_comp(s1, s2) -const char *s1; -const char *s2; +void +do_options() { - uchar u1, u2; + const char *optline; + int infocontext = 0; - for (;; s1++, s2++) { - u1 = (uchar) *s1; - if (isupper(u1)) - u1 = tolower(u1); - u2 = (uchar) *s2; - if (isupper(u2)) - u2 = tolower(u2); - if (u1 == '\0' || u1 != u2) - break; + windowing_sanity(); + filename[0] = '\0'; +#ifdef FILE_PREFIX + Strcat(filename, file_prefix); +#endif + Sprintf(eos(filename), DATA_TEMPLATE, OPTIONS_FILE); + if (!(ofp = fopen(filename, WRTMODE))) { + perror(filename); + exit(EXIT_FAILURE); } - return u1 - u2; + while ((optline = do_runtime_info(&infocontext)) != 0) + Fprintf(ofp, "%s\n", optline); + Fclose(ofp); + return; } -static char save_bones_compat_buf[BUFSZ]; - -static void -build_savebones_compat_string() -{ -#ifdef VERSION_COMPATIBILITY - unsigned long uver = VERSION_COMPATIBILITY; -#endif - Strcpy(save_bones_compat_buf, - "save and bones files accepted from version"); -#ifdef VERSION_COMPATIBILITY - Sprintf(eos(save_bones_compat_buf), "s %lu.%lu.%lu through %d.%d.%d", - ((uver & 0xFF000000L) >> 24), ((uver & 0x00FF0000L) >> 16), - ((uver & 0x0000FF00L) >> 8), VERSION_MAJOR, VERSION_MINOR, - PATCHLEVEL); -#else - Sprintf(eos(save_bones_compat_buf), " %d.%d.%d only", VERSION_MAJOR, - VERSION_MINOR, PATCHLEVEL); -#endif -} - -static const char *build_opts[] = { -#ifdef AMIGA_WBENCH - "Amiga WorkBench support", -#endif -#ifdef ANSI_DEFAULT - "ANSI default terminal", -#endif -#ifdef TEXTCOLOR - "color", -#endif -#ifdef TTY_GRAPHICS -#ifdef TTY_TILES_ESCCODES - "console escape codes for tile hinting", -#endif -#endif -#ifdef COM_COMPL - "command line completion", -#endif -#ifdef LIFE - "Conway's Game of Life", -#endif -#ifdef COMPRESS - "data file compression", -#endif -#ifdef ZLIB_COMP - "ZLIB data file compression", -#endif -#ifdef DLB -#ifndef VERSION_IN_DLB_FILENAME - "data librarian", -#else - "data librarian with a version-dependent name", -#endif -#endif -#ifdef DUMPLOG - "end-of-game dumplogs", -#endif -#ifdef HOLD_LOCKFILE_OPEN - "exclusive lock on level 0 file", -#endif -#if defined(MSGHANDLER) && (defined(POSIX_TYPES) || defined(__GNUC__)) - "external program as a message handler", -#endif -#ifdef MFLOPPY - "floppy drive support", -#endif -#ifdef INSURANCE - "insurance files for recovering from crashes", -#endif -#ifdef LOGFILE - "log file", -#endif -#ifdef XLOGFILE - "extended log file", -#endif -#ifdef PANICLOG - "errors and warnings log file", -#endif -#ifdef MAIL - "mail daemon", -#endif -#ifdef GNUDOS - "MSDOS protected mode", -#endif -#ifdef NEWS - "news file", -#endif -#ifdef OVERLAY -#ifdef MOVERLAY - "MOVE overlays", -#else -#ifdef VROOMM - "VROOMM overlays", -#else - "overlays", -#endif -#endif -#endif - /* pattern matching method will be substituted by nethack at run time */ - "pattern matching via :PATMATCH:", -#ifdef USE_ISAAC64 - "pseudo random numbers generated by ISAAC64", -#ifdef DEV_RANDOM -#ifdef NHSTDC - /* include which specific one */ - "strong PRNG seed available from " DEV_RANDOM, -#else - "strong PRNG seed available from DEV_RANDOM", -#endif -#else -#ifdef WIN32 - "strong PRNG seed available from CNG BCryptGenRandom()", -#endif -#endif /* DEV_RANDOM */ -#else /* ISAAC64 */ -#ifdef RANDOM - "pseudo random numbers generated by random()", -#else - "pseudo random numbers generated by C rand()", -#endif -#endif -#ifdef SELECTSAVED - "restore saved games via menu", -#endif -#ifdef SCORE_ON_BOTL - "score on status line", -#endif -#ifdef CLIPPING - "screen clipping", -#endif -#ifdef NO_TERMS -#ifdef MAC - "screen control via mactty", -#endif -#ifdef SCREEN_BIOS - "screen control via BIOS", -#endif -#ifdef SCREEN_DJGPPFAST - "screen control via DJGPP fast", -#endif -#ifdef SCREEN_VGA - "screen control via VGA graphics", -#endif -#ifdef WIN32CON - "screen control via WIN32 console I/O", -#endif -#endif -#ifdef SHELL - "shell command", -#endif - "traditional status display", -#ifdef STATUS_HILITES - "status via windowport with highlighting", -#else - "status via windowport without highlighting", -#endif -#ifdef SUSPEND - "suspend command", -#endif -#ifdef TTY_GRAPHICS -#ifdef TERMINFO - "terminal info library", -#else -#if defined(TERMLIB) || (!defined(MICRO) && !defined(WIN32)) - "terminal capability library", -#endif -#endif -#endif /*TTY_GRAPHICS*/ -/*#ifdef X11_GRAPHICS*/ -#ifdef USE_XPM - "tiles file in XPM format", -#endif -/*#endif*/ -/*#if (defined(QT_GRAPHICS) || defined(X11_GRAPHICS)*/ -#ifdef GRAPHIC_TOMBSTONE - "graphical RIP screen", -#endif -/*#endif*/ -#ifdef TIMED_DELAY - "timed wait for display effects", -#endif -#ifdef USER_SOUNDS - "user sounds", -#endif -#ifdef PREFIXES_IN_USE - "variable playground", -#endif -#ifdef VISION_TABLES - "vision tables", -#endif -#ifdef ZEROCOMP - "zero-compressed save files", -#endif -#ifdef RLECOMP - "run-length compression of map in save files", -#endif -#ifdef SYSCF - "system configuration at run-time", -#endif - save_bones_compat_buf, - "and basic NetHack features" -}; - -struct win_info { - const char *id, /* DEFAULT_WINDOW_SYS string */ - *name; /* description, often same as id */ -}; -static struct win_info window_opts[] = { -#ifdef TTY_GRAPHICS - { "tty", - /* testing 'USE_TILES' here would bring confusion because it could - apply to another interface such as X11, so check MSDOS explicitly - instead; even checking TTY_TILES_ESCCODES would probably be - confusing to most users (and it will already be listed separately - in the compiled options section so users aware of it can find it) */ -#ifdef MSDOS - "traditional text with optional 'tiles' graphics" -#else - /* assume that one or more of IBMgraphics, DECgraphics, or MACgraphics - can be enabled; we can't tell from here whether that is accurate */ - "traditional text with optional line-drawing" -#endif - }, -#endif -#ifdef CURSES_GRAPHICS - { "curses", "terminal-based graphics" }, -#endif -#ifdef X11_GRAPHICS - { "X11", "X11" }, -#endif -#ifdef QT_GRAPHICS /* too vague; there are multiple incompatible versions */ - { "Qt", "Qt" }, -#endif -#ifdef GNOME_GRAPHICS /* unmaintained/defunct */ - { "Gnome", "Gnome" }, -#endif -#ifdef MAC /* defunct OS 9 interface */ - { "mac", "Mac" }, -#endif -#ifdef AMIGA_INTUITION /* unmaintained/defunct */ - { "amii", "Amiga Intuition" }, -#endif -#ifdef GEM_GRAPHICS /* defunct Atari interface */ - { "Gem", "Gem" }, -#endif -#ifdef MSWIN_GRAPHICS /* win32 */ - { "mswin", "mswin" }, -#endif -#ifdef BEOS_GRAPHICS /* unmaintained/defunct */ - { "BeOS", "BeOS InterfaceKit" }, -#endif - { 0, 0 } -}; - static void windowing_sanity() { @@ -1776,107 +1365,10 @@ windowing_sanity() #endif /*DEFAULT_WINDOW_SYS*/ } -static const char opt_indent[] = " "; - -static void -opt_out_words(str, length_p) -char *str; /* input, but modified during processing */ -int *length_p; /* in/out */ -{ - char *word; - - while (*str) { - word = index(str, ' '); -#if 0 - /* treat " (" as unbreakable space */ - if (word && *(word + 1) == '(') - word = index(word + 1, ' '); -#endif - if (word) - *word = '\0'; - if (*length_p + (int) strlen(str) > COLNO - 5) - Fprintf(ofp, "\n%s", opt_indent), - *length_p = (int) strlen(opt_indent); - else - Fprintf(ofp, " "), (*length_p)++; - Fprintf(ofp, "%s", str), *length_p += (int) strlen(str); - str += strlen(str) + (word ? 1 : 0); - } -} - -void -do_options() -{ - char buf[BUFSZ]; - int i, length, winsyscnt; - - windowing_sanity(); - - filename[0] = '\0'; -#ifdef FILE_PREFIX - Strcat(filename, file_prefix); -#endif - Sprintf(eos(filename), DATA_TEMPLATE, OPTIONS_FILE); - if (!(ofp = fopen(filename, WRTMODE))) { - perror(filename); - exit(EXIT_FAILURE); - } - - build_savebones_compat_string(); - Fprintf(ofp, "\n%sNetHack version %d.%d.%d%s\n", - opt_indent, - VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL, -#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) -#if (NH_DEVEL_STATUS == NH_STATUS_BETA) - " [beta]" +#if (NH_DEVEL_STATUS == NH_STATUS_WIP) #else - " [work-in-progress]" + " [post-release]" #endif -#else - "" -#endif - ); - - Fprintf(ofp, "\nOptions compiled into this edition:\n"); - length = COLNO + 1; /* force 1st item onto new line */ - for (i = 0; i < SIZE(build_opts); i++) { - opt_out_words(strcat(strcpy(buf, build_opts[i]), - (i < SIZE(build_opts) - 1) ? "," : "."), - &length); - } - Fprintf(ofp, "\n"); /* terminate last line of words */ - - winsyscnt = SIZE(window_opts) - 1; - Fprintf(ofp, "\nSupported windowing system%s:\n", - (winsyscnt > 1) ? "s" : ""); - length = COLNO + 1; /* force 1st item onto new line */ - for (i = 0; i < winsyscnt; i++) { - Sprintf(buf, "\"%s\"", window_opts[i].id); - if (strcmp(window_opts[i].name, window_opts[i].id)) - Sprintf(eos(buf), " (%s)", window_opts[i].name); - /* - * 1 : foo. - * 2 : foo and bar (note no period; comes from 'with default' below) - * 3+: for, bar, and quux - */ - opt_out_words(strcat(buf, (winsyscnt == 1) ? "." /* no 'default' */ - : (winsyscnt == 2 && i == 0) ? " and" - : (i == winsyscnt - 2) ? ", and" - : ","), - &length); - } - if (winsyscnt > 1) { - Sprintf(buf, "with a default of \"%s\".", DEFAULT_WINDOW_SYS); - opt_out_words(buf, &length); - } - Fprintf(ofp, "\n"); /* terminate last line of words */ - - /* end with a blank line */ - Fprintf(ofp, "\n"); - Fclose(ofp); - return; -} - /* routine to decide whether to discard something from data.base */ static boolean d_filter(line) @@ -2376,347 +1868,15 @@ do_permonst() } /* Start of Quest text file processing. */ -#include "qtext.h" - -static struct qthdr qt_hdr; -static struct msghdr msg_hdr[N_HDR]; -static struct qtmsg *curr_msg; - -static int qt_line; - -static boolean in_msg; -#define NO_MSG 1 /* strlen of a null line returned by fgets() */ - -static boolean -qt_comment(s) -char *s; -{ - if (s[0] == '#') - return TRUE; - return (boolean) (!in_msg && strlen(s) == NO_MSG); -} - -static boolean -qt_control(s) -char *s; -{ - return (boolean) (s[0] == '%' && (s[1] == 'C' || s[1] == 'E')); -} - -static int -get_hdr(code) -char *code; -{ - int i; - - for (i = 0; i < qt_hdr.n_hdr; i++) - if (!strncmp(code, qt_hdr.id[i], LEN_HDR)) - return ++i; - - return 0; -} - -static boolean -new_id(code) -char *code; -{ - if (qt_hdr.n_hdr >= N_HDR) { - Fprintf(stderr, OUT_OF_HEADERS, qt_line); - return FALSE; - } - - strncpy(&qt_hdr.id[qt_hdr.n_hdr][0], code, LEN_HDR); - msg_hdr[qt_hdr.n_hdr].n_msg = 0; - qt_hdr.offset[qt_hdr.n_hdr++] = 0L; - return TRUE; -} - -static boolean -known_msg(num, id) -int num, id; -{ - int i; - - for (i = 0; i < msg_hdr[num].n_msg; i++) - if (msg_hdr[num].qt_msg[i].msgnum == id) - return TRUE; - - return FALSE; -} - -static void -new_msg(s, num, id) -char *s; -int num, id; -{ - struct qtmsg *qt_msg; - - if (msg_hdr[num].n_msg >= N_MSG) { - Fprintf(stderr, OUT_OF_MESSAGES, qt_line); - } else { - qt_msg = &(msg_hdr[num].qt_msg[msg_hdr[num].n_msg++]); - qt_msg->msgnum = id; - qt_msg->delivery = s[2]; - qt_msg->offset = qt_msg->size = qt_msg->summary_size = 0L; - - curr_msg = qt_msg; - } -} - -/* check %E record for "[summary text]" that nethack can stuff into the - message history buffer when delivering text via window instead of pline */ -static char * -valid_qt_summary(s, parsing) -char *s; /* end record: "%E" optionally followed by " [summary]" */ -boolean parsing; /* curr_msg is valid iff this is True */ -{ - static char summary[BUFSZ]; - char *p; - - if (*s != '%' || *(s + 1) != 'E') - return (char *) 0; - if ((p = index(s, '[')) == 0) - return (char *) 0; - /* note: opening '[' and closing ']' will be retained in the output; - anything after ']' will be discarded by putting a newline there */ - Strcpy(summary, p); - - /* have an opening bracket; summary[] holds it and all text that follows - */ - p = eos(summary); - /* find closing bracket */ - while (p > summary && *(p - 1) != ']') - --p; - - if (p == summary) { - /* we backed up all the way to the start without finding a bracket */ - if (parsing) /* malformed summary */ - Fprintf(stderr, MAL_SUM, qt_line); - } else if (p == summary + 1) { - ; /* ignore empty [] */ - } else { /* got something */ - /* p points one spot past ']', usually to '\n'; - we need to include the \n as part of the size */ - if (parsing) { - /* during the writing pass we won't be able to recheck - delivery, so any useless summary for a pline mode - message has to be carried along to the output file */ - if (curr_msg->delivery == 'p') - Fprintf(stderr, DUMB_SUM, qt_line); - /* +1 is for terminating newline */ - curr_msg->summary_size = (long) (p - summary) + 1L; - } else { - /* caller is writing rather than just parsing; - force newline after the closing bracket */ - Strcpy(p, "\n"); - } - return summary; - } - return (char *) 0; -} - -static void -do_qt_control(s) -char *s; -{ - char code[BUFSZ]; - int num, id = 0; - - if (!index(s, '\n')) - Fprintf(stderr, CTRL_TRUNC, qt_line); - - switch (s[1]) { - case 'C': - if (in_msg) { - Fprintf(stderr, CREC_IN_MSG, qt_line); - break; - } else { - in_msg = TRUE; - if (sscanf(&s[4], "%s %5d", code, &id) != 2) { - Fprintf(stderr, UNREC_CREC, qt_line); - break; - } - num = get_hdr(code); - if (!num && !new_id(code)) - break; - num = get_hdr(code) - 1; - if (known_msg(num, id)) - Fprintf(stderr, DUP_MSG, qt_line); - else - new_msg(s, num, id); - } - break; - - case 'E': - if (!in_msg) { - Fprintf(stderr, END_NOT_IN_MSG, qt_line); - } else { - /* sets curr_msg->summary_size if applicable */ - (void) valid_qt_summary(s, TRUE); - in_msg = FALSE; - } - break; - - default: - Fprintf(stderr, UNREC_CREC, qt_line); - break; - } -} - -static void -do_qt_text(s) -char *s; -{ - if (!in_msg) { - Fprintf(stderr, TEXT_NOT_IN_MSG, qt_line); - } else if (!index(s, '\n')) { - Fprintf(stderr, TEXT_TRUNC, qt_line); - } - - curr_msg->size += strlen(s); - return; -} - -static void -adjust_qt_hdrs() -{ - int i, j; - long count = 0L, hdr_offset = sizeof(int) - + (sizeof(char) * LEN_HDR + sizeof(long)) - * qt_hdr.n_hdr; - - for (i = 0; i < qt_hdr.n_hdr; i++) { - qt_hdr.offset[i] = hdr_offset; - hdr_offset += sizeof(int) + sizeof(struct qtmsg) * msg_hdr[i].n_msg; - } - - for (i = 0; i < qt_hdr.n_hdr; i++) - for (j = 0; j < msg_hdr[i].n_msg; j++) { - msg_hdr[i].qt_msg[j].offset = hdr_offset + count; - count += - msg_hdr[i].qt_msg[j].size + msg_hdr[i].qt_msg[j].summary_size; - } - return; -} - -static void -put_qt_hdrs() -{ - int i; - - /* - * The main header record. - */ - if (debug) - Fprintf(stderr, "%ld: header info.\n", ftell(ofp)); - (void) fwrite((genericptr_t) & (qt_hdr.n_hdr), sizeof(int), 1, ofp); - (void) fwrite((genericptr_t) & (qt_hdr.id[0][0]), sizeof(char) * LEN_HDR, - qt_hdr.n_hdr, ofp); - (void) fwrite((genericptr_t) & (qt_hdr.offset[0]), sizeof(long), - qt_hdr.n_hdr, ofp); - if (debug) { - for (i = 0; i < qt_hdr.n_hdr; i++) - Fprintf(stderr, "%s @ %ld, ", qt_hdr.id[i], qt_hdr.offset[i]); - Fprintf(stderr, "\n"); - } - - /* - * The individual class headers. - */ - for (i = 0; i < qt_hdr.n_hdr; i++) { - if (debug) - Fprintf(stderr, "%ld: %s header info.\n", ftell(ofp), - qt_hdr.id[i]); - (void) fwrite((genericptr_t) & (msg_hdr[i].n_msg), sizeof(int), 1, - ofp); - (void) fwrite((genericptr_t) & (msg_hdr[i].qt_msg[0]), - sizeof(struct qtmsg), msg_hdr[i].n_msg, ofp); - if (debug) { - int j; - - for (j = 0; j < msg_hdr[i].n_msg; j++) { - Fprintf(stderr, "msg %d @ %ld (%ld)", - msg_hdr[i].qt_msg[j].msgnum, - msg_hdr[i].qt_msg[j].offset, - msg_hdr[i].qt_msg[j].size); - if (msg_hdr[i].qt_msg[j].summary_size) - Fprintf(stderr, " [%ld]", - msg_hdr[i].qt_msg[j].summary_size); - Fprintf(stderr, "\n"); - } - } - } -} void do_questtxt() { - char *line; + printf("DEPRECATION WARNINGS:\n"); + printf("'makedefs -q' is no longer required. Remove all references\n"); + printf(" to it from the build process.\n"); + printf("'dat/quest.txt' is no longer part of the source tree.\n"); - Sprintf(filename, DATA_IN_TEMPLATE, QTXT_I_FILE); - if (!(ifp = fopen(filename, RDTMODE))) { - perror(filename); - exit(EXIT_FAILURE); - } - - filename[0] = '\0'; -#ifdef FILE_PREFIX - Strcat(filename, file_prefix); -#endif - Sprintf(eos(filename), DATA_TEMPLATE, QTXT_O_FILE); - if (!(ofp = fopen(filename, WRBMODE))) { - perror(filename); - Fclose(ifp); - exit(EXIT_FAILURE); - } - - qt_hdr.n_hdr = 0; - qt_line = 0; - in_msg = FALSE; - - while ((line = fgetline(ifp)) != 0) { - SpinCursor(3); - - qt_line++; - if (qt_control(line)) - do_qt_control(line); - else if (qt_comment(line)) { - free(line); - continue; - } else - do_qt_text(line); - free(line); - } - - (void) rewind(ifp); - in_msg = FALSE; - adjust_qt_hdrs(); - put_qt_hdrs(); - while ((line = fgetline(ifp)) != 0) { - if (qt_control(line)) { - char *summary_p = 0; - - in_msg = (line[1] == 'C'); - if (!in_msg) - summary_p = valid_qt_summary(line, FALSE); - /* don't write anything unless we've got a summary */ - if (!summary_p) { - free(line); - continue; - } - /* we have summary text; replace raw %E record with it */ - Strcpy(line, summary_p); /* (guaranteed to fit) */ - } else if (qt_comment(line)) { - free(line); - continue; - } - if (debug) - Fprintf(stderr, "%ld: %s", ftell(stdout), line); - (void) fputs(xcrypt(line), ofp); - free(line); - } - Fclose(ifp); - Fclose(ofp); return; } @@ -2904,15 +2064,6 @@ const char *str; return buf; } -static char * -eos(str) -char *str; -{ - while (*str) - str++; - return str; -} - /* * macro used to control vision algorithms: * VISION_TABLES => generate tables diff --git a/util/readtags.c b/util/readtags.c deleted file mode 100644 index 4f730b43d..000000000 --- a/util/readtags.c +++ /dev/null @@ -1,1620 +0,0 @@ -/* NetHack 3.6 readtags.c $Date$ $Revision$ */ -/* Copyright (c) Michael Allison, 2018 */ -/* NetHack may be freely redistributed. See license for details. */ - -/* - * Read the given ctags file and generate: - * Intermediate temp files: - * include/sfo_proto.tmp - * include/sfi_proto.tmp - * src/sfi_data.tmp - * src/sfo_data.tmp - * Final files: - * sfdata.c - * sfproto.h - * - */ - -#include "hack.h" -#include "lev.h" -#include "integer.h" -#include "wintype.h" -#include -#include -#include - -#ifdef __GNUC__ -#define strncmpi strncasecmp -#endif - -/* version information */ -#ifdef SHORT_FILENAMES -#include "patchlev.h" -#else -#include "patchlevel.h" -#endif - -#define NHTYPE_SIMPLE 1 -#define NHTYPE_COMPLEX 2 -struct nhdatatypes_t { - unsigned int dtclass; - char *dtype; - size_t dtsize; -}; - -struct tagstruct { - int linenum; - char ptr[128]; - char tag[100]; - char filename[128]; - char searchtext[255]; - char tagtype; - char parent[100]; - char parenttype[100]; - char arraysize1[100]; - char arraysize2[100]; - struct tagstruct *next; -}; - -struct needs_array_handling { - const char *nm; - const char *parent; -}; - -#define SFO_DATA c_sfodata -#define SFI_DATA c_sfidata -#define SFDATATMP c_sfdatatmp -#define SFO_PROTO c_sfoproto -#define SFI_PROTO c_sfiproto -#define SFDATA c_sfdata -#define SFPROTO c_sfproto - -static char *fgetline(FILE*); -static void quit(void); -static void out_of_memory(void); -static void doline(char *); -static void chain(struct tagstruct *); -static void showthem(void); -static char *stripspecial(char *); -static char *deblank(char *); -static char *deeol(char *); -static void generate_c_files(); -static char *findtype(char *, char *); -static boolean FDECL(is_prim, (char *)); -static void taglineparse(char *, struct tagstruct *); -static void parseExtensionFields(struct tagstruct *, char *); -static void set_member_array_size(struct tagstruct *); -static char *member_array_dims(struct tagstruct *, char *); -static char *member_array_size(struct tagstruct *, char *); -static void output_types(FILE *); -static char *FDECL(dtmacro,(const char *,int)); -static char *FDECL(dtfn,(const char *,int, boolean *)); -static char *FDECL(bfsize,(const char *)); -static char *FDECL(fieldfix,(char *,char *)); - -#ifdef VMS -static FILE *vms_fopen(name, mode) const char *name, *mode; -{ - return fopen(name, mode, "mbc=64", "shr=nil"); -} -# define fopen(f,m) vms_fopen(f,m) -#endif - -#define Fprintf (void) fprintf -#ifndef __GO32__ -#define DEFAULTTAGNAME "../util/nethack.tags" -#else -#define DEFAULTTAGNAME "../util/nhtags.tag" -#endif -#ifndef _MAX_PATH -#define _MAX_PATH 120 -#endif - -#define TAB '\t' -#define SPACE ' ' - -struct tagstruct *first; -struct tagstruct zerotag; - -static int tagcount; -static const char *infilenm; -static FILE *infile; -static char line[255]; -static long lineno; -static char ssdef[BUFSZ]; -static char fieldfixbuf[BUFSZ]; - -#define NHTYPE_SIMPLE 1 -#define NHTYPE_COMPLEX 2 - -struct nhdatatypes_t readtagstypes[] = { - {NHTYPE_SIMPLE, (char *) "any", sizeof(anything)}, - {NHTYPE_SIMPLE, (char *) "genericptr_t", sizeof(genericptr_t)}, - {NHTYPE_SIMPLE, (char *) "aligntyp", sizeof(aligntyp)}, - {NHTYPE_SIMPLE, (char *) "Bitfield", sizeof(uint8_t)}, - {NHTYPE_SIMPLE, (char *) "boolean", sizeof(boolean)}, - {NHTYPE_SIMPLE, (char *) "char", sizeof(char)}, - {NHTYPE_SIMPLE, (char *) "int", sizeof(int)}, - {NHTYPE_SIMPLE, (char *) "long", sizeof(long)}, - {NHTYPE_SIMPLE, (char *) "schar", sizeof(schar)}, - {NHTYPE_SIMPLE, (char *) "short", sizeof(short)}, - {NHTYPE_SIMPLE, (char *) "size_t", sizeof(size_t)}, - {NHTYPE_SIMPLE, (char *) "string", 1}, - {NHTYPE_SIMPLE, (char *) "time_t", sizeof(time_t)}, - {NHTYPE_SIMPLE, (char *) "uchar", sizeof(uchar)}, - {NHTYPE_SIMPLE, (char *) "unsigned char", sizeof(unsigned char)}, - {NHTYPE_SIMPLE, (char *) "unsigned int", sizeof(unsigned int)}, - {NHTYPE_SIMPLE, (char *) "unsigned long", sizeof(unsigned long)}, - {NHTYPE_SIMPLE, (char *) "unsigned short", sizeof(unsigned short)}, - {NHTYPE_SIMPLE, (char *) "unsigned", sizeof(unsigned)}, - {NHTYPE_SIMPLE, (char *) "xchar", sizeof(xchar)}, - {NHTYPE_COMPLEX, (char *) "align", sizeof(struct align)}, -/* {NHTYPE_COMPLEX, (char *) "attack", sizeof(struct attack)}, */ /* permonst affil */ - {NHTYPE_COMPLEX, (char *) "attribs", sizeof(struct attribs)}, - {NHTYPE_COMPLEX, (char *) "bill_x", sizeof(struct bill_x)}, - {NHTYPE_COMPLEX, (char *) "book_info", sizeof(struct book_info)}, - {NHTYPE_COMPLEX, (char *) "branch", sizeof(struct branch)}, - {NHTYPE_COMPLEX, (char *) "bubble", sizeof(struct bubble)}, - {NHTYPE_COMPLEX, (char *) "cemetery", sizeof(struct cemetery)}, -/* {NHTYPE_COMPLEX, (char *) "container", sizeof(struct container)}, */ - {NHTYPE_COMPLEX, (char *) "context_info", sizeof(struct context_info)}, - {NHTYPE_COMPLEX, (char *) "d_flags", sizeof(struct d_flags)}, - {NHTYPE_COMPLEX, (char *) "d_level", sizeof(struct d_level)}, - {NHTYPE_COMPLEX, (char *) "damage", sizeof(struct damage)}, - {NHTYPE_COMPLEX, (char *) "dest_area", sizeof(struct dest_area)}, - {NHTYPE_COMPLEX, (char *) "dgn_topology", sizeof(struct dgn_topology)}, - {NHTYPE_COMPLEX, (char *) "dig_info", sizeof(struct dig_info)}, - {NHTYPE_COMPLEX, (char *) "dungeon", sizeof(struct dungeon)}, - {NHTYPE_COMPLEX, (char *) "edog", sizeof(struct edog)}, - {NHTYPE_COMPLEX, (char *) "egd", sizeof(struct egd)}, - {NHTYPE_COMPLEX, (char *) "emin", sizeof(struct emin)}, - {NHTYPE_COMPLEX, (char *) "engr", sizeof(struct engr)}, - {NHTYPE_COMPLEX, (char *) "epri", sizeof(struct epri)}, - {NHTYPE_COMPLEX, (char *) "eshk", sizeof(struct eshk)}, - {NHTYPE_COMPLEX, (char *) "fakecorridor", sizeof(struct fakecorridor)}, - {NHTYPE_COMPLEX, (char *) "fe", sizeof(struct fe)}, - {NHTYPE_COMPLEX, (char *) "flag", sizeof(struct flag)}, - {NHTYPE_COMPLEX, (char *) "fruit", sizeof(struct fruit)}, - {NHTYPE_COMPLEX, (char *) "kinfo", sizeof(struct kinfo)}, - {NHTYPE_COMPLEX, (char *) "levelflags", sizeof(struct levelflags)}, - {NHTYPE_COMPLEX, (char *) "linfo", sizeof(struct linfo)}, - {NHTYPE_COMPLEX, (char *) "ls_t", sizeof(struct ls_t)}, - {NHTYPE_COMPLEX, (char *) "mapseen_feat", sizeof(struct mapseen_feat)}, - {NHTYPE_COMPLEX, (char *) "mapseen_flags", sizeof(struct mapseen_flags)}, - {NHTYPE_COMPLEX, (char *) "mapseen_rooms", sizeof(struct mapseen_rooms)}, - {NHTYPE_COMPLEX, (char *) "mapseen", sizeof(struct mapseen)}, - {NHTYPE_COMPLEX, (char *) "mextra", sizeof(struct mextra)}, - {NHTYPE_COMPLEX, (char *) "mkroom", sizeof(struct mkroom)}, - {NHTYPE_COMPLEX, (char *) "monst", sizeof(struct monst)}, - {NHTYPE_COMPLEX, (char *) "mvitals", sizeof(struct mvitals)}, - {NHTYPE_COMPLEX, (char *) "nhcoord", sizeof(struct nhcoord)}, - {NHTYPE_COMPLEX, (char *) "nhrect", sizeof(struct nhrect)}, - {NHTYPE_COMPLEX, (char *) "novel_tracking", sizeof(struct novel_tracking)}, - {NHTYPE_COMPLEX, (char *) "obj", sizeof(struct obj)}, - {NHTYPE_COMPLEX, (char *) "objclass", sizeof(struct objclass)}, - {NHTYPE_COMPLEX, (char *) "obj_split", sizeof(struct obj_split)}, - {NHTYPE_COMPLEX, (char *) "oextra", sizeof(struct oextra)}, -/* {NHTYPE_COMPLEX, (char *) "permonst", sizeof(struct permonst)}, */ - {NHTYPE_COMPLEX, (char *) "polearm_info", sizeof(struct polearm_info)}, - {NHTYPE_COMPLEX, (char *) "prop", sizeof(struct prop)}, - {NHTYPE_COMPLEX, (char *) "q_score", sizeof(struct q_score)}, - {NHTYPE_COMPLEX, (char *) "rm", sizeof(struct rm)}, - {NHTYPE_COMPLEX, (char *) "s_level", sizeof(struct s_level)}, - {NHTYPE_COMPLEX, (char *) "savefile_info", sizeof(struct savefile_info)}, - {NHTYPE_COMPLEX, (char *) "skills", sizeof(struct skills)}, - {NHTYPE_COMPLEX, (char *) "spell", sizeof(struct spell)}, - {NHTYPE_COMPLEX, (char *) "stairway", sizeof(struct stairway)}, -#ifdef SYSFLAGS - {NHTYPE_COMPLEX, (char *) "sysflag", sizeof(struct sysflag)}, -#endif - {NHTYPE_COMPLEX, (char *) "takeoff_info", sizeof(struct takeoff_info)}, - {NHTYPE_COMPLEX, (char *) "tin_info", sizeof(struct tin_info)}, - {NHTYPE_COMPLEX, (char *) "trap", sizeof(struct trap)}, - {NHTYPE_COMPLEX, (char *) "tribute_info", sizeof(struct tribute_info)}, - {NHTYPE_COMPLEX, (char *) "u_achieve", sizeof(struct u_achieve)}, - {NHTYPE_COMPLEX, (char *) "u_conduct", sizeof(struct u_conduct)}, - {NHTYPE_COMPLEX, (char *) "u_event", sizeof(struct u_event)}, - {NHTYPE_COMPLEX, (char *) "u_have", sizeof(struct u_have)}, - {NHTYPE_COMPLEX, (char *) "u_realtime", sizeof(struct u_realtime)}, - {NHTYPE_COMPLEX, (char *) "u_roleplay", sizeof(struct u_roleplay)}, - {NHTYPE_COMPLEX, (char *) "version_info", sizeof(struct version_info)}, - {NHTYPE_COMPLEX, (char *) "victual_info", sizeof(struct victual_info)}, - {NHTYPE_COMPLEX, (char *) "vlaunchinfo", sizeof(union vlaunchinfo)}, - {NHTYPE_COMPLEX, (char *) "vptrs", sizeof(union vptrs)}, - {NHTYPE_COMPLEX, (char *) "warntype_info", sizeof(struct warntype_info)}, - {NHTYPE_COMPLEX, (char *) "you", sizeof(struct you)} -}; - -/* - * These have arrays of other structs, not just arrays of - * simple types. We need to put array handling right into - * the code for these ones. - */ -struct needs_array_handling nah[] = { - {"fakecorr", (char *) "egd"}, - {"bill", "eshk"}, - {"msrooms", "mapseen"}, - {"mtrack", "monst"}, - {"ualignbase", "you"}, - {"weapon_skills", "you"}, -}; - -/* conditional code tags - eecch */ -char *condtag[] = { -#ifdef SYSFLAGS - "sysflag","altmeta","#ifdef AMIFLUSH", "", - "sysflag","amiflush","","#endif /*AMIFLUSH*/", - "sysflag","numcols", "#ifdef AMII_GRAPHICS", "", - "sysflag","amii_dripens","","", - "sysflag","amii_curmap","","#endif", - "sysflag","fast_map", "#ifdef OPT_DISMAP", "#endif", - "sysflag","asksavedisk","#ifdef MFLOPPY","#endif", - "sysflag","page_wait", "#ifdef MAC", "#endif", -#endif - "linfo","where","#ifdef MFLOPPY","", - "linfo","time","","", - "linfo","size","","#endif /*MFLOPPY*/", - "obj","oinvis","#ifdef INVISIBLE_OBJECTS", "#endif", - (char *)0,(char *)0,(char *)0, (char *)0 -}; - - - -int main(argc, argv) -int argc; -char *argv[]; -{ - tagcount = 0; - - if (argc > 1) infilenm = argv[1]; - if (!infilenm || !*infilenm) infilenm = DEFAULTTAGNAME; - - infile = fopen(infilenm,"r"); - if (!infile) { - printf("%s not found or unavailable\n",infilenm); - quit(); - } - - while (fgets(line, sizeof line, infile)) { - ++lineno; -/* if (lineno == 868) DebugBreak(); */ - doline(line); - } - - fclose(infile); - printf("\nRead in %ld lines and stored %d tags.\n", lineno, tagcount); -#if 0 - showthem(); -#endif - generate_c_files(); - exit(EXIT_SUCCESS); - /*NOTREACHED*/ - return 0; -} - -static void doline(line) -char *line; -{ - char buf[255], *tmp1 = (char *)0; - struct tagstruct *tmptag = malloc(sizeof(struct tagstruct)); - - if (!tmptag) { - out_of_memory(); - } - *tmptag = zerotag; - - if (!line || (line && *line == '!')) { - free(tmptag); - return; - } - - strncpy(buf, deeol(line), 254); - taglineparse(buf,tmptag); - chain(tmptag); - return; -} - -static void chain(tag) -struct tagstruct *tag; -{ - static struct tagstruct *prev = (struct tagstruct *)0; - if (!first) { - tag->next = (struct tagstruct *)0; - first = tag; - } else { - tag->next = (struct tagstruct *)0; - if (prev) { - prev->next = tag; - } else { - printf("Error - No previous tag at %s\n", tag->tag); - } - } - prev = tag; - ++tagcount; -} -static void quit() -{ - exit(EXIT_FAILURE); -} - -static void out_of_memory() -{ - printf("maketags: out of memory at line %ld of %s\n", - lineno, infilenm); - quit(); -} - -static char *member_array_dims(struct tagstruct *tmptag, char *buf) -{ - if (buf && tmptag) { - if (tmptag->arraysize1[0]) - Sprintf(buf, "[%s]", tmptag->arraysize1); - if (tmptag->arraysize2[0]) - Sprintf(eos(buf), "[%s]", tmptag->arraysize2); - return buf; - } - return ""; -} - -static char *member_array_size(struct tagstruct *tmptag, char *buf) -{ - if (buf && tmptag) { - if (tmptag->arraysize1[0]) - strcpy(buf, tmptag->arraysize1); - if (tmptag->arraysize2[0]) - Sprintf(eos(buf), " * %s", tmptag->arraysize2); - return buf; - } - return ""; -} - -void set_member_array_size(struct tagstruct *tmptag) -{ - char buf[BUFSZ]; - static char result[49]; - char *arr1 = (char *)0, *arr2 = (char *)0, *tmp; - int cnt = 0; - - if (!tmptag || (tmptag && !tmptag->searchtext)) return; - strcpy(buf, tmptag->searchtext); - - tmptag->arraysize1[0] = '\0'; - tmptag->arraysize2[0] = '\0'; - - /* find left-open square bracket */ - tmp = strchr(buf, '['); - if (tmp) { - arr1 = tmp; - *tmp = '\0'; - --tmp; - /* backup and make sure the [] are on the right tag */ - while (!(*tmp == SPACE || *tmp == TAB || *tmp ==',' || cnt > 50)) { - --tmp; - cnt++; - } - if (cnt > 50) return; - tmp++; - if (strcmp(tmp, tmptag->tag) == 0) { - ++arr1; - tmp = strchr(arr1, ']'); - if (tmp) { - arr2 = tmp; - ++arr2; - *tmp = '\0'; - if (*arr2 == '[') { /* two-dimensional array */ - ++arr2; - tmp = strchr(arr2, ']'); - if (tmp) *tmp = '\0'; - } else { - arr2 = (char *)0; - } - } - } else { - arr1 = (char *)0; - } - } - if (arr1) (void)strcpy(tmptag->arraysize1, arr1); - if (arr2) (void)strcpy(tmptag->arraysize2, arr2); -} - -static void parseExtensionFields (tmptag, buf) -struct tagstruct *tmptag; -char *buf; -{ - char *p = buf; - while (p != (char *)0 && *p != '\0') { - while (*p == TAB) - *p++ = '\0'; - if (*p != '\0') { - char *colon; - char *field = p; - - p = strchr (p, TAB); - if (p != (char *)0) - *p++ = '\0'; - colon = strchr (field, ':'); - if (colon == (char *)0) { - tmptag->tagtype = *field; - } else { - const char *key = field; - const char *value = colon + 1; - *colon = '\0'; - if ((strcmp (key, "struct") == 0) || - (strcmp (key, "union") == 0)) { - colon = strstr(value,"::"); - if (colon) - value = colon +2; - strcpy(tmptag->parenttype, key); - strcpy(tmptag->parent, value); - } - } - } - } -} - -void -taglineparse(p,tmptag) -char *p; -struct tagstruct *tmptag; -{ - int fieldsPresent = 0; - char *filenm = 0, *pattern = 0, *tmp1 = 0; - int linenumber = 0; - char *tab = strchr (p, TAB); - - if (tab != NULL) { - *tab = '\0'; - strcpy(tmptag->tag,p); - p = tab + 1; - filenm = p; - tab = strchr (p, TAB); - if (tab != NULL) { - *tab = '\0'; - p = tab + 1; - if (*p == '/' || *p == '?') { - /* parse pattern */ - int delimiter = *(unsigned char *) p; - linenumber = 0; - pattern = p; - do { - p = strchr (p + 1, delimiter); - } while (p != (char *)0 && *(p - 1) == '\\'); - - if (p == (char *)0) { - /* invalid pattern */ - } else - ++p; - } else if (isdigit ((int) *(unsigned char *) p)) { - /* parse line number */ - pattern = p; - linenumber = atol(p); - while (isdigit((int) *(unsigned char *) p)) - ++p; - } else { - /* invalid pattern */ - } - fieldsPresent = (strncmp (p, ";\"", 2) == 0); - *p = '\0'; - - if (fieldsPresent) - parseExtensionFields (tmptag, p + 2); - } - } - - strcpy(tmptag->searchtext, pattern); - tmptag->linenum = linenumber; - - /* add the array dimensions */ - set_member_array_size(tmptag); - - /* determine if this is a pointer and mark it as such */ - if (tmptag->searchtext && - (tmptag->tagtype == 'm' || tmptag->tagtype == 's')) { - char ptrbuf[BUFSZ], searchbuf[BUFSZ]; - - (void) strcpy(ptrbuf, tmptag->searchtext); - Sprintf(searchbuf,"*%s", tmptag->tag); - tmp1 = strstr(ptrbuf, searchbuf); - if (!tmp1) { - Sprintf(searchbuf,"* %s", tmptag->tag); - tmp1 = strstr(ptrbuf, searchbuf); - } - if (tmp1) { - while ((tmp1 > ptrbuf) && (*tmp1 != SPACE) && - (*tmp1 != TAB) && (*tmp1 != ',')) - tmp1--; - tmp1++; - while (*tmp1 == '*') - tmp1++; - *tmp1 = '\0'; - /* now find the first * before this in case multiple things - are declared on this line */ - tmp1 = strchr(ptrbuf+2, '*'); - if (tmp1) { - tmp1++; - *tmp1 = '\0'; - tmp1 = ptrbuf + 2; - while (*tmp1 == SPACE || *tmp1 == TAB || *tmp1 == ',') - ++tmp1; - (void)strcpy(tmptag->ptr, tmp1); - } - } - } -} - -/* eos() is copied from hacklib.c */ -/* return the end of a string (pointing at '\0') */ -char * -eos(s) -char *s; -{ - while (*s) s++; /* s += strlen(s); */ - return s; -} - -static char stripbuf[255]; - -static char *stripspecial(char *st) -{ - char *out = stripbuf; - *out = '\0'; - if (!st) return st; - while(*st) { - if (*st >= SPACE) - *out++ = *st++; - else - *st++; - } - *out = '\0'; - return stripbuf; -} - -static char *deblank(char *st) -{ - char *out = stripbuf; - *out = '\0'; - if (!st) return st; - while(*st) { - if (*st == SPACE) { - *out++ = '_'; - st++; - } else - *out++ = *st++; - } - *out = '\0'; - return stripbuf; -} - -static char *deeol(char *st) -{ - char *out = stripbuf; - *out = '\0'; - if (!st) return st; - while(*st) { - if ((*st == '\r') || (*st == '\n')) { - st++; - } else - *out++ = *st++; - } - *out = '\0'; - return stripbuf; -} - -#if 0 -static void showthem() -{ - char buf[BUFSZ], *tmp; - struct tagstruct *t = first; - while(t) { - printf("%-28s %c, %-16s %-10s", t->tag, t->tagtype, - t->parent, t->parenttype); -#if 0 - t->parent[0] ? t->searchtext : ""); -#endif - buf[0] = '\0'; - tmp = member_array_dims(t,buf); - if (tmp) printf("%s", tmp); - printf("%s","\n"); - t = t->next; - } -} -#endif - -static boolean -is_prim(sdt) -char *sdt; -{ - int k = 0; - if (sdt) { - /* special case where we don't match entire thing */ - if (!strncmpi(sdt, "Bitfield",8)) - return TRUE; - for (k = 0; k < SIZE(readtagstypes); ++k) { - if (!strcmpi(readtagstypes[k].dtype, sdt)) { - if (readtagstypes[k].dtclass == NHTYPE_SIMPLE) - return TRUE; - else - return FALSE; - } - } - } - return FALSE; -} - -char * -findtype(st, tag) -char *st; -char *tag; -{ - static char ftbuf[512]; - static char prevbuf[512]; - char *tmp1, *tmp2, *tmp3, *tmp4, *r; - if (!st) return (char *)0; - if (st[0] == '/' && st[1] == '^') { - tmp2 = tmp3 = tmp4 = (char *)0; - tmp1 = &st[3]; - while (*tmp1) { - if (isspace(*tmp1)) - ; /* skip it */ - else - break; - ++tmp1; - } - if (!strncmp(tmp1, tag, strlen(tag))) { - if(strlen(tag) == 1) { - char *sc = tmp1; - /* Kludge: single char match is too iffy, - check to make sure its a complete - token that we're comparing to. */ - ++sc; - if (!(*sc == '_' || (*sc > 'a' && *sc < 'z') || - (*sc > 'A' && *sc < 'Z') || (*sc > '0' && *sc < '9'))) - return (char *)0; - } else { - return (char *)0; - } - } - if (*tmp1) { - if (!strncmp(tmp1, "Bitfield", 8)) { - strcpy(ftbuf, tmp1); - tmp1 = ftbuf; - tmp3 = strchr(tmp1, ')'); - if (tmp3) { - tmp3++; - *tmp3 = '\0'; - return ftbuf; - } - return (char *)0; - } - } - if (*tmp1) { - int prevchar = 0; - strcpy(ftbuf, tmp1); - tmp1 = ftbuf; - /* find space separating first word with second */ - while (!isspace(*tmp1)) { - prevchar = *tmp1; - ++tmp1; - } - - /* some oddball cases */ - if (prevchar == ',' || prevchar == ';') { - tmp3 = strchr(ftbuf, ','); - tmp2 = strstr(ftbuf, tag); - return prevbuf; - } else { - /* a comma means that more than one thing declared on line */ - tmp3 = strchr(tmp1, ','); - tmp2 = strstr(tmp1, tag); - } - /* make sure we're matching a complete token */ - if (tmp2) { - tmp4 = tmp2 + strlen(tag); - if ((*tmp4 == '_') || (*tmp4 >= 'a' && *tmp4 <= 'z') || - (*tmp4 >= 'A' && *tmp4 <= 'Z') || (*tmp4 >= '0' && *tmp4 <= '9')) - /* jump to next occurence then */ - tmp2 = strstr(tmp4, tag); - } - /* tag w/o comma OR tag found w comma and tag before comma */ - if ((tmp2 && !tmp3) || ((tmp2 && tmp3) && (tmp2 < tmp3))) { - *tmp2 = '\0'; - --tmp2; - while (isspace(*tmp2)) - --tmp2; - tmp2++; - *tmp2 = '\0'; - } - /* comma and no tag OR tag w comma and comma before tag */ - else if ((tmp3 && !tmp2) || ((tmp2 && tmp3) && (tmp3 < tmp2))) { - --tmp3; - if (isspace(*tmp3)) { - while (isspace(*tmp3)) - --tmp3; - } - while (!isspace(*tmp3) && (*tmp3 != '*')) - --tmp3; - while (isspace(*tmp3)) - --tmp3; - tmp3++; - *tmp3 = '\0'; - } - /* comma or semicolon immediately following tag */ - else { - volatile int y; - y = 1; - } - if (strncmpi(ftbuf, "struct ", 7) == 0) - r = ftbuf + 7; - else if (strncmpi(ftbuf, "union ", 6) == 0) - r = ftbuf + 6; - /* a couple of kludges follow unfortunately */ - else if (strncmpi(ftbuf, "coord", 5) == 0) - r = "nhcoord"; - else if (strncmpi(ftbuf, "anything", 8) == 0) - r = "any"; - else if (strncmpi(ftbuf, "const char", 10) == 0) - r = "char"; - else - r = ftbuf; - strcpy(prevbuf, r); - return r; - } - } - prevbuf[0] = '\0'; - return (char *)0; -} - -boolean -listed(t) -struct tagstruct *t; -{ - int k; - - if ((strncmpi(t->tag, "Bitfield", 8) == 0) || - (strcmpi(t->tag, "string") == 0)) - return TRUE; - for (k = 0; k < SIZE(readtagstypes); ++k) { - /* This needs to be case-sensitive to avoid generating collision - * between 'align' and 'Align'. - */ - if (strcmp(readtagstypes[k].dtype, t->tag) == 0) - return TRUE; - } - return FALSE; -} - - -char *preamble[] = { - "/* Copyright (c) NetHack Development Team 2018. */\n", - "/* NetHack may be freely redistributed. See license for details. */\n\n", - "/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE! */\n\n", - "#include \"hack.h\"\n", - "#include \"artifact.h\"\n", - "#include \"func_tab.h\"\n", - "#include \"lev.h\"\n", - "#include \"integer.h\"\n", - "#include \"wintype.h\"\n", - (char *)0 -}; - -static void output_types(fp1) -FILE *fp1; -{ - int k, cnt, hcnt = 1; - struct tagstruct *t = first; - - Fprintf(fp1, "%s", - "struct nhdatatypes_t nhdatatypes[] = {\n"); - - for (k = 0; k < SIZE(readtagstypes); ++k) { - if (readtagstypes[k].dtclass == NHTYPE_SIMPLE) { - Fprintf(fp1,"\t{NHTYPE_SIMPLE, (char *) \"%s\", sizeof(%s)},\n", - readtagstypes[k].dtype, - (strncmpi(readtagstypes[k].dtype, "Bitfield", 8) == 0) ? - "uint8_t" : - (strcmpi(readtagstypes[k].dtype, "string") == 0) ? - "uchar" : - (strcmpi(readtagstypes[k].dtype, "any") == 0) ? - "anything" : readtagstypes[k].dtype); -/* dtmacro(readtagstypes[k].dtype,0)); */ -#if 0 - Fprintf(fp2, "#define %s\t%s%d\n", dtmacro(readtagstypes[k].dtype,1), - (strlen(readtagstypes[k].dtype) > 12) ? "" : - (strlen(readtagstypes[k].dtype) < 5) ? "\t\t" : - "\t", hcnt++); -#endif - } - } - cnt = 0; - while(t) { - if (listed(t) && ((t->tagtype == 's') || (t->tagtype == 'u'))) { - if (!strcmp(t->tag, "any")) { - t = t->next; - continue; - } - if (cnt > 0) - Fprintf(fp1, "%s", ",\n"); - Fprintf(fp1, "\t{NHTYPE_COMPLEX, (char *) \"%s\", sizeof(%s %s)}", - t->tag, - (t->tagtype == 's') ? "struct" : "union", t->tag); - cnt += 1; - } - t = t->next; - } - Fprintf(fp1, "%s", "\n};\n\n"); - Fprintf(fp1, "int nhdatatypes_size()\n{\n\treturn SIZE(nhdatatypes);\n}\n\n"); -} - -static void generate_c_files() -{ - struct tagstruct *t = first; -#ifdef KR1ED - long clocktim = 0; -#else - time_t clocktim = 0; -#endif - char *c, cbuf[60], sfparent[BUFSZ], *substruct, *line; - FILE *SFO_DATA, *SFI_DATA, *SFDATATMP, *SFO_PROTO, *SFI_PROTO, - *SFDATA, *SFPROTO; - int k = 0, j, opening, closetag = 0; - char *iftxt = "} else "; - char *ft, *pt, *layout, *last_ft = (char *)0; - int okeydokey, x, a; - boolean did_i; - - SFDATA = fopen("../src/sfdata.c", "w"); - if (!SFDATA) return; - - SFPROTO = fopen("../include/sfproto.h", "w"); - if (!SFPROTO) return; - - SFO_DATA = fopen("../src/sfo_data.tmp", "w"); - if (!SFO_DATA) return; - - SFO_PROTO = fopen("../include/sfo_proto.tmp", "w"); - if (!SFO_PROTO) return; - - SFI_PROTO = fopen("../include/sfi_proto.tmp", "w"); - if (!SFI_PROTO) return; - - SFI_DATA = fopen("../src/sfi_data.tmp", "w"); - if (!SFI_DATA) return; - - SFDATATMP = fopen("../src/sfdata.tmp", "w"); - if (!SFDATATMP) return; - - (void) time(&clocktim); - Strcpy(cbuf, ctime(&clocktim)); - - for (c = cbuf; *c; c++) - if (*c == '\n') - break; - *c = '\0'; /* strip off the '\n' */ - - /* begin sfproto.h */ - Fprintf(SFPROTO,"/* NetHack %d.%d sfproto.h\t%s */\n", - VERSION_MAJOR, VERSION_MINOR, cbuf); - for (j = 0; j < 3; ++j) - Fprintf(SFPROTO, "%s", preamble[j]); - Fprintf(SFPROTO, "#ifndef SFPROTO_H\n#define SFPROTO_H\n\n"); - Fprintf(SFPROTO, "#include \"hack.h\"\n#include \"integer.h\"\n#include \"wintype.h\"\n\n" - "#define E extern\n\n"); - - /* sfbase.c function prototypes */ - Fprintf(SFPROTO,"%s\n", "E int NDECL(critical_members_count);"); - Fprintf(SFPROTO,"/* sfbase.c output functions */\n"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_addinfo, (NHFILE *, const char *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_aligntyp, (NHFILE *, aligntyp *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_any, (NHFILE *, anything *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_boolean, (NHFILE *, boolean *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_char, (NHFILE *, const char *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_int, (NHFILE *, int *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_long, (NHFILE *, long *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_schar, (NHFILE *, schar *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_short, (NHFILE *, short *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_size_t, (NHFILE *, size_t *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_time_t, (NHFILE *, time_t *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_uchar, (NHFILE *, uchar *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_unsigned, (NHFILE *, unsigned *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_uchar, (NHFILE *, unsigned char *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_uint, (NHFILE *, unsigned int *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_ulong, (NHFILE *, unsigned long *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_ushort, (NHFILE *, unsigned short *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_xchar, (NHFILE *, xchar *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfo_str, (NHFILE *, const char *, const char *, const char *, int));"); - Fprintf(SFPROTO,"/* sfbase.c input functions */\n"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_addinfo, (NHFILE *, const char *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_aligntyp, (NHFILE *, aligntyp *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_any, (NHFILE *, anything *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_bitfield, (NHFILE *, uint8_t *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_boolean, (NHFILE *, boolean *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_char, (NHFILE *, const char *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_genericptr, (NHFILE *, genericptr_t *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_int, (NHFILE *, int *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_long, (NHFILE *, long *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_schar, (NHFILE *, schar *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_short, (NHFILE *, short *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_size_t, (NHFILE *, size_t *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_time_t, (NHFILE *, time_t *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_uchar, (NHFILE *, uchar *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_unsigned, (NHFILE *, unsigned *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_uchar, (NHFILE *, unsigned char *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_uint, (NHFILE *, unsigned int *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_ulong, (NHFILE *, unsigned long *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_ushort, (NHFILE *, unsigned short *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_xchar, (NHFILE *, xchar *, const char *, const char *, int));"); - Fprintf(SFPROTO,"%s\n", "E void FDECL(sfi_str, (NHFILE *, const char *, const char *, const char *, int));"); - Fprintf(SFO_PROTO, "/* generated output functions */\n"); - Fprintf(SFI_PROTO, "/* generated input functions */\n"); - - /* begin sfdata.c */ - Fprintf(SFDATA,"/* NetHack %d.%d sfdata.c\t$Date$ $Revision$ */\n", - VERSION_MAJOR, VERSION_MINOR); - for (j = 0; preamble[j]; ++j) - Fprintf(SFDATA, "%s", preamble[j]); - Fprintf(SFDATA, "#include \"sfproto.h\"\n\n"); - Fprintf(SFDATA, "#define BUILD_DATE \"%s\"\n", cbuf); - Fprintf(SFDATA, "#define BUILD_TIME (%ldL)\n\n", (long) clocktim); - Fprintf(SFDATA, "#define NHTYPE_SIMPLE 1\n"); - Fprintf(SFDATA, "#define NHTYPE_COMPLEX 2\n"); - Fprintf(SFDATA, "struct nhdatatypes_t {\n"); - Fprintf(SFDATA, " unsigned int dtclass;\n"); - Fprintf(SFDATA, " char *dtype;\n"); - Fprintf(SFDATA, " size_t dtsize;\n};\n\n"); - Fprintf(SFDATA,"static uint8_t bitfield = 0;\n"); - - output_types(SFDATATMP); - Fprintf(SFDATATMP,"const char *critical_members[] = {\n"); - - k = 0; - opening = 1; - did_i = FALSE; - while(k < SIZE(readtagstypes)) { - boolean insert_const = FALSE; - - if (readtagstypes[k].dtclass == NHTYPE_COMPLEX) { - - if (!strncmpi(readtagstypes[k].dtype,"Bitfield",8)) { - Fprintf(SFO_DATA, - "\nvoid\nsfo_bitfield(nhfp, d_bitfield, myparent, myname, cnt)\n" - "NHFILE *nhfp;\n" - "uint8_t *d_bitfield;\n" - "const char *myparent;\n" - "const char *myname;\n" - "int cnt;\n" - "{\n"); - - Fprintf(SFI_DATA, - "\nvoid\nsfi_bitfield(nhfp, d_bitfield, myparent, myname, cnt)\n" - "NHFILE *nhfp;\n" - "uint8_t *d_bitfield;\n" - "const char *myparent;\n" - "const char *myname;\n" - "int cnt;\n" - "{\n"); - } - -#if 0 - if (!strncmpi(readtagstypes[k].dtype,"version_info",8)) - insert_const = TRUE; -#endif - - pt = layout = (char *)0; - t = first; - while(t) { - if (t->tagtype == 'u' && !strcmp(t->tag, readtagstypes[k].dtype)) { - pt = "union"; - break; - } - t = t->next; - } - - if (!pt) { - pt = "struct"; - } - Fprintf(SFO_PROTO, - "E void FDECL(sfo_%s, (NHFILE *, %s%s %s *, const char *, const char *, int));\n", - readtagstypes[k].dtype, - insert_const ? "const " : "", - pt, readtagstypes[k].dtype); - - Fprintf(SFO_DATA, - "\nvoid\nsfo_%s(nhfp, d_%s, myparent, myname, cnt)\n" - "NHFILE *nhfp;\n" - "%s%s %s *d_%s;\n" - "const char *myparent;\n" - "const char *myname;\n" - "int cnt;\n" - "{\n", - readtagstypes[k].dtype, - deblank(readtagstypes[k].dtype), - insert_const ? "const " : "", - pt, readtagstypes[k].dtype, - deblank(readtagstypes[k].dtype)); - - Fprintf(SFO_DATA, - " const char *parent = \"%s\";\n", - readtagstypes[k].dtype); - - Fprintf(SFI_PROTO, - "E void FDECL(sfi_%s, (NHFILE *, %s%s %s *, const char *, const char *, int));\n", - readtagstypes[k].dtype, - insert_const ? "const " : "", - pt, readtagstypes[k].dtype); - - Fprintf(SFI_DATA, - "\nvoid\nsfi_%s(nhfp, d_%s, myparent, myname, cnt)\n" - "NHFILE *nhfp;\n" - "%s%s %s *d_%s;\n" - "const char *myparent;\n" - "const char *myname;\n" - "int cnt;\n" - "{\n", - readtagstypes[k].dtype, - deblank(readtagstypes[k].dtype), - insert_const ? "const " : "", - pt, readtagstypes[k].dtype, - deblank(readtagstypes[k].dtype)); - - Fprintf(SFI_DATA, - " const char *parent = \"%s\";\n", - readtagstypes[k].dtype); - - Sprintf(sfparent, "%s %s", pt, readtagstypes[k].dtype); - - for (a = 0; a < SIZE(nah); ++a) { - if (!strcmp(nah[a].parent, readtagstypes[k].dtype)) { - if (!did_i) { - Fprintf(SFO_DATA, " int i;\n"); - Fprintf(SFI_DATA, " int i;\n"); - did_i = TRUE; - } - } - } - - Fprintf(SFO_DATA, "\n"); - Fprintf(SFI_DATA, "\n"); - - Fprintf(SFO_DATA, " nhUse(myname);\n nhUse(cnt);\n"); - Fprintf(SFO_DATA, - " if (nhfp->addinfo)\n" - " sfo_addinfo(nhfp, myparent, \"start\", \"%s\", 1);\n", - readtagstypes[k].dtype); - - Fprintf(SFI_DATA, " nhUse(myname);\n nhUse(cnt);\n"); - Fprintf(SFI_DATA, - " if (nhfp->addinfo)\n" - " sfi_addinfo(nhfp, myparent, \"start\", \"%s\", 1);\n", - readtagstypes[k].dtype); - - Fprintf(SFO_DATA, "\n"); - Fprintf(SFI_DATA, "\n"); - - /******************************************************** - * cycle through all the tags and find every tag with * - * a parent matching readtagstypes[k].dtype * - ********************************************************/ - - t = first; - - while(t) { - x = 0; - okeydokey = 0; - - if (t->tagtype == 's') { - char *ss = strstr(t->searchtext,"{$/"); - - if (ss) { - strcpy(ssdef, t->tag); - } - t = t->next; - continue; - } - - /************insert opening conditional if needed ********/ - while(condtag[x]) { - if (!strcmp(condtag[x],readtagstypes[k].dtype) && - !strcmp(condtag[x+1],t->tag)) { - okeydokey = 1; - break; - } - x = x + 4; - } - - /* some structs are entirely defined within another struct declaration. - * Legal, but unfortunate for us here. - */ - substruct = strstr(t->parent, "::"); - if (substruct) { - substruct += 2; - } - - if ((strcmp(readtagstypes[k].dtype, t->parent) == 0) || - (substruct && strcmp(readtagstypes[k].dtype, substruct) == 0)) { - ft = (char *)0; - if (t->ptr[0]) - ft = &t->ptr[0]; - else - ft = findtype(t->searchtext, t->tag); - if (ft) { - last_ft = ft; - if (okeydokey && condtag[x+2] && strlen(condtag[x+2]) > 0) { - Fprintf(SFO_DATA,"%s\n", condtag[x+2]); - Fprintf(SFI_DATA,"%s\n", condtag[x+2]); - Fprintf(SFDATATMP,"%s\n", condtag[x+2]); - } - } else { - /* use the last found one as last resort then */ - ft = last_ft; - } - - /***************** Bitfield *******************/ - if (!strncmpi(ft, "Bitfield", 8)) { - char lbuf[BUFSZ]; - int j, z; - - Sprintf(lbuf, - " " - "bitfield = d_%s->%s;", - readtagstypes[k].dtype, t->tag); - z = (int) strlen(lbuf); - for (j = 0; j < (65 - z); ++j) - Strcat(lbuf, " "); - Sprintf(eos(lbuf), "/* (%s) */\n", ft); - Fprintf(SFO_DATA, "%s", lbuf); - Fprintf(SFO_DATA, - " " - "sfo_bitfield(nhfp, &bitfield, parent, \"%s\", %s);\n", - t->tag, bfsize(ft)); -#if 0 - Fprintf(SFI_DATA, - " " - "bitfield = 0;\n"); -#else - Fprintf(SFI_DATA, - " " - "bitfield = d_%s->%s; /* set it to current value for testing */\n", - readtagstypes[k].dtype, t->tag); -#endif - Fprintf(SFI_DATA, - " " - "sfi_bitfield(nhfp, &bitfield, parent, \"%s\", %s);\n", - t->tag, bfsize(ft)); - - Fprintf(SFI_DATA, - " " - "d_%s->%s = bitfield;\n\n", - readtagstypes[k].dtype, t->tag); - Fprintf(SFDATATMP, - "\t\"%s:%s:%s\",\n", - sfparent, t->tag, ft); - } else { - /**************** not a bitfield ****************/ - char arrbuf[BUFSZ]; - char lbuf[BUFSZ]; - char fnbuf[BUFSZ]; - char altbuf[BUFSZ]; - boolean isptr = FALSE, kludge_sbrooms = FALSE; - boolean insert_loop = FALSE; - int j, z; - - /*************** kludge for sbrooms *************/ - if (!strcmp(t->tag, "sbrooms")) { - kludge_sbrooms = TRUE; - (void) strcpy(t->arraysize1,"MAX_SUBROOMS"); - } - - if (t->arraysize2[0]) { - Sprintf(arrbuf, "(%s * %s)", - t->arraysize1, t->arraysize2); - isptr = TRUE; /* suppress the & in function args */ - } else if (t->arraysize1[0]) { - Sprintf(arrbuf, "%s", t->arraysize1); - isptr = TRUE; /* suppress the & in function args */ - } else { - Strcpy(arrbuf, "1"); - } - Strcpy(fnbuf, dtfn(ft,0,&isptr)); - /* - * determine if this is one of the special cases - * where there's an array of structs instead of - * an array of simple types. We need to insert - * a for loop in those cases. - */ - for (a = 0; a < SIZE(nah); ++a) { - if (!strcmp(nah[a].parent, t->parent)) - if (!strcmp(nah[a].nm, t->tag)) - insert_loop = TRUE; - } - - if (isptr && !strcmp(fnbuf, readtagstypes[k].dtype)) { - Strcpy(altbuf, "genericptr"); - } else if (isptr && - (!strcmp(t->ptr, "struct permonst *") || - !strcmp(t->ptr, "struct monst *") || - !strcmp(t->ptr, "struct obj *") || - !strcmp(t->ptr, "struct cemetery *") || - !strcmp(t->ptr, "struct container *") || - !strcmp(t->ptr, "struct mextra *") || - !strcmp(t->ptr, "struct oextra *") || - !strcmp(t->ptr, "struct s_level *") || - !strcmp(t->ptr, "struct bill_x *") || - !strcmp(t->ptr, "struct trap *"))) { - Strcpy(altbuf, "genericptr"); - } else if (isptr && - (!strcmp(t->parent, "engr") && - !strcmp(t->tag, "engr_txt"))) { - Strcpy(altbuf, "genericptr"); - } else if (isptr && !strcmp(t->tag, "oc_uname")) { - Strcpy(altbuf, "genericptr"); - } else { - Strcpy(altbuf, fnbuf); - } - - if (insert_loop) { - Fprintf(SFO_DATA, - " for (i = 0; i < %s; ++i)\n", - arrbuf); - Fprintf(SFI_DATA, - " for (i = 0; i < %s; ++i)\n", - arrbuf); - arrbuf[0] = '1'; - arrbuf[1] = '\0'; - } - - Sprintf(lbuf, - " " - "%ssfo_%s(nhfp, %s%sd_%s->%s%s, parent, \"%s\", %s);", - insert_loop ? " " : "", - altbuf, - (isptr && !strcmp(altbuf, "genericptr")) ? "(genericptr_t) " : "", - (isptr && !insert_loop && !kludge_sbrooms - && strcmp(altbuf, "genericptr")) ? "" : "&", - readtagstypes[k].dtype, - t->tag, - kludge_sbrooms ? "[0]" : insert_loop ? "[i]" : "", - t->tag, - arrbuf); - /* align comments */ - z = (int) strlen(lbuf); - for (j = 0; j < (65 - z); ++j) - Strcat(lbuf, " "); - Sprintf(eos(lbuf), "/* (%s) */\n", ft); - Fprintf(SFO_DATA, "%s", lbuf); - - Sprintf(lbuf, - " " - "%ssfi_%s(nhfp, %s%sd_%s->%s%s, parent, \"%s\", %s);\n", - insert_loop ? " " : "", - altbuf, - (isptr && !strcmp(altbuf, "genericptr")) ? "(genericptr_t) " : "", - (isptr && !insert_loop && !kludge_sbrooms - && strcmp(altbuf, "genericptr")) ? "" : "&", - readtagstypes[k].dtype, - t->tag, - kludge_sbrooms ? "[0]" : insert_loop ? "[i]" : "", - t->tag, - arrbuf); - Fprintf(SFI_DATA, "%s", lbuf); - Fprintf(SFDATATMP, - "\t\"%s:%s:%s\",\n", - sfparent, t->tag,fieldfix(ft,ssdef)); - kludge_sbrooms = FALSE; - } - - /************insert closing conditional if needed ********/ - if (okeydokey && condtag[x+3] && strlen(condtag[x+3]) > 0) { - Fprintf(SFO_DATA,"%s\n", condtag[x+3]); - Fprintf(SFI_DATA,"%s\n", condtag[x+3]); - Fprintf(SFDATATMP,"%s\n", condtag[x+3]); - } - } - t = t->next; - } - - Fprintf(SFO_DATA, "\n"); - Fprintf(SFI_DATA, "\n"); - - Fprintf(SFO_DATA, - " if (nhfp->addinfo)\n" - " sfo_addinfo(nhfp, myparent, \"end\", \"%s\", 1);\n", - readtagstypes[k].dtype); - - Fprintf(SFI_DATA, - " if (nhfp->addinfo)\n" - " sfi_addinfo(nhfp, myparent, \"end\", \"%s\", 1);\n", - readtagstypes[k].dtype); - - Fprintf(SFO_DATA, "}\n"); - Fprintf(SFI_DATA, "}\n"); - opening = 0; - } - ++k; - did_i = FALSE; - } - - Fprintf(SFDATATMP,"};\n\n"); - Fprintf(SFDATATMP, "int critical_members_count()\n{\n\treturn SIZE(critical_members);\n}\n\n"); - - fclose(SFO_DATA); - fclose(SFI_DATA); - fclose(SFO_PROTO); - fclose(SFI_PROTO); - fclose(SFDATATMP); - - /* Consolidate SFO_* and SFI_* into single files */ - - SFO_DATA = fopen("../src/sfo_data.tmp", "r"); - if (!SFO_DATA) return; - while ((line = fgetline(SFO_DATA)) != 0) { - (void) fputs(line, SFDATA); - free(line); - } - (void) fclose(SFO_DATA); - (void) remove("../src/sfo_data.tmp"); - - SFI_DATA = fopen("../src/sfi_data.tmp", "r"); - if (!SFI_DATA) return; - while ((line = fgetline(SFI_DATA)) != 0) { - (void) fputs(line, SFDATA); - free(line); - } - (void) fclose(SFI_DATA); - (void) remove("../src/sfi_data.tmp"); - - SFO_PROTO = fopen("../include/sfo_proto.tmp", "r"); - if (!SFO_PROTO) return; - while ((line = fgetline(SFO_PROTO)) != 0) { - (void) fputs(line, SFPROTO); - free(line); - } - (void) fclose(SFO_PROTO); - (void) remove("../include/sfo_proto.tmp"); - - SFI_PROTO = fopen("../include/sfi_proto.tmp", "r"); - if (!SFI_PROTO) return; - while ((line = fgetline(SFI_PROTO)) != 0) { - (void) fputs(line, SFPROTO); - free(line); - } - (void) fclose(SFI_PROTO); - (void) remove("../include/sfi_proto.tmp"); - - SFDATATMP = fopen("../src/sfdata.tmp", "r"); - if (!SFDATATMP) return; - while ((line = fgetline(SFDATATMP)) != 0) { - (void) fputs(line, SFDATA); - free(line); - } - (void) fclose(SFDATATMP); - (void) remove("../src/sfdata.tmp"); - - Fprintf(SFDATA, "/*sfdata.c*/\n"); - Fprintf(SFPROTO,"#endif /* SFPROTO_H */\n"); - (void) fclose(SFDATA); - (void) fclose(SFPROTO); -} - -static char * -dtmacro(str,n) -const char *str; -int n; /* 1 = supress appending |SF_PTRMASK */ -{ - static char buf[128], buf2[128]; - char *nam, *c; - int ispointer = 0; - - if (!str) - return (char *)0; - (void)strncpy(buf, str, 127); - - c = buf; - while (*c) - c++; /* eos */ - - c--; - if (*c == '*') { - ispointer = 1; - *c = '\0'; - c--; - } - while(isspace(*c)) { - c--; - } - *(c+1) = '\0'; - c = buf; - - if (strncmpi(c, "Bitfield", 8) == 0) { - *(c+8) = '\0'; - } else if (strcmpi(c, "genericptr_t") == 0) { - ispointer = 1; - } else if (strncmpi(c, "const ", 6) == 0) { - c = buf + 6; - } else if ((strncmpi(c, "struct ", 7) == 0) || - (strncmpi(c, "struct\t", 7) == 0)) { - c = buf + 7; - } else if (strncmpi(c, "union ", 6) == 0) { - c = buf + 6; - } - - /* end of substruct within struct definition */ - if (strcmp(buf,"}") == 0 && strlen(ssdef) > 0) { - strcpy(buf,ssdef); - c = buf; - } - - for (nam = c; *c; c++) { - if (*c >= 'a' && *c <= 'z') - *c -= (char)('a' - 'A'); - else if (*c < 'A' || *c > 'Z') - *c = '_'; - } - (void)sprintf(buf2, "SF_%s%s", nam, - (ispointer && (n == 0)) ? " | SF_PTRMASK" : ""); - return buf2; -} - -static char * -dtfn(str,n, isptr) -const char *str; -int n; /* 1 = supress appending |SF_PTRMASK */ -boolean *isptr; -{ - static char buf[128], buf2[128]; - char *nam, *c; - int ispointer = 0; - - if (!str) - return (char *)0; - (void)strncpy(buf, str, 127); - - c = buf; - while (*c) c++; /* eos */ - - c--; - if (*c == '*') { - ispointer = 1; - *c = '\0'; - c--; - } - while(isspace(*c)) { - c--; - } - *(c+1) = '\0'; - c = buf; - - if (strncmpi(c, "Bitfield", 8) == 0) { - *(c+8) = '\0'; - } else if (strcmpi(c, "genericptr_t") == 0) { - ispointer = 1; - } else if (strncmpi(c, "const ", 6) == 0) { - c = buf + 6; - } else if ((strncmpi(c, "struct ", 7) == 0) || - (strncmpi(c, "struct\t", 7) == 0)) { - c = buf + 7; - } else if (strncmpi(c, "union ", 6) == 0) { - c = buf + 6; - } - - /* end of substruct within struct definition */ - if (strcmp(buf,"}") == 0 && strlen(ssdef) > 0) { - strcpy(buf,ssdef); - c = buf; - } - - for (nam = c; *c; c++) { - if (*c >= 'A' && *c <= 'Z') - *c = tolower(*c); - else if (*c == ' ') - *c = '_'; - } - /* some fix-ups */ - if (!strcmp(nam, "genericptr_t")) - nam = "genericptr"; - else if (!strcmp(nam, "unsigned_int")) - nam = "uint"; - else if (!strcmp(nam, "unsigned_long")) - nam = "ulong"; - else if (!strcmp(nam, "unsigned_char")) - nam = "uchar"; - else if (!strcmp(nam, "unsigned_short")) - nam = "ushort"; - - if (ispointer && isptr && n == 0) - *isptr = TRUE; - (void)sprintf(buf2, "%s%s", nam, ""); - return buf2; -} - -static char * -fieldfix(f,ss) -char *f, *ss; -{ - char *c, *dest = fieldfixbuf; - - if (strcmp(f,"}") == 0 && strlen(ss) > 0 && strlen(ss) < BUFSZ - 1) { - /* (void)sprintf(fieldfixbuf,"struct %s", ss); */ - strcpy(fieldfixbuf,ss); - } else { - if (strlen(f) < BUFSZ - 1) strcpy(fieldfixbuf,f); - } - - /* converting any tabs to space */ - for (c = fieldfixbuf; *c; c++) - if (*c == TAB) *c = SPACE; - - return fieldfixbuf; -} - -static char * -bfsize(str) -const char *str; -{ - static char buf[128]; - const char *c1; - char *c2, *subst; - - if (!str) - return (char *)0; - - /* kludge */ - subst = strstr(str, ",$/"); - if (subst != 0) { - subst++; - *subst++ = ' '; - *subst++ = '1'; - } - - c2 = buf; - c1 = str; - while (*c1) { - if (*c1 == ',') - break; - c1++; - } - - if (*c1 == ',') { - c1++; - while (*c1 && *c1 != ')') { - *c2++ = *c1++; - } - *c2 = '\0'; - } else { - return (char *)0; - } - return buf; -} - -/* Read one line from input, up to and including the next newline - * character. Returns a pointer to the heap-allocated string, or a - * null pointer if no characters were read. - */ -static char * -fgetline(fd) -FILE *fd; -{ - static const int inc = 256; - int len = inc; - char *c = malloc(len), *ret; - - for (;;) { - ret = fgets(c + len - inc, inc, fd); - if (!ret) { - free(c); - c = NULL; - break; - } else if (index(c, '\n')) { - /* normal case: we have a full line */ - break; - } - len += inc; - c = realloc(c, len); - } - return c; -} - -/*readtags2.c*/ - - diff --git a/win/Qt/.gitattributes b/win/Qt/.gitattributes index 7b924974c..ef4b40804 100644 --- a/win/Qt/.gitattributes +++ b/win/Qt/.gitattributes @@ -1,4 +1 @@ -Install.Qt NHSUBST -qpe-nethack.control NH_header=no -knethack.lnk NH_header=no -* NH_filestag=(file%s_for_the_Qt_3_widget_library_-_X11,_Windows,_Mac_OS_X,_or_Qtopia) +* NH_filestag=(file%s_for_the_Qt_4_or_5_widget_library_-_X11,_Windows,_Mac_OS_X) diff --git a/win/Qt4/.gitignore b/win/Qt/.gitignore similarity index 100% rename from win/Qt4/.gitignore rename to win/Qt/.gitignore diff --git a/win/Qt4/qt4bind.cpp b/win/Qt/qt_bind.cpp similarity index 88% rename from win/Qt4/qt4bind.cpp rename to win/Qt/qt_bind.cpp index f6cf3196d..842daf9d9 100644 --- a/win/Qt4/qt4bind.cpp +++ b/win/Qt/qt_bind.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4bind.cpp -- bindings between the Qt 4 interface and the main code +// qt_bind.cpp -- bindings between the Qt 4 interface and the main code extern "C" { #include "hack.h" @@ -25,23 +25,23 @@ extern "C" { #else #include #endif -#include "qt4bind.h" -#include "qt4click.h" +#include "qt_bind.h" +#include "qt_click.h" #ifdef TIMED_DELAY -#include "qt4delay.h" +#include "qt_delay.h" #endif -#include "qt4xcmd.h" -#include "qt4key.h" -#include "qt4map.h" -#include "qt4menu.h" -#include "qt4msg.h" -#include "qt4plsel.h" -#include "qt4svsel.h" -#include "qt4set.h" -#include "qt4stat.h" -#include "qt4streq.h" -#include "qt4yndlg.h" -#include "qt4str.h" +#include "qt_xcmd.h" +#include "qt_key.h" +#include "qt_map.h" +#include "qt_menu.h" +#include "qt_msg.h" +#include "qt_plsel.h" +#include "qt_svsel.h" +#include "qt_set.h" +#include "qt_stat.h" +#include "qt_streq.h" +#include "qt_yndlg.h" +#include "qt_str.h" extern "C" { #include "dlb.h" @@ -51,7 +51,7 @@ extern "C" { extern int qt_compact_mode; // end temporary -namespace nethack_qt4 { +namespace nethack_qt_ { // XXX Should be from Options // @@ -721,7 +721,7 @@ boolean NetHackQtBind::msgs_initd = false; static void Qt_positionbar(char *) {} -} // namespace nethack_qt4 +} // namespace nethack_qt_ struct window_procs Qt_procs = { "Qt", @@ -730,48 +730,49 @@ struct window_procs Qt_procs = { | WC_FONT_MAP | WC_TILE_FILE | WC_TILE_WIDTH | WC_TILE_HEIGHT | WC_PLAYER_SELECTION | WC_SPLASH_SCREEN, 0L, - nethack_qt4::NetHackQtBind::qt_init_nhwindows, - nethack_qt4::NetHackQtBind::qt_player_selection, - nethack_qt4::NetHackQtBind::qt_askname, - nethack_qt4::NetHackQtBind::qt_get_nh_event, - nethack_qt4::NetHackQtBind::qt_exit_nhwindows, - nethack_qt4::NetHackQtBind::qt_suspend_nhwindows, - nethack_qt4::NetHackQtBind::qt_resume_nhwindows, - nethack_qt4::NetHackQtBind::qt_create_nhwindow, - nethack_qt4::NetHackQtBind::qt_clear_nhwindow, - nethack_qt4::NetHackQtBind::qt_display_nhwindow, - nethack_qt4::NetHackQtBind::qt_destroy_nhwindow, - nethack_qt4::NetHackQtBind::qt_curs, - nethack_qt4::NetHackQtBind::qt_putstr, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */ + nethack_qt_::NetHackQtBind::qt_init_nhwindows, + nethack_qt_::NetHackQtBind::qt_player_selection, + nethack_qt_::NetHackQtBind::qt_askname, + nethack_qt_::NetHackQtBind::qt_get_nh_event, + nethack_qt_::NetHackQtBind::qt_exit_nhwindows, + nethack_qt_::NetHackQtBind::qt_suspend_nhwindows, + nethack_qt_::NetHackQtBind::qt_resume_nhwindows, + nethack_qt_::NetHackQtBind::qt_create_nhwindow, + nethack_qt_::NetHackQtBind::qt_clear_nhwindow, + nethack_qt_::NetHackQtBind::qt_display_nhwindow, + nethack_qt_::NetHackQtBind::qt_destroy_nhwindow, + nethack_qt_::NetHackQtBind::qt_curs, + nethack_qt_::NetHackQtBind::qt_putstr, genl_putmixed, - nethack_qt4::NetHackQtBind::qt_display_file, - nethack_qt4::NetHackQtBind::qt_start_menu, - nethack_qt4::NetHackQtBind::qt_add_menu, - nethack_qt4::NetHackQtBind::qt_end_menu, - nethack_qt4::NetHackQtBind::qt_select_menu, + nethack_qt_::NetHackQtBind::qt_display_file, + nethack_qt_::NetHackQtBind::qt_start_menu, + nethack_qt_::NetHackQtBind::qt_add_menu, + nethack_qt_::NetHackQtBind::qt_end_menu, + nethack_qt_::NetHackQtBind::qt_select_menu, genl_message_menu, /* no need for X-specific handling */ - nethack_qt4::NetHackQtBind::qt_update_inventory, - nethack_qt4::NetHackQtBind::qt_mark_synch, - nethack_qt4::NetHackQtBind::qt_wait_synch, + nethack_qt_::NetHackQtBind::qt_update_inventory, + nethack_qt_::NetHackQtBind::qt_mark_synch, + nethack_qt_::NetHackQtBind::qt_wait_synch, #ifdef CLIPPING - nethack_qt4::NetHackQtBind::qt_cliparound, + nethack_qt_::NetHackQtBind::qt_cliparound, #endif #ifdef POSITIONBAR - nethack_qt4::Qt_positionbar, + nethack_qt_::Qt_positionbar, #endif - nethack_qt4::NetHackQtBind::qt_print_glyph, + nethack_qt_::NetHackQtBind::qt_print_glyph, //NetHackQtBind::qt_print_glyph_compose, - nethack_qt4::NetHackQtBind::qt_raw_print, - nethack_qt4::NetHackQtBind::qt_raw_print_bold, - nethack_qt4::NetHackQtBind::qt_nhgetch, - nethack_qt4::NetHackQtBind::qt_nh_poskey, - nethack_qt4::NetHackQtBind::qt_nhbell, - nethack_qt4::NetHackQtBind::qt_doprev_message, - nethack_qt4::NetHackQtBind::qt_yn_function, - nethack_qt4::NetHackQtBind::qt_getlin, - nethack_qt4::NetHackQtBind::qt_get_ext_cmd, - nethack_qt4::NetHackQtBind::qt_number_pad, - nethack_qt4::NetHackQtBind::qt_delay_output, + nethack_qt_::NetHackQtBind::qt_raw_print, + nethack_qt_::NetHackQtBind::qt_raw_print_bold, + nethack_qt_::NetHackQtBind::qt_nhgetch, + nethack_qt_::NetHackQtBind::qt_nh_poskey, + nethack_qt_::NetHackQtBind::qt_nhbell, + nethack_qt_::NetHackQtBind::qt_doprev_message, + nethack_qt_::NetHackQtBind::qt_yn_function, + nethack_qt_::NetHackQtBind::qt_getlin, + nethack_qt_::NetHackQtBind::qt_get_ext_cmd, + nethack_qt_::NetHackQtBind::qt_number_pad, + nethack_qt_::NetHackQtBind::qt_delay_output, #ifdef CHANGE_COLOR /* only a Mac option currently */ donull, donull, @@ -779,17 +780,17 @@ struct window_procs Qt_procs = { donull, #endif /* other defs that really should go away (they're tty specific) */ - nethack_qt4::NetHackQtBind::qt_start_screen, - nethack_qt4::NetHackQtBind::qt_end_screen, + nethack_qt_::NetHackQtBind::qt_start_screen, + nethack_qt_::NetHackQtBind::qt_end_screen, #ifdef GRAPHIC_TOMBSTONE - nethack_qt4::NetHackQtBind::qt_outrip, + nethack_qt_::NetHackQtBind::qt_outrip, #else genl_outrip, #endif genl_preference_update, - nethack_qt4::NetHackQtBind::qt_getmsghistory, - nethack_qt4::NetHackQtBind::qt_putmsghistory, + nethack_qt_::NetHackQtBind::qt_getmsghistory, + nethack_qt_::NetHackQtBind::qt_putmsghistory, genl_status_init, genl_status_finish, genl_status_enablefield, #ifdef STATUS_HILITES diff --git a/win/Qt4/qt4bind.h b/win/Qt/qt_bind.h similarity index 95% rename from win/Qt4/qt4bind.h rename to win/Qt/qt_bind.h index 820341cae..04d2a43d7 100644 --- a/win/Qt4/qt4bind.h +++ b/win/Qt/qt_bind.h @@ -2,14 +2,14 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4bind.h -- bindings between the Qt 4 interface and the main code +// qt_bind.h -- bindings between the Qt 4 interface and the main code #ifndef QT4BIND_H #define QT4BIND_H -#include "qt4main.h" +#include "qt_main.h" -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtClickBuffer; @@ -94,6 +94,6 @@ private: static boolean msgs_initd; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4click.cpp b/win/Qt/qt_click.cpp similarity index 89% rename from win/Qt4/qt4click.cpp rename to win/Qt/qt_click.cpp index 78177a14f..6cee16258 100644 --- a/win/Qt4/qt4click.cpp +++ b/win/Qt/qt_click.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4click.cpp -- a mouse click buffer +// qt_click.cpp -- a mouse click buffer #include "hack.h" #undef Invisible @@ -16,9 +16,9 @@ #undef max #include -#include "qt4click.h" +#include "qt_click.h" -namespace nethack_qt4 { +namespace nethack_qt_ { NetHackQtClickBuffer::NetHackQtClickBuffer() : in(0), out(0) @@ -45,4 +45,4 @@ void NetHackQtClickBuffer::Get() out=(out+1)%maxclick; } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4click.h b/win/Qt/qt_click.h similarity index 85% rename from win/Qt4/qt4click.h rename to win/Qt/qt_click.h index 50fd8b1cc..325f455fd 100644 --- a/win/Qt4/qt4click.h +++ b/win/Qt/qt_click.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4click.h -- a mouse click buffer +// qt_click.h -- a mouse click buffer #ifndef QT4CLICK_H #define QT4CLICK_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtClickBuffer { public: @@ -32,6 +32,6 @@ private: int in,out; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt/qt_clust.cpp b/win/Qt/qt_clust.cpp index c5063a6a3..b21a53a74 100644 --- a/win/Qt/qt_clust.cpp +++ b/win/Qt/qt_clust.cpp @@ -1,10 +1,9 @@ -/* NetHack 3.6 qt_clust.cpp $NHDT-Date: 1524684507 2018/04/25 19:28:27 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.8 $ */ +/* SCCS Id: @(#)qt_clust.cpp 3.4 1999/11/19 */ /* Copyright (c) Warwick Allison, 1999. */ /* NetHack may be freely redistributed. See license for details. */ #include "qt_clust.h" -static -void include(QRect& r, const QRect& rect) +static void include(QRect& r, const QRect& rect) { if (rect.left() -#include "qt4delay.h" +#include "qt_delay.h" -namespace nethack_qt4 { +namespace nethack_qt_ { // RLC Can we use QTimer::single_shot for this? NetHackQtDelay::NetHackQtDelay(int ms) : @@ -39,4 +39,4 @@ void NetHackQtDelay::timerEvent(QTimerEvent* timer) m_timer = 0; } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4delay.h b/win/Qt/qt_delay.h similarity index 82% rename from win/Qt4/qt4delay.h rename to win/Qt/qt_delay.h index 2e0085edf..8c918856f 100644 --- a/win/Qt4/qt4delay.h +++ b/win/Qt/qt_delay.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4delay.h -- implement a delay +// qt_delay.h -- implement a delay #ifndef QT4DELAY_H #define QT4DELAY_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtDelay : QObject { private: @@ -21,6 +21,6 @@ public: virtual void timerEvent(QTimerEvent* timer); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4glyph.cpp b/win/Qt/qt_glyph.cpp similarity index 94% rename from win/Qt4/qt4glyph.cpp rename to win/Qt/qt_glyph.cpp index 942f3a1ab..a3e4f24ef 100644 --- a/win/Qt4/qt4glyph.cpp +++ b/win/Qt/qt_glyph.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4glyph.cpp -- class to manage the glyphs in a tile set +// qt_glyph.cpp -- class to manage the glyphs in a tile set extern "C" { #include "hack.h" @@ -22,13 +22,13 @@ extern "C" { #if QT_VERSION >= 0x050000 #include #endif -#include "qt4glyph.h" -#include "qt4set.h" -#include "qt4str.h" +#include "qt_glyph.h" +#include "qt_set.h" +#include "qt_str.h" extern short glyph2tile[]; // from tile.c -namespace nethack_qt4 { +namespace nethack_qt_ { static int tilefile_tile_W=16; static int tilefile_tile_H=16; @@ -138,4 +138,4 @@ void NetHackQtGlyphs::setSize(int w, int h) (was1 ? pm2 : pm1) = pm; } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4glyph.h b/win/Qt/qt_glyph.h similarity index 85% rename from win/Qt4/qt4glyph.h rename to win/Qt/qt_glyph.h index 12fd915fd..b85c4f4d3 100644 --- a/win/Qt4/qt4glyph.h +++ b/win/Qt/qt_glyph.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4glyph.h -- class to manage the glyphs in a tile set +// qt_glyph.h -- class to manage the glyphs in a tile set #ifndef QT4GLYPH_H #define QT4GLYPH_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtGlyphs { public: @@ -29,6 +29,6 @@ private: int tiles_per_row; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4icon.cpp b/win/Qt/qt_icon.cpp similarity index 97% rename from win/Qt4/qt4icon.cpp rename to win/Qt/qt_icon.cpp index 0876cb59d..160fc7e10 100644 --- a/win/Qt4/qt4icon.cpp +++ b/win/Qt/qt_icon.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4icon.cpp -- a labelled icon +// qt_icon.cpp -- a labelled icon #include "hack.h" #undef Invisible @@ -19,9 +19,9 @@ #if QT_VERSION >= 0x050000 #include #endif -#include "qt4icon.h" +#include "qt_icon.h" -namespace nethack_qt4 { +namespace nethack_qt_ { NetHackQtLabelledIcon::NetHackQtLabelledIcon(QWidget* parent, const char* l) : QWidget(parent), @@ -200,4 +200,4 @@ void NetHackQtLabelledIcon::setAlignments() if (icon) icon->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter); } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4icon.h b/win/Qt/qt_icon.h similarity index 93% rename from win/Qt4/qt4icon.h rename to win/Qt/qt_icon.h index bdaf8183c..f1974ba44 100644 --- a/win/Qt4/qt4icon.h +++ b/win/Qt/qt_icon.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4icon.cpp -- a labelled icon +// qt_icon.cpp -- a labelled icon #ifndef QT4ICON_H #define QT4ICON_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtLabelledIcon : public QWidget { public: @@ -48,6 +48,6 @@ private: QLabel* icon; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4inv.cpp b/win/Qt/qt_inv.cpp similarity index 93% rename from win/Qt4/qt4inv.cpp rename to win/Qt/qt_inv.cpp index 6d1a201b4..be31d536e 100644 --- a/win/Qt4/qt4inv.cpp +++ b/win/Qt/qt_inv.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4inv.cpp -- inventory usage window +// qt_inv.cpp -- inventory usage window // This is at the top center of the main window extern "C" { @@ -22,11 +22,11 @@ extern "C" { #if QT_VERSION >= 0x050000 #include #endif -#include "qt4inv.h" -#include "qt4glyph.h" -#include "qt4set.h" +#include "qt_inv.h" +#include "qt_glyph.h" +#include "qt_set.h" -namespace nethack_qt4 { +namespace nethack_qt_ { NetHackQtInvUsageWindow::NetHackQtInvUsageWindow(QWidget* parent) : QWidget(parent) @@ -96,4 +96,4 @@ QSize NetHackQtInvUsageWindow::sizeHint(void) const } } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4inv.h b/win/Qt/qt_inv.h similarity index 85% rename from win/Qt4/qt4inv.h rename to win/Qt/qt_inv.h index 51cdd4d0b..4c74b8a6a 100644 --- a/win/Qt4/qt4inv.h +++ b/win/Qt/qt_inv.h @@ -2,13 +2,13 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4inv.h -- inventory usage window +// qt_inv.h -- inventory usage window // This is at the top center of the main window #ifndef QT4INV_H #define QT4INV_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtInvUsageWindow : public QWidget { public: @@ -20,6 +20,6 @@ private: void drawWorn(QPainter& painter, obj*, int x, int y, bool canbe=true); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4kde0.h b/win/Qt/qt_kde0.h similarity index 91% rename from win/Qt4/qt4kde0.h rename to win/Qt/qt_kde0.h index 27a678c01..8ac1f9595 100644 --- a/win/Qt4/qt4kde0.h +++ b/win/Qt/qt_kde0.h @@ -4,7 +4,7 @@ #ifndef QT_DUMMYKDE #define QT_DUMMYKDE -namespace nethack_qt4 { +namespace nethack_qt_ { class KTopLevelWidget : public QMainWindow { Q_OBJECT diff --git a/win/Qt4/qt4key.cpp b/win/Qt/qt_key.cpp similarity index 93% rename from win/Qt4/qt4key.cpp rename to win/Qt/qt_key.cpp index ff16616fe..2a43f7c85 100644 --- a/win/Qt4/qt4key.cpp +++ b/win/Qt/qt_key.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4key.cpp -- a key buffer +// qt_key.cpp -- a key buffer #include "hack.h" #undef Invisible @@ -16,9 +16,9 @@ #undef max #include -#include "qt4key.h" +#include "qt_key.h" -namespace nethack_qt4 { +namespace nethack_qt_ { NetHackQtKeyBuffer::NetHackQtKeyBuffer() : in(0), out(0) @@ -88,4 +88,4 @@ Qt::KeyboardModifiers NetHackQtKeyBuffer::TopState() const return state[out]; } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4key.h b/win/Qt/qt_key.h similarity index 89% rename from win/Qt4/qt4key.h rename to win/Qt/qt_key.h index 0333269cd..c2ef3a89b 100644 --- a/win/Qt4/qt4key.h +++ b/win/Qt/qt_key.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4key.h -- a key buffer +// qt_key.h -- a key buffer #ifndef QT4KEY_H #define QT4KEY_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtKeyBuffer { public: @@ -35,6 +35,6 @@ private: int in,out; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4line.cpp b/win/Qt/qt_line.cpp similarity index 86% rename from win/Qt4/qt4line.cpp rename to win/Qt/qt_line.cpp index dd9b18c5f..6374bea3f 100644 --- a/win/Qt4/qt4line.cpp +++ b/win/Qt/qt_line.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4line.cpp -- a one line input window +// qt_line.cpp -- a one line input window #include "hack.h" #undef Invisible @@ -19,9 +19,9 @@ #if QT_VERSION >= 0x050000 #include #endif -#include "qt4line.h" +#include "qt_line.h" -namespace nethack_qt4 { +namespace nethack_qt_ { NetHackQtLineEdit::NetHackQtLineEdit() : QLineEdit(0) @@ -39,4 +39,4 @@ void NetHackQtLineEdit::fakeEvent(int key, int ascii, Qt::KeyboardModifiers stat keyPressEvent(&fake); } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4line.h b/win/Qt/qt_line.h similarity index 81% rename from win/Qt4/qt4line.h rename to win/Qt/qt_line.h index bb5067f79..4b3c10cef 100644 --- a/win/Qt4/qt4line.h +++ b/win/Qt/qt_line.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4line.h -- a one line input window +// qt_line.h -- a one line input window #ifndef QT4LINE_H #define QT4LINE_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtLineEdit : public QLineEdit { public: @@ -17,6 +17,6 @@ public: void fakeEvent(int key, int ascii, Qt::KeyboardModifiers state); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4main.cpp b/win/Qt/qt_main.cpp similarity index 98% rename from win/Qt4/qt4main.cpp rename to win/Qt/qt_main.cpp index 291bddc35..06e47c3c5 100644 --- a/win/Qt4/qt4main.cpp +++ b/win/Qt/qt_main.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4main.cpp -- the main window +// qt_main.cpp -- the main window extern "C" { #include "hack.h" @@ -22,20 +22,20 @@ extern "C" { #if QT_VERSION >= 0x050000 #include #endif -#include "qt4main.h" -#include "qt4main.moc" -#include "qt4bind.h" -#include "qt4glyph.h" -#include "qt4inv.h" -#include "qt4key.h" -#include "qt4map.h" -#include "qt4msg.h" -#include "qt4set.h" -#include "qt4stat.h" -#include "qt4str.h" +#include "qt_main.h" +#include "qt_main.moc" +#include "qt_bind.h" +#include "qt_glyph.h" +#include "qt_inv.h" +#include "qt_key.h" +#include "qt_map.h" +#include "qt_msg.h" +#include "qt_set.h" +#include "qt_stat.h" +#include "qt_str.h" #ifndef KDE -#include "qt4kde0.moc" +#include "qt_kde0.moc" #endif // temporary @@ -44,7 +44,7 @@ extern char *qt_tileheight; extern int qt_compact_mode; // end temporary -namespace nethack_qt4 { +namespace nethack_qt_ { // temporary void centerOnMain( QWidget* w ); @@ -683,7 +683,7 @@ NetHackQtMainWindow::NetHackQtMainWindow(NetHackQtKeyBuffer& ks) : QToolButton* tb; char actchar[32]; tb = new SmallToolButton( QPixmap(again_xpm),"Again","Action", sm, SLOT(map()), toolbar ); - Sprintf(actchar, "%c", Cmd.spkeys[NHKF_DOAGAIN]); + Sprintf(actchar, "%c", g.Cmd.spkeys[NHKF_DOAGAIN]); sm->setMapping(tb, actchar ); toolbar->addWidget(tb); tb = new SmallToolButton( QPixmap(get_xpm),"Get","Action", sm, SLOT(map()), toolbar ); @@ -977,7 +977,7 @@ void NetHackQtMainWindow::keyPressEvent(QKeyEvent* event) event->key() >= Qt::Key_Left && event->key() <= Qt::Key_Down ) return; - const char* d = Cmd.dirchars; + const char* d = g.Cmd.dirchars; switch (event->key()) { case Qt::Key_Up: if ( dirkey == d[0] ) @@ -1073,4 +1073,4 @@ void NetHackQtMainWindow::ShowIfReady() } } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4main.h b/win/Qt/qt_main.h similarity index 95% rename from win/Qt4/qt4main.h rename to win/Qt/qt_main.h index a3ec15ac2..2e4a2a5d0 100644 --- a/win/Qt4/qt4main.h +++ b/win/Qt/qt_main.h @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4main.h -- the main window +// qt_main.h -- the main window #ifndef QT4MAIN_H #define QT4MAIN_H @@ -11,10 +11,10 @@ #include #include #else -#include "qt4kde0.h" +#include "qt_kde0.h" #endif -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtInvUsageWindow; class NetHackQtKeyBuffer; @@ -90,6 +90,6 @@ private: int dirkey; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4map.cpp b/win/Qt/qt_map.cpp similarity index 98% rename from win/Qt4/qt4map.cpp rename to win/Qt/qt_map.cpp index f3425bab2..74d30b3c8 100644 --- a/win/Qt4/qt4map.cpp +++ b/win/Qt/qt_map.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4map.cpp -- the map window +// qt_map.cpp -- the map window extern "C" { #include "hack.h" @@ -21,19 +21,19 @@ extern "C" { #if QT_VERSION >= 0x050000 #include #endif -#include "qt4map.h" -#include "qt4map.moc" -#include "qt4click.h" -#include "qt4glyph.h" +#include "qt_map.h" +#include "qt_map.moc" +#include "qt_click.h" +#include "qt_glyph.h" #include "qt_xpms.h" -#include "qt4set.h" -#include "qt4str.h" +#include "qt_set.h" +#include "qt_str.h" // temporary extern int qt_compact_mode; // end temporary -namespace nethack_qt4 { +namespace nethack_qt_ { #ifdef TEXTCOLOR static const QPen& nhcolor_to_pen(int c) @@ -137,7 +137,7 @@ void NetHackQtMapViewport::paintEvent(QPaintEvent* event) painter.setPen( Qt::green ); /* map glyph to character and color */ - mapglyph(g, &ch, &color, &special, i, j); + mapglyph(g, &ch, &color, &special, i, j, 0); ch = cp437(ch); #ifdef TEXTCOLOR painter.setPen( nhcolor_to_pen(color) ); @@ -176,7 +176,7 @@ void NetHackQtMapViewport::paintEvent(QPaintEvent* event) int color; int ch; unsigned special; - mapglyph(g, &ch, &color, &special, i, j); + mapglyph(g, &ch, &color, &special, i, j, 0); qt_settings->glyphs().drawCell(painter, g, i, j); #ifdef TEXTCOLOR if (((special & MG_PET) != 0) && ::iflags.hilite_pet) { @@ -829,7 +829,7 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event) painter.setPen( Qt::green ); /* map glyph to character and color */ - mapglyph(g, &ch, &color, &special, i, j); + mapglyph(g, &ch, &color, &special, i, j, 0); #ifdef TEXTCOLOR painter.setPen( nhcolor_to_pen(color) ); #endif @@ -859,7 +859,7 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event) int color; int ch; unsigned special; - mapglyph(g, &ch, &color, &special, i, j); + mapglyph(g, &ch, &color, &special, i, j, 0); qt_settings->glyphs().drawCell(painter, g, i, j); #ifdef TEXTCOLOR if (((special & MG_PET) != 0) && ::iflags.hilite_pet) { @@ -971,4 +971,4 @@ void NetHackQtMapWindow::Changed(int x, int y) } #endif -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4map.h b/win/Qt/qt_map.h similarity index 93% rename from win/Qt4/qt4map.h rename to win/Qt/qt_map.h index 337a726aa..8849a18da 100644 --- a/win/Qt4/qt4map.h +++ b/win/Qt/qt_map.h @@ -2,15 +2,15 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4map.h -- the map window +// qt_map.h -- the map window #ifndef QT4MAP_H #define QT4MAP_H -#include "qt4win.h" -#include "qt4clust.h" +#include "qt_win.h" +#include "qt_clust.h" -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtClickBuffer; @@ -77,6 +77,6 @@ private: QString messages; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4menu.cpp b/win/Qt/qt_menu.cpp similarity index 98% rename from win/Qt4/qt4menu.cpp rename to win/Qt/qt_menu.cpp index 19d073cfe..8a0106b4d 100644 --- a/win/Qt4/qt4menu.cpp +++ b/win/Qt/qt_menu.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4menu.cpp -- a menu or text-list widget +// qt_menu.cpp -- a menu or text-list widget extern "C" { #include "hack.h" @@ -21,12 +21,12 @@ extern "C" { #if QT_VERSION >= 0x050000 #include #endif -#include "qt4menu.h" -#include "qt4menu.moc" -#include "qt4glyph.h" -#include "qt4set.h" -#include "qt4streq.h" -#include "qt4str.h" +#include "qt_menu.h" +#include "qt_menu.moc" +#include "qt_glyph.h" +#include "qt_set.h" +#include "qt_streq.h" +#include "qt_str.h" // temporary extern "C" int qt_compact_mode; @@ -34,7 +34,7 @@ extern "C" int qt_compact_mode; extern "C" struct menucoloring *menu_colorings; -namespace nethack_qt4 { +namespace nethack_qt_ { // temporary void centerOnMain( QWidget* w ); @@ -827,4 +827,4 @@ int NetHackQtMenuOrTextWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) return actual->SelectMenu(how,menu_list); } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4menu.h b/win/Qt/qt_menu.h similarity index 96% rename from win/Qt4/qt4menu.h rename to win/Qt/qt_menu.h index 5bc265920..1b278a89f 100644 --- a/win/Qt4/qt4menu.h +++ b/win/Qt/qt_menu.h @@ -2,15 +2,15 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4menu.cpp -- a menu or text-list widget +// qt_menu.cpp -- a menu or text-list widget #ifndef QT4MENU_H #define QT4MENU_H -#include "qt4win.h" -#include "qt4rip.h" +#include "qt_win.h" +#include "qt_rip.h" -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtTextListBox : public QListWidget { public: @@ -178,6 +178,6 @@ public: }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4msg.cpp b/win/Qt/qt_msg.cpp similarity index 94% rename from win/Qt4/qt4msg.cpp rename to win/Qt/qt_msg.cpp index d82e102fe..6236f9817 100644 --- a/win/Qt4/qt4msg.cpp +++ b/win/Qt/qt_msg.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4msg.cpp -- a message window +// qt_msg.cpp -- a message window extern "C" { #include "hack.h" @@ -21,13 +21,13 @@ extern "C" { #if QT_VERSION >= 0x050000 #include #endif -#include "qt4msg.h" -#include "qt4msg.moc" -#include "qt4map.h" -#include "qt4set.h" -#include "qt4str.h" +#include "qt_msg.h" +#include "qt_msg.moc" +#include "qt_map.h" +#include "qt_set.h" +#include "qt_str.h" -namespace nethack_qt4 { +namespace nethack_qt_ { NetHackQtMessageWindow::NetHackQtMessageWindow() : list(new QListWidget()) @@ -152,4 +152,4 @@ void NetHackQtMessageWindow::PutStr(int attr, const QString& text) map->putMessage(attr, text2); } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4msg.h b/win/Qt/qt_msg.h similarity index 88% rename from win/Qt4/qt4msg.h rename to win/Qt/qt_msg.h index f4091ad18..08c029b9b 100644 --- a/win/Qt4/qt4msg.h +++ b/win/Qt/qt_msg.h @@ -2,14 +2,14 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4msg.h -- a message window +// qt_msg.h -- a message window #ifndef QT4MSG_H #define QT4MSG_H -#include "qt4win.h" +#include "qt_win.h" -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtMapWindow2; @@ -40,6 +40,6 @@ private slots: void updateFont(); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4plsel.cpp b/win/Qt/qt_plsel.cpp similarity index 98% rename from win/Qt4/qt4plsel.cpp rename to win/Qt/qt_plsel.cpp index fc1e105b3..c77203bec 100644 --- a/win/Qt4/qt4plsel.cpp +++ b/win/Qt/qt_plsel.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4plsel.cpp -- player selector dialog +// qt_plsel.cpp -- player selector dialog extern "C" { #include "hack.h" @@ -21,17 +21,17 @@ extern "C" { #if QT_VERSION >= 0x050000 #include #endif -#include "qt4plsel.h" -#include "qt4plsel.moc" -#include "qt4bind.h" -#include "qt4glyph.h" -#include "qt4set.h" -#include "qt4str.h" +#include "qt_plsel.h" +#include "qt_plsel.moc" +#include "qt_bind.h" +#include "qt_glyph.h" +#include "qt_set.h" +#include "qt_str.h" // Warwick prefers it this way... #define QT_CHOOSE_RACE_FIRST -namespace nethack_qt4 { +namespace nethack_qt_ { // temporary void centerOnMain( QWidget* w ); @@ -533,4 +533,4 @@ bool NetHackQtPlayerSelector::Choose() } } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4plsel.h b/win/Qt/qt_plsel.h similarity index 90% rename from win/Qt4/qt4plsel.h rename to win/Qt/qt_plsel.h index de070d147..5e2f7923e 100644 --- a/win/Qt4/qt4plsel.h +++ b/win/Qt/qt_plsel.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4plsel.h -- player selector dialog +// qt_plsel.h -- player selector dialog #ifndef QT4PLSEL_H #define QT4PLSEL_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtKeyBuffer; @@ -43,6 +43,6 @@ private: int chosen_align; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4rip.cpp b/win/Qt/qt_rip.cpp similarity index 92% rename from win/Qt4/qt4rip.cpp rename to win/Qt/qt_rip.cpp index d509f8895..cbe795f85 100644 --- a/win/Qt4/qt4rip.cpp +++ b/win/Qt/qt_rip.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4rip.cpp -- tombstone window +// qt_rip.cpp -- tombstone window #include "hack.h" #undef Invisible @@ -19,11 +19,11 @@ #if QT_VERSION >= 0x050000 #include #endif -#include "qt4rip.h" -#include "qt4bind.h" -#include "qt4str.h" +#include "qt_rip.h" +#include "qt_bind.h" +#include "qt_str.h" -namespace nethack_qt4 { +namespace nethack_qt_ { QPixmap* NetHackQtRIP::pixmap=0; @@ -91,4 +91,4 @@ void NetHackQtRIP::paintEvent(QPaintEvent* event) } } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4rip.h b/win/Qt/qt_rip.h similarity index 84% rename from win/Qt4/qt4rip.h rename to win/Qt/qt_rip.h index 792a4e32f..97670f0d0 100644 --- a/win/Qt4/qt4rip.h +++ b/win/Qt/qt_rip.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4rip.h -- tombstone window +// qt_rip.h -- tombstone window #ifndef QT4RIP_H #define QT4RIP_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtRIP : public QWidget { private: @@ -25,6 +25,6 @@ protected: QSize sizeHint() const; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4set.cpp b/win/Qt/qt_set.cpp similarity index 96% rename from win/Qt4/qt4set.cpp rename to win/Qt/qt_set.cpp index f9bfa246e..2ac70fd9d 100644 --- a/win/Qt4/qt4set.cpp +++ b/win/Qt/qt_set.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4set.cpp -- the Qt settings +// qt_set.cpp -- the Qt settings #include "hack.h" #undef Invisible @@ -19,10 +19,10 @@ #if QT_VERSION >= 0x050000 #include #endif -#include "qt4set.h" -#include "qt4set.moc" -#include "qt4glyph.h" -#include "qt4str.h" +#include "qt_set.h" +#include "qt_set.moc" +#include "qt_glyph.h" +#include "qt_str.h" /* Used by tile/font-size patch below and in ../../src/files.c */ char *qt_tilewidth=NULL; @@ -34,7 +34,7 @@ int qt_compact_mode = 1; int qt_compact_mode = 0; #endif -namespace nethack_qt4 { +namespace nethack_qt_ { #define TILEWMIN 6 #define TILEHMIN 6 @@ -192,4 +192,4 @@ bool NetHackQtSettings::ynInMessages() NetHackQtSettings* qt_settings; -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4set.h b/win/Qt/qt_set.h similarity index 92% rename from win/Qt4/qt4set.h rename to win/Qt/qt_set.h index 48b90f306..6b2aa6a4a 100644 --- a/win/Qt4/qt4set.h +++ b/win/Qt/qt_set.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4set.h -- the Qt settings +// qt_set.h -- the Qt settings #ifndef QT4SET_H #define QT4SET_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtGlyphs; @@ -54,6 +54,6 @@ private slots: extern NetHackQtSettings* qt_settings; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4stat.cpp b/win/Qt/qt_stat.cpp similarity index 97% rename from win/Qt4/qt4stat.cpp rename to win/Qt/qt_stat.cpp index be0ceb1cc..5e6918f00 100644 --- a/win/Qt4/qt4stat.cpp +++ b/win/Qt/qt_stat.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4stat.cpp -- bindings between the Qt 4 interface and the main code +// qt_stat.cpp -- bindings between the Qt 4 interface and the main code extern "C" { #include "hack.h" @@ -21,16 +21,16 @@ extern "C" { #if QT_VERSION >= 0x050000 #include #endif -#include "qt4stat.h" -#include "qt4stat.moc" -#include "qt4set.h" -#include "qt4str.h" +#include "qt_stat.h" +#include "qt_stat.moc" +#include "qt_set.h" +#include "qt_str.h" #include "qt_xpms.h" extern const char *enc_stat[]; /* from botl.c */ extern const char *hu_stat[]; /* from eat.c */ -namespace nethack_qt4 { +namespace nethack_qt_ { NetHackQtStatusWindow::NetHackQtStatusWindow() : // Notes: @@ -431,7 +431,7 @@ void NetHackQtStatusWindow::updateStats() if (u.mtimedone) { buf = nh_capitalize_words(mons[u.umonnum].mname); } else { - buf = rank_of(u.ulevel, pl_character[0], ::flags.female); + buf = rank_of(u.ulevel, g.pl_character[0], ::flags.female); } QString buf2; buf2.sprintf("%s the %s", g.plname, buf.toLatin1().constData()); @@ -441,7 +441,7 @@ void NetHackQtStatusWindow::updateStats() if (describe_level(buf3)) { dlevel.setLabel(buf3,true); } else { - buf.sprintf("%s, level ", dungeons[u.uz.dnum].dname); + buf.sprintf("%s, level ", g.dungeons[u.uz.dnum].dname); dlevel.setLabel(buf,(long)::depth(&u.uz)); } @@ -537,4 +537,4 @@ void NetHackQtStatusWindow::checkTurnEvents() { } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4stat.h b/win/Qt/qt_stat.h similarity index 92% rename from win/Qt4/qt4stat.h rename to win/Qt/qt_stat.h index a0a00a46f..73d7d8eca 100644 --- a/win/Qt4/qt4stat.h +++ b/win/Qt/qt_stat.h @@ -2,15 +2,15 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4stat.h -- bindings between the Qt 4 interface and the main code +// qt_stat.h -- bindings between the Qt 4 interface and the main code #ifndef QT4STAT_H #define QT4STAT_H -#include "qt4win.h" -#include "qt4icon.h" +#include "qt_win.h" +#include "qt_icon.h" -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtStatusWindow : QWidget, public NetHackQtWindow { Q_OBJECT @@ -101,6 +101,6 @@ private: void checkTurnEvents(); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4str.cpp b/win/Qt/qt_str.cpp similarity index 96% rename from win/Qt4/qt4str.cpp rename to win/Qt/qt_str.cpp index b6b4440eb..fc9cd26d7 100644 --- a/win/Qt4/qt4str.cpp +++ b/win/Qt/qt_str.cpp @@ -2,13 +2,13 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4str.cpp -- some string functions +// qt_str.cpp -- some string functions #include #include -#include "qt4str.h" +#include "qt_str.h" -namespace nethack_qt4 { +namespace nethack_qt_ { // Bounded string copy size_t str_copy(char *dest, const char *src, size_t max) @@ -80,4 +80,4 @@ int cp437(int ch) return cp437table[(unsigned char)ch]; } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4str.h b/win/Qt/qt_str.h similarity index 83% rename from win/Qt4/qt4str.h rename to win/Qt/qt_str.h index 05f25f4c4..2d5449363 100644 --- a/win/Qt4/qt4str.h +++ b/win/Qt/qt_str.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4str.h -- various string functions +// qt_str.h -- various string functions #ifndef QT4STR_H #define QT4STR_H -namespace nethack_qt4 { +namespace nethack_qt_ { // Bounded string copy extern size_t str_copy(char *dest, const char *src, size_t max); @@ -19,6 +19,6 @@ extern QString nh_capitalize_words(const QString& str); // Map symbol conversion extern int cp437(int ch); -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4streq.cpp b/win/Qt/qt_streq.cpp similarity index 94% rename from win/Qt4/qt4streq.cpp rename to win/Qt/qt_streq.cpp index abe910ff7..c489e5800 100644 --- a/win/Qt4/qt4streq.cpp +++ b/win/Qt/qt_streq.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4streq.cpp -- string requestor +// qt_streq.cpp -- string requestor #include "hack.h" #undef Invisible @@ -19,10 +19,10 @@ #if QT_VERSION >= 0x050000 #include #endif -#include "qt4streq.h" -#include "qt4str.h" +#include "qt_streq.h" +#include "qt_str.h" -namespace nethack_qt4 { +namespace nethack_qt_ { // temporary void centerOnMain(QWidget *); @@ -99,4 +99,4 @@ bool NetHackQtStringRequestor::Get(char* buffer, int maxchar) } } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4streq.h b/win/Qt/qt_streq.h similarity index 84% rename from win/Qt4/qt4streq.h rename to win/Qt/qt_streq.h index a5f05d769..12fd0a776 100644 --- a/win/Qt4/qt4streq.h +++ b/win/Qt/qt_streq.h @@ -2,14 +2,14 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4streq.h -- string requestor +// qt_streq.h -- string requestor #ifndef QT4STREQ_H #define QT4STREQ_H -#include "qt4line.h" +#include "qt_line.h" -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtStringRequestor : QDialog { private: @@ -25,6 +25,6 @@ public: virtual void resizeEvent(QResizeEvent*); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4svsel.cpp b/win/Qt/qt_svsel.cpp similarity index 93% rename from win/Qt4/qt4svsel.cpp rename to win/Qt/qt_svsel.cpp index 0b5271588..6950afd79 100644 --- a/win/Qt4/qt4svsel.cpp +++ b/win/Qt/qt_svsel.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4svsel.cpp -- saved game selector +// qt_svsel.cpp -- saved game selector #include "hack.h" #undef Invisible @@ -19,11 +19,11 @@ #if QT_VERSION >= 0x050000 #include #endif -#include "qt4svsel.h" -#include "qt4bind.h" -#include "qt4str.h" +#include "qt_svsel.h" +#include "qt_bind.h" +#include "qt_str.h" -namespace nethack_qt4 { +namespace nethack_qt_ { NetHackQtSavedGameSelector::NetHackQtSavedGameSelector(const char** saved) : QDialog(NetHackQtBind::mainWidget()) @@ -77,4 +77,4 @@ int NetHackQtSavedGameSelector::choose() return exec()-2; } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4svsel.h b/win/Qt/qt_svsel.h similarity index 79% rename from win/Qt4/qt4svsel.h rename to win/Qt/qt_svsel.h index 918e6f7e3..3a5498758 100644 --- a/win/Qt4/qt4svsel.h +++ b/win/Qt/qt_svsel.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4svsel.h -- saved game selector +// qt_svsel.h -- saved game selector #ifndef QT4SVSEL_H #define QT4SVSEL_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtSavedGameSelector : public QDialog { public: @@ -16,6 +16,6 @@ public: int choose(); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt/qt_win.cpp b/win/Qt/qt_win.cpp index a431a5736..664591834 100644 --- a/win/Qt/qt_win.cpp +++ b/win/Qt/qt_win.cpp @@ -1,5 +1,5 @@ -// NetHack 3.6 qt_win.cpp $NHDT-Date: 1524684508 2018/04/25 19:28:28 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.77 $ // Copyright (c) Warwick Allison, 1999. +// Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. // Qt Binding for NetHack 3.4 @@ -25,8 +25,8 @@ // key events by overiding QApplicion::notify(...), and putting them in // a buffer. Mouse clicks on the map window are treated with a similar // buffer. When the NetHack engine calls for a key, one is taken from -// the buffer, or if that is empty, QApplication::enter_loop() is called. -// Whenever keys or clicks go into the buffer, QApplication::exit_loop() +// the buffer, or if that is empty, QApplication::exec() is called. +// Whenever keys or clicks go into the buffer, QApplication::exit() // is called. // // Another problem is that some NetHack players are decade-long players who @@ -40,1400 +40,78 @@ // by the key event buffer. // -extern "C" { - // This includes all the definitions we need from the NetHack main // engine. We pretend MSC is a STDC compiler, because C++ is close // enough, and we undefine NetHack macros which conflict with Qt // identifiers. -#define alloc hide_alloc // avoid treading on STL symbol -#define lock hide_lock // avoid treading on STL symbol -#ifdef _MSC_VER -#define NHSTDC -#endif +#define QT_DEPRECATED_WARNINGS #include "hack.h" -#include "func_tab.h" -#include "dlb.h" -#include "patchlevel.h" -#include "tile2x11.h" #undef Invisible #undef Warning -#undef red -#undef green -#undef blue -#undef Black -#undef curs -#undef TRUE -#undef FALSE +#undef index +#undef msleep +#undef rindex +#undef wizard +#undef yn #undef min #undef max -#undef alloc -#undef lock -#undef yn - -} +#include +#if QT_VERSION >= 0x050000 +#include +#endif #include "qt_win.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -//#include +#include "qt_bind.h" +#include "qt_click.h" +#include "qt_glyph.h" +#include "qt_inv.h" +#include "qt_key.h" +#include "qt_icon.h" +#include "qt_map.h" +#include "qt_menu.h" +#include "qt_msg.h" +#include "qt_set.h" #include #include "qt_clust.h" -#include "qt_xpms.h" #include -#ifdef Q_WS_MACX -# include -#else -# include -#endif #ifdef _WS_X11_ // For userid control #include #endif -// Some distributors released Qt 2.1.0beta4 -#if QT_VERSION < 220 -# define nh_WX11BypassWM 0x01000000 -#else -# define nh_WX11BypassWM WX11BypassWM -#endif - #ifdef USER_SOUNDS -# if QT_VERSION < 220 -# undef USER_SOUNDS +#if QT_VERSION >= 0x050000 +# include # else -# include +# include # endif #endif #ifdef USER_SOUNDS -extern "C" void play_sound_for_message(const char* str); +extern void play_sound_for_message(const std::string& str); #endif -#ifdef SAFERHANGUP -#include -#endif +namespace nethack_qt_ { -// Warwick prefers it this way... -#define QT_CHOOSE_RACE_FIRST - -static const char nh_attribution[] = "
NetHack" - "
by the NetHack DevTeam
"; - -static QString -aboutMsg() -{ - QString msg; - msg.sprintf( - "Qt NetHack is a version of NetHack built\n" -#ifdef KDE - "using KDE and the Qt GUI toolkit.\n" -#else - "using the Qt GUI toolkit.\n" -#endif - "This is version %d.%d.%d\n\n" - "Homepage:\n http://trolls.troll.no/warwick/nethack/\n\n" -#ifdef KDE - "KDE:\n http://www.kde.org\n" -#endif - "Qt:\n http://www.troll.no", - VERSION_MAJOR, - VERSION_MINOR, - PATCHLEVEL); - return msg; -} - -static void +void centerOnMain( QWidget* w ) { - QWidget* m = qApp->mainWidget(); + QWidget* m = NetHackQtBind::mainWidget(); if (!m) m = qApp->desktop(); QPoint p = m->mapToGlobal(QPoint(0,0)); w->move( p.x() + m->width()/2 - w->width()/2, p.y() + m->height()/2 - w->height()/2 ); } -NetHackQtLineEdit::NetHackQtLineEdit() : - QLineEdit(0) -{ -} - -NetHackQtLineEdit::NetHackQtLineEdit(QWidget* parent, const char* name) : - QLineEdit(parent,name) -{ -} - -void NetHackQtLineEdit::fakeEvent(int key, int ascii, int state) -{ - QKeyEvent fake(QEvent::KeyPress,key,ascii,state); - keyPressEvent(&fake); -} - -extern "C" { -/* Used by tile/font-size patch below and in ../../src/files.c */ -char *qt_tilewidth=NULL; -char *qt_tileheight=NULL; -char *qt_fontsize=NULL; -#if defined(QWS) -int qt_compact_mode = 1; -#else -int qt_compact_mode = 0; -#endif -extern const char *enc_stat[]; /* from botl.c */ -extern const char *hu_stat[]; /* from eat.c */ -extern int total_tiles_used; // from tile.c -extern short glyph2tile[]; // from tile.c -} - -static int tilefile_tile_W=16; -static int tilefile_tile_H=16; - -#define TILEWMIN 1 -#define TILEHMIN 1 - - -/* XPM */ -static const char * nh_icon[] = { -"40 40 6 1", -" s None c none", -". c #ffffff", -"X c #dadab6", -"o c #6c91b6", -"O c #476c6c", -"+ c #000000", -" ", -" ", -" ", -" . .X..XX.XX X ", -" .. .....X.XXXXXX XX ", -" ... ....X..XX.XXXXX XXX ", -" .. ..........X.XXXXXXXXXXX XX ", -" .... ........X..XX.XXXXXXXXX XXXX ", -" .... ..........X.XXXXXXXXXXX XXXX ", -" ooOOO..ooooooOooOOoOOOOOOOXX+++OO++ ", -" ooOOO..ooooooooOoOOOOOOOOOXX+++OO++ ", -" ....O..ooooooOooOOoOOOOOOOXX+XXXX++ ", -" ....O..ooooooooOoOOOOOOOOOXX+XXXX++ ", -" ..OOO..ooooooOooOOoOOOOOOOXX+++XX++ ", -" ++++..ooooooooOoOOOOOOOOOXX+++ +++ ", -" +++..ooooooOooOOoOOOOOOOXX+++ + ", -" ++..ooooooooOoOOOOOOOOOXX+++ ", -" ..ooooooOooOOoOOOOOOOXX+++ ", -" ..ooooooooOoOOOOOOOOOXX+++ ", -" ..ooooooOooOOoOOOOOOOXX+++ ", -" ..ooooooooOoOOOOOOOOOXX+++ ", -" ..oooooOooOOoOOOOOOXX+++ ", -" ..oooooooOoOOOOOOOOXX+++ ", -" ..ooooOooOOoOOOOOXX+++ ", -" ..ooooooOoOOOOOOOXX++++ ", -" ..o..oooOooOOoOOOOXX+XX+++ ", -" ...o..oooooOoOOOOOXX++XXX++ ", -" ....OO..ooOooOOoOOXX+++XXXX++ ", -" ...oo..+..oooOoOOOXX++XXooXXX++ ", -" ...ooo..++..OooOOoXX+++XXooOXXX+ ", -" ..oooOOXX+++....XXXX++++XXOOoOOXX+ ", -" ..oooOOXX+++ ...XXX+++++XXOOooOXX++ ", -" ..oooOXXX+++ ..XX+++ +XXOOooOXX++ ", -" .....XXX++++ XXXXXXX++ ", -" ....XX++++ XXXXXXX+ ", -" ...XX+++ XXXXX++ ", -" ", -" ", -" ", -" "}; -/* XPM */ -static const char * nh_icon_small[] = { -/* width height ncolors chars_per_pixel */ -"16 16 16 1", -/* colors */ -" c #587070", -". c #D1D5C9", -"X c #8B8C84", -"o c #2A2A28", -"O c #9AABA9", -"+ c #6A8FB2", -"@ c #C4CAC4", -"# c #B6BEB6", -"$ c None", -"% c #54564E", -"& c #476C6C", -"* c #ADB2AB", -"= c #ABABA2", -"- c #5E8295", -"; c #8B988F", -": c #E8EAE7", -/* pixels */ -"$$$$$$$$$$$$$$$$", -"$$$.$#::.#==*$$$", -"$.*:::::....#*=$", -"$@#:..@#*==#;XX;", -"$@O:+++- &&; X%X", -"$#%.+++- &&;% oX", -"$$o.++-- &&;%%X$", -"$$$:++-- &&;%%$$", -"$$$.O++- &&=o $$", -"$$$=:++- & XoX$$", -"$$*:@O-- ;%Xo$$", -"$*:O#$+--;oOOX $", -"$:+ =o::=oo=-;%X", -"$::.%o$*;X;##@%$", -"$$@# ;$$$$$=*;X$", -"$$$$$$$$$$$$$$$$" -}; - -/* XPM */ -static const char * map_xpm[] = { -"12 13 4 1", -". c None", -" c #000000000000", -"X c #0000B6DAFFFF", -"o c #69A69248B6DA", -" .", -" XXXXX ooo ", -" XoooX o ", -" XoooX o o ", -" XoooX ooo ", -" XXoXX o ", -" oooooXXX ", -" oo o oooX ", -" o XooX ", -" oooo XooX ", -" o o XXXX ", -" ", -". "}; -/* XPM */ -static const char * msg_xpm[] = { -"12 13 4 1", -". c None", -" c #FFFFFFFFFFFF", -"X c #69A69248B6DA", -"o c #000000000000", -" .", -" XXX XXX X o", -" o", -" XXXXX XX o", -" o", -" XX XXXXX o", -" o", -" XXXXXX o", -" o", -" XX XXX XX o", -" o", -" o", -".ooooooooooo"}; -/* XPM */ -static const char * stat_xpm[] = { -"12 13 5 1", -" c None", -". c #FFFF00000000", -"X c #000000000000", -"o c #FFFFFFFF0000", -"O c #69A6FFFF0000", -" ", -" ", -"... ", -"...X ", -"...X ... ", -"oooX oooX", -"oooXooo oooX", -"OOOXOOOXOOOX", -"OOOXOOOXOOOX", -"OOOXOOOXOOOX", -"OOOXOOOXOOOX", -"OOOXOOOXOOOX", -" XXXXXXXXXXX"}; -/* XPM */ -static const char * info_xpm[] = { -"12 13 4 1", -" c None", -". c #00000000FFFF", -"X c #FFFFFFFFFFFF", -"o c #000000000000", -" ... ", -" ....... ", -" ...XXX... ", -" .........o ", -"...XXXX.... ", -"....XXX....o", -"....XXX....o", -"....XXX....o", -" ...XXX...oo", -" ..XXXXX..o ", -" .......oo ", -" o...ooo ", -" ooo "}; - - -/* XPM */ -static const char * again_xpm[] = { -"12 13 2 1", -" c None", -". c #000000000000", -" .. ", -" .. ", -" ..... ", -" ....... ", -"... .. .. ", -".. .. .. ", -".. ..", -".. ..", -".. ..", -" .. .. ", -" .......... ", -" ...... ", -" "}; -/* XPM */ -static const char * kick_xpm[] = { -"12 13 3 1", -" c None", -". c #000000000000", -"X c #FFFF6DB60000", -" ", -" ", -" . . . ", -" ... . . ", -" ... . ", -" ... . ", -" ... ", -"XXX ... ", -"XXX. ... ", -"XXX. ... ", -"XXX. .. ", -" ... ", -" "}; -/* XPM */ -static const char * throw_xpm[] = { -"12 13 3 1", -" c None", -". c #FFFF6DB60000", -"X c #000000000000", -" ", -" ", -" ", -" ", -".... X ", -"....X X ", -"....X XXXXXX", -"....X X ", -" XXXX X ", -" ", -" ", -" ", -" "}; -/* XPM */ -static const char * fire_xpm[] = { -"12 13 5 1", -" c None", -". c #B6DA45140000", -"X c #FFFFB6DA9658", -"o c #000000000000", -"O c #FFFF6DB60000", -" . ", -" X. ", -" X . ", -" X .o ", -" X . o ", -" X .o o ", -"OOOOOOOOoooo", -" X .o o ", -" X . o o ", -" X .o ", -" X. o ", -" . o ", -" o "}; -/* XPM */ -static const char * get_xpm[] = { -"12 13 3 1", -" c None", -". c #000000000000", -"X c #FFFF6DB60000", -" ", -" . ", -" ... ", -" . . . ", -" . ", -" . ", -" ", -" XXXXX ", -" XXXXX. ", -" XXXXX. ", -" XXXXX. ", -" ..... ", -" "}; -/* XPM */ -static const char * drop_xpm[] = { -"12 13 3 1", -" c None", -". c #FFFF6DB60000", -"X c #000000000000", -" ", -" ..... ", -" .....X ", -" .....X ", -" .....X ", -" XXXXX ", -" ", -" X ", -" X ", -" X X X ", -" XXX ", -" X ", -" "}; -/* XPM */ -static const char * eat_xpm[] = { -"12 13 4 1", -" c None", -". c #000000000000", -"X c #FFFFB6DA9658", -"o c #FFFF6DB60000", -" .X. .. ", -" .X. .. ", -" .X. .. ", -" .X. .. ", -" ... .. ", -" .. .. ", -" .. .. ", -" oo oo ", -" oo oo ", -" oo oo ", -" oo oo ", -" oo oo ", -" oo oo "}; -/* XPM */ -static const char * rest_xpm[] = { -"12 13 2 1", -" c None", -". c #000000000000", -" ..... ", -" . ", -" . ", -" . ....", -" ..... . ", -" . ", -" ....", -" ", -" .... ", -" . ", -" . ", -" .... ", -" "}; -/* XPM */ -static const char * cast_a_xpm[] = { -"12 13 3 1", -" c None", -". c #FFFF6DB60000", -"X c #000000000000", -" . ", -" . ", -" .. ", -" .. ", -" .. . ", -" .. . ", -" ...... ", -" .. .. XX ", -" .. X X ", -" .. X X ", -" .. XXXX ", -" . X X ", -" . X X "}; -/* XPM */ -static const char * cast_b_xpm[] = { -"12 13 3 1", -" c None", -". c #FFFF6DB60000", -"X c #000000000000", -" . ", -" . ", -" .. ", -" .. ", -" .. . ", -" .. . ", -" ...... ", -" .. .. XXX ", -" .. X X ", -" .. XXX ", -" .. X X ", -" . X X ", -" . XXX "}; -/* XPM */ -static const char * cast_c_xpm[] = { -"12 13 3 1", -" c None", -". c #FFFF6DB60000", -"X c #000000000000", -" . ", -" . ", -" .. ", -" .. ", -" .. . ", -" .. . ", -" ...... ", -" .. .. XX ", -" .. X X ", -" .. X ", -" .. X ", -" . X X ", -" . XX "}; - -NetHackQtSettings::NetHackQtSettings(int w, int h) : - tilewidth(TILEWMIN,64,1,this), - tileheight(TILEHMIN,64,1,this), - widthlbl(&tilewidth,"&Width:",this), - heightlbl(&tileheight,"&Height:",this), - whichsize("&Zoomed",this), - fontsize(this), - normal("times"), -#ifdef WS_WIN - normalfixed("courier new"), -#else - normalfixed("fixed"), -#endif - large("times"), - theglyphs(0) - -{ - int default_fontsize; - - if (w<=300) { - // ~240x320 - default_fontsize=4; - tilewidth.setValue(8); - tileheight.setValue(12); - } else if (w<=700) { - // ~640x480 - default_fontsize=3; - tilewidth.setValue(8); - tileheight.setValue(14); - } else if (w<=900) { - // ~800x600 - default_fontsize=3; - tilewidth.setValue(10); - tileheight.setValue(17); - } else if (w<=1100) { - // ~1024x768 - default_fontsize=2; - tilewidth.setValue(12); - tileheight.setValue(22); - } else if (w<=1200) { - // ~1152x900 - default_fontsize=1; - tilewidth.setValue(14); - tileheight.setValue(26); - } else { - // ~1280x1024 and larger - default_fontsize=0; - tilewidth.setValue(16); - tileheight.setValue(30); - } - - // Tile/font sizes read from .nethackrc - if (qt_tilewidth != NULL) { - tilewidth.setValue(atoi(qt_tilewidth)); - free(qt_tilewidth); - } - if (qt_tileheight != NULL) { - tileheight.setValue(atoi(qt_tileheight)); - free(qt_tileheight); - } - if (qt_fontsize != NULL) { - switch (tolower(qt_fontsize[0])) { - case 'h': default_fontsize = 0; break; - case 'l': default_fontsize = 1; break; - case 'm': default_fontsize = 2; break; - case 's': default_fontsize = 3; break; - case 't': default_fontsize = 4; break; - } - free(qt_fontsize); - } - - theglyphs=new NetHackQtGlyphs(); - resizeTiles(); - - connect(&tilewidth,SIGNAL(valueChanged(int)),this,SLOT(resizeTiles())); - connect(&tileheight,SIGNAL(valueChanged(int)),this,SLOT(resizeTiles())); - connect(&whichsize,SIGNAL(toggled(bool)),this,SLOT(setGlyphSize(bool))); - - fontsize.insertItem("Huge"); - fontsize.insertItem("Large"); - fontsize.insertItem("Medium"); - fontsize.insertItem("Small"); - fontsize.insertItem("Tiny"); - fontsize.setCurrentItem(default_fontsize); - connect(&fontsize,SIGNAL(activated(int)),this,SIGNAL(fontChanged())); - - QGridLayout* grid = new QGridLayout(this, 5, 2, 8); - grid->addMultiCellWidget(&whichsize, 0, 0, 0, 1); - grid->addWidget(&tilewidth, 1, 1); grid->addWidget(&widthlbl, 1, 0); - grid->addWidget(&tileheight, 2, 1); grid->addWidget(&heightlbl, 2, 0); - QLabel* flabel=new QLabel(&fontsize, "&Font:",this); - grid->addWidget(flabel, 3, 0); grid->addWidget(&fontsize, 3, 1); - QPushButton* dismiss=new QPushButton("Dismiss",this); - dismiss->setDefault(TRUE); - grid->addMultiCellWidget(dismiss, 4, 4, 0, 1); - grid->setRowStretch(4,0); - grid->setColStretch(1,1); - grid->setColStretch(2,2); - grid->activate(); - - connect(dismiss,SIGNAL(clicked()),this,SLOT(accept())); - resize(150,140); -} - -NetHackQtGlyphs& NetHackQtSettings::glyphs() -{ - return *theglyphs; -} - -void NetHackQtSettings::resizeTiles() -{ - int w = tilewidth.value(); - int h = tileheight.value(); - - theglyphs->setSize(w,h); - emit tilesChanged(); -} - -void NetHackQtSettings::toggleGlyphSize() -{ - whichsize.toggle(); -} - -void NetHackQtSettings::setGlyphSize(bool which) -{ - QSize n = QSize(tilewidth.value(),tileheight.value()); - if ( othersize.isValid() ) { - tilewidth.blockSignals(TRUE); - tileheight.blockSignals(TRUE); - tilewidth.setValue(othersize.width()); - tileheight.setValue(othersize.height()); - tileheight.blockSignals(FALSE); - tilewidth.blockSignals(FALSE); - resizeTiles(); - } - othersize = n; -} - -const QFont& NetHackQtSettings::normalFont() -{ - static int size[]={ 18, 14, 12, 10, 8 }; - normal.setPointSize(size[fontsize.currentItem()]); - return normal; -} - -const QFont& NetHackQtSettings::normalFixedFont() -{ - static int size[]={ 18, 14, 13, 10, 8 }; - normalfixed.setPointSize(size[fontsize.currentItem()]); - return normalfixed; -} - -const QFont& NetHackQtSettings::largeFont() -{ - static int size[]={ 24, 18, 14, 12, 10 }; - large.setPointSize(size[fontsize.currentItem()]); - return large; -} - -bool NetHackQtSettings::ynInMessages() -{ - return !qt_compact_mode; -} - - -NetHackQtSettings* qt_settings; - - - -NetHackQtKeyBuffer::NetHackQtKeyBuffer() : - in(0), out(0) -{ -} - -bool NetHackQtKeyBuffer::Empty() const { return in==out; } -bool NetHackQtKeyBuffer::Full() const { return (in+1)%maxkey==out; } - -void NetHackQtKeyBuffer::Put(int k, int a, int state) -{ - if ( Full() ) return; // Safety - key[in]=k; - ascii[in]=a; - in=(in+1)%maxkey; -} - -void NetHackQtKeyBuffer::Put(char a) -{ - Put(0,a,0); -} - -void NetHackQtKeyBuffer::Put(const char* str) -{ - while (*str) Put(*str++); -} - -int NetHackQtKeyBuffer::GetKey() -{ - if ( Empty() ) return 0; - int r=TopKey(); - out=(out+1)%maxkey; - return r; -} - -int NetHackQtKeyBuffer::GetAscii() -{ - if ( Empty() ) return 0; // Safety - int r=TopAscii(); - out=(out+1)%maxkey; - return r; -} - -int NetHackQtKeyBuffer::GetState() -{ - if ( Empty() ) return 0; - int r=TopState(); - out=(out+1)%maxkey; - return r; -} - -int NetHackQtKeyBuffer::TopKey() const -{ - if ( Empty() ) return 0; - return key[out]; -} - -int NetHackQtKeyBuffer::TopAscii() const -{ - if ( Empty() ) return 0; - return ascii[out]; -} - -int NetHackQtKeyBuffer::TopState() const -{ - if ( Empty() ) return 0; - return state[out]; -} - - -NetHackQtClickBuffer::NetHackQtClickBuffer() : - in(0), out(0) -{ -} - -bool NetHackQtClickBuffer::Empty() const { return in==out; } -bool NetHackQtClickBuffer::Full() const { return (in+1)%maxclick==out; } - -void NetHackQtClickBuffer::Put(int x, int y, int mod) -{ - click[in].x=x; - click[in].y=y; - click[in].mod=mod; - in=(in+1)%maxclick; -} - -int NetHackQtClickBuffer::NextX() const { return click[out].x; } -int NetHackQtClickBuffer::NextY() const { return click[out].y; } -int NetHackQtClickBuffer::NextMod() const { return click[out].mod; } - -void NetHackQtClickBuffer::Get() -{ - out=(out+1)%maxclick; -} - -class NhPSListViewItem : public QListViewItem { -public: - NhPSListViewItem( QListView* parent, const QString& name ) : - QListViewItem(parent, name) - { - } - - void setGlyph(int g) - { - NetHackQtGlyphs& glyphs = qt_settings->glyphs(); - int gw = glyphs.width(); - int gh = glyphs.height(); - QPixmap pm(gw,gh); - QPainter p(&pm); - glyphs.drawGlyph(p, g, 0, 0); - p.end(); - setPixmap(0,pm); - setHeight(QMAX(pm.height()+1,height())); - } - - void paintCell( QPainter *p, const QColorGroup &cg, - int column, int width, int alignment ) - { - if ( isSelectable() ) { - QListViewItem::paintCell( p, cg, column, width, alignment ); - } else { - QColorGroup disabled( - cg.foreground().light(), - cg.button().light(), - cg.light(), cg.dark(), cg.mid(), - gray, cg.base() ); - QListViewItem::paintCell( p, disabled, column, width, alignment ); - } - } -}; - -class NhPSListViewRole : public NhPSListViewItem { -public: - NhPSListViewRole( QListView* parent, int id ) : - NhPSListViewItem(parent, -#ifdef QT_CHOOSE_RACE_FIRST // Lowerize - looks better - QString(QChar(roles[id].name.m[0])).lower()+QString(roles[id].name.m+1) -#else - roles[id].name.m -#endif - ) - { - setGlyph(monnum_to_glyph(roles[id].malenum)); - } -}; - -class NhPSListViewRace : public NhPSListViewItem { -public: - NhPSListViewRace( QListView* parent, int id ) : - NhPSListViewItem(parent, -#ifdef QT_CHOOSE_RACE_FIRST // Capitalize - looks better - QString(QChar(races[id].noun[0])).upper()+QString(races[id].noun+1) -#else - QString(QChar(races[id].noun[0])+QString(races[id].noun+1)) -#endif - ) - { - setGlyph(monnum_to_glyph(races[id].malenum)); - } -}; - -class NhPSListView : public QListView { -public: - NhPSListView( QWidget* parent ) : - QListView(parent) - { - setSorting(-1); // order is identity - header()->setClickEnabled(FALSE); - } - - QSizePolicy sizePolicy() const - { - return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); - } - - QSize minimumSizeHint() const - { - return sizeHint(); - } - - QSize sizeHint() const - { - QListView::sizeHint(); - QSize sz = header()->sizeHint(); - int h=0; - QListViewItem* c=firstChild(); - while (c) h+=c->height(),c = c->nextSibling(); - sz += QSize(frameWidth()*2, h+frameWidth()*2); - return sz; - } - - int selectedItemNumber() const - { - int i=0; - QListViewItem* c = firstChild(); - while (c) { - if (c == selectedItem()) { - return i; - } - i++; - c = c->nextSibling(); - } - return -1; - } - - void setSelectedItemNumber(int i) - { - QListViewItem* c=firstChild(); - while (i--) - c = c->nextSibling(); - c->setSelected(TRUE); - } -}; - -NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks) : - QDialog(qApp->mainWidget(),"plsel",TRUE), - keysource(ks), - fully_specified_role(TRUE) -{ - /* - 0 1 2 - + Name ------------------------------------+ - 0 | | - + ---- ------------------------------------+ - + Role ---+ + Race ---+ + Gender ------+ - | | | | | * Male | - 1 | | | | | * Female | - | | | | +--------------+ - | | | | - | | | | + Alignment ---+ - 2 | | | | | * Male | - | | | | | * Female | - | | | | +--------------+ - 3 | | | | ...stretch... - | | | | - 4 | | | | [ Play ] - 5 | | | | [ Quit ] - +---------+ +---------+ - */ - - int marg=4; - QGridLayout *l = new QGridLayout(this,6,3,marg,marg); - - QButtonGroup* namebox = new QButtonGroup(1,Horizontal,"Name",this); - QLineEdit* name = new QLineEdit(namebox); - name->setMaxLength(sizeof(g.plname)-1); - if ( strncmp(g.plname,"player",6) && strncmp(g.plname,"games",5) ) - name->setText(g.plname); - connect(name, SIGNAL(textChanged(const QString&)), - this, SLOT(selectName(const QString&)) ); - name->setFocus(); - QButtonGroup* genderbox = new QButtonGroup("Sex",this); - QButtonGroup* alignbox = new QButtonGroup("Alignment",this); - QVBoxLayout* vbgb = new QVBoxLayout(genderbox,3,1); - vbgb->setAutoAdd(TRUE); - vbgb->addSpacing(fontMetrics().height()*3/4); - QVBoxLayout* vbab = new QVBoxLayout(alignbox,3,1); - vbab->setAutoAdd(TRUE); - vbab->addSpacing(fontMetrics().height()); - QLabel* logo = new QLabel(nh_attribution, this); - - l->addMultiCellWidget( namebox, 0,0,0,2 ); -#ifdef QT_CHOOSE_RACE_FIRST - race = new NhPSListView(this); - role = new NhPSListView(this); - l->addMultiCellWidget( race, 1,5,0,0 ); - l->addMultiCellWidget( role, 1,5,1,1 ); -#else - role = new NhPSListView(this); - race = new NhPSListView(this); - l->addMultiCellWidget( role, 1,5,0,0 ); - l->addMultiCellWidget( race, 1,5,1,1 ); -#endif - role->addColumn("Role"); - race->addColumn("Race"); - - l->addWidget( genderbox, 1, 2 ); - l->addWidget( alignbox, 2, 2 ); - l->addWidget( logo, 3, 2, AlignCenter ); - l->setRowStretch( 3, 5 ); - - int i; - int nrole; - - for (nrole=0; roles[nrole].name.m; nrole++) - ; - for (i=nrole-1; i>=0; i--) { // XXX QListView unsorted goes in rev. - new NhPSListViewRole( role, i ); - } - connect( role, SIGNAL(selectionChanged()), this, SLOT(selectRole()) ); - - int nrace; - for (nrace=0; races[nrace].noun; nrace++) - ; - for (i=nrace-1; i>=0; i--) { - new NhPSListViewRace( race, i ); - } - connect( race, SIGNAL(selectionChanged()), this, SLOT(selectRace()) ); - - gender = new QRadioButton*[ROLE_GENDERS]; - for (i=0; iaddWidget( ok, 4, 2 ); - ok->setDefault(TRUE); - connect( ok, SIGNAL(clicked()), this, SLOT(accept()) ); - - QPushButton* cancel = new QPushButton("Quit",this); - l->addWidget( cancel, 5, 2 ); - connect( cancel, SIGNAL(clicked()), this, SLOT(reject()) ); - - // Randomize race and role, unless specified in config - int ro = flags.initrole; - if (ro == ROLE_NONE || ro == ROLE_RANDOM) { - ro = rn2(nrole); - if (flags.initrole != ROLE_RANDOM) { - fully_specified_role = FALSE; - } - } - int ra = flags.initrace; - if (ra == ROLE_NONE || ra == ROLE_RANDOM) { - ra = rn2(nrace); - if (flags.initrace != ROLE_RANDOM) { - fully_specified_role = FALSE; - } - } - - // make sure we have a valid combination, honoring - // the users request if possible. - bool choose_race_first; -#ifdef QT_CHOOSE_RACE_FIRST - choose_race_first = TRUE; - if (flags.initrole >= 0 && flags.initrace < 0) { - choose_race_first = FALSE; - } -#else - choose_race_first = FALSE; - if (flags.initrace >= 0 && flags.initrole < 0) { - choose_race_first = TRUE; - } -#endif - while (!validrace(ro,ra)) { - if (choose_race_first) { - ro = rn2(nrole); - if (flags.initrole != ROLE_RANDOM) { - fully_specified_role = FALSE; - } - } else { - ra = rn2(nrace); - if (flags.initrace != ROLE_RANDOM) { - fully_specified_role = FALSE; - } - } - } - - int g = flags.initgend; - if (g == -1) { - g = rn2(ROLE_GENDERS); - fully_specified_role = FALSE; - } - while (!validgend(ro,ra,g)) { - g = rn2(ROLE_GENDERS); - } - gender[g]->setChecked(TRUE); - selectGender(g); - - int a = flags.initalign; - if (a == -1) { - a = rn2(ROLE_ALIGNS); - fully_specified_role = FALSE; - } - while (!validalign(ro,ra,a)) { - a = rn2(ROLE_ALIGNS); - } - alignment[a]->setChecked(TRUE); - selectAlignment(a); - - QListViewItem* li; - - li = role->firstChild(); - while (ro--) li=li->nextSibling(); - role->setSelected(li,TRUE); - - li = race->firstChild(); - while (ra--) li=li->nextSibling(); - race->setSelected(li,TRUE); - - flags.initrace = race->selectedItemNumber(); - flags.initrole = role->selectedItemNumber(); -} - - -void NetHackQtPlayerSelector::selectName(const QString& n) -{ - strncpy(g.plname,n.latin1(),sizeof(g.plname)-1); -} - -void NetHackQtPlayerSelector::selectRole() -{ - int ra = race->selectedItemNumber(); - int ro = role->selectedItemNumber(); - if (ra == -1 || ro == -1) return; - -#ifdef QT_CHOOSE_RACE_FIRST - selectRace(); -#else - QListViewItem* i=role->currentItem(); - QListViewItem* valid=0; - int j; - NhPSListViewItem* item; - item = (NhPSListViewItem*)role->firstChild(); - for (j=0; roles[j].name.m; j++) { - bool v = validrace(j,ra); - item->setSelectable(TRUE); - if ( !valid && v ) valid = item; - item=(NhPSListViewItem*)item->nextSibling(); - } - if ( !validrace(role->selectedItemNumber(),ra) ) - i = valid; - role->setSelected(i,TRUE); - item = (NhPSListViewItem*)role->firstChild(); - for (j=0; roles[j].name.m; j++) { - bool v = validrace(j,ra); - item->setSelectable(v); - item->repaint(); - item=(NhPSListViewItem*)item->nextSibling(); - } -#endif - - flags.initrole = role->selectedItemNumber(); - setupOthers(); -} - -void NetHackQtPlayerSelector::selectRace() -{ - int ra = race->selectedItemNumber(); - int ro = role->selectedItemNumber(); - if (ra == -1 || ro == -1) return; - -#ifndef QT_CHOOSE_RACE_FIRST - selectRole(); -#else - QListViewItem* i=race->currentItem(); - QListViewItem* valid=0; - int j; - NhPSListViewItem* item; - item = (NhPSListViewItem*)race->firstChild(); - for (j=0; races[j].noun; j++) { - bool v = validrace(ro,j); - item->setSelectable(TRUE); - if ( !valid && v ) valid = item; - item=(NhPSListViewItem*)item->nextSibling(); - } - if ( !validrace(ro,race->selectedItemNumber()) ) - i = valid; - race->setSelected(i,TRUE); - item = (NhPSListViewItem*)race->firstChild(); - for (j=0; races[j].noun; j++) { - bool v = validrace(ro,j); - item->setSelectable(v); - item->repaint(); - item=(NhPSListViewItem*)item->nextSibling(); - } -#endif - - flags.initrace = race->selectedItemNumber(); - setupOthers(); -} - -void NetHackQtPlayerSelector::setupOthers() -{ - int ro = role->selectedItemNumber(); - int ra = race->selectedItemNumber(); - int valid=-1; - int c=0; - int j; - for (j=0; jisChecked() ) - c = j; - gender[j]->setEnabled(v); - if ( valid<0 && v ) valid = j; - } - if ( !validgend(ro,ra,c) ) - c = valid; - int k; - for (k=0; ksetChecked(c==k); - } - selectGender(c); - - valid=-1; - for (j=0; jisChecked() ) - c = j; - alignment[j]->setEnabled(v); - if ( valid<0 && v ) valid = j; - } - if ( !validalign(ro,ra,c) ) - c = valid; - for (k=0; ksetChecked(c==k); - } - selectAlignment(c); -} - -void NetHackQtPlayerSelector::selectGender(int i) -{ - flags.initgend = i; -} - -void NetHackQtPlayerSelector::selectAlignment(int i) -{ - flags.initalign = i; -} - - -void NetHackQtPlayerSelector::done(int i) -{ - setResult(i); - qApp->exit_loop(); -} - -void NetHackQtPlayerSelector::Quit() -{ - done(R_Quit); - qApp->exit_loop(); -} - -void NetHackQtPlayerSelector::Random() -{ - done(R_Rand); - qApp->exit_loop(); -} - -bool NetHackQtPlayerSelector::Choose() -{ - if (fully_specified_role) return TRUE; - -#if defined(QWS) // probably safe with Qt 3, too (where show!=exec in QDialog). - if ( qt_compact_mode ) { - showMaximized(); - } else -#endif - { - adjustSize(); - centerOnMain(this); - } - - if ( exec() ) { - return TRUE; - } else { - return FALSE; - } -} - - -NetHackQtStringRequestor::NetHackQtStringRequestor(NetHackQtKeyBuffer& ks, const char* p, const char* cancelstr) : - QDialog(qApp->mainWidget(),"string",FALSE), - prompt(p,this,"prompt"), - input(this,"input"), - keysource(ks) -{ - cancel=new QPushButton(cancelstr,this); - connect(cancel,SIGNAL(clicked()),this,SLOT(reject())); - - okay=new QPushButton("Okay",this); - connect(okay,SIGNAL(clicked()),this,SLOT(accept())); - connect(&input,SIGNAL(returnPressed()),this,SLOT(accept())); - okay->setDefault(TRUE); - - setFocusPolicy(StrongFocus); -} - -void NetHackQtStringRequestor::resizeEvent(QResizeEvent*) -{ - const int margin=5; - const int gutter=5; - - int h=(height()-margin*2-gutter); - - if (strlen(prompt.text()) > 16) { - h/=3; - prompt.setGeometry(margin,margin,width()-margin*2,h); - input.setGeometry(width()*1/5,margin+h+gutter, - (width()-margin-2-gutter)*4/5,h); - } else { - h/=2; - prompt.setGeometry(margin,margin,(width()-margin*2-gutter)*2/5,h); - input.setGeometry(prompt.geometry().right()+gutter,margin, - (width()-margin-2-gutter)*3/5,h); - } - - cancel->setGeometry(margin,input.geometry().bottom()+gutter, - (width()-margin*2-gutter)/2,h); - okay->setGeometry(cancel->geometry().right()+gutter,cancel->geometry().y(), - cancel->width(),h); -} - -void NetHackQtStringRequestor::SetDefault(const char* d) -{ - input.setText(d); -} - -bool NetHackQtStringRequestor::Get(char* buffer, int maxchar) -{ - input.setMaxLength(maxchar); - if (strlen(prompt.text()) > 16) { - resize(fontMetrics().width(prompt.text())+50,fontMetrics().height()*6); - } else { - resize(fontMetrics().width(prompt.text())*2+50,fontMetrics().height()*4); - } - - centerOnMain(this); - show(); - input.setFocus(); - setResult(-1); - while (result()==-1) { - // Put keys in buffer (eg. from macros, from out-of-focus input) - if (!keysource.Empty()) { - while (!keysource.Empty()) { - int key=keysource.TopKey(); - int ascii=keysource.TopAscii(); - int state=keysource.GetState(); - if (ascii=='\r' || ascii=='\n') { - // CR or LF in buffer causes confirmation - strcpy(buffer,input.text()); - return TRUE; - } else if (ascii=='\033') { - return FALSE; - } else { - input.fakeEvent(key,ascii,state); - } - } - } - qApp->enter_loop(); - } - // XXX Get rid of extra keys, since we couldn't get focus! - while (!keysource.Empty()) keysource.GetKey(); - - if (result()) { - strcpy(buffer,input.text()); - return TRUE; - } else { - return FALSE; - } -} -void NetHackQtStringRequestor::done(int i) -{ - setResult(i); - qApp->exit_loop(); -} - - NetHackQtWindow::NetHackQtWindow() { } - NetHackQtWindow::~NetHackQtWindow() { } @@ -1442,3870 +120,17 @@ NetHackQtWindow::~NetHackQtWindow() // void NetHackQtWindow::Clear() { puts("unexpected Clear"); } void NetHackQtWindow::Display(bool block) { puts("unexpected Display"); } -bool NetHackQtWindow::Destroy() { return TRUE; } +bool NetHackQtWindow::Destroy() { return true; } void NetHackQtWindow::CursorTo(int x,int y) { puts("unexpected CursorTo"); } -void NetHackQtWindow::PutStr(int attr, const char* text) { puts("unexpected PutStr"); } +void NetHackQtWindow::PutStr(int attr, const QString& text) { puts("unexpected PutStr"); } void NetHackQtWindow::StartMenu() { puts("unexpected StartMenu"); } void NetHackQtWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, - const char* str, bool presel) { puts("unexpected AddMenu"); } -void NetHackQtWindow::EndMenu(const char* prompt) { puts("unexpected EndMenu"); } + const QString& str, bool presel) { puts("unexpected AddMenu"); } +void NetHackQtWindow::EndMenu(const QString& prompt) { puts("unexpected EndMenu"); } int NetHackQtWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) { puts("unexpected SelectMenu"); return 0; } void NetHackQtWindow::ClipAround(int x,int y) { puts("unexpected ClipAround"); } void NetHackQtWindow::PrintGlyph(int x,int y,int glyph) { puts("unexpected PrintGlyph"); } //void NetHackQtWindow::PrintGlyphCompose(int x,int y,int,int) { puts("unexpected PrintGlyphCompose"); } void NetHackQtWindow::UseRIP(int how, time_t when) { puts("unexpected UseRIP"); } - - -// XXX Hmmm... crash after saving bones file if Map window is -// XXX deleted. Strange bug somewhere. -bool NetHackQtMapWindow::Destroy() { return FALSE; } - -NetHackQtMapWindow::NetHackQtMapWindow(NetHackQtClickBuffer& click_sink) : - clicksink(click_sink), - change(10), - rogue_font(0) -{ - viewport.addChild(this); - - setBackgroundColor(black); - viewport.setBackgroundColor(black); - - pet_annotation = QPixmap(qt_compact_mode ? pet_mark_small_xpm : pet_mark_xpm); - - cursor.setX(0); - cursor.setY(0); - Clear(); - - connect(qt_settings,SIGNAL(tilesChanged()),this,SLOT(updateTiles())); - connect(&viewport, SIGNAL(contentsMoving(int,int)), this, - SLOT(moveMessages(int,int))); - - updateTiles(); - //setFocusPolicy(StrongFocus); -#ifdef SAFERHANGUP - QTimer* deadman = new QTimer(this); - connect(deadman, SIGNAL(timeout()), SLOT(timeout())); - deadman->start(2000); // deadman timer every 2 seconds -#endif -} - -#ifdef SAFERHANGUP -// The "deadman" timer is received by this slot -void NetHackQtMapWindow::timeout() {} -#endif - -void NetHackQtMapWindow::moveMessages(int x, int y) -{ - QRect u = messages_rect; - messages_rect.moveTopLeft(QPoint(x,y)); - u |= messages_rect; - update(u); -} - -void NetHackQtMapWindow::clearMessages() -{ - messages = ""; - update(messages_rect); - messages_rect = QRect(); -} - -void NetHackQtMapWindow::putMessage(int attr, const char* text) -{ - if ( !messages.isEmpty() ) - messages += "\n"; - messages += text; - QFontMetrics fm = fontMetrics(); - messages_rect = fm.boundingRect(viewport.contentsX(), viewport.contentsY(), - viewport.width(), 0, - WordBreak|AlignTop|AlignLeft|DontClip, - messages); - update(messages_rect); -} - -void NetHackQtMapWindow::updateTiles() -{ - NetHackQtGlyphs& glyphs = qt_settings->glyphs(); - int gw = glyphs.width(); - int gh = glyphs.height(); - // Be exactly the size we want to be - full map... - resize(COLNO*gw,ROWNO*gh); - - viewport.verticalScrollBar()->setSteps(gh,gh); - viewport.horizontalScrollBar()->setSteps(gw,gw); - /* - viewport.setMaximumSize( - gw*COLNO + viewport.verticalScrollBar()->width(), - gh*ROWNO + viewport.horizontalScrollBar()->height() - ); - */ - viewport.updateScrollBars(); - - change.clear(); - change.add(0,0,COLNO,ROWNO); - delete rogue_font; rogue_font = 0; - Display(FALSE); - - emit resized(); -} - -NetHackQtMapWindow::~NetHackQtMapWindow() -{ - // Remove from viewport porthole, since that is a destructible member. - viewport.removeChild(this); - recreate(0,0,QPoint(0,0)); -} - -QWidget* NetHackQtMapWindow::Widget() -{ - return &viewport; -} - -void NetHackQtMapWindow::Scroll(int dx, int dy) -{ - if (viewport.horizontalScrollBar()->isVisible()) { - while (dx<0) { viewport.horizontalScrollBar()->subtractPage(); dx++; } - while (dx>0) { viewport.horizontalScrollBar()->addPage(); dx--; } - } - if (viewport.verticalScrollBar()->isVisible()) { - while (dy<0) { viewport.verticalScrollBar()->subtractPage(); dy++; } - while (dy>0) { viewport.verticalScrollBar()->addPage(); dy--; } - } -} - -void NetHackQtMapWindow::Clear() -{ - unsigned short stone=cmap_to_glyph(S_stone); - - for (int j=0; jexit_loop(); -} - -void NetHackQtMapWindow::mousePressEvent(QMouseEvent* event) -{ - clicksink.Put( - event->pos().x()/qt_settings->glyphs().width(), - event->pos().y()/qt_settings->glyphs().height(), - event->button()==LeftButton ? CLICK_1 : CLICK_2 - ); - qApp->exit_loop(); -} - -#ifdef TEXTCOLOR -static -const QPen& nhcolor_to_pen(int c) -{ - static QPen* pen=0; - if ( !pen ) { - pen = new QPen[17]; - pen[0] = QColor(24,24,24); // "black" on black - pen[1] = Qt::red; - pen[2] = QColor(0,191,0); - pen[3] = QColor(127,127,0); - pen[4] = Qt::blue; - pen[5] = Qt::magenta; - pen[6] = Qt::cyan; - pen[7] = Qt::gray; - pen[8] = Qt::white; // no color - pen[9] = QColor(255,127,0); - pen[10] = QColor(127,255,127); - pen[11] = Qt::yellow; - pen[12] = QColor(127,127,255); - pen[13] = QColor(255,127,255); - pen[14] = QColor(127,255,255); - pen[15] = Qt::white; - pen[16] = QColor(24,24,24); // "black" on black - } - - return pen[c]; -} -#endif - -void NetHackQtMapWindow::paintEvent(QPaintEvent* event) -{ - QRect area=event->rect(); - QRect garea; - garea.setCoords( - QMAX(0,area.left()/qt_settings->glyphs().width()), - QMAX(0,area.top()/qt_settings->glyphs().height()), - QMIN(COLNO-1,area.right()/qt_settings->glyphs().width()), - QMIN(ROWNO-1,area.bottom()/qt_settings->glyphs().height()) - ); - - QPainter painter; - - painter.begin(this); - - if (Is_rogue_level(&u.uz) || iflags.wc_ascii_map) - { - // You enter a VERY primitive world! - - painter.setClipRect( event->rect() ); // (normally we don't clip) - painter.fillRect( event->rect(), black ); - - if ( !rogue_font ) { - // Find font... - int pts = 5; - QString fontfamily = iflags.wc_font_map - ? iflags.wc_font_map : "Courier"; - bool bold = FALSE; - if ( fontfamily.right(5).lower() == "-bold" ) { - fontfamily.truncate(fontfamily.length()-5); - bold = TRUE; - } - while ( pts < 32 ) { - QFont f(fontfamily, pts, bold ? QFont::Bold : QFont::Normal); - painter.setFont(QFont(fontfamily, pts)); - QFontMetrics fm = painter.fontMetrics(); - if ( fm.width("M") > qt_settings->glyphs().width() ) - break; - if ( fm.height() > qt_settings->glyphs().height() ) - break; - pts++; - } - rogue_font = new QFont(fontfamily,pts-1); - } - painter.setFont(*rogue_font); - - for (int j=garea.top(); j<=garea.bottom(); j++) { - for (int i=garea.left(); i<=garea.right(); i++) { - unsigned short g=Glyph(i,j); - uchar ch; - int color, och; - unsigned special; - - painter.setPen( green ); - /* map glyph to character and color */ - (void)mapglyph(g, &och, &color, &special, i, j); - ch = (uchar)och; -#ifdef TEXTCOLOR - painter.setPen( nhcolor_to_pen(color) ); -#endif - painter.drawText( - i*qt_settings->glyphs().width(), - j*qt_settings->glyphs().height(), - qt_settings->glyphs().width(), - qt_settings->glyphs().height(), - AlignCenter, - (const char*)&ch, 1 - ); - if (glyph_is_pet(g) -#ifdef TEXTCOLOR - && ::iflags.hilite_pet -#endif - ) { - painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), - j*qt_settings->glyphs().height()), - pet_annotation); - } - } - } - - painter.setFont(font()); - } else { - for (int j=garea.top(); j<=garea.bottom(); j++) { - for (int i=garea.left(); i<=garea.right(); i++) { - unsigned short g=Glyph(i,j); - qt_settings->glyphs().drawCell(painter, g, i, j); - if (glyph_is_pet(g) -#ifdef TEXTCOLOR - && ::iflags.hilite_pet -#endif - ) { - painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), - j*qt_settings->glyphs().height()), - pet_annotation); - } - } - } - } - - if (garea.contains(cursor)) { - if (Is_rogue_level(&u.uz)) { -#ifdef TEXTCOLOR - painter.setPen( white ); -#else - painter.setPen( green ); // REALLY primitive -#endif - } else - { - int hp100; - if (u.mtimedone) { - hp100=u.mhmax ? u.mh*100/u.mhmax : 100; - } else { - hp100=u.uhpmax ? u.uhp*100/u.uhpmax : 100; - } - - if (hp100 > 75) painter.setPen(white); - else if (hp100 > 50) painter.setPen(yellow); - else if (hp100 > 25) painter.setPen(QColor(0xff,0xbf,0x00)); // orange - else if (hp100 > 10) painter.setPen(red); - else painter.setPen(magenta); - } - - painter.drawRect( - cursor.x()*qt_settings->glyphs().width(),cursor.y()*qt_settings->glyphs().height(), - qt_settings->glyphs().width(),qt_settings->glyphs().height()); - } - - if (area.intersects(messages_rect)) { - painter.setPen(black); - painter.drawText(viewport.contentsX()+1,viewport.contentsY()+1, - viewport.width(),0, WordBreak|AlignTop|AlignLeft|DontClip, messages); - painter.setPen(white); - painter.drawText(viewport.contentsX(),viewport.contentsY(), - viewport.width(),0, WordBreak|AlignTop|AlignLeft|DontClip, messages); - } - - painter.end(); -} - -void NetHackQtMapWindow::Display(bool block) -{ - for (int i=0; iglyphs().width(), - ch.y()*qt_settings->glyphs().height(), - ch.width()*qt_settings->glyphs().width(), - ch.height()*qt_settings->glyphs().height(), - FALSE - ); - } - - change.clear(); - - if (block) { - yn_function("Press a key when done viewing",0,'\0'); - } -} - -void NetHackQtMapWindow::CursorTo(int x,int y) -{ - Changed(cursor.x(),cursor.y()); - cursor.setX(x); - cursor.setY(y); - Changed(cursor.x(),cursor.y()); -} - -void NetHackQtMapWindow::PutStr(int attr, const char* text) -{ - puts("unexpected PutStr in MapWindow"); -} - -void NetHackQtMapWindow::ClipAround(int x,int y) -{ - // Convert to pixel of center of tile - x=x*qt_settings->glyphs().width()+qt_settings->glyphs().width()/2; - y=y*qt_settings->glyphs().height()+qt_settings->glyphs().height()/2; - - // Then ensure that pixel is visible - viewport.center(x,y,0.45,0.45); -} - -void NetHackQtMapWindow::PrintGlyph(int x,int y,int glyph) -{ - Glyph(x,y)=glyph; - Changed(x,y); -} - -//void NetHackQtMapWindow::PrintGlyphCompose(int x,int y,int glyph1, int glyph2) -//{ - // TODO: composed graphics -//} - -void NetHackQtMapWindow::Changed(int x, int y) -{ - change.add(x,y); -} - - -class NetHackQtScrollText : public QTableView { - struct UData { - UData() : text(0), attr(0) { } - ~UData() { if (text) free(text); } - - char* text; - int attr; - }; -public: - int uncleared; - - NetHackQtScrollText(int maxlength) : - uncleared(0), - maxitems(maxlength), - first(0), - count(0), - item_cycle(maxlength) - { - setNumCols(1); - setCellWidth(200); - setCellHeight(fontMetrics().height()); - setBackgroundColor(white); - setTableFlags(Tbl_vScrollBar - |Tbl_autoHScrollBar - |Tbl_clipCellPainting - |Tbl_smoothScrolling); - } - - ~NetHackQtScrollText() - { - } - - void Scroll(int dx, int dy) - { - setXOffset(xOffset()+dx*viewWidth()); - setYOffset(yOffset()+dy*viewHeight()); - } - - void insertItem(int attr, const char* text) - { - setTopCell(count); - - setAutoUpdate(FALSE); - - int i; - if (count cellWidth()) { - // Get wider. - setCellWidth(w); - } - setTopCell(count); - - setAutoUpdate(TRUE); - - if (viewHeight() >= totalHeight()-cellHeight()) { - repaint(); - } else { - scroll(0,cellHeight()); - } - } - - virtual void setFont(const QFont& font) - { - QTableView::setFont(font); - setCellHeight(fontMetrics().height()); - } - -protected: - - UData& item(int i) - { - return item_cycle[(first+i)%maxitems]; - } - - const int maxitems; - int first, count; - QArray item_cycle; - - int datumWidth(const UData& uitem) - { - if (uitem.text) { - int width=fontMetrics().width(uitem.text)+3; - if (uitem.attr) { - // XXX Too expensive to do properly, because - // XXX we have to set the font of the widget - // XXX just to get the font metrics information! - // XXX Could hold a fake widget for that - // XXX purpose, but this hack is less ugly. - width+=width/10; - } - return width; - } else { - return 0; - } - } - - virtual void setupPainter(QPainter *p) - { - // XXX This shouldn't be needed - we set the bg in the constructor. - p->setBackgroundColor(white); - } - - virtual void paintCell(QPainter *p, int row, int col) - { - bool sel=FALSE; - UData& uitem=item(row); - - if (!sel && row < count-uncleared) { - p->setPen(darkGray); - } else { - p->setPen(black); - } - - if (uitem.attr) { - // XXX only bold - QFont bold(font().family(),font().pointSize(),QFont::Bold); - p->setFont(bold); - } - - p->drawText(3, 0, cellWidth(), cellHeight(), - AlignLeft|AlignVCenter, uitem.text); - - if (uitem.attr) { - p->setFont(font()); - } - } -}; - -NetHackQtMessageWindow::NetHackQtMessageWindow() : - list(new NetHackQtScrollText(::iflags.msg_history)) -{ - ::iflags.window_inited = 1; - map = 0; - connect(qt_settings,SIGNAL(fontChanged()),this,SLOT(updateFont())); - updateFont(); -} - -NetHackQtMessageWindow::~NetHackQtMessageWindow() -{ - ::iflags.window_inited = 0; - delete list; -} - -QWidget* NetHackQtMessageWindow::Widget() { return list; } - -void NetHackQtMessageWindow::setMap(NetHackQtMapWindow* m) -{ - map = m; - updateFont(); -} - -void NetHackQtMessageWindow::updateFont() -{ - list->setFont(qt_settings->normalFont()); - if ( map ) - map->setFont(qt_settings->normalFont()); -} - -void NetHackQtMessageWindow::Scroll(int dx, int dy) -{ - list->Scroll(dx,dy); -} - -void NetHackQtMessageWindow::Clear() -{ - if ( map ) - map->clearMessages(); - if (list->uncleared) { - list->uncleared=0; - changed=TRUE; - Display(FALSE); - } -} - -void NetHackQtMessageWindow::Display(bool block) -{ - if (changed) { - list->repaint(); - changed=FALSE; - } -} - -void NetHackQtMessageWindow::PutStr(int attr, const char* text) -{ -#ifdef USER_SOUNDS - play_sound_for_message(text); -#endif - - changed=TRUE; - list->uncleared++; - list->insertItem(attr,text); - - // Force scrollbar to bottom - // XXX list->setTopItem(list->count()); - - if ( map ) - map->putMessage(attr, text); -} - - - -NetHackQtLabelledIcon::NetHackQtLabelledIcon(QWidget* parent, const char* l) : - QWidget(parent), - low_is_good(FALSE), - prev_value(-123), - turn_count(-1), - label(new QLabel(l,this)), - icon(0) -{ - initHighlight(); -} -NetHackQtLabelledIcon::NetHackQtLabelledIcon(QWidget* parent, const char* l, const QPixmap& i) : - QWidget(parent), - low_is_good(FALSE), - prev_value(-123), - turn_count(-1), - label(new QLabel(l,this)), - icon(new QLabel(this)) -{ - setIcon(i); - initHighlight(); -} -void NetHackQtLabelledIcon::initHighlight() -{ - const QPalette& pal=palette(); - const QColorGroup& pa=pal.normal(); - //QColorGroup good(white,darkGreen,pa.light(),pa.dark(),pa.mid(),white,pa.base()); - QColorGroup good(black,green,pa.light(),pa.dark(),pa.mid(),black,pa.base()); - QColorGroup bad(white,red,pa.light(),pa.dark(),pa.mid(),white,pa.base()); - hl_good=pal.copy(); - hl_good.setNormal(good); - hl_good.setActive(good); - hl_bad=pal.copy(); - hl_bad.setNormal(bad); - hl_bad.setActive(bad); -} - -void NetHackQtLabelledIcon::setLabel(const char* t, bool lower) -{ - if (!label) { - label=new QLabel(this); - label->setFont(font()); - resizeEvent(0); - } - if (0!=strcmp(label->text(),t)) { - label->setText(t); - highlight(lower==low_is_good ? hl_good : hl_bad); - } -} -void NetHackQtLabelledIcon::setLabel(const char* t, long v, long cv, const char* tail) -{ - char buf[BUFSZ]; - if (v==NoNum) { - Sprintf(buf,"%s%s",t,tail); - } else { - Sprintf(buf,"%s%ld%s",t,v,tail); - } - setLabel(buf,cvsetPixmap(i); - else { icon=new QLabel(this); icon->setPixmap(i); resizeEvent(0); } - icon->resize(i.width(),i.height()); -} -void NetHackQtLabelledIcon::setFont(const QFont& f) -{ - QWidget::setFont(f); - if (label) label->setFont(f); -} -void NetHackQtLabelledIcon::show() -{ -#if QT_VERSION >= 300 - if (isHidden()) -#else - if (!isVisible()) -#endif - highlight(hl_bad); - QWidget::show(); -} -void NetHackQtLabelledIcon::highlightWhenChanging() -{ - turn_count=0; -} -void NetHackQtLabelledIcon::lowIsGood() -{ - low_is_good=TRUE; -} -void NetHackQtLabelledIcon::dissipateHighlight() -{ - if (turn_count>0) { - turn_count--; - if (!turn_count) - unhighlight(); - } -} -void NetHackQtLabelledIcon::highlight(const QPalette& hl) -{ - if (label) { // Surely it is?! - if (turn_count>=0) { - label->setPalette(hl); - turn_count=4; - // `4' includes this turn, so dissipates after - // 3 more keypresses. - } else { - label->setPalette(palette()); - } - } -} -void NetHackQtLabelledIcon::unhighlight() -{ - if (label) { // Surely it is?! - label->setPalette(palette()); - } -} -void NetHackQtLabelledIcon::resizeEvent(QResizeEvent*) -{ - setAlignments(); - - //int labw=label ? label->fontMetrics().width(label->text()) : 0; - int labh=label ? label->fontMetrics().height() : 0; - int icoh=icon ? icon->height() : 0; - int h=icoh+labh; - int icoy=(h>height() ? height()-labh-icoh : height()/2-h/2); - int laby=icoy+icoh; - if (icon) { - icon->setGeometry(0,icoy,width(),icoh); - } - if (label) { - label->setGeometry(0,laby,width(),labh); - } -} - -void NetHackQtLabelledIcon::setAlignments() -{ - if (label) label->setAlignment(AlignHCenter|AlignVCenter); - if (icon) icon->setAlignment(AlignHCenter|AlignVCenter); -} - -static void -tryload(QPixmap& pm, const char* fn) -{ - if (!pm.load(fn)) { - QString msg; - msg.sprintf("Cannot load \"%s\"", fn); - QMessageBox::warning(0, "IO Error", msg); - } -} - -NetHackQtStatusWindow::NetHackQtStatusWindow() : - // Notes: - // Alignment needs -2 init value, because -1 is an alignment. - // Armor Class is an schar, so 256 is out of range. - // Blank value is 0 and should never change. - name(this,"(name)"), - dlevel(this,"(dlevel)"), - str(this,"STR"), - dex(this,"DEX"), - con(this,"CON"), - intel(this,"INT"), - wis(this,"WIS"), - cha(this,"CHA"), - gold(this,"Gold"), - hp(this,"Hit Points"), - power(this,"Power"), - ac(this,"Armour Class"), - level(this,"Level"), - exp(this,"Experience"), - align(this,"Alignment"), - time(this,"Time"), - score(this,"Score"), - hunger(this,""), - confused(this,"Confused"), - sick_fp(this,"Sick"), - sick_il(this,"Ill"), - blind(this,"Blind"), - stunned(this,"Stunned"), - hallu(this,"Hallu"), - encumber(this,""), - hline1(this), - hline2(this), - hline3(this), - first_set(TRUE) -{ - p_str = QPixmap(str_xpm); - p_str = QPixmap(str_xpm); - p_dex = QPixmap(dex_xpm); - p_con = QPixmap(cns_xpm); - p_int = QPixmap(int_xpm); - p_wis = QPixmap(wis_xpm); - p_cha = QPixmap(cha_xpm); - - p_chaotic = QPixmap(chaotic_xpm); - p_neutral = QPixmap(neutral_xpm); - p_lawful = QPixmap(lawful_xpm); - - p_satiated = QPixmap(satiated_xpm); - p_hungry = QPixmap(hungry_xpm); - - p_confused = QPixmap(confused_xpm); - p_sick_fp = QPixmap(sick_fp_xpm); - p_sick_il = QPixmap(sick_il_xpm); - p_blind = QPixmap(blind_xpm); - p_stunned = QPixmap(stunned_xpm); - p_hallu = QPixmap(hallu_xpm); - - p_encumber[0] = QPixmap(slt_enc_xpm); - p_encumber[1] = QPixmap(mod_enc_xpm); - p_encumber[2] = QPixmap(hvy_enc_xpm); - p_encumber[3] = QPixmap(ext_enc_xpm); - p_encumber[4] = QPixmap(ovr_enc_xpm); - - str.setIcon(p_str); - dex.setIcon(p_dex); - con.setIcon(p_con); - intel.setIcon(p_int); - wis.setIcon(p_wis); - cha.setIcon(p_cha); - - align.setIcon(p_neutral); - hunger.setIcon(p_hungry); - - confused.setIcon(p_confused); - sick_fp.setIcon(p_sick_fp); - sick_il.setIcon(p_sick_il); - blind.setIcon(p_blind); - stunned.setIcon(p_stunned); - hallu.setIcon(p_hallu); - - encumber.setIcon(p_encumber[0]); - - hline1.setFrameStyle(QFrame::HLine|QFrame::Sunken); - hline2.setFrameStyle(QFrame::HLine|QFrame::Sunken); - hline3.setFrameStyle(QFrame::HLine|QFrame::Sunken); - hline1.setLineWidth(1); - hline2.setLineWidth(1); - hline3.setLineWidth(1); - - connect(qt_settings,SIGNAL(fontChanged()),this,SLOT(doUpdate())); - doUpdate(); -} - -void NetHackQtStatusWindow::doUpdate() -{ - const QFont& large=qt_settings->largeFont(); - name.setFont(large); - dlevel.setFont(large); - - const QFont& normal=qt_settings->normalFont(); - str.setFont(normal); - dex.setFont(normal); - con.setFont(normal); - intel.setFont(normal); - wis.setFont(normal); - cha.setFont(normal); - gold.setFont(normal); - hp.setFont(normal); - power.setFont(normal); - ac.setFont(normal); - level.setFont(normal); - exp.setFont(normal); - align.setFont(normal); - time.setFont(normal); - score.setFont(normal); - hunger.setFont(normal); - confused.setFont(normal); - sick_fp.setFont(normal); - sick_il.setFont(normal); - blind.setFont(normal); - stunned.setFont(normal); - hallu.setFont(normal); - encumber.setFont(normal); - - updateStats(); -} - -QWidget* NetHackQtStatusWindow::Widget() { return this; } - -void NetHackQtStatusWindow::Clear() -{ -} -void NetHackQtStatusWindow::Display(bool block) -{ -} -void NetHackQtStatusWindow::CursorTo(int,int y) -{ - cursy=y; -} -void NetHackQtStatusWindow::PutStr(int attr, const char* text) -{ - // do a complete update when line 0 is done (as per X11 fancy status) - if (cursy==0) updateStats(); -} - -void NetHackQtStatusWindow::resizeEvent(QResizeEvent*) -{ - const float SP_name=0.13; // the (large) - const float SP_dlev=0.13; // Level 3 in The Dungeons of Doom (large) - const float SP_atr1=0.25; // STR DEX CON INT WIS CHA - const float SP_hln1=0.02; // --- - const float SP_atr2=0.09; // Au HP PW AC LVL EXP - const float SP_hln2=0.02; // --- - const float SP_time=0.09; // time score - const float SP_hln3=0.02; // --- - const float SP_stat=0.25; // Alignment, Poisoned, Hungry, Sick, etc. - - int h=height(); - int x=0,y=0; - - int iw; // Width of an item across line - int lh; // Height of a line of values - - lh=int(h*SP_name); - name.setGeometry(0,0,width(),lh); y+=lh; - lh=int(h*SP_dlev); - dlevel.setGeometry(0,y,width(),lh); y+=lh; - - lh=int(h*SP_hln1); - hline1.setGeometry(0,y,width(),lh); y+=lh; - - lh=int(h*SP_atr1); - iw=width()/6; - str.setGeometry(x,y,iw,lh); x+=iw; - dex.setGeometry(x,y,iw,lh); x+=iw; - con.setGeometry(x,y,iw,lh); x+=iw; - intel.setGeometry(x,y,iw,lh); x+=iw; - wis.setGeometry(x,y,iw,lh); x+=iw; - cha.setGeometry(x,y,iw,lh); x+=iw; - x=0; y+=lh; - - lh=int(h*SP_hln2); - hline2.setGeometry(0,y,width(),lh); y+=lh; - - lh=int(h*SP_atr2); - iw=width()/6; - gold.setGeometry(x,y,iw,lh); x+=iw; - hp.setGeometry(x,y,iw,lh); x+=iw; - power.setGeometry(x,y,iw,lh); x+=iw; - ac.setGeometry(x,y,iw,lh); x+=iw; - level.setGeometry(x,y,iw,lh); x+=iw; - exp.setGeometry(x,y,iw,lh); x+=iw; - x=0; y+=lh; - - lh=int(h*SP_hln3); - hline3.setGeometry(0,y,width(),lh); y+=lh; - - lh=int(h*SP_time); - iw=width()/3; x+=iw/2; - time.setGeometry(x,y,iw,lh); x+=iw; - score.setGeometry(x,y,iw,lh); x+=iw; - x=0; y+=lh; - - lh=int(h*SP_stat); - iw=width()/9; - align.setGeometry(x,y,iw,lh); x+=iw; - hunger.setGeometry(x,y,iw,lh); x+=iw; - confused.setGeometry(x,y,iw,lh); x+=iw; - sick_fp.setGeometry(x,y,iw,lh); x+=iw; - sick_il.setGeometry(x,y,iw,lh); x+=iw; - blind.setGeometry(x,y,iw,lh); x+=iw; - stunned.setGeometry(x,y,iw,lh); x+=iw; - hallu.setGeometry(x,y,iw,lh); x+=iw; - encumber.setGeometry(x,y,iw,lh); x+=iw; - x=0; y+=lh; -} - - -/* - * Set all widget values to a null string. This is used after all spacings - * have been calculated so that when the window is popped up we don't get all - * kinds of funny values being displayed. - */ -void NetHackQtStatusWindow::nullOut() -{ -} - -void NetHackQtStatusWindow::fadeHighlighting() -{ - name.dissipateHighlight(); - dlevel.dissipateHighlight(); - - str.dissipateHighlight(); - dex.dissipateHighlight(); - con.dissipateHighlight(); - intel.dissipateHighlight(); - wis.dissipateHighlight(); - cha.dissipateHighlight(); - - gold.dissipateHighlight(); - hp.dissipateHighlight(); - power.dissipateHighlight(); - ac.dissipateHighlight(); - level.dissipateHighlight(); - exp.dissipateHighlight(); - align.dissipateHighlight(); - - time.dissipateHighlight(); - score.dissipateHighlight(); - - hunger.dissipateHighlight(); - confused.dissipateHighlight(); - sick_fp.dissipateHighlight(); - sick_il.dissipateHighlight(); - blind.dissipateHighlight(); - stunned.dissipateHighlight(); - hallu.dissipateHighlight(); - encumber.dissipateHighlight(); -} - -/* - * Update the displayed status. The current code in botl.c updates - * two lines of information. Both lines are always updated one after - * the other. So only do our update when we update the second line. - * - * Information on the first line: - * name, attributes, alignment, score - * - * Information on the second line: - * dlvl, gold, hp, power, ac, {level & exp or HD **} - * status (hunger, conf, halu, stun, sick, blind), time, encumbrance - * - * [**] HD is shown instead of level and exp if mtimedone is non-zero. - */ -void NetHackQtStatusWindow::updateStats() -{ - if (!parentWidget()) return; - - char buf[BUFSZ]; - - if (cursy != 0) return; /* do a complete update when line 0 is done */ - - if (ACURR(A_STR) > 118) { - Sprintf(buf,"STR:%d",ACURR(A_STR)-100); - } else if (ACURR(A_STR)==118) { - Sprintf(buf,"STR:18/**"); - } else if(ACURR(A_STR) > 18) { - Sprintf(buf,"STR:18/%02d",ACURR(A_STR)-18); - } else { - Sprintf(buf,"STR:%d",ACURR(A_STR)); - } - str.setLabel(buf,NetHackQtLabelledIcon::NoNum,ACURR(A_STR)); - - dex.setLabel("DEX:",(long)ACURR(A_DEX)); - con.setLabel("CON:",(long)ACURR(A_CON)); - intel.setLabel("INT:",(long)ACURR(A_INT)); - wis.setLabel("WIS:",(long)ACURR(A_WIS)); - cha.setLabel("CHA:",(long)ACURR(A_CHA)); - const char* hung=hu_stat[u.uhs]; - if (hung[0]==' ') { - hunger.hide(); - } else { - hunger.setIcon(u.uhs ? p_hungry : p_satiated); - hunger.setLabel(hung); - hunger.show(); - } - if (Confusion) confused.show(); else confused.hide(); - if (Sick) { - if (u.usick_type & SICK_VOMITABLE) { - sick_fp.show(); - } else { - sick_fp.hide(); - } - if (u.usick_type & SICK_NONVOMITABLE) { - sick_il.show(); - } else { - sick_il.hide(); - } - } else { - sick_fp.hide(); - sick_il.hide(); - } - if (Blind) blind.show(); else blind.hide(); - if (Stunned) stunned.show(); else stunned.hide(); - if (Hallucination) hallu.show(); else hallu.hide(); - const char* enc=enc_stat[near_capacity()]; - if (enc[0]==' ' || !enc[0]) { - encumber.hide(); - } else { - encumber.setIcon(p_encumber[near_capacity()-1]); - encumber.setLabel(enc); - encumber.show(); - } - Strcpy(buf, g.plname); - if ('a' <= buf[0] && buf[0] <= 'z') buf[0] += 'A'-'a'; - Strcat(buf, " the "); - if (u.mtimedone) { - char mname[BUFSZ]; - int k = 0; - - Strcpy(mname, mons[u.umonnum].mname); - while(mname[k] != 0) { - if ((k == 0 || (k > 0 && mname[k-1] == ' ')) - && 'a' <= mname[k] && mname[k] <= 'z') - { - mname[k] += 'A' - 'a'; - } - k++; - } - Strcat(buf, mname); - } else { - Strcat(buf, rank_of(u.ulevel, pl_character[0], ::flags.female)); - } - name.setLabel(buf,NetHackQtLabelledIcon::NoNum,u.ulevel); - - if (describe_level(buf)) { - dlevel.setLabel(buf,(bool)TRUE); - } else { - Sprintf(buf, "%s, level ", dungeons[u.uz.dnum].dname); - dlevel.setLabel(buf,(long)depth(&u.uz)); - } - - gold.setLabel("Au:", money_cnt(g.invent)); - if (u.mtimedone) { - // You're a monster! - - Sprintf(buf, "/%d", u.mhmax); - hp.setLabel("HP:",u.mh > 0 ? u.mh : 0,buf); - level.setLabel("HD:",(long)mons[u.umonnum].mlevel); - } else { - // You're normal. - - Sprintf(buf, "/%d", u.uhpmax); - hp.setLabel("HP:",u.uhp > 0 ? u.uhp : 0,buf); - level.setLabel("Level:",(long)u.ulevel); - } - Sprintf(buf, "/%d", u.uenmax); - power.setLabel("Pow:",u.uen,buf); - ac.setLabel("AC:",(long)u.uac); - if (::flags.showexp) { - exp.setLabel("Exp:",(long)u.uexp); - } else - { - exp.setLabel(""); - } - if (u.ualign.type==A_CHAOTIC) { - align.setIcon(p_chaotic); - align.setLabel("Chaotic"); - } else if (u.ualign.type==A_NEUTRAL) { - align.setIcon(p_neutral); - align.setLabel("Neutral"); - } else { - align.setIcon(p_lawful); - align.setLabel("Lawful"); - } - - if (::flags.time) time.setLabel("Time:",(long)g.moves); - else time.setLabel(""); -#ifdef SCORE_ON_BOTL - if (::flags.showscore) { - score.setLabel("Score:",(long)botl_score()); - } else -#endif - { - score.setLabel(""); - } - - if (first_set) - { - first_set=FALSE; - - name.highlightWhenChanging(); - dlevel.highlightWhenChanging(); - - str.highlightWhenChanging(); - dex.highlightWhenChanging(); - con.highlightWhenChanging(); - intel.highlightWhenChanging(); - wis.highlightWhenChanging(); - cha.highlightWhenChanging(); - - gold.highlightWhenChanging(); - hp.highlightWhenChanging(); - power.highlightWhenChanging(); - ac.highlightWhenChanging(); ac.lowIsGood(); - level.highlightWhenChanging(); - exp.highlightWhenChanging(); - align.highlightWhenChanging(); - - //time.highlightWhenChanging(); - score.highlightWhenChanging(); - - hunger.highlightWhenChanging(); - confused.highlightWhenChanging(); - sick_fp.highlightWhenChanging(); - sick_il.highlightWhenChanging(); - blind.highlightWhenChanging(); - stunned.highlightWhenChanging(); - hallu.highlightWhenChanging(); - encumber.highlightWhenChanging(); - } -} - -/* - * Turn off hilighted status values after a certain amount of turns. - */ -void NetHackQtStatusWindow::checkTurnEvents() -{ -} - - - -NetHackQtMenuDialog::NetHackQtMenuDialog() : - QDialog(qApp->mainWidget(),0,FALSE) -{ -} - -void NetHackQtMenuDialog::resizeEvent(QResizeEvent*) -{ - emit Resized(); -} - -void NetHackQtMenuDialog::Accept() -{ - accept(); -} - -void NetHackQtMenuDialog::Reject() -{ - reject(); -} - -void NetHackQtMenuDialog::SetResult(int r) -{ - setResult(r); -} - -void NetHackQtMenuDialog::done(int i) -{ - setResult(i); - qApp->exit_loop(); -} - -// Table view columns: -// -// [pick-count] [accel] [glyph] [string] -// -// Maybe accel should be near string. We'll see. -// pick-count normally blank. -// double-clicking or click-on-count gives pop-up entry -// string is green when selected -// -NetHackQtMenuWindow::NetHackQtMenuWindow(NetHackQtKeyBuffer& ks) : - QTableView(), - keysource(ks), - dialog(new NetHackQtMenuDialog()), - prompt(0), - pressed(-1) -{ - setNumCols(4); - setCellHeight(QMAX(qt_settings->glyphs().height()+1,fontMetrics().height())); - setBackgroundColor(lightGray); - setFrameStyle(Panel|Sunken); - setLineWidth(2); - - ok=new QPushButton("Ok",dialog); - connect(ok,SIGNAL(clicked()),dialog,SLOT(accept())); - - cancel=new QPushButton("Cancel",dialog); - connect(cancel,SIGNAL(clicked()),dialog,SLOT(reject())); - - all=new QPushButton("All",dialog); - connect(all,SIGNAL(clicked()),this,SLOT(All())); - - none=new QPushButton("None",dialog); - connect(none,SIGNAL(clicked()),this,SLOT(ChooseNone())); - - invert=new QPushButton("Invert",dialog); - connect(invert,SIGNAL(clicked()),this,SLOT(Invert())); - - search=new QPushButton("Search",dialog); - connect(search,SIGNAL(clicked()),this,SLOT(Search())); - - QPoint pos(0,ok->height()); - recreate(dialog,0,pos); - prompt.recreate(dialog,0,pos); - - setBackgroundColor(lightGray); - - connect(dialog,SIGNAL(Resized()),this,SLOT(Layout())); - - setTableFlags(Tbl_autoHScrollBar|Tbl_autoVScrollBar - |Tbl_smoothScrolling|Tbl_clipCellPainting); - setFocusPolicy(StrongFocus); -} - -NetHackQtMenuWindow::~NetHackQtMenuWindow() -{ - // Remove from dialog before we destruct it - recreate(0,0,QPoint(0,0)); - delete dialog; -} - -void NetHackQtMenuWindow::focusInEvent(QFocusEvent *) -{ - // Don't repaint at all, since nothing is using the focus colour -} -void NetHackQtMenuWindow::focusOutEvent(QFocusEvent *) -{ - // Don't repaint at all, since nothing is using the focus colour -} - -int NetHackQtMenuWindow::cellWidth(int col) -{ - switch (col) { - case 0: - return fontMetrics().width("All "); - break; case 1: - return fontMetrics().width(" m "); - break; case 2: - return qt_settings->glyphs().width(); - break; case 3: - return str_width; - } - impossible("Extra column (#%d) in MenuWindow",col); - return 0; -} - -QWidget* NetHackQtMenuWindow::Widget() { return dialog; } - -void NetHackQtMenuWindow::StartMenu() -{ - setNumRows((itemcount=0)); - str_width=200; - str_fixed=FALSE; - next_accel=0; - has_glyphs=FALSE; -} - -NetHackQtMenuWindow::MenuItem::MenuItem() : - str(0) -{ -} - -NetHackQtMenuWindow::MenuItem::~MenuItem() -{ - if (str) free((void*)str); -} - -#define STR_MARGIN 4 - -void NetHackQtMenuWindow::AddMenu(int glyph, const ANY_P* identifier, - char ch, char gch, int attr, const char* str, bool presel) -{ - if (!ch && identifier->a_void!=0) { - // Supply a keyboard accelerator. Limited supply. - static char accel[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - if (accel[next_accel]) { - ch=accel[next_accel++]; - } - } - - if ((int)item.size() < itemcount+1) { - item.resize(itemcount*4+10); - } - item[itemcount].glyph=glyph; - item[itemcount].identifier=*identifier; - item[itemcount].ch=ch; - item[itemcount].attr=attr; - item[itemcount].str=strdup(str); - item[itemcount].selected=presel; - item[itemcount].count=-1; - ++itemcount; - - str_fixed=str_fixed || strstr(str," "); - if (glyph!=NO_GLYPH) has_glyphs=TRUE; -} -void NetHackQtMenuWindow::EndMenu(const char* p) -{ - prompt.setText(p ? p : ""); -} -void NetHackQtMenuWindow::Layout() -{ - int butw=totalWidth()/6; // 6 buttons - int buth=fontMetrics().height()+8; // 8 for spacing & mitres - int prompth=(prompt.text().isNull() ? 0 : buth); - - prompt.setGeometry(6,buth,dialog->width()-6,prompth); - int h=dialog->height()-buth-prompth; - setGeometry(0,buth+prompth, dialog->width(), h); - - // Below, we take care to use up full width - int x=0; - ok->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/5; - cancel->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/4; - all->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/3; - none->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/2; - invert->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/1; - search->setGeometry(x,0,butw,buth); -} - -int NetHackQtMenuWindow::SelectMenu(int h, MENU_ITEM_P **menu_list) -{ - setFont(str_fixed ? - qt_settings->normalFixedFont() : qt_settings->normalFont()); - - for (int i=0; iglyphs().height()+1,fontMetrics().height())); - setNumRows(itemcount); - - int buth=fontMetrics().height()+8; // 8 for spacing & mitres - - how=h; - - ok->setEnabled(how!=PICK_ONE);ok->setDefault(how!=PICK_ONE); - cancel->setEnabled(TRUE); - all->setEnabled(how==PICK_ANY); - none->setEnabled(how==PICK_ANY); - invert->setEnabled(how==PICK_ANY); - search->setEnabled(how!=PICK_NONE); - - dialog->SetResult(-1); - - // 20 allows for scrollbar or spacing - // 4 for frame borders - int mh = QApplication::desktop()->height()*3/5; - if ( qt_compact_mode && totalHeight() > mh ) { - // big, so make it fill - dialog->showMaximized(); - } else { - dialog->resize(totalWidth()+20, - QMIN(totalHeight(), mh)+buth+4+(prompt.text().isNull() ? 0 : buth)); - if ( dialog->width() > QApplication::desktop()->width() ) - dialog->resize(QApplication::desktop()->width(),dialog->height()+16); - centerOnMain(dialog); - dialog->show(); - } - - setFocus(); - while (dialog->result()<0) { - // changed the defaults below to the values in wintype.h 000119 - azy - if (!keysource.Empty()) { - char k=keysource.GetAscii(); - k=map_menu_cmd(k); /* added 000119 - azy */ - if (k=='\033') - dialog->Reject(); - else if (k=='\r' || k=='\n' || k==' ') - dialog->Accept(); - else if (k==MENU_SEARCH) - Search(); - else if (k==MENU_SELECT_ALL) - All(); - else if (k==MENU_INVERT_ALL) - Invert(); - else if (k==MENU_UNSELECT_ALL) - ChooseNone(); - else { - for (int i=0; iresult()<0) - qApp->enter_loop(); - } - //if ( (nhid != WIN_INVEN || !iflags.perm_invent) ) // doesn't work yet - { - dialog->hide(); - } - int result=dialog->result(); - - // Consume ^M (which QDialog steals for default button) - while (!keysource.Empty() && - (keysource.TopAscii()=='\n' || keysource.TopAscii()=='\r')) - keysource.GetAscii(); - - *menu_list=0; - if (how==PICK_NONE) - return result==0 ? -1 : 0; - - if (result>0) { - if (how==PICK_ONE) { - int i; - for (i=0; istate()&ShiftButton)) { - if (event->key()==Key_Prior) { - setYOffset(yOffset()-viewHeight()); - } else if (event->key()==Key_Next) { - setYOffset(yOffset()+viewHeight()); - } else { - event->ignore(); - } - } else { - event->ignore(); - } -} - -void NetHackQtMenuWindow::All() -{ - for (int i=0; iAccept(); - } - } -} - - -void NetHackQtMenuWindow::paintCell(QPainter* painter, int row, int col) -{ - // [pick-count] [accel] [glyph] [string] - - MenuItem& i = item[row]; - - painter->setPen(black); - painter->setFont(font()); - - if (i.selected) { - painter->setPen(darkGreen); - } - - switch (col) { - case 0: - if ( i.ch || i.attr!=ATR_INVERSE ) { - QString text; - if ( i.selected && i.count == -1 ) { - if ( i.str[0]>='0' && i.str[0]<='9' ) - text = "All"; - else - text = "*"; - } else if ( i.count<0 ) { - text = "-"; - } else { - text.sprintf("%d",i.count); - } - painter->drawText(0,0,cellWidth(col),cellHeight(), - AlignHCenter|AlignVCenter,text); - } - break; case 1: - if ((signed char)i.ch >= 0) { - char text[2]={i.ch,0}; - painter->drawText(0,0,cellWidth(col),cellHeight(), - AlignHCenter|AlignVCenter,text); - } - break; case 2: - if (i.glyph!=NO_GLYPH) { - // Centered in height - int y=(cellHeight()-qt_settings->glyphs().height())/2; - if (y<0) y=0; - qt_settings->glyphs().drawGlyph(*painter, i.glyph, 0, y); - } - break; case 3: - // XXX should qt_settings have ALL the various fonts - QFont newfont=font(); - - if (i.attr) { - switch(i.attr) { - case ATR_ULINE: - newfont.setUnderline(TRUE); - break; case ATR_BOLD: - painter->setPen(red); - break; case ATR_BLINK: - newfont.setItalic(TRUE); - break; case ATR_INVERSE: - newfont=qt_settings->largeFont(); - newfont.setWeight(QFont::Bold); - - if (i.selected) { - painter->setPen(blue); - } else { - painter->setPen(darkBlue); - } - } - } - painter->setFont(newfont); - - painter->drawText(STR_MARGIN,0,cellWidth(col),cellHeight(), - AlignLeft|AlignVCenter,i.str); - } -} - -void NetHackQtMenuWindow::mousePressEvent(QMouseEvent* event) -{ - int col=findCol(event->pos().x()); - int row=findRow(event->pos().y()); - - if (col<0 || row<0 || !item[row].Selectable()) return; - - if (how!=PICK_NONE) { - if (col==0) { - // Changing count. - NetHackQtStringRequestor requestor(keysource,"Count:"); - char buf[BUFSZ]; - - if (item[row].count>0) - Sprintf(buf,"%d", item[row].count); - else - Strcpy(buf, ""); - - requestor.SetDefault(buf); - if (requestor.Get(buf)) { - item[row].count=atoi(buf); - if (item[row].count==0) { - item[row].count=-1; - if (item[row].selected) ToggleSelect(row); - } else { - if (!item[row].selected) ToggleSelect(row); - } - updateCell(row,0); - } - } else { - pressed=row; - was_sel=item[row].selected; - ToggleSelect(row); - updateCell(row,0); - } - } -} - -void NetHackQtMenuWindow::mouseReleaseEvent(QMouseEvent* event) -{ - if (pressed>=0) { - int p=pressed; - pressed=-1; - updateCell(p,3); - } -} - -void NetHackQtMenuWindow::mouseMoveEvent(QMouseEvent* event) -{ - if (pressed>=0) { - int col=findCol(event->pos().x()); - int row=findRow(event->pos().y()); - - if (row>=0 && col>=0) { - if (pressed!=row) { - // reset to initial state - if (item[pressed].selected!=was_sel) - ToggleSelect(pressed); - } else { - // reset to new state - if (item[pressed].selected==was_sel) - ToggleSelect(pressed); - } - } - } -} - - -class NetHackQtTextListBox : public QListBox { -public: - NetHackQtTextListBox(QWidget* parent) : QListBox(parent) { } - - int TotalWidth() - { - doLayout(); - return contentsWidth(); - } - int TotalHeight() - { - doLayout(); - return contentsHeight(); - } - - virtual void setFont(const QFont &font) - { - QListBox::setFont(font); - } - void keyPressEvent(QKeyEvent* e) - { - QListBox::keyPressEvent(e); - } -}; - - -QPixmap* NetHackQtRIP::pixmap=0; - -NetHackQtRIP::NetHackQtRIP(QWidget* parent) : - QWidget(parent) -{ - if (!pixmap) { - pixmap=new QPixmap; - tryload(*pixmap, "rip.xpm"); - } - riplines=0; - resize(pixmap->width(),pixmap->height()); - setFont(QFont("times",12)); // XXX may need to be configurable -} - -void NetHackQtRIP::setLines(char** l, int n) -{ - line=l; - riplines=n; -} - -QSize NetHackQtRIP::sizeHint() const -{ - return pixmap->size(); -} - -void NetHackQtRIP::paintEvent(QPaintEvent* event) -{ - if ( riplines ) { - int pix_x=(width()-pixmap->width())/2; - int pix_y=(height()-pixmap->height())/2; - - // XXX positions based on RIP image - int rip_text_x=pix_x+156; - int rip_text_y=pix_y+67; - int rip_text_h=94/riplines; - - QPainter painter; - painter.begin(this); - painter.drawPixmap(pix_x,pix_y,*pixmap); - for (int i=0; imainWidget(),0,FALSE), - keysource(ks), - use_rip(FALSE), - str_fixed(FALSE), - ok("Dismiss",this), - search("Search",this), - lines(new NetHackQtTextListBox(this)), - rip(this) -{ - ok.setDefault(TRUE); - connect(&ok,SIGNAL(clicked()),this,SLOT(accept())); - connect(&search,SIGNAL(clicked()),this,SLOT(Search())); - connect(qt_settings,SIGNAL(fontChanged()),this,SLOT(doUpdate())); - - QVBoxLayout* vb = new QVBoxLayout(this); - vb->addWidget(&rip); - QHBoxLayout* hb = new QHBoxLayout(vb); - hb->addWidget(&ok); - hb->addWidget(&search); - vb->addWidget(lines); -} - -void NetHackQtTextWindow::doUpdate() -{ - update(); -} - - -NetHackQtTextWindow::~NetHackQtTextWindow() -{ - -} - -QWidget* NetHackQtTextWindow::Widget() -{ - return this; -} - -bool NetHackQtTextWindow::Destroy() -{ - return !isVisible(); -} - -void NetHackQtTextWindow::UseRIP(int how, time_t when) -{ -// Code from X11 windowport -#define STONE_LINE_LEN 16 /* # chars that fit on one line */ -#define NAME_LINE 0 /* line # for player name */ -#define GOLD_LINE 1 /* line # for amount of gold */ -#define DEATH_LINE 2 /* line # for death description */ -#define YEAR_LINE 6 /* line # for year */ - -static char** rip_line=0; - if (!rip_line) { - rip_line=new char*[YEAR_LINE+1]; - for (int i=0; i STONE_LINE_LEN) { - for(i = STONE_LINE_LEN; - ((i0 > STONE_LINE_LEN) && i); i--) - if(dpx[i] == ' ') i0 = i; - if(!i) i0 = STONE_LINE_LEN; - } - tmpchar = dpx[i0]; - dpx[i0] = 0; - strcpy(rip_line[line], dpx); - if (tmpchar != ' ') { - dpx[i0] = tmpchar; - dpx= &dpx[i0]; - } else dpx= &dpx[i0+1]; - } - - /* Put year on stone */ - year = yyyymmdd(when) / 10000L; - Sprintf(rip_line[YEAR_LINE], "%4ld", year); - - rip.setLines(rip_line,YEAR_LINE+1); - - use_rip=TRUE; -} - -void NetHackQtTextWindow::Clear() -{ - lines->clear(); - use_rip=FALSE; - str_fixed=FALSE; -} - -void NetHackQtTextWindow::Display(bool block) -{ - if (str_fixed) { - lines->setFont(qt_settings->normalFixedFont()); - } else { - lines->setFont(qt_settings->normalFont()); - } - - int h=0; - if (use_rip) { - h+=rip.height(); - ok.hide(); - search.hide(); - rip.show(); - } else { - h+=ok.height()*2; - ok.show(); - search.show(); - rip.hide(); - } - int mh = QApplication::desktop()->height()*3/5; - if ( qt_compact_mode && (lines->TotalHeight() > mh || use_rip) ) { - // big, so make it fill - showMaximized(); - } else { - resize(QMAX(use_rip ? rip.width() : 200, - lines->TotalWidth()+24), - QMIN(mh, lines->TotalHeight()+h)); - centerOnMain(this); - show(); - } - if (block) { - setResult(-1); - while (result()==-1) { - qApp->enter_loop(); - if (result()==-1 && !keysource.Empty()) { - char k=keysource.GetAscii(); - if (k=='\033' || k==' ' || k=='\r' || k=='\n') { - accept(); - } else if (k=='/') { - Search(); - } - } - } - } -} - -void NetHackQtTextWindow::PutStr(int attr, const char* text) -{ - str_fixed=str_fixed || strstr(text," "); - lines->insertItem(text); -} - -void NetHackQtTextWindow::done(int i) -{ - setResult(i+1000); - hide(); - qApp->exit_loop(); -} - -void NetHackQtTextWindow::keyPressEvent(QKeyEvent* e) -{ - if ( e->ascii() != '\r' && e->ascii() != '\n' && e->ascii() != '\033' ) - lines->keyPressEvent(e); - else - QDialog::keyPressEvent(e); -} - -void NetHackQtTextWindow::Search() -{ - NetHackQtStringRequestor requestor(keysource,"Search for:"); - static char line[256]=""; - requestor.SetDefault(line); - if (requestor.Get(line)) { - int current=lines->currentItem(); - for (uint i=1; icount(); i++) { - int lnum=(i+current)%lines->count(); - QString str=lines->text(lnum); - if (str.contains(line)) { - lines->setCurrentItem(lnum); - lines->centerCurrentItem(); - return; - } - } - lines->setCurrentItem(-1); - } -} - - -NetHackQtDelay::NetHackQtDelay(int ms) : - msec(ms) -{ -} - -void NetHackQtDelay::wait() -{ - startTimer(msec); - qApp->enter_loop(); -} - -void NetHackQtDelay::timerEvent(QTimerEvent* timer) -{ - qApp->exit_loop(); - killTimers(); -} - -NetHackQtInvUsageWindow::NetHackQtInvUsageWindow(QWidget* parent) : - QWidget(parent) -{ -} - -void NetHackQtInvUsageWindow::drawWorn(QPainter& painter, obj* nhobj, int x, int y, bool canbe) -{ - short int glyph; - if (nhobj) - glyph=obj_to_glyph(nhobj, rn2_on_display_rng); - else if (canbe) - glyph=cmap_to_glyph(S_room); - else - glyph=cmap_to_glyph(S_stone); - - qt_settings->glyphs().drawCell(painter,glyph,x,y); -} - -void NetHackQtInvUsageWindow::paintEvent(QPaintEvent*) -{ - // 012 - // - //0 WhB - //1 s"w - //2 gCg - //3 =A= - //4 T - //5 S - - QPainter painter; - painter.begin(this); - - // Blanks - drawWorn(painter,0,0,4,FALSE); - drawWorn(painter,0,0,5,FALSE); - drawWorn(painter,0,2,4,FALSE); - drawWorn(painter,0,2,5,FALSE); - - drawWorn(painter,uarm,1,3); // Armour - drawWorn(painter,uarmc,1,2); // Cloak - drawWorn(painter,uarmh,1,0); // Helmet - drawWorn(painter,uarms,0,1); // Shield - drawWorn(painter,uarmg,0,2); // Gloves - repeated - drawWorn(painter,uarmg,2,2); // Gloves - repeated - drawWorn(painter,uarmf,1,5); // Shoes (feet) - drawWorn(painter,uarmu,1,4); // Undershirt - drawWorn(painter,uleft,0,3); // RingL - drawWorn(painter,uright,2,3); // RingR - - drawWorn(painter,uwep,2,1); // Weapon - drawWorn(painter,uswapwep,0,0); // Secondary weapon - drawWorn(painter,uamul,1,1); // Amulet - drawWorn(painter,ublindf,2,0); // Blindfold - - painter.end(); -} - -class SmallToolButton : public QToolButton { -public: - SmallToolButton(const QPixmap & pm, const QString &textLabel, - const QString& grouptext, - QObject * receiver, const char* slot, - QToolBar * parent) : - QToolButton(pm, textLabel, -#if QT_VERSION < 210 - QString::null, -#else - grouptext, -#endif - receiver, slot, parent) - { - } - - QSize sizeHint() const - { - // get just a couple more pixels for the map - return QToolButton::sizeHint()-QSize(0,2); - } -}; - - -NetHackQtMainWindow::NetHackQtMainWindow(NetHackQtKeyBuffer& ks) : - message(0), map(0), status(0), invusage(0), - keysink(ks), dirkey(0) -{ - QToolBar* toolbar = new QToolBar(this); -#if QT_VERSION >= 210 - setToolBarsMovable(FALSE); - toolbar->setHorizontalStretchable(TRUE); - toolbar->setVerticalStretchable(TRUE); -#endif - addToolBar(toolbar); - menubar = menuBar(); - - setCaption("Qt NetHack"); - if ( qt_compact_mode ) - setIcon(QPixmap(nh_icon_small)); - else - setIcon(QPixmap(nh_icon)); - - QPopupMenu* game=new QPopupMenu; - QPopupMenu* apparel=new QPopupMenu; - QPopupMenu* act1=new QPopupMenu; - QPopupMenu* act2 = qt_compact_mode ? new QPopupMenu : act1; - QPopupMenu* magic=new QPopupMenu; - QPopupMenu* info=new QPopupMenu; - - QPopupMenu *help; - -#ifdef KDE - help = kapp->getHelpMenu( TRUE, "" ); - help->insertSeparator(); -#else - help = qt_compact_mode ? info : new QPopupMenu; -#endif - - enum { OnDesktop=1, OnHandhelds=2 }; - struct Macro { - QPopupMenu* menu; - const char* name; - const char* action; - int flags; - } item[] = { - { game, 0, 0, 3}, - { game, "Version\tv", "v", 3}, - { game, "Compilation\tAlt+V", "\366", 3}, - { game, "History\tShift+V", "V", 3}, - { game, "Redraw\tCtrl+R", "\022", 0}, // useless - { game, "Options\tShift+O", "O", 3}, - { game, "Explore mode\tShift+X", "X", 3}, - { game, 0, 0, 3}, - { game, "Save\tSy", "Sy", 3}, - { game, "Quit\tAlt+Q", "\361", 3}, - - { apparel, "Apparel off\tShift+A", "A", 2}, - { apparel, "Remove many\tShift+A", "A", 1}, - { apparel, 0, 0, 3}, - { apparel, "Wield weapon\tw", "w", 3}, - { apparel, "Exchange weapons\tx", "x", 3}, - { apparel, "Two weapon combat\t#two", "#tw", 3}, - { apparel, "Load quiver\tShift+Q", "Q", 3}, - { apparel, 0, 0, 3}, - { apparel, "Wear armour\tShift+W", "W", 3}, - { apparel, "Take off armour\tShift+T", "T", 3}, - { apparel, 0, 0, 3}, - { apparel, "Put on non-armour\tShift+P", "P", 3}, - { apparel, "Remove non-armour\tShift+R", "R", 3}, - - { act1, "Again\tCtrl+A", "\001", 2}, - { act1, 0, 0, 3}, - { act1, "Apply\ta?", "a?", 3}, - { act1, "Chat\tAlt+C", "\343", 3}, - { act1, "Close door\tc", "c", 3}, - { act1, "Down\t>", ">", 3}, - { act1, "Drop many\tShift+D", "D", 2}, - { act1, "Drop\td?", "d?", 2}, - { act1, "Eat\te?", "e?", 2}, - { act1, "Engrave\tShift+E", "E", 3}, - { act1, "Fight\tShift+F", "F", 3}, - { act1, "Fire from quiver\tf", "f", 2}, - { act1, "Force\tAlt+F", "\346", 3}, - { act1, "Get\t,", ",", 2}, - { act1, "Jump\tAlt+J", "\352", 3}, - { act2, "Kick\tCtrl+D", "\004", 2}, - { act2, "Loot\tAlt+L", "\354", 3}, - { act2, "Open door\to", "o", 3}, - { act2, "Pay\tp", "p", 3}, - { act2, "Rest\t.", ".", 2}, - { act2, "Ride\t#ri", "#ri", 3}, - { act2, "Search\ts", "s", 3}, - { act2, "Sit\tAlt+S", "\363", 3}, - { act2, "Throw\tt", "t", 2}, - { act2, "Untrap\t#u", "#u", 3}, - { act2, "Up\t<", "<", 3}, - { act2, "Wipe face\tAlt+W", "\367", 3}, - - { magic, "Quaff potion\tq?", "q?", 3}, - { magic, "Read scroll/book\tr?", "r?", 3}, - { magic, "Zap wand\tz?", "z?", 3}, - { magic, "Zap spell\tShift+Z", "Z", 3}, - { magic, "Dip\tAlt+D", "\344", 3}, - { magic, "Rub\tAlt+R", "\362", 3}, - { magic, "Invoke\tAlt+I", "\351", 3}, - { magic, 0, 0, 3}, - { magic, "Offer\tAlt+O", "\357", 3}, - { magic, "Pray\tAlt+P", "\360", 3}, - { magic, 0, 0, 3}, - { magic, "Teleport\tCtrl+T", "\024", 3}, - { magic, "Monster action\tAlt+M", "\355", 3}, - { magic, "Turn undead\tAlt+T", "\364", 3}, - - { help, "Help\t?", "?", 3}, - { help, 0, 0, 3}, - { help, "What is here\t:", ":", 3}, - { help, "What is there\t;", ";", 3}, - { help, "What is...\t/y", "/y", 2}, - { help, 0, 0, 1}, - - { info, "Inventory\ti", "i", 3}, -#ifdef SLASHEM - { info, "Angbandish inventory\t*", "*", 3}, -#endif - { info, "Conduct\t#co", "#co", 3}, - { info, "Discoveries\t\\", "\\", 3}, - { info, "List/reorder spells\t+", "+", 3}, - { info, "Adjust letters\tAlt+A", "\341", 2}, - { info, 0, 0, 3}, - { info, "Name object\tAlt+N", "\356y?", 3}, - { info, "Name object type\tAlt+N", "\356n?", 3}, - { info, "Name creature\tShift+C", "C", 3}, - { info, 0, 0, 3}, - { info, "Qualifications\tAlt+E", "\345", 3}, - - { 0, 0, 0, 0 } - }; - - int i; - int count=0; - for (i=0; item[i].menu; i++) - if (item[i].name) count++; - - macro=new const char* [count]; - - game->insertItem("Qt settings...",1000); - help->insertItem("About Qt NetHack...",2000); - //help->insertItem("NetHack Guidebook...",3000); - help->insertSeparator(); - - count=0; - for (i=0; item[i].menu; i++) { - if ( item[i].flags & (qt_compact_mode ? 1 : 2) ) { - if (item[i].name) { - QString name = item[i].name; - if ( qt_compact_mode ) // accelerators aren't - name.replace(QRegExp("\t.*"),""); - item[i].menu->insertItem(name,count); - macro[count++]=item[i].action; - } else { - item[i].menu->insertSeparator(); - } - } - } - - menubar->insertItem("Game",game); - menubar->insertItem("Gear",apparel); - - if ( qt_compact_mode ) { - menubar->insertItem("A-J",act1); - menubar->insertItem("K-Z",act2); - menubar->insertItem("Magic",magic); - menubar->insertItem(QPixmap(info_xpm),info); - menubar->insertItem(QPixmap(map_xpm), this, SLOT(raiseMap())); - menubar->insertItem(QPixmap(msg_xpm), this, SLOT(raiseMessages())); - menubar->insertItem(QPixmap(stat_xpm), this, SLOT(raiseStatus())); - } else { - menubar->insertItem("Action",act1); - menubar->insertItem("Magic",magic); - menubar->insertItem("Info",info); - menubar->insertSeparator(); - menubar->insertItem("Help",help); - } - - QSignalMapper* sm = new QSignalMapper(this); - connect(sm, SIGNAL(mapped(const QString&)), this, SLOT(doKeys(const QString&))); - QToolButton* tb; - tb = new SmallToolButton( QPixmap(again_xpm),"Again","Action", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "\001" ); - tb = new SmallToolButton( QPixmap(get_xpm),"Get","Action", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "," ); - tb = new SmallToolButton( QPixmap(kick_xpm),"Kick","Action", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "\004" ); - tb = new SmallToolButton( QPixmap(throw_xpm),"Throw","Action", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "t" ); - tb = new SmallToolButton( QPixmap(fire_xpm),"Fire","Action", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "f" ); - tb = new SmallToolButton( QPixmap(drop_xpm),"Drop","Action", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "D" ); - tb = new SmallToolButton( QPixmap(eat_xpm),"Eat","Action", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "e" ); - tb = new SmallToolButton( QPixmap(rest_xpm),"Rest","Action", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "." ); - tb = new SmallToolButton( QPixmap(cast_a_xpm),"Cast A","Magic", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "Za" ); - tb = new SmallToolButton( QPixmap(cast_b_xpm),"Cast B","Magic", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "Zb" ); - tb = new SmallToolButton( QPixmap(cast_c_xpm),"Cast C","Magic", sm, SLOT(map()), toolbar ); - sm->setMapping(tb, "Zc" ); - if ( !qt_compact_mode ) { - QWidget* filler = new QWidget(toolbar); - filler->setBackgroundMode(PaletteButton); - toolbar->setStretchableWidget(filler); - } - - connect(menubar,SIGNAL(activated(int)),this,SLOT(doMenuItem(int))); - -#ifdef KDE - setMenu (menubar); -#endif - - int x=0,y=0; - int w=QApplication::desktop()->width()-10; // XXX arbitrary extra space for frame - int h=QApplication::desktop()->height()-50; - - int maxwn; - int maxhn; - if (qt_tilewidth != NULL) { - maxwn = atoi(qt_tilewidth) * COLNO + 10; - } else { - maxwn = 1400; - } - if (qt_tileheight != NULL) { - maxhn = atoi(qt_tileheight) * ROWNO * 6/4; - } else { - maxhn = 1024; - } - - // Be exactly the size we want to be - full map... - if (w>maxwn) { - x+=(w-maxwn)/2; - w=maxwn; // Doesn't need to be any wider - } - if (h>maxhn) { - y+=(h-maxhn)/2; - h=maxhn; // Doesn't need to be any taller - } - - setGeometry(x,y,w,h); - - if ( qt_compact_mode ) { - stack = new QWidgetStack(this); - setCentralWidget(stack); - } else { - setCentralWidget(new QWidget(this)); - invusage = new NetHackQtInvUsageWindow(centralWidget()); - } -} - -void NetHackQtMainWindow::zoomMap() -{ - qt_settings->toggleGlyphSize(); -} - -void NetHackQtMainWindow::raiseMap() -{ - if ( stack->id(stack->visibleWidget()) == 0 ) { - zoomMap(); - } else { - stack->raiseWidget(0); - } -} - -void NetHackQtMainWindow::raiseMessages() -{ - stack->raiseWidget(1); -} - -void NetHackQtMainWindow::raiseStatus() -{ - stack->raiseWidget(2); -} - -class NetHackMimeSourceFactory : public QMimeSourceFactory { -public: - const QMimeSource* data(const QString& abs_name) const - { - const QMimeSource* r = 0; - if ( (NetHackMimeSourceFactory*)this == QMimeSourceFactory::defaultFactory() ) - r = QMimeSourceFactory::data(abs_name); - else - r = QMimeSourceFactory::defaultFactory()->data(abs_name); - if ( !r ) { - int sl = abs_name.length(); - do { - sl = abs_name.findRev('/',sl-1); - QString name = sl>=0 ? abs_name.mid(sl+1) : abs_name; - int dot = name.findRev('.'); - if ( dot >= 0 ) - name = name.left(dot); - if ( name == "map" ) - r = new QImageDrag(QImage(map_xpm)); - else if ( name == "msg" ) - r = new QImageDrag(QImage(msg_xpm)); - else if ( name == "stat" ) - r = new QImageDrag(QImage(stat_xpm)); - } while (!r && sl>0); - } - return r; - } -}; - -void NetHackQtMainWindow::doMenuItem(int id) -{ - switch (id) { - case 1000: - centerOnMain(qt_settings); - qt_settings->show(); - break; - case 2000: - QMessageBox::about(this, "About Qt NetHack", aboutMsg()); - break; - case 3000: { - QDialog dlg(this,0,TRUE); - (new QVBoxLayout(&dlg))->setAutoAdd(TRUE); - QTextBrowser browser(&dlg); - NetHackMimeSourceFactory ms; - browser.setMimeSourceFactory(&ms); - browser.setSource(QDir::currentDirPath()+"/Guidebook.html"); - if ( qt_compact_mode ) - dlg.showMaximized(); - dlg.exec(); - } - break; - default: - if ( id >= 0 ) - doKeys(macro[id]); - } -} - -void NetHackQtMainWindow::doKeys(const QString& k) -{ - keysink.Put(k); - qApp->exit_loop(); -} - -void NetHackQtMainWindow::AddMessageWindow(NetHackQtMessageWindow* window) -{ - message=window; - ShowIfReady(); -} - -void NetHackQtMainWindow::AddMapWindow(NetHackQtMapWindow* window) -{ - map=window; - ShowIfReady(); - connect(map,SIGNAL(resized()),this,SLOT(layout())); -} - -void NetHackQtMainWindow::AddStatusWindow(NetHackQtStatusWindow* window) -{ - status=window; - ShowIfReady(); -} - -void NetHackQtMainWindow::RemoveWindow(NetHackQtWindow* window) -{ - if (window==status) { - status=0; - ShowIfReady(); - } else if (window==map) { - map=0; - ShowIfReady(); - } else if (window==message) { - message=0; - ShowIfReady(); - } -} - -void NetHackQtMainWindow::updateInventory() -{ - if ( invusage ) - invusage->repaint(FALSE); -} - -void NetHackQtMainWindow::fadeHighlighting() -{ - if (status) { - status->fadeHighlighting(); - } -} - -void NetHackQtMainWindow::layout() -{ - if ( qt_compact_mode ) - return; - if (message && map && status) { - QSize maxs=map->Widget()->maximumSize(); - int maph=QMIN(height()*2/3,maxs.height()); - - QWidget* c = centralWidget(); - int h=c->height(); - int toph=h-maph; - int iuw=3*qt_settings->glyphs().width(); - int topw=(c->width()-iuw)/2; - - message->Widget()->setGeometry(0,0,topw,toph); - invusage->setGeometry(topw,0,iuw,toph); - status->Widget()->setGeometry(topw+iuw,0,topw,toph); - map->Widget()->setGeometry(QMAX(0,(c->width()-maxs.width())/2), - toph,c->width(),maph); - } -} - -void NetHackQtMainWindow::resizeEvent(QResizeEvent*) -{ - layout(); -#ifdef KDE - updateRects(); -#endif -} - -void NetHackQtMainWindow::keyReleaseEvent(QKeyEvent* event) -{ - if ( dirkey ) { - doKeys(QString(QChar(dirkey))); - if ( !event->isAutoRepeat() ) - dirkey = 0; - } -} - -void NetHackQtMainWindow::keyPressEvent(QKeyEvent* event) -{ - // Global key controls - - // For desktop, arrow keys scroll map, since we don't want players - // to think that's the way to move. For handhelds, the normal way is to - // click-to-travel, so we allow the cursor keys for fine movements. - - // 321 - // 4 0 - // 567 - - if ( event->isAutoRepeat() && - event->key() >= Key_Left && event->key() <= Key_Down ) - return; - - const char* d = Cmd.dirchars; - switch (event->key()) { - case Key_Up: - if ( dirkey == d[0] ) - dirkey = d[1]; - else if ( dirkey == d[4] ) - dirkey = d[3]; - else - dirkey = d[2]; - break; case Key_Down: - if ( dirkey == d[0] ) - dirkey = d[7]; - else if ( dirkey == d[4] ) - dirkey = d[5]; - else - dirkey = d[6]; - break; case Key_Left: - if ( dirkey == d[2] ) - dirkey = d[1]; - else if ( dirkey == d[6] ) - dirkey = d[7]; - else - dirkey = d[0]; - break; case Key_Right: - if ( dirkey == d[2] ) - dirkey = d[3]; - else if ( dirkey == d[6] ) - dirkey = d[5]; - else - dirkey = d[4]; - break; case Key_Prior: - dirkey = 0; - if (message) message->Scroll(0,-1); - break; case Key_Next: - dirkey = 0; - if (message) message->Scroll(0,+1); - break; case Key_Space: - if ( flags.rest_on_space ) { - event->ignore(); - return; - } - case Key_Enter: - if ( map ) - map->clickCursor(); - break; default: - dirkey = 0; - event->ignore(); - } -} - -void NetHackQtMainWindow::closeEvent(QCloseEvent* e) -{ - if ( g.program_state.something_worth_saving ) { - switch ( QMessageBox::information( this, "NetHack", - "This will end your NetHack session", - "&Save", "&Cancel", 0, 1 ) ) - { - case 0: - // See dosave() function - if (dosave0()) { - u.uhp = -1; - NetHackQtBind::qt_exit_nhwindows(0); - nh_terminate(EXIT_SUCCESS); - } - break; - case 1: - break; // ignore the event - } - } else { - e->accept(); - } -} - -void NetHackQtMainWindow::ShowIfReady() -{ - if (message && map && status) { - QPoint pos(0,0); - QWidget* p = qt_compact_mode ? stack : centralWidget(); - message->Widget()->recreate(p,0,pos); - map->Widget()->recreate(p,0,pos); - status->Widget()->recreate(p,0,pos); - if ( qt_compact_mode ) { - message->setMap(map); - stack->addWidget(map->Widget(), 0); - stack->addWidget(message->Widget(), 1); - stack->addWidget(status->Widget(), 2); - raiseMap(); - } else { - layout(); - } - showMaximized(); - } else if (isVisible()) { - hide(); - } -} - - -NetHackQtYnDialog::NetHackQtYnDialog(NetHackQtKeyBuffer& keysrc,const char* q,const char* ch,char df) : - QDialog(qApp->mainWidget(),0,FALSE), - question(q), choices(ch), def(df), - keysource(keysrc) -{ - setCaption("NetHack: Question"); -} - -char NetHackQtYnDialog::Exec() -{ - QString ch(choices); - int ch_per_line=6; - QString qlabel; - QString enable; - if ( qt_compact_mode && !choices ) { - // expand choices from prompt - // ##### why isn't choices set properly??? - const char* c=question; - while ( *c && *c != '[' ) - c++; - qlabel = QString(question).left(c-question); - if ( *c ) { - c++; - if ( *c == '-' ) - ch.append(*c++); - char from=0; - while ( *c && *c != ']' && *c != ' ' ) { - if ( *c == '-' ) { - from = c[-1]; - } else if ( from ) { - for (char f=from+1; f<=*c; f++) - ch.append(f); - from = 0; - } else { - ch.append(*c); - from = 0; - } - c++; - } - if ( *c == ' ' ) { - while ( *c && *c != ']' ) { - if ( *c == '*' || *c == '?' ) - ch.append(*c); - c++; - } - } - } - if ( strstr(question, "what direction") ) { - // We replace this regardless, since sometimes you get choices. - const char* d = Cmd.dirchars; - enable=ch; - ch=""; - ch.append(d[1]); - ch.append(d[2]); - ch.append(d[3]); - ch.append(d[0]); - ch.append('.'); - ch.append(d[4]); - ch.append(d[7]); - ch.append(d[6]); - ch.append(d[5]); - ch.append(d[8]); - ch.append(d[9]); - ch_per_line = 3; - def = ' '; - } else { - // Hmm... they'll have to use a virtual keyboard - } - } else { - qlabel = question; - } - if (!ch.isNull()) { - QVBoxLayout vb(this); - vb.setAutoAdd(TRUE); - bool bigq = qlabel.length()>40; - if ( bigq ) { - QLabel* q = new QLabel(qlabel,this); - q->setAlignment(AlignLeft|WordBreak); - q->setMargin(4); - } - QButtonGroup group(ch_per_line, Horizontal, - bigq ? QString::null : qlabel, this); - - int nchoices=ch.length(); - - bool allow_count=ch.contains('#'); - - const int margin=8; - const int gutter=8; - const int extra=fontMetrics().height(); // Extra for group - int x=margin, y=extra+margin; - int butsize=fontMetrics().height()*2+5; - - QPushButton* button; - for (int i=0; isetEnabled(FALSE); - } - button->setFixedSize(butsize,butsize); // Square - if (ch[i]==def) button->setDefault(TRUE); - if (i%10==9) { - // last in row - x=margin; - y+=butsize+gutter; - } else { - x+=butsize+gutter; - } - } - - connect(&group,SIGNAL(clicked(int)),this,SLOT(doneItem(int))); - - QLabel* lb=0; - QLineEdit* le=0; - - if (allow_count) { - QHBox *hb = new QHBox(this); - lb=new QLabel("Count: ",hb); - le=new QLineEdit(hb); - } - - adjustSize(); - centerOnMain(this); - show(); - char choice=0; - char ch_esc=0; - for (uint i=0; i= 1000 ) { - choice = ch[result() - 1000].latin1(); - } - if ( !choice ) - qApp->enter_loop(); - } - hide(); - if (allow_count && !le->text().isEmpty()) { - yn_number=atoi(le->text()); - choice='#'; - } - return choice; - } else { - QLabel label(qlabel,this); - QPushButton cancel("Dismiss",this); - label.setFrameStyle(QFrame::Box|QFrame::Sunken); - label.setAlignment(AlignCenter); - label.resize(fontMetrics().width(qlabel)+60,30+fontMetrics().height()); - cancel.move(width()/2-cancel.width()/2,label.geometry().bottom()+8); - connect(&cancel,SIGNAL(clicked()),this,SLOT(reject())); - centerOnMain(this); - setResult(-1); - show(); - while (result()<0 && keysource.Empty()) { - qApp->enter_loop(); - } - hide(); - if (keysource.Empty()) { - return '\033'; - } else { - return keysource.GetAscii(); - } - } -} -void NetHackQtYnDialog::keyPressEvent(QKeyEvent* event) -{ - // Don't want QDialog's Return/Esc behaviour - event->ignore(); -} - -void NetHackQtYnDialog::doneItem(int i) -{ - done(i+1000); -} - -void NetHackQtYnDialog::done(int i) -{ - setResult(i); - qApp->exit_loop(); -} - -NetHackQtGlyphs::NetHackQtGlyphs() -{ - const char* tile_file = "nhtiles.bmp"; - if ( iflags.wc_tile_file ) - tile_file = iflags.wc_tile_file; - - if (!img.load(tile_file)) { - tile_file = "x11tiles"; - if (!img.load(tile_file)) { - QString msg; - msg.sprintf("Cannot load x11tiles or nhtiles.bmp"); - QMessageBox::warning(0, "IO Error", msg); - } else { - tiles_per_row = TILES_PER_ROW; - if (img.width()%tiles_per_row) { - impossible( - "Tile file \"%s\" has %d columns, not multiple of row count (%d)", - tile_file, img.width(), tiles_per_row); - } - } - } else { - tiles_per_row = 40; - } - - if ( iflags.wc_tile_width ) - tilefile_tile_W = iflags.wc_tile_width; - else - tilefile_tile_W = img.width() / tiles_per_row; - if ( iflags.wc_tile_height ) - tilefile_tile_H = iflags.wc_tile_height; - else - tilefile_tile_H = tilefile_tile_W; - - setSize(tilefile_tile_W, tilefile_tile_H); -} - -void NetHackQtGlyphs::drawGlyph(QPainter& painter, int glyph, int x, int y) -{ - int tile = glyph2tile[glyph]; - int px = (tile%tiles_per_row)*width(); - int py = tile/tiles_per_row*height(); - - painter.drawPixmap( - x, - y, - pm, - px,py, - width(),height() - ); -} -void NetHackQtGlyphs::drawCell(QPainter& painter, int glyph, int cellx, int celly) -{ - drawGlyph(painter,glyph,cellx*width(),celly*height()); -} -void NetHackQtGlyphs::setSize(int w, int h) -{ - if ( size == QSize(w,h) ) - return; - - bool was1 = size == pm1.size(); - size = QSize(w,h); - if (!w || !h) - return; // Still not decided - - if ( size == pm1.size() ) { - pm = pm1; - return; - } - if ( size == pm2.size() ) { - pm = pm2; - return; - } - - if (w==tilefile_tile_W && h==tilefile_tile_H) { - pm.convertFromImage(img); - } else { - QApplication::setOverrideCursor( Qt::waitCursor ); - QImage scaled = img.smoothScale( - w*img.width()/tilefile_tile_W, - h*img.height()/tilefile_tile_H - ); - pm.convertFromImage(scaled,Qt::ThresholdDither|Qt::PreferDither); - QApplication::restoreOverrideCursor(); - } - (was1 ? pm2 : pm1) = pm; -} - - -////////////////////////////////////////////////////////////// -// -// The ugly C binding classes... -// -////////////////////////////////////////////////////////////// - - -NetHackQtMenuOrTextWindow::NetHackQtMenuOrTextWindow(NetHackQtKeyBuffer& ks) : - actual(0), - keysource(ks) -{ -} - -QWidget* NetHackQtMenuOrTextWindow::Widget() -{ - if (!actual) impossible("Widget called before we know if Menu or Text"); - return actual->Widget(); -} - -// Text -void NetHackQtMenuOrTextWindow::Clear() -{ - if (!actual) - impossible("Clear called before we know if Menu or Text"); - else - actual->Clear(); -} - -void NetHackQtMenuOrTextWindow::Display(bool block) -{ - if (!actual) - impossible("Display called before we know if Menu or Text"); - else - actual->Display(block); -} - -bool NetHackQtMenuOrTextWindow::Destroy() -{ - bool res = FALSE; - - if (!actual) - impossible("Destroy called before we know if Menu or Text"); - else - res = actual->Destroy(); - - return res; -} - -void NetHackQtMenuOrTextWindow::PutStr(int attr, const char* text) -{ - if (!actual) actual=new NetHackQtTextWindow(keysource); - actual->PutStr(attr,text); -} - -// Menu -void NetHackQtMenuOrTextWindow::StartMenu() -{ - if (!actual) actual=new NetHackQtMenuWindow(keysource); - actual->StartMenu(); -} - -void NetHackQtMenuOrTextWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, - const char* str, bool presel) -{ - if (!actual) impossible("AddMenu called before we know if Menu or Text"); - actual->AddMenu(glyph,identifier,ch,gch,attr,str,presel); -} - -void NetHackQtMenuOrTextWindow::EndMenu(const char* prompt) -{ - if (!actual) impossible("EndMenu called before we know if Menu or Text"); - actual->EndMenu(prompt); -} - -int NetHackQtMenuOrTextWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) -{ - if (!actual) impossible("SelectMenu called before we know if Menu or Text"); - return actual->SelectMenu(how,menu_list); -} - - -// XXX Should be from Options -// -// XXX Hmm. Tricky part is that perhaps some macros should only be active -// XXX when a key is about to be gotten. For example, the user could -// XXX define "-" to do "E-yyyyyyyy\r", but would still need "-" for -// XXX other purposes. Maybe just too bad. -// -struct { - int key; - int state; - const char* macro; -} key_macro[]={ - { Qt::Key_F1, 0, "n100." }, // Rest (x100) - { Qt::Key_F2, 0, "n20s" }, // Search (x20) - { Qt::Key_F3, 0, "o8o4o6o2o8o4o6o2o8o4o6o2" }, // Open all doors (x3) - { Qt::Key_Tab, 0, "\001" }, - { 0, 0, 0 } -}; - - -NetHackQtBind::NetHackQtBind(int& argc, char** argv) : -#ifdef KDE - KApplication(argc,argv) -#elif defined(QWS) // not quite the right condition - QPEApplication(argc,argv) -#else - QApplication(argc,argv) -#endif -{ - QPixmap pm("nhsplash.xpm"); - if ( iflags.wc_splash_screen && !pm.isNull() ) { - QVBox *vb = new QVBox(0,0, - WStyle_Customize | WStyle_NoBorder | nh_WX11BypassWM | WStyle_StaysOnTop ); - splash = vb; - QLabel *lsplash = new QLabel(vb); - lsplash->setAlignment(AlignCenter); - lsplash->setPixmap(pm); - QLabel* capt = new QLabel("Loading...",vb); - capt->setAlignment(AlignCenter); - if ( pm.mask() ) { - lsplash->setFixedSize(pm.size()); - lsplash->setMask(*pm.mask()); - } - splash->move((QApplication::desktop()->width()-pm.width())/2, - (QApplication::desktop()->height()-pm.height())/2); - //splash->setGeometry(0,0,100,100); - if ( qt_compact_mode ) { - splash->showMaximized(); - } else { - vb->setFrameStyle(QFrame::WinPanel|QFrame::Raised); - vb->setMargin(10); - splash->adjustSize(); - splash->show(); - } - - // force content refresh outside event loop - splash->repaint(FALSE); - lsplash->repaint(FALSE); - capt->repaint(FALSE); - qApp->flushX(); - - } else { - splash = 0; - } - main = new NetHackQtMainWindow(keybuffer); -#if defined(QWS) // not quite the right condition - showMainWidget(main); -#else - setMainWidget(main); -#endif - qt_settings=new NetHackQtSettings(main->width(),main->height()); -} - -void NetHackQtBind::qt_init_nhwindows(int* argc, char** argv) -{ -#ifdef UNIX -// Userid control -// -// Michael Hohmuth ... -// -// As the game runs setuid games, it must seteuid(getuid()) before -// calling XOpenDisplay(), and reset the euid afterwards. -// Otherwise, it can't read the $HOME/.Xauthority file and whines about -// not being able to open the X display (if a magic-cookie -// authorization mechanism is being used). - - uid_t gamesuid=geteuid(); - seteuid(getuid()); -#endif - - QApplication::setColorSpec(ManyColor); - instance=new NetHackQtBind(*argc,argv); - -#ifdef UNIX - seteuid(gamesuid); -#endif - -#ifdef _WS_WIN_ - // This nethack engine feature should be moved into windowport API - nt_kbhit = NetHackQtBind::qt_kbhit; -#endif -} - -int NetHackQtBind::qt_kbhit() -{ - return !keybuffer.Empty(); -} - -static bool have_asked = FALSE; - -void NetHackQtBind::qt_player_selection() -{ - if ( !have_asked ) - qt_askname(); -} - -NetHackQtSavedGameSelector::NetHackQtSavedGameSelector(const char** saved) : - QDialog(qApp->mainWidget(),"sgsel",TRUE) -{ - QVBoxLayout *vbl = new QVBoxLayout(this,6); - QHBox* hb; - - QLabel* logo = new QLabel(this); vbl->addWidget(logo); - logo->setAlignment(AlignCenter); - logo->setPixmap(QPixmap("nhsplash.xpm")); - QLabel* attr = new QLabel("by the NetHack DevTeam",this); - attr->setAlignment(AlignCenter); - vbl->addWidget(attr); - vbl->addStretch(2); - /* - QLabel* logo = new QLabel(hb); - hb = new QHBox(this); - vbl->addWidget(hb, AlignCenter); - logo->setPixmap(QPixmap(nh_icon)); - logo->setAlignment(AlignRight|AlignVCenter); - new QLabel(nh_attribution,hb); - */ - - hb = new QHBox(this); - vbl->addWidget(hb, AlignCenter); - QPushButton* q = new QPushButton("Quit",hb); - connect(q, SIGNAL(clicked()), this, SLOT(reject())); - QPushButton* c = new QPushButton("New Game",hb); - connect(c, SIGNAL(clicked()), this, SLOT(accept())); - c->setDefault(TRUE); - - QButtonGroup* bg = new QButtonGroup(3, Horizontal, "Saved Characters",this); - vbl->addWidget(bg); - connect(bg, SIGNAL(clicked(int)), this, SLOT(done(int))); - for (int i=0; saved[i]; i++) { - QPushButton* b = new QPushButton(saved[i],bg); - bg->insert(b, i+2); - } -} - -int NetHackQtSavedGameSelector::choose() -{ -#if defined(QWS) // probably safe with Qt 3, too (where show!=exec in QDialog). - if ( qt_compact_mode ) - showMaximized(); -#endif - return exec()-2; -} - -void NetHackQtBind::qt_askname() -{ - have_asked = TRUE; - - // We do it all here, and nothing in askname - - char** saved = get_saved_games(); - int ch = -1; - if ( saved && *saved ) { - if ( splash ) splash->hide(); - NetHackQtSavedGameSelector sgsel((const char**)saved); - ch = sgsel.choose(); - if ( ch >= 0 ) - strcpy(g.plname,saved[ch]); - } - free_saved_games(saved); - - switch (ch) { - case -1: - if ( splash ) splash->hide(); - if (NetHackQtPlayerSelector(keybuffer).Choose()) - return; - case -2: - break; - default: - return; - } - - // Quit - clearlocks(); - qt_exit_nhwindows(0); - nh_terminate(0); -} - -void NetHackQtBind::qt_get_nh_event() -{ -} - -#if defined(QWS) -// Kludge to access lastWindowClosed() signal. -class TApp : public QApplication { -public: - TApp(int& c, char**v) : QApplication(c,v) {} - void lwc() { emit lastWindowClosed(); } -}; -#endif - -void NetHackQtBind::qt_exit_nhwindows(const char *) -{ -#if defined(QWS) - // Avoids bug in SHARP SL5500 - ((TApp*)qApp)->lwc(); - qApp->quit(); -#endif - - delete instance; // ie. qApp -} - -void NetHackQtBind::qt_suspend_nhwindows(const char *) -{ -} - -void NetHackQtBind::qt_resume_nhwindows() -{ -} - -static QArray id_to_window; - -winid NetHackQtBind::qt_create_nhwindow(int type) -{ - winid id; - for (id = 0; id < (winid) id_to_window.size(); id++) { - if ( !id_to_window[id] ) - break; - } - if ( id == (winid) id_to_window.size() ) - id_to_window.resize(id+1); - - NetHackQtWindow* window=0; - - switch (type) { - case NHW_MAP: { - NetHackQtMapWindow* w=new NetHackQtMapWindow(clickbuffer); - main->AddMapWindow(w); - window=w; - } break; case NHW_MESSAGE: { - NetHackQtMessageWindow* w=new NetHackQtMessageWindow; - main->AddMessageWindow(w); - window=w; - } break; case NHW_STATUS: { - NetHackQtStatusWindow* w=new NetHackQtStatusWindow; - main->AddStatusWindow(w); - window=w; - } break; case NHW_MENU: - window=new NetHackQtMenuOrTextWindow(keybuffer); - break; case NHW_TEXT: - window=new NetHackQtTextWindow(keybuffer); - } - - window->nhid = id; - - // Note: use of isHidden does not work with Qt 2.1 - if ( splash -#if QT_VERSION >= 300 - && !main->isHidden() -#else - && main->isVisible() -#endif - ) - { - delete splash; - splash = 0; - } - - id_to_window[id] = window; - return id; -} - -void NetHackQtBind::qt_clear_nhwindow(winid wid) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->Clear(); -} - -void NetHackQtBind::qt_display_nhwindow(winid wid, BOOLEAN_P block) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->Display(block); -} - -void NetHackQtBind::qt_destroy_nhwindow(winid wid) -{ - NetHackQtWindow* window=id_to_window[wid]; - main->RemoveWindow(window); - if (window->Destroy()) - delete window; - id_to_window[wid] = 0; -} - -void NetHackQtBind::qt_curs(winid wid, int x, int y) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->CursorTo(x,y); -} - -void NetHackQtBind::qt_putstr(winid wid, int attr, const char *text) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->PutStr(attr,text); -} - -void NetHackQtBind::qt_display_file(const char *filename, BOOLEAN_P must_exist) -{ - NetHackQtTextWindow* window=new NetHackQtTextWindow(keybuffer); - bool complain = FALSE; - -#ifdef DLB - { - dlb *f; - char buf[BUFSZ]; - char *cr; - - window->Clear(); - f = dlb_fopen(filename, "r"); - if (!f) { - complain = must_exist; - } else { - while (dlb_fgets(buf, BUFSZ, f)) { - if ((cr = index(buf, '\n')) != 0) *cr = 0; -#ifdef MSDOS - if ((cr = index(buf, '\r')) != 0) *cr = 0; -#endif - if (index(buf, '\t') != 0) (void) tabexpand(buf); - window->PutStr(ATR_NONE, buf); - } - window->Display(FALSE); - (void) dlb_fclose(f); - } - } -#else - QFile file(filename); - - if (file.open(IO_ReadOnly)) { - char line[128]; - while (file.readLine(line,127) >= 0) { - line[strlen(line)-1]=0;// remove newline - window->PutStr(ATR_NONE,line); - } - window->Display(FALSE); - } else { - complain = must_exist; - } -#endif - - if (complain) { - QString message; - message.sprintf("File not found: %s\n",filename); - QMessageBox::message("File Error", (const char*)message, "Ignore"); - } -} - -void NetHackQtBind::qt_start_menu(winid wid) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->StartMenu(); -} - -void NetHackQtBind::qt_add_menu(winid wid, int glyph, - const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr, - const char *str, BOOLEAN_P presel) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->AddMenu(glyph, identifier, ch, gch, attr, str, presel); -} - -void NetHackQtBind::qt_end_menu(winid wid, const char *prompt) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->EndMenu(prompt); -} - -int NetHackQtBind::qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list) -{ - NetHackQtWindow* window=id_to_window[wid]; - return window->SelectMenu(how,menu_list); -} - -void NetHackQtBind::qt_update_inventory() -{ - if (main) - main->updateInventory(); - /* doesn't work yet - if (g.program_state.something_worth_saving && iflags.perm_invent) - display_inventory(NULL, FALSE); - */ -} - -void NetHackQtBind::qt_mark_synch() -{ -} - -void NetHackQtBind::qt_wait_synch() -{ -} - -void NetHackQtBind::qt_cliparound(int x, int y) -{ - // XXXNH - winid should be a parameter! - qt_cliparound_window(WIN_MAP,x,y); -} - -void NetHackQtBind::qt_cliparound_window(winid wid, int x, int y) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->ClipAround(x,y); -} -void NetHackQtBind::qt_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph, int bkglyph) -{ - NetHackQtWindow* window=id_to_window[wid]; - window->PrintGlyph(x,y,glyph); -} -//void NetHackQtBind::qt_print_glyph_compose(winid wid,XCHAR_P x,XCHAR_P y,int glyph1, int glyph2) -//{ - //NetHackQtWindow* window=id_to_window[wid]; - //window->PrintGlyphCompose(x,y,glyph1,glyph2); -//} - -void NetHackQtBind::qt_raw_print(const char *str) -{ - puts(str); -} - -void NetHackQtBind::qt_raw_print_bold(const char *str) -{ - puts(str); -} - -int NetHackQtBind::qt_nhgetch() -{ - if (main) - main->fadeHighlighting(); - - // Process events until a key arrives. - // - while (keybuffer.Empty() -#ifdef SAFERHANGUP - && !g.program_state.done_hup -#endif - ) { - qApp->enter_loop(); - } - -#ifdef SAFERHANGUP - if (g.program_state.done_hup && keybuffer.Empty()) return '\033'; -#endif - return keybuffer.GetAscii(); -} - -int NetHackQtBind::qt_nh_poskey(int *x, int *y, int *mod) -{ - if (main) - main->fadeHighlighting(); - - // Process events until a key or map-click arrives. - // - while (keybuffer.Empty() && clickbuffer.Empty() -#ifdef SAFERHANGUP - && !g.program_state.done_hup -#endif - ) { - qApp->enter_loop(); - } -#ifdef SAFERHANGUP - if (g.program_state.done_hup && keybuffer.Empty()) return '\033'; -#endif - if (!keybuffer.Empty()) { - return keybuffer.GetAscii(); - } else { - *x=clickbuffer.NextX(); - *y=clickbuffer.NextY(); - *mod=clickbuffer.NextMod(); - clickbuffer.Get(); - return 0; - } -} - -void NetHackQtBind::qt_nhbell() -{ - QApplication::beep(); -} - -int NetHackQtBind::qt_doprev_message() -{ - // Don't need it - uses scrollbar - // XXX but could make this a shortcut - return 0; -} - -char NetHackQtBind::qt_yn_function(const char *question, const char *choices, CHAR_P def) -{ - if (qt_settings->ynInMessages() && WIN_MESSAGE!=WIN_ERR) { - // Similar to X11 windowport `slow' feature. - - char message[BUFSZ]; - char yn_esc_map='\033'; - - if (choices) { - char *cb, choicebuf[QBUFSZ]; - Strcpy(choicebuf, choices); - if ((cb = index(choicebuf, '\033')) != 0) { - // anything beyond is hidden - *cb = '\0'; - } - (void)strncpy(message, question, QBUFSZ-1); - message[QBUFSZ-1] = '\0'; - Sprintf(eos(message), " [%s]", choicebuf); - if (def) Sprintf(eos(message), " (%c)", def); - Strcat(message, " "); - // escape maps to 'q' or 'n' or default, in that order - yn_esc_map = (index(choices, 'q') ? 'q' : - (index(choices, 'n') ? 'n' : def)); - } else { - Strcpy(message, question); - } - -#ifdef USE_POPUPS - // Improve some special-cases (DIRKS 08/02/23) - if (strcmp (choices,"ynq") == 0) { - switch (QMessageBox::information (qApp->mainWidget(),"NetHack",question,"&Yes","&No","&Quit",0,2)) - { - case 0: return 'y'; - case 1: return 'n'; - case 2: return 'q'; - } - } - - if (strcmp (choices,"yn") == 0) { - switch (QMessageBox::information(qApp->mainWidget(),"NetHack",question,"&Yes", "&No",0,1)) - { - case 0: return 'y'; - case 1: return 'n'; - } - } -#endif - - NetHackQtBind::qt_putstr(WIN_MESSAGE, ATR_BOLD, message); - - int result=-1; - while (result<0) { - char ch=NetHackQtBind::qt_nhgetch(); - if (ch=='\033') { - result=yn_esc_map; - } else if (choices && !index(choices,ch)) { - if (def && (ch==' ' || ch=='\r' || ch=='\n')) { - result=def; - } else { - NetHackQtBind::qt_nhbell(); - // and try again... - } - } else { - result=ch; - } - } - - NetHackQtBind::qt_clear_nhwindow(WIN_MESSAGE); - - return result; - } else { - NetHackQtYnDialog dialog(keybuffer,question,choices,def); - return dialog.Exec(); - } -} - -void NetHackQtBind::qt_getlin(const char *prompt, char *line) -{ - NetHackQtStringRequestor requestor(keybuffer,prompt); - if (!requestor.Get(line)) { - line[0]=0; - } -} - -NetHackQtExtCmdRequestor::NetHackQtExtCmdRequestor(NetHackQtKeyBuffer& ks) : - QDialog(qApp->mainWidget(), "ext-cmd", FALSE), - keysource(ks) -{ - int marg=4; - QVBoxLayout *l = new QVBoxLayout(this,marg,marg); - - QPushButton* can = new QPushButton("Cancel", this); - can->setDefault(TRUE); - can->setMinimumSize(can->sizeHint()); - l->addWidget(can); - - QButtonGroup *group=new QButtonGroup("",0); - QGroupBox *grid=new QGroupBox("Extended commands",this); - l->addWidget(grid); - - int i; - int butw=50; - QFontMetrics fm = fontMetrics(); - for (i=0; extcmdlist[i].ef_txt; i++) { - butw = QMAX(butw,30+fm.width(extcmdlist[i].ef_txt)); - } - int ncols=4; - int nrows=(i+ncols-1)/ncols; - - QVBoxLayout* bl = new QVBoxLayout(grid,marg); - bl->addSpacing(fm.height()); - QGridLayout* gl = new QGridLayout(nrows,ncols,marg); - bl->addLayout(gl); - for (i=0; extcmdlist[i].ef_txt; i++) { - QPushButton* pb=new QPushButton(extcmdlist[i].ef_txt, grid); - pb->setMinimumSize(butw,pb->sizeHint().height()); - group->insert(pb); - gl->addWidget(pb,i/ncols,i%ncols); - } - connect(group,SIGNAL(clicked(int)),this,SLOT(done(int))); - - bl->activate(); - l->activate(); - resize(1,1); - - connect(can,SIGNAL(clicked()),this,SLOT(cancel())); -} - -void NetHackQtExtCmdRequestor::cancel() -{ - setResult(-1); - qApp->exit_loop(); -} - -void NetHackQtExtCmdRequestor::done(int i) -{ - setResult(i); - qApp->exit_loop(); -} - -int NetHackQtExtCmdRequestor::get() -{ - const int none = -10; - char str[32]; - int cursor=0; - resize(1,1); // pack - centerOnMain(this); - show(); - setResult(none); - while (result()==none) { - while (result()==none && !keysource.Empty()) { - char k=keysource.GetAscii(); - if (k=='\r' || k=='\n' || k==' ' || k=='\033') { - setResult(-1); - } else { - str[cursor++] = k; - int r=-1; - for (int i=0; extcmdlist[i].ef_txt; i++) { - if (qstrnicmp(str, extcmdlist[i].ef_txt, cursor)==0) { - if ( r == -1 ) - r = i; - else - r = -2; - } - } - if ( r == -1 ) { // no match! - QApplication::beep(); - cursor=0; - } else if ( r != -2 ) { // only one match - setResult(r); - } - } - } - if (result()==none) - qApp->enter_loop(); - } - hide(); - return result(); -} - - -int NetHackQtBind::qt_get_ext_cmd() -{ - NetHackQtExtCmdRequestor requestor(keybuffer); - return requestor.get(); -} - -void NetHackQtBind::qt_number_pad(int) -{ - // Ignore. -} - -void NetHackQtBind::qt_delay_output() -{ - NetHackQtDelay delay(15); - delay.wait(); -} - -void NetHackQtBind::qt_start_screen() -{ - // Ignore. -} - -void NetHackQtBind::qt_end_screen() -{ - // Ignore. -} - -void NetHackQtBind::qt_outrip(winid wid, int how, time_t when) -{ - NetHackQtWindow* window=id_to_window[wid]; - - window->UseRIP(how, when); -} - -bool NetHackQtBind::notify(QObject *receiver, QEvent *event) -{ - // Ignore Alt-key navigation to menubar, it's annoying when you - // use Alt-Direction to move around. - if ( main && event->type()==QEvent::KeyRelease && main==receiver - && ((QKeyEvent*)event)->key() == Key_Alt ) - return TRUE; - - bool result=QApplication::notify(receiver,event); -#ifdef SAFERHANGUP - if (g.program_state.done_hup) { - keybuffer.Put('\033'); - qApp->exit_loop(); - return TRUE; - } -#endif - if (event->type()==QEvent::KeyPress) { - QKeyEvent* key_event=(QKeyEvent*)event; - - if (!key_event->isAccepted()) { - const int k=key_event->key(); - bool macro=FALSE; - for (int i=0; !macro && key_macro[i].key; i++) { - if (key_macro[i].key==k - && ((key_macro[i].state&key_event->state())==key_macro[i].state)) - { - keybuffer.Put(key_macro[i].macro); - macro=TRUE; - } - } - char ch=key_event->ascii(); - if ( !ch && (key_event->state() & Qt::ControlButton) ) { - // On Mac, it aint-ncessarily-control - if ( k>=Qt::Key_A && k<=Qt::Key_Z ) - ch = k - Qt::Key_A + 1; - } - if (!macro && ch) { - bool alt = (key_event->state()&AltButton) || - (k >= Key_0 && k <= Key_9 && (key_event->state()&ControlButton)); - keybuffer.Put(key_event->key(),ch + (alt ? 128 : 0), - key_event->state()); - key_event->accept(); - result=TRUE; - } - - if (ch || macro) { - qApp->exit_loop(); - } - } - } - return result; -} - -NetHackQtBind* NetHackQtBind::instance=0; -NetHackQtKeyBuffer NetHackQtBind::keybuffer; -NetHackQtClickBuffer NetHackQtBind::clickbuffer; -NetHackQtMainWindow* NetHackQtBind::main=0; -QWidget* NetHackQtBind::splash=0; - - -extern "C" struct window_procs Qt_procs; - -struct window_procs Qt_procs = { - "Qt", - WC_COLOR|WC_HILITE_PET| - WC_ASCII_MAP|WC_TILED_MAP| - WC_FONT_MAP|WC_TILE_FILE|WC_TILE_WIDTH|WC_TILE_HEIGHT| - WC_PLAYER_SELECTION|WC_SPLASH_SCREEN, - 0L, - NetHackQtBind::qt_init_nhwindows, - NetHackQtBind::qt_player_selection, - NetHackQtBind::qt_askname, - NetHackQtBind::qt_get_nh_event, - NetHackQtBind::qt_exit_nhwindows, - NetHackQtBind::qt_suspend_nhwindows, - NetHackQtBind::qt_resume_nhwindows, - NetHackQtBind::qt_create_nhwindow, - NetHackQtBind::qt_clear_nhwindow, - NetHackQtBind::qt_display_nhwindow, - NetHackQtBind::qt_destroy_nhwindow, - NetHackQtBind::qt_curs, - NetHackQtBind::qt_putstr, - genl_putmixed, - NetHackQtBind::qt_display_file, - NetHackQtBind::qt_start_menu, - NetHackQtBind::qt_add_menu, - NetHackQtBind::qt_end_menu, - NetHackQtBind::qt_select_menu, - genl_message_menu, /* no need for X-specific handling */ - NetHackQtBind::qt_update_inventory, - NetHackQtBind::qt_mark_synch, - NetHackQtBind::qt_wait_synch, -#ifdef CLIPPING - NetHackQtBind::qt_cliparound, -#endif -#ifdef POSITIONBAR - donull, -#endif - NetHackQtBind::qt_print_glyph, - //NetHackQtBind::qt_print_glyph_compose, - NetHackQtBind::qt_raw_print, - NetHackQtBind::qt_raw_print_bold, - NetHackQtBind::qt_nhgetch, - NetHackQtBind::qt_nh_poskey, - NetHackQtBind::qt_nhbell, - NetHackQtBind::qt_doprev_message, - NetHackQtBind::qt_yn_function, - NetHackQtBind::qt_getlin, - NetHackQtBind::qt_get_ext_cmd, - NetHackQtBind::qt_number_pad, - NetHackQtBind::qt_delay_output, -#ifdef CHANGE_COLOR /* only a Mac option currently */ - donull, - donull, -#endif - /* other defs that really should go away (they're tty specific) */ - NetHackQtBind::qt_start_screen, - NetHackQtBind::qt_end_screen, -#ifdef GRAPHIC_TOMBSTONE - NetHackQtBind::qt_outrip, -#else - genl_outrip, -#endif - genl_preference_update, - genl_getmsghistory, - genl_putmsghistory, - genl_status_init, - genl_status_finish, - genl_status_enablefield, - genl_status_update, - genl_can_suspend_yes, -}; - -extern "C" void play_usersound(const char* filename, int volume) -{ -#ifdef USER_SOUNDS -#ifndef QT_NO_SOUND - QSound::play(filename); -#endif -#endif -} - -#include "qt_win.moc" -#ifndef KDE -#include "qt_kde0.moc" -#endif -#if QT_VERSION >= 300 -#include "qttableview.moc" -#endif +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4win.h b/win/Qt/qt_win.h similarity index 93% rename from win/Qt4/qt4win.h rename to win/Qt/qt_win.h index 02e96cd31..b85104414 100644 --- a/win/Qt4/qt4win.h +++ b/win/Qt/qt_win.h @@ -11,10 +11,10 @@ // major application of Qt. // -#ifndef qt4win_h -#define qt4win_h +#ifndef qt_win_h +#define qt_win_h -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtWindow { public: @@ -44,6 +44,6 @@ public: int nhid; }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt4/qt4xcmd.cpp b/win/Qt/qt_xcmd.cpp similarity index 94% rename from win/Qt4/qt4xcmd.cpp rename to win/Qt/qt_xcmd.cpp index 7c078f640..a994d4eae 100644 --- a/win/Qt4/qt4xcmd.cpp +++ b/win/Qt/qt_xcmd.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4xcmd.cpp -- extended command widget +// qt_xcmd.cpp -- extended command widget #include "hack.h" #include "func_tab.h" @@ -20,13 +20,13 @@ #if QT_VERSION >= 0x050000 #include #endif -#include "qt4xcmd.h" -#include "qt4xcmd.moc" -#include "qt4bind.h" -#include "qt4set.h" -#include "qt4str.h" +#include "qt_xcmd.h" +#include "qt_xcmd.moc" +#include "qt_bind.h" +#include "qt_set.h" +#include "qt_str.h" -namespace nethack_qt4 { +namespace nethack_qt_ { // temporary void centerOnMain(QWidget *); @@ -145,4 +145,4 @@ void NetHackQtExtCmdRequestor::enableButtons() } } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4xcmd.h b/win/Qt/qt_xcmd.h similarity index 85% rename from win/Qt4/qt4xcmd.h rename to win/Qt/qt_xcmd.h index 338ef3370..fe8b027a6 100644 --- a/win/Qt4/qt4xcmd.h +++ b/win/Qt/qt_xcmd.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4xcmd.h -- extended command widget +// qt_xcmd.h -- extended command widget #ifndef QT4XCMD_H #define QT4XCMD_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtExtCmdRequestor : public QDialog { Q_OBJECT @@ -28,6 +28,6 @@ private slots: void cancel(); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/include/qt_xpms.h b/win/Qt/qt_xpms.h similarity index 100% rename from include/qt_xpms.h rename to win/Qt/qt_xpms.h diff --git a/win/Qt4/qt4yndlg.cpp b/win/Qt/qt_yndlg.cpp similarity index 96% rename from win/Qt4/qt4yndlg.cpp rename to win/Qt/qt_yndlg.cpp index e315189de..8d1caf400 100644 --- a/win/Qt4/qt4yndlg.cpp +++ b/win/Qt/qt_yndlg.cpp @@ -2,7 +2,7 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4yndlg.cpp -- yes/no dialog +// qt_yndlg.cpp -- yes/no dialog #include "hack.h" #undef Invisible @@ -19,15 +19,15 @@ #if QT_VERSION >= 0x050000 #include #endif -#include "qt4yndlg.h" -#include "qt4yndlg.moc" -#include "qt4str.h" +#include "qt_yndlg.h" +#include "qt_yndlg.moc" +#include "qt_str.h" // temporary extern int qt_compact_mode; // end temporary -namespace nethack_qt4 { +namespace nethack_qt_ { // temporary void centerOnMain(QWidget *); @@ -81,7 +81,7 @@ char NetHackQtYnDialog::Exec() } if ( question.indexOf("what direction") >= 0 ) { // We replace this regardless, since sometimes you get choices. - const char* d = Cmd.dirchars; + const char* d = g.Cmd.dirchars; enable=ch; ch=""; ch.append(d[1]); @@ -241,4 +241,4 @@ void NetHackQtYnDialog::doneItem(int i) done(i+1000); } -} // namespace nethack_qt4 +} // namespace nethack_qt_ diff --git a/win/Qt4/qt4yndlg.h b/win/Qt/qt_yndlg.h similarity index 86% rename from win/Qt4/qt4yndlg.h rename to win/Qt/qt_yndlg.h index d1474f541..079d7119f 100644 --- a/win/Qt4/qt4yndlg.h +++ b/win/Qt/qt_yndlg.h @@ -2,12 +2,12 @@ // Qt4 conversion copyright (c) Ray Chason, 2012-2014. // NetHack may be freely redistributed. See license for details. -// qt4yndlg.h -- yes/no dialog +// qt_yndlg.h -- yes/no dialog #ifndef QT4YNDLG_H #define QT4YNDLG_H -namespace nethack_qt4 { +namespace nethack_qt_ { class NetHackQtYnDialog : QDialog { Q_OBJECT @@ -29,6 +29,6 @@ public: char Exec(); }; -} // namespace nethack_qt4 +} // namespace nethack_qt_ #endif diff --git a/win/Qt3/.gitattributes b/win/Qt3/.gitattributes new file mode 100644 index 000000000..7b924974c --- /dev/null +++ b/win/Qt3/.gitattributes @@ -0,0 +1,4 @@ +Install.Qt NHSUBST +qpe-nethack.control NH_header=no +knethack.lnk NH_header=no +* NH_filestag=(file%s_for_the_Qt_3_widget_library_-_X11,_Windows,_Mac_OS_X,_or_Qtopia) diff --git a/win/Qt/Info.plist b/win/Qt3/Info.plist similarity index 100% rename from win/Qt/Info.plist rename to win/Qt3/Info.plist diff --git a/win/Qt/Install.Qt b/win/Qt3/Install.Qt similarity index 100% rename from win/Qt/Install.Qt rename to win/Qt3/Install.Qt diff --git a/win/Qt/knethack.lnk b/win/Qt3/knethack.lnk similarity index 100% rename from win/Qt/knethack.lnk rename to win/Qt3/knethack.lnk diff --git a/win/Qt/knh-mini.xpm b/win/Qt3/knh-mini.xpm similarity index 100% rename from win/Qt/knh-mini.xpm rename to win/Qt3/knh-mini.xpm diff --git a/win/Qt/knh.xpm b/win/Qt3/knh.xpm similarity index 100% rename from win/Qt/knh.xpm rename to win/Qt3/knh.xpm diff --git a/win/Qt/qpe-nethack.control b/win/Qt3/qpe-nethack.control similarity index 100% rename from win/Qt/qpe-nethack.control rename to win/Qt3/qpe-nethack.control diff --git a/win/Qt4/qt4clust.cpp b/win/Qt3/qt3_clust.cpp similarity index 93% rename from win/Qt4/qt4clust.cpp rename to win/Qt3/qt3_clust.cpp index 1cd080c11..6b1039f9b 100644 --- a/win/Qt4/qt4clust.cpp +++ b/win/Qt3/qt3_clust.cpp @@ -1,9 +1,10 @@ -/* SCCS Id: @(#)qt_clust.cpp 3.4 1999/11/19 */ +/* NetHack 3.6 qt_clust.cpp $NHDT-Date: 1575917719 2019/12/09 18:55:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.0 $ */ /* Copyright (c) Warwick Allison, 1999. */ /* NetHack may be freely redistributed. See license for details. */ -#include "qt4clust.h" +#include "qt3_clust.h" -static void include(QRect& r, const QRect& rect) +static +void include(QRect& r, const QRect& rect) { if (rect.left() +// - Userid control +// Svante Gerhard +// - .nethackrc tile and font size settings +// Dirk Schoenberger +// - KDE support +// - SlashEm support +// and many others for bug reports. +// +// Unfortunately, this doesn't use Qt as well as I would like, +// primarily because NetHack is fundamentally a getkey-type program +// rather than being event driven (hence the ugly key and click buffer) +// and also because this is my first major application of Qt. +// +// The problem of NetHack's getkey requirement is solved by intercepting +// key events by overiding QApplicion::notify(...), and putting them in +// a buffer. Mouse clicks on the map window are treated with a similar +// buffer. When the NetHack engine calls for a key, one is taken from +// the buffer, or if that is empty, QApplication::enter_loop() is called. +// Whenever keys or clicks go into the buffer, QApplication::exit_loop() +// is called. +// +// Another problem is that some NetHack players are decade-long players who +// demand complete keyboard control (while Qt and X11 conspire to make this +// difficult by having widget-based focus rather than application based - +// a good thing in general). This problem is solved by again using the key +// event buffer. +// +// Out of all this hackery comes a silver lining however, as macros for +// the super-expert and menus for the ultra-newbie are also made possible +// by the key event buffer. +// + +extern "C" { + +// This includes all the definitions we need from the NetHack main +// engine. We pretend MSC is a STDC compiler, because C++ is close +// enough, and we undefine NetHack macros which conflict with Qt +// identifiers. + +#define alloc hide_alloc // avoid treading on STL symbol +#define lock hide_lock // avoid treading on STL symbol +#ifdef _MSC_VER +#define NHSTDC +#endif +#include "hack.h" +#include "func_tab.h" +#include "dlb.h" +#include "patchlevel.h" +#include "tile2x11.h" +#undef Invisible +#undef Warning +#undef red +#undef green +#undef blue +#undef Black +#undef curs +#undef TRUE +#undef FALSE +#undef min +#undef max +#undef alloc +#undef lock +#undef yn + +} + +#include "qt3_win.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +//#include + +#include + +#include "qt3_clust.h" +#include "qt3_xpms.h" + +#include +#ifdef Q_WS_MACX +# include +#else +# include +#endif + +#ifdef _WS_X11_ +// For userid control +#include +#endif + +// Some distributors released Qt 2.1.0beta4 +#if QT_VERSION < 220 +# define nh_WX11BypassWM 0x01000000 +#else +# define nh_WX11BypassWM WX11BypassWM +#endif + +#ifdef USER_SOUNDS +# if QT_VERSION < 220 +# undef USER_SOUNDS +# else +# include +# endif +#endif + + +#ifdef USER_SOUNDS +extern "C" void play_sound_for_message(const char* str); +#endif + +#ifdef SAFERHANGUP +#include +#endif + +// Warwick prefers it this way... +#define QT_CHOOSE_RACE_FIRST + +static const char nh_attribution[] = "
NetHack" + "
by the NetHack DevTeam
"; + +static QString +aboutMsg() +{ + QString msg; + msg.sprintf( + "Qt NetHack is a version of NetHack built\n" +#ifdef KDE + "using KDE and the Qt GUI toolkit.\n" +#else + "using the Qt GUI toolkit.\n" +#endif + "This is version %d.%d.%d\n\n" + "Homepage:\n http://trolls.troll.no/warwick/nethack/\n\n" +#ifdef KDE + "KDE:\n http://www.kde.org\n" +#endif + "Qt:\n http://www.troll.no", + VERSION_MAJOR, + VERSION_MINOR, + PATCHLEVEL); + return msg; +} + +static void +centerOnMain( QWidget* w ) +{ + QWidget* m = qApp->mainWidget(); + if (!m) m = qApp->desktop(); + QPoint p = m->mapToGlobal(QPoint(0,0)); + w->move( p.x() + m->width()/2 - w->width()/2, + p.y() + m->height()/2 - w->height()/2 ); +} + +NetHackQtLineEdit::NetHackQtLineEdit() : + QLineEdit(0) +{ +} + +NetHackQtLineEdit::NetHackQtLineEdit(QWidget* parent, const char* name) : + QLineEdit(parent,name) +{ +} + +void NetHackQtLineEdit::fakeEvent(int key, int ascii, int state) +{ + QKeyEvent fake(QEvent::KeyPress,key,ascii,state); + keyPressEvent(&fake); +} + +extern "C" { +/* Used by tile/font-size patch below and in ../../src/files.c */ +char *qt_tilewidth=NULL; +char *qt_tileheight=NULL; +char *qt_fontsize=NULL; +#if defined(QWS) +int qt_compact_mode = 1; +#else +int qt_compact_mode = 0; +#endif +extern const char *enc_stat[]; /* from botl.c */ +extern const char *hu_stat[]; /* from eat.c */ +extern int total_tiles_used; // from tile.c +extern short glyph2tile[]; // from tile.c +} + +static int tilefile_tile_W=16; +static int tilefile_tile_H=16; + +#define TILEWMIN 1 +#define TILEHMIN 1 + + +/* XPM */ +static const char * nh_icon[] = { +"40 40 6 1", +" s None c none", +". c #ffffff", +"X c #dadab6", +"o c #6c91b6", +"O c #476c6c", +"+ c #000000", +" ", +" ", +" ", +" . .X..XX.XX X ", +" .. .....X.XXXXXX XX ", +" ... ....X..XX.XXXXX XXX ", +" .. ..........X.XXXXXXXXXXX XX ", +" .... ........X..XX.XXXXXXXXX XXXX ", +" .... ..........X.XXXXXXXXXXX XXXX ", +" ooOOO..ooooooOooOOoOOOOOOOXX+++OO++ ", +" ooOOO..ooooooooOoOOOOOOOOOXX+++OO++ ", +" ....O..ooooooOooOOoOOOOOOOXX+XXXX++ ", +" ....O..ooooooooOoOOOOOOOOOXX+XXXX++ ", +" ..OOO..ooooooOooOOoOOOOOOOXX+++XX++ ", +" ++++..ooooooooOoOOOOOOOOOXX+++ +++ ", +" +++..ooooooOooOOoOOOOOOOXX+++ + ", +" ++..ooooooooOoOOOOOOOOOXX+++ ", +" ..ooooooOooOOoOOOOOOOXX+++ ", +" ..ooooooooOoOOOOOOOOOXX+++ ", +" ..ooooooOooOOoOOOOOOOXX+++ ", +" ..ooooooooOoOOOOOOOOOXX+++ ", +" ..oooooOooOOoOOOOOOXX+++ ", +" ..oooooooOoOOOOOOOOXX+++ ", +" ..ooooOooOOoOOOOOXX+++ ", +" ..ooooooOoOOOOOOOXX++++ ", +" ..o..oooOooOOoOOOOXX+XX+++ ", +" ...o..oooooOoOOOOOXX++XXX++ ", +" ....OO..ooOooOOoOOXX+++XXXX++ ", +" ...oo..+..oooOoOOOXX++XXooXXX++ ", +" ...ooo..++..OooOOoXX+++XXooOXXX+ ", +" ..oooOOXX+++....XXXX++++XXOOoOOXX+ ", +" ..oooOOXX+++ ...XXX+++++XXOOooOXX++ ", +" ..oooOXXX+++ ..XX+++ +XXOOooOXX++ ", +" .....XXX++++ XXXXXXX++ ", +" ....XX++++ XXXXXXX+ ", +" ...XX+++ XXXXX++ ", +" ", +" ", +" ", +" "}; +/* XPM */ +static const char * nh_icon_small[] = { +/* width height ncolors chars_per_pixel */ +"16 16 16 1", +/* colors */ +" c #587070", +". c #D1D5C9", +"X c #8B8C84", +"o c #2A2A28", +"O c #9AABA9", +"+ c #6A8FB2", +"@ c #C4CAC4", +"# c #B6BEB6", +"$ c None", +"% c #54564E", +"& c #476C6C", +"* c #ADB2AB", +"= c #ABABA2", +"- c #5E8295", +"; c #8B988F", +": c #E8EAE7", +/* pixels */ +"$$$$$$$$$$$$$$$$", +"$$$.$#::.#==*$$$", +"$.*:::::....#*=$", +"$@#:..@#*==#;XX;", +"$@O:+++- &&; X%X", +"$#%.+++- &&;% oX", +"$$o.++-- &&;%%X$", +"$$$:++-- &&;%%$$", +"$$$.O++- &&=o $$", +"$$$=:++- & XoX$$", +"$$*:@O-- ;%Xo$$", +"$*:O#$+--;oOOX $", +"$:+ =o::=oo=-;%X", +"$::.%o$*;X;##@%$", +"$$@# ;$$$$$=*;X$", +"$$$$$$$$$$$$$$$$" +}; + +/* XPM */ +static const char * map_xpm[] = { +"12 13 4 1", +". c None", +" c #000000000000", +"X c #0000B6DAFFFF", +"o c #69A69248B6DA", +" .", +" XXXXX ooo ", +" XoooX o ", +" XoooX o o ", +" XoooX ooo ", +" XXoXX o ", +" oooooXXX ", +" oo o oooX ", +" o XooX ", +" oooo XooX ", +" o o XXXX ", +" ", +". "}; +/* XPM */ +static const char * msg_xpm[] = { +"12 13 4 1", +". c None", +" c #FFFFFFFFFFFF", +"X c #69A69248B6DA", +"o c #000000000000", +" .", +" XXX XXX X o", +" o", +" XXXXX XX o", +" o", +" XX XXXXX o", +" o", +" XXXXXX o", +" o", +" XX XXX XX o", +" o", +" o", +".ooooooooooo"}; +/* XPM */ +static const char * stat_xpm[] = { +"12 13 5 1", +" c None", +". c #FFFF00000000", +"X c #000000000000", +"o c #FFFFFFFF0000", +"O c #69A6FFFF0000", +" ", +" ", +"... ", +"...X ", +"...X ... ", +"oooX oooX", +"oooXooo oooX", +"OOOXOOOXOOOX", +"OOOXOOOXOOOX", +"OOOXOOOXOOOX", +"OOOXOOOXOOOX", +"OOOXOOOXOOOX", +" XXXXXXXXXXX"}; +/* XPM */ +static const char * info_xpm[] = { +"12 13 4 1", +" c None", +". c #00000000FFFF", +"X c #FFFFFFFFFFFF", +"o c #000000000000", +" ... ", +" ....... ", +" ...XXX... ", +" .........o ", +"...XXXX.... ", +"....XXX....o", +"....XXX....o", +"....XXX....o", +" ...XXX...oo", +" ..XXXXX..o ", +" .......oo ", +" o...ooo ", +" ooo "}; + + +/* XPM */ +static const char * again_xpm[] = { +"12 13 2 1", +" c None", +". c #000000000000", +" .. ", +" .. ", +" ..... ", +" ....... ", +"... .. .. ", +".. .. .. ", +".. ..", +".. ..", +".. ..", +" .. .. ", +" .......... ", +" ...... ", +" "}; +/* XPM */ +static const char * kick_xpm[] = { +"12 13 3 1", +" c None", +". c #000000000000", +"X c #FFFF6DB60000", +" ", +" ", +" . . . ", +" ... . . ", +" ... . ", +" ... . ", +" ... ", +"XXX ... ", +"XXX. ... ", +"XXX. ... ", +"XXX. .. ", +" ... ", +" "}; +/* XPM */ +static const char * throw_xpm[] = { +"12 13 3 1", +" c None", +". c #FFFF6DB60000", +"X c #000000000000", +" ", +" ", +" ", +" ", +".... X ", +"....X X ", +"....X XXXXXX", +"....X X ", +" XXXX X ", +" ", +" ", +" ", +" "}; +/* XPM */ +static const char * fire_xpm[] = { +"12 13 5 1", +" c None", +". c #B6DA45140000", +"X c #FFFFB6DA9658", +"o c #000000000000", +"O c #FFFF6DB60000", +" . ", +" X. ", +" X . ", +" X .o ", +" X . o ", +" X .o o ", +"OOOOOOOOoooo", +" X .o o ", +" X . o o ", +" X .o ", +" X. o ", +" . o ", +" o "}; +/* XPM */ +static const char * get_xpm[] = { +"12 13 3 1", +" c None", +". c #000000000000", +"X c #FFFF6DB60000", +" ", +" . ", +" ... ", +" . . . ", +" . ", +" . ", +" ", +" XXXXX ", +" XXXXX. ", +" XXXXX. ", +" XXXXX. ", +" ..... ", +" "}; +/* XPM */ +static const char * drop_xpm[] = { +"12 13 3 1", +" c None", +". c #FFFF6DB60000", +"X c #000000000000", +" ", +" ..... ", +" .....X ", +" .....X ", +" .....X ", +" XXXXX ", +" ", +" X ", +" X ", +" X X X ", +" XXX ", +" X ", +" "}; +/* XPM */ +static const char * eat_xpm[] = { +"12 13 4 1", +" c None", +". c #000000000000", +"X c #FFFFB6DA9658", +"o c #FFFF6DB60000", +" .X. .. ", +" .X. .. ", +" .X. .. ", +" .X. .. ", +" ... .. ", +" .. .. ", +" .. .. ", +" oo oo ", +" oo oo ", +" oo oo ", +" oo oo ", +" oo oo ", +" oo oo "}; +/* XPM */ +static const char * rest_xpm[] = { +"12 13 2 1", +" c None", +". c #000000000000", +" ..... ", +" . ", +" . ", +" . ....", +" ..... . ", +" . ", +" ....", +" ", +" .... ", +" . ", +" . ", +" .... ", +" "}; +/* XPM */ +static const char * cast_a_xpm[] = { +"12 13 3 1", +" c None", +". c #FFFF6DB60000", +"X c #000000000000", +" . ", +" . ", +" .. ", +" .. ", +" .. . ", +" .. . ", +" ...... ", +" .. .. XX ", +" .. X X ", +" .. X X ", +" .. XXXX ", +" . X X ", +" . X X "}; +/* XPM */ +static const char * cast_b_xpm[] = { +"12 13 3 1", +" c None", +". c #FFFF6DB60000", +"X c #000000000000", +" . ", +" . ", +" .. ", +" .. ", +" .. . ", +" .. . ", +" ...... ", +" .. .. XXX ", +" .. X X ", +" .. XXX ", +" .. X X ", +" . X X ", +" . XXX "}; +/* XPM */ +static const char * cast_c_xpm[] = { +"12 13 3 1", +" c None", +". c #FFFF6DB60000", +"X c #000000000000", +" . ", +" . ", +" .. ", +" .. ", +" .. . ", +" .. . ", +" ...... ", +" .. .. XX ", +" .. X X ", +" .. X ", +" .. X ", +" . X X ", +" . XX "}; + +NetHackQtSettings::NetHackQtSettings(int w, int h) : + tilewidth(TILEWMIN,64,1,this), + tileheight(TILEHMIN,64,1,this), + widthlbl(&tilewidth,"&Width:",this), + heightlbl(&tileheight,"&Height:",this), + whichsize("&Zoomed",this), + fontsize(this), + normal("times"), +#ifdef WS_WIN + normalfixed("courier new"), +#else + normalfixed("fixed"), +#endif + large("times"), + theglyphs(0) + +{ + int default_fontsize; + + if (w<=300) { + // ~240x320 + default_fontsize=4; + tilewidth.setValue(8); + tileheight.setValue(12); + } else if (w<=700) { + // ~640x480 + default_fontsize=3; + tilewidth.setValue(8); + tileheight.setValue(14); + } else if (w<=900) { + // ~800x600 + default_fontsize=3; + tilewidth.setValue(10); + tileheight.setValue(17); + } else if (w<=1100) { + // ~1024x768 + default_fontsize=2; + tilewidth.setValue(12); + tileheight.setValue(22); + } else if (w<=1200) { + // ~1152x900 + default_fontsize=1; + tilewidth.setValue(14); + tileheight.setValue(26); + } else { + // ~1280x1024 and larger + default_fontsize=0; + tilewidth.setValue(16); + tileheight.setValue(30); + } + + // Tile/font sizes read from .nethackrc + if (qt_tilewidth != NULL) { + tilewidth.setValue(atoi(qt_tilewidth)); + free(qt_tilewidth); + } + if (qt_tileheight != NULL) { + tileheight.setValue(atoi(qt_tileheight)); + free(qt_tileheight); + } + if (qt_fontsize != NULL) { + switch (tolower(qt_fontsize[0])) { + case 'h': default_fontsize = 0; break; + case 'l': default_fontsize = 1; break; + case 'm': default_fontsize = 2; break; + case 's': default_fontsize = 3; break; + case 't': default_fontsize = 4; break; + } + free(qt_fontsize); + } + + theglyphs=new NetHackQtGlyphs(); + resizeTiles(); + + connect(&tilewidth,SIGNAL(valueChanged(int)),this,SLOT(resizeTiles())); + connect(&tileheight,SIGNAL(valueChanged(int)),this,SLOT(resizeTiles())); + connect(&whichsize,SIGNAL(toggled(bool)),this,SLOT(setGlyphSize(bool))); + + fontsize.insertItem("Huge"); + fontsize.insertItem("Large"); + fontsize.insertItem("Medium"); + fontsize.insertItem("Small"); + fontsize.insertItem("Tiny"); + fontsize.setCurrentItem(default_fontsize); + connect(&fontsize,SIGNAL(activated(int)),this,SIGNAL(fontChanged())); + + QGridLayout* grid = new QGridLayout(this, 5, 2, 8); + grid->addMultiCellWidget(&whichsize, 0, 0, 0, 1); + grid->addWidget(&tilewidth, 1, 1); grid->addWidget(&widthlbl, 1, 0); + grid->addWidget(&tileheight, 2, 1); grid->addWidget(&heightlbl, 2, 0); + QLabel* flabel=new QLabel(&fontsize, "&Font:",this); + grid->addWidget(flabel, 3, 0); grid->addWidget(&fontsize, 3, 1); + QPushButton* dismiss=new QPushButton("Dismiss",this); + dismiss->setDefault(TRUE); + grid->addMultiCellWidget(dismiss, 4, 4, 0, 1); + grid->setRowStretch(4,0); + grid->setColStretch(1,1); + grid->setColStretch(2,2); + grid->activate(); + + connect(dismiss,SIGNAL(clicked()),this,SLOT(accept())); + resize(150,140); +} + +NetHackQtGlyphs& NetHackQtSettings::glyphs() +{ + return *theglyphs; +} + +void NetHackQtSettings::resizeTiles() +{ + int w = tilewidth.value(); + int h = tileheight.value(); + + theglyphs->setSize(w,h); + emit tilesChanged(); +} + +void NetHackQtSettings::toggleGlyphSize() +{ + whichsize.toggle(); +} + +void NetHackQtSettings::setGlyphSize(bool which) +{ + QSize n = QSize(tilewidth.value(),tileheight.value()); + if ( othersize.isValid() ) { + tilewidth.blockSignals(TRUE); + tileheight.blockSignals(TRUE); + tilewidth.setValue(othersize.width()); + tileheight.setValue(othersize.height()); + tileheight.blockSignals(FALSE); + tilewidth.blockSignals(FALSE); + resizeTiles(); + } + othersize = n; +} + +const QFont& NetHackQtSettings::normalFont() +{ + static int size[]={ 18, 14, 12, 10, 8 }; + normal.setPointSize(size[fontsize.currentItem()]); + return normal; +} + +const QFont& NetHackQtSettings::normalFixedFont() +{ + static int size[]={ 18, 14, 13, 10, 8 }; + normalfixed.setPointSize(size[fontsize.currentItem()]); + return normalfixed; +} + +const QFont& NetHackQtSettings::largeFont() +{ + static int size[]={ 24, 18, 14, 12, 10 }; + large.setPointSize(size[fontsize.currentItem()]); + return large; +} + +bool NetHackQtSettings::ynInMessages() +{ + return !qt_compact_mode; +} + + +NetHackQtSettings* qt_settings; + + + +NetHackQtKeyBuffer::NetHackQtKeyBuffer() : + in(0), out(0) +{ +} + +bool NetHackQtKeyBuffer::Empty() const { return in==out; } +bool NetHackQtKeyBuffer::Full() const { return (in+1)%maxkey==out; } + +void NetHackQtKeyBuffer::Put(int k, int a, int state) +{ + if ( Full() ) return; // Safety + key[in]=k; + ascii[in]=a; + in=(in+1)%maxkey; +} + +void NetHackQtKeyBuffer::Put(char a) +{ + Put(0,a,0); +} + +void NetHackQtKeyBuffer::Put(const char* str) +{ + while (*str) Put(*str++); +} + +int NetHackQtKeyBuffer::GetKey() +{ + if ( Empty() ) return 0; + int r=TopKey(); + out=(out+1)%maxkey; + return r; +} + +int NetHackQtKeyBuffer::GetAscii() +{ + if ( Empty() ) return 0; // Safety + int r=TopAscii(); + out=(out+1)%maxkey; + return r; +} + +int NetHackQtKeyBuffer::GetState() +{ + if ( Empty() ) return 0; + int r=TopState(); + out=(out+1)%maxkey; + return r; +} + +int NetHackQtKeyBuffer::TopKey() const +{ + if ( Empty() ) return 0; + return key[out]; +} + +int NetHackQtKeyBuffer::TopAscii() const +{ + if ( Empty() ) return 0; + return ascii[out]; +} + +int NetHackQtKeyBuffer::TopState() const +{ + if ( Empty() ) return 0; + return state[out]; +} + + +NetHackQtClickBuffer::NetHackQtClickBuffer() : + in(0), out(0) +{ +} + +bool NetHackQtClickBuffer::Empty() const { return in==out; } +bool NetHackQtClickBuffer::Full() const { return (in+1)%maxclick==out; } + +void NetHackQtClickBuffer::Put(int x, int y, int mod) +{ + click[in].x=x; + click[in].y=y; + click[in].mod=mod; + in=(in+1)%maxclick; +} + +int NetHackQtClickBuffer::NextX() const { return click[out].x; } +int NetHackQtClickBuffer::NextY() const { return click[out].y; } +int NetHackQtClickBuffer::NextMod() const { return click[out].mod; } + +void NetHackQtClickBuffer::Get() +{ + out=(out+1)%maxclick; +} + +class NhPSListViewItem : public QListViewItem { +public: + NhPSListViewItem( QListView* parent, const QString& name ) : + QListViewItem(parent, name) + { + } + + void setGlyph(int g) + { + NetHackQtGlyphs& glyphs = qt_settings->glyphs(); + int gw = glyphs.width(); + int gh = glyphs.height(); + QPixmap pm(gw,gh); + QPainter p(&pm); + glyphs.drawGlyph(p, g, 0, 0); + p.end(); + setPixmap(0,pm); + setHeight(QMAX(pm.height()+1,height())); + } + + void paintCell( QPainter *p, const QColorGroup &cg, + int column, int width, int alignment ) + { + if ( isSelectable() ) { + QListViewItem::paintCell( p, cg, column, width, alignment ); + } else { + QColorGroup disabled( + cg.foreground().light(), + cg.button().light(), + cg.light(), cg.dark(), cg.mid(), + gray, cg.base() ); + QListViewItem::paintCell( p, disabled, column, width, alignment ); + } + } +}; + +class NhPSListViewRole : public NhPSListViewItem { +public: + NhPSListViewRole( QListView* parent, int id ) : + NhPSListViewItem(parent, +#ifdef QT_CHOOSE_RACE_FIRST // Lowerize - looks better + QString(QChar(roles[id].name.m[0])).lower()+QString(roles[id].name.m+1) +#else + roles[id].name.m +#endif + ) + { + setGlyph(monnum_to_glyph(roles[id].malenum)); + } +}; + +class NhPSListViewRace : public NhPSListViewItem { +public: + NhPSListViewRace( QListView* parent, int id ) : + NhPSListViewItem(parent, +#ifdef QT_CHOOSE_RACE_FIRST // Capitalize - looks better + QString(QChar(races[id].noun[0])).upper()+QString(races[id].noun+1) +#else + QString(QChar(races[id].noun[0])+QString(races[id].noun+1)) +#endif + ) + { + setGlyph(monnum_to_glyph(races[id].malenum)); + } +}; + +class NhPSListView : public QListView { +public: + NhPSListView( QWidget* parent ) : + QListView(parent) + { + setSorting(-1); // order is identity + header()->setClickEnabled(FALSE); + } + + QSizePolicy sizePolicy() const + { + return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); + } + + QSize minimumSizeHint() const + { + return sizeHint(); + } + + QSize sizeHint() const + { + QListView::sizeHint(); + QSize sz = header()->sizeHint(); + int h=0; + QListViewItem* c=firstChild(); + while (c) h+=c->height(),c = c->nextSibling(); + sz += QSize(frameWidth()*2, h+frameWidth()*2); + return sz; + } + + int selectedItemNumber() const + { + int i=0; + QListViewItem* c = firstChild(); + while (c) { + if (c == selectedItem()) { + return i; + } + i++; + c = c->nextSibling(); + } + return -1; + } + + void setSelectedItemNumber(int i) + { + QListViewItem* c=firstChild(); + while (i--) + c = c->nextSibling(); + c->setSelected(TRUE); + } +}; + +NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks) : + QDialog(qApp->mainWidget(),"plsel",TRUE), + keysource(ks), + fully_specified_role(TRUE) +{ + /* + 0 1 2 + + Name ------------------------------------+ + 0 | | + + ---- ------------------------------------+ + + Role ---+ + Race ---+ + Gender ------+ + | | | | | * Male | + 1 | | | | | * Female | + | | | | +--------------+ + | | | | + | | | | + Alignment ---+ + 2 | | | | | * Male | + | | | | | * Female | + | | | | +--------------+ + 3 | | | | ...stretch... + | | | | + 4 | | | | [ Play ] + 5 | | | | [ Quit ] + +---------+ +---------+ + */ + + int marg=4; + QGridLayout *l = new QGridLayout(this,6,3,marg,marg); + + QButtonGroup* namebox = new QButtonGroup(1,Horizontal,"Name",this); + QLineEdit* name = new QLineEdit(namebox); + name->setMaxLength(sizeof(g.plname)-1); + if ( strncmp(g.plname,"player",6) && strncmp(g.plname,"games",5) ) + name->setText(g.plname); + connect(name, SIGNAL(textChanged(const QString&)), + this, SLOT(selectName(const QString&)) ); + name->setFocus(); + QButtonGroup* genderbox = new QButtonGroup("Sex",this); + QButtonGroup* alignbox = new QButtonGroup("Alignment",this); + QVBoxLayout* vbgb = new QVBoxLayout(genderbox,3,1); + vbgb->setAutoAdd(TRUE); + vbgb->addSpacing(fontMetrics().height()*3/4); + QVBoxLayout* vbab = new QVBoxLayout(alignbox,3,1); + vbab->setAutoAdd(TRUE); + vbab->addSpacing(fontMetrics().height()); + QLabel* logo = new QLabel(nh_attribution, this); + + l->addMultiCellWidget( namebox, 0,0,0,2 ); +#ifdef QT_CHOOSE_RACE_FIRST + race = new NhPSListView(this); + role = new NhPSListView(this); + l->addMultiCellWidget( race, 1,5,0,0 ); + l->addMultiCellWidget( role, 1,5,1,1 ); +#else + role = new NhPSListView(this); + race = new NhPSListView(this); + l->addMultiCellWidget( role, 1,5,0,0 ); + l->addMultiCellWidget( race, 1,5,1,1 ); +#endif + role->addColumn("Role"); + race->addColumn("Race"); + + l->addWidget( genderbox, 1, 2 ); + l->addWidget( alignbox, 2, 2 ); + l->addWidget( logo, 3, 2, AlignCenter ); + l->setRowStretch( 3, 5 ); + + int i; + int nrole; + + for (nrole=0; roles[nrole].name.m; nrole++) + ; + for (i=nrole-1; i>=0; i--) { // XXX QListView unsorted goes in rev. + new NhPSListViewRole( role, i ); + } + connect( role, SIGNAL(selectionChanged()), this, SLOT(selectRole()) ); + + int nrace; + for (nrace=0; races[nrace].noun; nrace++) + ; + for (i=nrace-1; i>=0; i--) { + new NhPSListViewRace( race, i ); + } + connect( race, SIGNAL(selectionChanged()), this, SLOT(selectRace()) ); + + gender = new QRadioButton*[ROLE_GENDERS]; + for (i=0; iaddWidget( ok, 4, 2 ); + ok->setDefault(TRUE); + connect( ok, SIGNAL(clicked()), this, SLOT(accept()) ); + + QPushButton* cancel = new QPushButton("Quit",this); + l->addWidget( cancel, 5, 2 ); + connect( cancel, SIGNAL(clicked()), this, SLOT(reject()) ); + + // Randomize race and role, unless specified in config + int ro = flags.initrole; + if (ro == ROLE_NONE || ro == ROLE_RANDOM) { + ro = rn2(nrole); + if (flags.initrole != ROLE_RANDOM) { + fully_specified_role = FALSE; + } + } + int ra = flags.initrace; + if (ra == ROLE_NONE || ra == ROLE_RANDOM) { + ra = rn2(nrace); + if (flags.initrace != ROLE_RANDOM) { + fully_specified_role = FALSE; + } + } + + // make sure we have a valid combination, honoring + // the users request if possible. + bool choose_race_first; +#ifdef QT_CHOOSE_RACE_FIRST + choose_race_first = TRUE; + if (flags.initrole >= 0 && flags.initrace < 0) { + choose_race_first = FALSE; + } +#else + choose_race_first = FALSE; + if (flags.initrace >= 0 && flags.initrole < 0) { + choose_race_first = TRUE; + } +#endif + while (!validrace(ro,ra)) { + if (choose_race_first) { + ro = rn2(nrole); + if (flags.initrole != ROLE_RANDOM) { + fully_specified_role = FALSE; + } + } else { + ra = rn2(nrace); + if (flags.initrace != ROLE_RANDOM) { + fully_specified_role = FALSE; + } + } + } + + int g = flags.initgend; + if (g == -1) { + g = rn2(ROLE_GENDERS); + fully_specified_role = FALSE; + } + while (!validgend(ro,ra,g)) { + g = rn2(ROLE_GENDERS); + } + gender[g]->setChecked(TRUE); + selectGender(g); + + int a = flags.initalign; + if (a == -1) { + a = rn2(ROLE_ALIGNS); + fully_specified_role = FALSE; + } + while (!validalign(ro,ra,a)) { + a = rn2(ROLE_ALIGNS); + } + alignment[a]->setChecked(TRUE); + selectAlignment(a); + + QListViewItem* li; + + li = role->firstChild(); + while (ro--) li=li->nextSibling(); + role->setSelected(li,TRUE); + + li = race->firstChild(); + while (ra--) li=li->nextSibling(); + race->setSelected(li,TRUE); + + flags.initrace = race->selectedItemNumber(); + flags.initrole = role->selectedItemNumber(); +} + + +void NetHackQtPlayerSelector::selectName(const QString& n) +{ + strncpy(g.plname,n.latin1(),sizeof(g.plname)-1); +} + +void NetHackQtPlayerSelector::selectRole() +{ + int ra = race->selectedItemNumber(); + int ro = role->selectedItemNumber(); + if (ra == -1 || ro == -1) return; + +#ifdef QT_CHOOSE_RACE_FIRST + selectRace(); +#else + QListViewItem* i=role->currentItem(); + QListViewItem* valid=0; + int j; + NhPSListViewItem* item; + item = (NhPSListViewItem*)role->firstChild(); + for (j=0; roles[j].name.m; j++) { + bool v = validrace(j,ra); + item->setSelectable(TRUE); + if ( !valid && v ) valid = item; + item=(NhPSListViewItem*)item->nextSibling(); + } + if ( !validrace(role->selectedItemNumber(),ra) ) + i = valid; + role->setSelected(i,TRUE); + item = (NhPSListViewItem*)role->firstChild(); + for (j=0; roles[j].name.m; j++) { + bool v = validrace(j,ra); + item->setSelectable(v); + item->repaint(); + item=(NhPSListViewItem*)item->nextSibling(); + } +#endif + + flags.initrole = role->selectedItemNumber(); + setupOthers(); +} + +void NetHackQtPlayerSelector::selectRace() +{ + int ra = race->selectedItemNumber(); + int ro = role->selectedItemNumber(); + if (ra == -1 || ro == -1) return; + +#ifndef QT_CHOOSE_RACE_FIRST + selectRole(); +#else + QListViewItem* i=race->currentItem(); + QListViewItem* valid=0; + int j; + NhPSListViewItem* item; + item = (NhPSListViewItem*)race->firstChild(); + for (j=0; races[j].noun; j++) { + bool v = validrace(ro,j); + item->setSelectable(TRUE); + if ( !valid && v ) valid = item; + item=(NhPSListViewItem*)item->nextSibling(); + } + if ( !validrace(ro,race->selectedItemNumber()) ) + i = valid; + race->setSelected(i,TRUE); + item = (NhPSListViewItem*)race->firstChild(); + for (j=0; races[j].noun; j++) { + bool v = validrace(ro,j); + item->setSelectable(v); + item->repaint(); + item=(NhPSListViewItem*)item->nextSibling(); + } +#endif + + flags.initrace = race->selectedItemNumber(); + setupOthers(); +} + +void NetHackQtPlayerSelector::setupOthers() +{ + int ro = role->selectedItemNumber(); + int ra = race->selectedItemNumber(); + int valid=-1; + int c=0; + int j; + for (j=0; jisChecked() ) + c = j; + gender[j]->setEnabled(v); + if ( valid<0 && v ) valid = j; + } + if ( !validgend(ro,ra,c) ) + c = valid; + int k; + for (k=0; ksetChecked(c==k); + } + selectGender(c); + + valid=-1; + for (j=0; jisChecked() ) + c = j; + alignment[j]->setEnabled(v); + if ( valid<0 && v ) valid = j; + } + if ( !validalign(ro,ra,c) ) + c = valid; + for (k=0; ksetChecked(c==k); + } + selectAlignment(c); +} + +void NetHackQtPlayerSelector::selectGender(int i) +{ + flags.initgend = i; +} + +void NetHackQtPlayerSelector::selectAlignment(int i) +{ + flags.initalign = i; +} + + +void NetHackQtPlayerSelector::done(int i) +{ + setResult(i); + qApp->exit_loop(); +} + +void NetHackQtPlayerSelector::Quit() +{ + done(R_Quit); + qApp->exit_loop(); +} + +void NetHackQtPlayerSelector::Random() +{ + done(R_Rand); + qApp->exit_loop(); +} + +bool NetHackQtPlayerSelector::Choose() +{ + if (fully_specified_role) return TRUE; + +#if defined(QWS) // probably safe with Qt 3, too (where show!=exec in QDialog). + if ( qt_compact_mode ) { + showMaximized(); + } else +#endif + { + adjustSize(); + centerOnMain(this); + } + + if ( exec() ) { + return TRUE; + } else { + return FALSE; + } +} + + +NetHackQtStringRequestor::NetHackQtStringRequestor(NetHackQtKeyBuffer& ks, const char* p, const char* cancelstr) : + QDialog(qApp->mainWidget(),"string",FALSE), + prompt(p,this,"prompt"), + input(this,"input"), + keysource(ks) +{ + cancel=new QPushButton(cancelstr,this); + connect(cancel,SIGNAL(clicked()),this,SLOT(reject())); + + okay=new QPushButton("Okay",this); + connect(okay,SIGNAL(clicked()),this,SLOT(accept())); + connect(&input,SIGNAL(returnPressed()),this,SLOT(accept())); + okay->setDefault(TRUE); + + setFocusPolicy(StrongFocus); +} + +void NetHackQtStringRequestor::resizeEvent(QResizeEvent*) +{ + const int margin=5; + const int gutter=5; + + int h=(height()-margin*2-gutter); + + if (strlen(prompt.text()) > 16) { + h/=3; + prompt.setGeometry(margin,margin,width()-margin*2,h); + input.setGeometry(width()*1/5,margin+h+gutter, + (width()-margin-2-gutter)*4/5,h); + } else { + h/=2; + prompt.setGeometry(margin,margin,(width()-margin*2-gutter)*2/5,h); + input.setGeometry(prompt.geometry().right()+gutter,margin, + (width()-margin-2-gutter)*3/5,h); + } + + cancel->setGeometry(margin,input.geometry().bottom()+gutter, + (width()-margin*2-gutter)/2,h); + okay->setGeometry(cancel->geometry().right()+gutter,cancel->geometry().y(), + cancel->width(),h); +} + +void NetHackQtStringRequestor::SetDefault(const char* d) +{ + input.setText(d); +} + +bool NetHackQtStringRequestor::Get(char* buffer, int maxchar) +{ + input.setMaxLength(maxchar); + if (strlen(prompt.text()) > 16) { + resize(fontMetrics().width(prompt.text())+50,fontMetrics().height()*6); + } else { + resize(fontMetrics().width(prompt.text())*2+50,fontMetrics().height()*4); + } + + centerOnMain(this); + show(); + input.setFocus(); + setResult(-1); + while (result()==-1) { + // Put keys in buffer (eg. from macros, from out-of-focus input) + if (!keysource.Empty()) { + while (!keysource.Empty()) { + int key=keysource.TopKey(); + int ascii=keysource.TopAscii(); + int state=keysource.GetState(); + if (ascii=='\r' || ascii=='\n') { + // CR or LF in buffer causes confirmation + strcpy(buffer,input.text()); + return TRUE; + } else if (ascii=='\033') { + return FALSE; + } else { + input.fakeEvent(key,ascii,state); + } + } + } + qApp->enter_loop(); + } + // XXX Get rid of extra keys, since we couldn't get focus! + while (!keysource.Empty()) keysource.GetKey(); + + if (result()) { + strcpy(buffer,input.text()); + return TRUE; + } else { + return FALSE; + } +} +void NetHackQtStringRequestor::done(int i) +{ + setResult(i); + qApp->exit_loop(); +} + + +NetHackQtWindow::NetHackQtWindow() +{ +} + +NetHackQtWindow::~NetHackQtWindow() +{ +} + +// XXX Use "expected ..." for now, abort or default later. +// +void NetHackQtWindow::Clear() { puts("unexpected Clear"); } +void NetHackQtWindow::Display(bool block) { puts("unexpected Display"); } +bool NetHackQtWindow::Destroy() { return TRUE; } +void NetHackQtWindow::CursorTo(int x,int y) { puts("unexpected CursorTo"); } +void NetHackQtWindow::PutStr(int attr, const char* text) { puts("unexpected PutStr"); } +void NetHackQtWindow::StartMenu() { puts("unexpected StartMenu"); } +void NetHackQtWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, + const char* str, bool presel) { puts("unexpected AddMenu"); } +void NetHackQtWindow::EndMenu(const char* prompt) { puts("unexpected EndMenu"); } +int NetHackQtWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) { puts("unexpected SelectMenu"); return 0; } +void NetHackQtWindow::ClipAround(int x,int y) { puts("unexpected ClipAround"); } +void NetHackQtWindow::PrintGlyph(int x,int y,int glyph) { puts("unexpected PrintGlyph"); } +//void NetHackQtWindow::PrintGlyphCompose(int x,int y,int,int) { puts("unexpected PrintGlyphCompose"); } +void NetHackQtWindow::UseRIP(int how, time_t when) { puts("unexpected UseRIP"); } + + + +// XXX Hmmm... crash after saving bones file if Map window is +// XXX deleted. Strange bug somewhere. +bool NetHackQtMapWindow::Destroy() { return FALSE; } + +NetHackQtMapWindow::NetHackQtMapWindow(NetHackQtClickBuffer& click_sink) : + clicksink(click_sink), + change(10), + rogue_font(0) +{ + viewport.addChild(this); + + setBackgroundColor(black); + viewport.setBackgroundColor(black); + + pet_annotation = QPixmap(qt_compact_mode ? pet_mark_small_xpm : pet_mark_xpm); + + cursor.setX(0); + cursor.setY(0); + Clear(); + + connect(qt_settings,SIGNAL(tilesChanged()),this,SLOT(updateTiles())); + connect(&viewport, SIGNAL(contentsMoving(int,int)), this, + SLOT(moveMessages(int,int))); + + updateTiles(); + //setFocusPolicy(StrongFocus); +#ifdef SAFERHANGUP + QTimer* deadman = new QTimer(this); + connect(deadman, SIGNAL(timeout()), SLOT(timeout())); + deadman->start(2000); // deadman timer every 2 seconds +#endif +} + +#ifdef SAFERHANGUP +// The "deadman" timer is received by this slot +void NetHackQtMapWindow::timeout() {} +#endif + +void NetHackQtMapWindow::moveMessages(int x, int y) +{ + QRect u = messages_rect; + messages_rect.moveTopLeft(QPoint(x,y)); + u |= messages_rect; + update(u); +} + +void NetHackQtMapWindow::clearMessages() +{ + messages = ""; + update(messages_rect); + messages_rect = QRect(); +} + +void NetHackQtMapWindow::putMessage(int attr, const char* text) +{ + if ( !messages.isEmpty() ) + messages += "\n"; + messages += text; + QFontMetrics fm = fontMetrics(); + messages_rect = fm.boundingRect(viewport.contentsX(), viewport.contentsY(), + viewport.width(), 0, + WordBreak|AlignTop|AlignLeft|DontClip, + messages); + update(messages_rect); +} + +void NetHackQtMapWindow::updateTiles() +{ + NetHackQtGlyphs& glyphs = qt_settings->glyphs(); + int gw = glyphs.width(); + int gh = glyphs.height(); + // Be exactly the size we want to be - full map... + resize(COLNO*gw,ROWNO*gh); + + viewport.verticalScrollBar()->setSteps(gh,gh); + viewport.horizontalScrollBar()->setSteps(gw,gw); + /* + viewport.setMaximumSize( + gw*COLNO + viewport.verticalScrollBar()->width(), + gh*ROWNO + viewport.horizontalScrollBar()->height() + ); + */ + viewport.updateScrollBars(); + + change.clear(); + change.add(0,0,COLNO,ROWNO); + delete rogue_font; rogue_font = 0; + Display(FALSE); + + emit resized(); +} + +NetHackQtMapWindow::~NetHackQtMapWindow() +{ + // Remove from viewport porthole, since that is a destructible member. + viewport.removeChild(this); + recreate(0,0,QPoint(0,0)); +} + +QWidget* NetHackQtMapWindow::Widget() +{ + return &viewport; +} + +void NetHackQtMapWindow::Scroll(int dx, int dy) +{ + if (viewport.horizontalScrollBar()->isVisible()) { + while (dx<0) { viewport.horizontalScrollBar()->subtractPage(); dx++; } + while (dx>0) { viewport.horizontalScrollBar()->addPage(); dx--; } + } + if (viewport.verticalScrollBar()->isVisible()) { + while (dy<0) { viewport.verticalScrollBar()->subtractPage(); dy++; } + while (dy>0) { viewport.verticalScrollBar()->addPage(); dy--; } + } +} + +void NetHackQtMapWindow::Clear() +{ + unsigned short stone=cmap_to_glyph(S_stone); + + for (int j=0; jexit_loop(); +} + +void NetHackQtMapWindow::mousePressEvent(QMouseEvent* event) +{ + clicksink.Put( + event->pos().x()/qt_settings->glyphs().width(), + event->pos().y()/qt_settings->glyphs().height(), + event->button()==LeftButton ? CLICK_1 : CLICK_2 + ); + qApp->exit_loop(); +} + +#ifdef TEXTCOLOR +static +const QPen& nhcolor_to_pen(int c) +{ + static QPen* pen=0; + if ( !pen ) { + pen = new QPen[17]; + pen[0] = QColor(24,24,24); // "black" on black + pen[1] = Qt::red; + pen[2] = QColor(0,191,0); + pen[3] = QColor(127,127,0); + pen[4] = Qt::blue; + pen[5] = Qt::magenta; + pen[6] = Qt::cyan; + pen[7] = Qt::gray; + pen[8] = Qt::white; // no color + pen[9] = QColor(255,127,0); + pen[10] = QColor(127,255,127); + pen[11] = Qt::yellow; + pen[12] = QColor(127,127,255); + pen[13] = QColor(255,127,255); + pen[14] = QColor(127,255,255); + pen[15] = Qt::white; + pen[16] = QColor(24,24,24); // "black" on black + } + + return pen[c]; +} +#endif + +void NetHackQtMapWindow::paintEvent(QPaintEvent* event) +{ + QRect area=event->rect(); + QRect garea; + garea.setCoords( + QMAX(0,area.left()/qt_settings->glyphs().width()), + QMAX(0,area.top()/qt_settings->glyphs().height()), + QMIN(COLNO-1,area.right()/qt_settings->glyphs().width()), + QMIN(ROWNO-1,area.bottom()/qt_settings->glyphs().height()) + ); + + QPainter painter; + + painter.begin(this); + + if (Is_rogue_level(&u.uz) || iflags.wc_ascii_map) + { + // You enter a VERY primitive world! + + painter.setClipRect( event->rect() ); // (normally we don't clip) + painter.fillRect( event->rect(), black ); + + if ( !rogue_font ) { + // Find font... + int pts = 5; + QString fontfamily = iflags.wc_font_map + ? iflags.wc_font_map : "Courier"; + bool bold = FALSE; + if ( fontfamily.right(5).lower() == "-bold" ) { + fontfamily.truncate(fontfamily.length()-5); + bold = TRUE; + } + while ( pts < 32 ) { + QFont f(fontfamily, pts, bold ? QFont::Bold : QFont::Normal); + painter.setFont(QFont(fontfamily, pts)); + QFontMetrics fm = painter.fontMetrics(); + if ( fm.width("M") > qt_settings->glyphs().width() ) + break; + if ( fm.height() > qt_settings->glyphs().height() ) + break; + pts++; + } + rogue_font = new QFont(fontfamily,pts-1); + } + painter.setFont(*rogue_font); + + for (int j=garea.top(); j<=garea.bottom(); j++) { + for (int i=garea.left(); i<=garea.right(); i++) { + unsigned short g=Glyph(i,j); + uchar ch; + int color, och; + unsigned special; + + painter.setPen( green ); + /* map glyph to character and color */ + (void)mapglyph(g, &och, &color, &special, i, j, 0); + ch = (uchar)och; +#ifdef TEXTCOLOR + painter.setPen( nhcolor_to_pen(color) ); +#endif + painter.drawText( + i*qt_settings->glyphs().width(), + j*qt_settings->glyphs().height(), + qt_settings->glyphs().width(), + qt_settings->glyphs().height(), + AlignCenter, + (const char*)&ch, 1 + ); + if (glyph_is_pet(g) +#ifdef TEXTCOLOR + && ::iflags.hilite_pet +#endif + ) { + painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), + j*qt_settings->glyphs().height()), + pet_annotation); + } + } + } + + painter.setFont(font()); + } else { + for (int j=garea.top(); j<=garea.bottom(); j++) { + for (int i=garea.left(); i<=garea.right(); i++) { + unsigned short g=Glyph(i,j); + qt_settings->glyphs().drawCell(painter, g, i, j); + if (glyph_is_pet(g) +#ifdef TEXTCOLOR + && ::iflags.hilite_pet +#endif + ) { + painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), + j*qt_settings->glyphs().height()), + pet_annotation); + } + } + } + } + + if (garea.contains(cursor)) { + if (Is_rogue_level(&u.uz)) { +#ifdef TEXTCOLOR + painter.setPen( white ); +#else + painter.setPen( green ); // REALLY primitive +#endif + } else + { + int hp100; + if (u.mtimedone) { + hp100=u.mhmax ? u.mh*100/u.mhmax : 100; + } else { + hp100=u.uhpmax ? u.uhp*100/u.uhpmax : 100; + } + + if (hp100 > 75) painter.setPen(white); + else if (hp100 > 50) painter.setPen(yellow); + else if (hp100 > 25) painter.setPen(QColor(0xff,0xbf,0x00)); // orange + else if (hp100 > 10) painter.setPen(red); + else painter.setPen(magenta); + } + + painter.drawRect( + cursor.x()*qt_settings->glyphs().width(),cursor.y()*qt_settings->glyphs().height(), + qt_settings->glyphs().width(),qt_settings->glyphs().height()); + } + + if (area.intersects(messages_rect)) { + painter.setPen(black); + painter.drawText(viewport.contentsX()+1,viewport.contentsY()+1, + viewport.width(),0, WordBreak|AlignTop|AlignLeft|DontClip, messages); + painter.setPen(white); + painter.drawText(viewport.contentsX(),viewport.contentsY(), + viewport.width(),0, WordBreak|AlignTop|AlignLeft|DontClip, messages); + } + + painter.end(); +} + +void NetHackQtMapWindow::Display(bool block) +{ + for (int i=0; iglyphs().width(), + ch.y()*qt_settings->glyphs().height(), + ch.width()*qt_settings->glyphs().width(), + ch.height()*qt_settings->glyphs().height(), + FALSE + ); + } + + change.clear(); + + if (block) { + yn_function("Press a key when done viewing",0,'\0'); + } +} + +void NetHackQtMapWindow::CursorTo(int x,int y) +{ + Changed(cursor.x(),cursor.y()); + cursor.setX(x); + cursor.setY(y); + Changed(cursor.x(),cursor.y()); +} + +void NetHackQtMapWindow::PutStr(int attr, const char* text) +{ + puts("unexpected PutStr in MapWindow"); +} + +void NetHackQtMapWindow::ClipAround(int x,int y) +{ + // Convert to pixel of center of tile + x=x*qt_settings->glyphs().width()+qt_settings->glyphs().width()/2; + y=y*qt_settings->glyphs().height()+qt_settings->glyphs().height()/2; + + // Then ensure that pixel is visible + viewport.center(x,y,0.45,0.45); +} + +void NetHackQtMapWindow::PrintGlyph(int x,int y,int glyph) +{ + Glyph(x,y)=glyph; + Changed(x,y); +} + +//void NetHackQtMapWindow::PrintGlyphCompose(int x,int y,int glyph1, int glyph2) +//{ + // TODO: composed graphics +//} + +void NetHackQtMapWindow::Changed(int x, int y) +{ + change.add(x,y); +} + + +class NetHackQtScrollText : public QTableView { + struct UData { + UData() : text(0), attr(0) { } + ~UData() { if (text) free(text); } + + char* text; + int attr; + }; +public: + int uncleared; + + NetHackQtScrollText(int maxlength) : + uncleared(0), + maxitems(maxlength), + first(0), + count(0), + item_cycle(maxlength) + { + setNumCols(1); + setCellWidth(200); + setCellHeight(fontMetrics().height()); + setBackgroundColor(white); + setTableFlags(Tbl_vScrollBar + |Tbl_autoHScrollBar + |Tbl_clipCellPainting + |Tbl_smoothScrolling); + } + + ~NetHackQtScrollText() + { + } + + void Scroll(int dx, int dy) + { + setXOffset(xOffset()+dx*viewWidth()); + setYOffset(yOffset()+dy*viewHeight()); + } + + void insertItem(int attr, const char* text) + { + setTopCell(count); + + setAutoUpdate(FALSE); + + int i; + if (count cellWidth()) { + // Get wider. + setCellWidth(w); + } + setTopCell(count); + + setAutoUpdate(TRUE); + + if (viewHeight() >= totalHeight()-cellHeight()) { + repaint(); + } else { + scroll(0,cellHeight()); + } + } + + virtual void setFont(const QFont& font) + { + QTableView::setFont(font); + setCellHeight(fontMetrics().height()); + } + +protected: + + UData& item(int i) + { + return item_cycle[(first+i)%maxitems]; + } + + const int maxitems; + int first, count; + QArray item_cycle; + + int datumWidth(const UData& uitem) + { + if (uitem.text) { + int width=fontMetrics().width(uitem.text)+3; + if (uitem.attr) { + // XXX Too expensive to do properly, because + // XXX we have to set the font of the widget + // XXX just to get the font metrics information! + // XXX Could hold a fake widget for that + // XXX purpose, but this hack is less ugly. + width+=width/10; + } + return width; + } else { + return 0; + } + } + + virtual void setupPainter(QPainter *p) + { + // XXX This shouldn't be needed - we set the bg in the constructor. + p->setBackgroundColor(white); + } + + virtual void paintCell(QPainter *p, int row, int col) + { + bool sel=FALSE; + UData& uitem=item(row); + + if (!sel && row < count-uncleared) { + p->setPen(darkGray); + } else { + p->setPen(black); + } + + if (uitem.attr) { + // XXX only bold + QFont bold(font().family(),font().pointSize(),QFont::Bold); + p->setFont(bold); + } + + p->drawText(3, 0, cellWidth(), cellHeight(), + AlignLeft|AlignVCenter, uitem.text); + + if (uitem.attr) { + p->setFont(font()); + } + } +}; + +NetHackQtMessageWindow::NetHackQtMessageWindow() : + list(new NetHackQtScrollText(::iflags.msg_history)) +{ + ::iflags.window_inited = 1; + map = 0; + connect(qt_settings,SIGNAL(fontChanged()),this,SLOT(updateFont())); + updateFont(); +} + +NetHackQtMessageWindow::~NetHackQtMessageWindow() +{ + ::iflags.window_inited = 0; + delete list; +} + +QWidget* NetHackQtMessageWindow::Widget() { return list; } + +void NetHackQtMessageWindow::setMap(NetHackQtMapWindow* m) +{ + map = m; + updateFont(); +} + +void NetHackQtMessageWindow::updateFont() +{ + list->setFont(qt_settings->normalFont()); + if ( map ) + map->setFont(qt_settings->normalFont()); +} + +void NetHackQtMessageWindow::Scroll(int dx, int dy) +{ + list->Scroll(dx,dy); +} + +void NetHackQtMessageWindow::Clear() +{ + if ( map ) + map->clearMessages(); + if (list->uncleared) { + list->uncleared=0; + changed=TRUE; + Display(FALSE); + } +} + +void NetHackQtMessageWindow::Display(bool block) +{ + if (changed) { + list->repaint(); + changed=FALSE; + } +} + +void NetHackQtMessageWindow::PutStr(int attr, const char* text) +{ +#ifdef USER_SOUNDS + play_sound_for_message(text); +#endif + + changed=TRUE; + list->uncleared++; + list->insertItem(attr,text); + + // Force scrollbar to bottom + // XXX list->setTopItem(list->count()); + + if ( map ) + map->putMessage(attr, text); +} + + + +NetHackQtLabelledIcon::NetHackQtLabelledIcon(QWidget* parent, const char* l) : + QWidget(parent), + low_is_good(FALSE), + prev_value(-123), + turn_count(-1), + label(new QLabel(l,this)), + icon(0) +{ + initHighlight(); +} +NetHackQtLabelledIcon::NetHackQtLabelledIcon(QWidget* parent, const char* l, const QPixmap& i) : + QWidget(parent), + low_is_good(FALSE), + prev_value(-123), + turn_count(-1), + label(new QLabel(l,this)), + icon(new QLabel(this)) +{ + setIcon(i); + initHighlight(); +} +void NetHackQtLabelledIcon::initHighlight() +{ + const QPalette& pal=palette(); + const QColorGroup& pa=pal.normal(); + //QColorGroup good(white,darkGreen,pa.light(),pa.dark(),pa.mid(),white,pa.base()); + QColorGroup good(black,green,pa.light(),pa.dark(),pa.mid(),black,pa.base()); + QColorGroup bad(white,red,pa.light(),pa.dark(),pa.mid(),white,pa.base()); + hl_good=pal.copy(); + hl_good.setNormal(good); + hl_good.setActive(good); + hl_bad=pal.copy(); + hl_bad.setNormal(bad); + hl_bad.setActive(bad); +} + +void NetHackQtLabelledIcon::setLabel(const char* t, bool lower) +{ + if (!label) { + label=new QLabel(this); + label->setFont(font()); + resizeEvent(0); + } + if (0!=strcmp(label->text(),t)) { + label->setText(t); + highlight(lower==low_is_good ? hl_good : hl_bad); + } +} +void NetHackQtLabelledIcon::setLabel(const char* t, long v, long cv, const char* tail) +{ + char buf[BUFSZ]; + if (v==NoNum) { + Sprintf(buf,"%s%s",t,tail); + } else { + Sprintf(buf,"%s%ld%s",t,v,tail); + } + setLabel(buf,cvsetPixmap(i); + else { icon=new QLabel(this); icon->setPixmap(i); resizeEvent(0); } + icon->resize(i.width(),i.height()); +} +void NetHackQtLabelledIcon::setFont(const QFont& f) +{ + QWidget::setFont(f); + if (label) label->setFont(f); +} +void NetHackQtLabelledIcon::show() +{ +#if QT_VERSION >= 300 + if (isHidden()) +#else + if (!isVisible()) +#endif + highlight(hl_bad); + QWidget::show(); +} +void NetHackQtLabelledIcon::highlightWhenChanging() +{ + turn_count=0; +} +void NetHackQtLabelledIcon::lowIsGood() +{ + low_is_good=TRUE; +} +void NetHackQtLabelledIcon::dissipateHighlight() +{ + if (turn_count>0) { + turn_count--; + if (!turn_count) + unhighlight(); + } +} +void NetHackQtLabelledIcon::highlight(const QPalette& hl) +{ + if (label) { // Surely it is?! + if (turn_count>=0) { + label->setPalette(hl); + turn_count=4; + // `4' includes this turn, so dissipates after + // 3 more keypresses. + } else { + label->setPalette(palette()); + } + } +} +void NetHackQtLabelledIcon::unhighlight() +{ + if (label) { // Surely it is?! + label->setPalette(palette()); + } +} +void NetHackQtLabelledIcon::resizeEvent(QResizeEvent*) +{ + setAlignments(); + + //int labw=label ? label->fontMetrics().width(label->text()) : 0; + int labh=label ? label->fontMetrics().height() : 0; + int icoh=icon ? icon->height() : 0; + int h=icoh+labh; + int icoy=(h>height() ? height()-labh-icoh : height()/2-h/2); + int laby=icoy+icoh; + if (icon) { + icon->setGeometry(0,icoy,width(),icoh); + } + if (label) { + label->setGeometry(0,laby,width(),labh); + } +} + +void NetHackQtLabelledIcon::setAlignments() +{ + if (label) label->setAlignment(AlignHCenter|AlignVCenter); + if (icon) icon->setAlignment(AlignHCenter|AlignVCenter); +} + +static void +tryload(QPixmap& pm, const char* fn) +{ + if (!pm.load(fn)) { + QString msg; + msg.sprintf("Cannot load \"%s\"", fn); + QMessageBox::warning(0, "IO Error", msg); + } +} + +NetHackQtStatusWindow::NetHackQtStatusWindow() : + // Notes: + // Alignment needs -2 init value, because -1 is an alignment. + // Armor Class is an schar, so 256 is out of range. + // Blank value is 0 and should never change. + name(this,"(name)"), + dlevel(this,"(dlevel)"), + str(this,"STR"), + dex(this,"DEX"), + con(this,"CON"), + intel(this,"INT"), + wis(this,"WIS"), + cha(this,"CHA"), + gold(this,"Gold"), + hp(this,"Hit Points"), + power(this,"Power"), + ac(this,"Armour Class"), + level(this,"Level"), + exp(this,"Experience"), + align(this,"Alignment"), + time(this,"Time"), + score(this,"Score"), + hunger(this,""), + confused(this,"Confused"), + sick_fp(this,"Sick"), + sick_il(this,"Ill"), + blind(this,"Blind"), + stunned(this,"Stunned"), + hallu(this,"Hallu"), + encumber(this,""), + hline1(this), + hline2(this), + hline3(this), + first_set(TRUE) +{ + p_str = QPixmap(str_xpm); + p_str = QPixmap(str_xpm); + p_dex = QPixmap(dex_xpm); + p_con = QPixmap(cns_xpm); + p_int = QPixmap(int_xpm); + p_wis = QPixmap(wis_xpm); + p_cha = QPixmap(cha_xpm); + + p_chaotic = QPixmap(chaotic_xpm); + p_neutral = QPixmap(neutral_xpm); + p_lawful = QPixmap(lawful_xpm); + + p_satiated = QPixmap(satiated_xpm); + p_hungry = QPixmap(hungry_xpm); + + p_confused = QPixmap(confused_xpm); + p_sick_fp = QPixmap(sick_fp_xpm); + p_sick_il = QPixmap(sick_il_xpm); + p_blind = QPixmap(blind_xpm); + p_stunned = QPixmap(stunned_xpm); + p_hallu = QPixmap(hallu_xpm); + + p_encumber[0] = QPixmap(slt_enc_xpm); + p_encumber[1] = QPixmap(mod_enc_xpm); + p_encumber[2] = QPixmap(hvy_enc_xpm); + p_encumber[3] = QPixmap(ext_enc_xpm); + p_encumber[4] = QPixmap(ovr_enc_xpm); + + str.setIcon(p_str); + dex.setIcon(p_dex); + con.setIcon(p_con); + intel.setIcon(p_int); + wis.setIcon(p_wis); + cha.setIcon(p_cha); + + align.setIcon(p_neutral); + hunger.setIcon(p_hungry); + + confused.setIcon(p_confused); + sick_fp.setIcon(p_sick_fp); + sick_il.setIcon(p_sick_il); + blind.setIcon(p_blind); + stunned.setIcon(p_stunned); + hallu.setIcon(p_hallu); + + encumber.setIcon(p_encumber[0]); + + hline1.setFrameStyle(QFrame::HLine|QFrame::Sunken); + hline2.setFrameStyle(QFrame::HLine|QFrame::Sunken); + hline3.setFrameStyle(QFrame::HLine|QFrame::Sunken); + hline1.setLineWidth(1); + hline2.setLineWidth(1); + hline3.setLineWidth(1); + + connect(qt_settings,SIGNAL(fontChanged()),this,SLOT(doUpdate())); + doUpdate(); +} + +void NetHackQtStatusWindow::doUpdate() +{ + const QFont& large=qt_settings->largeFont(); + name.setFont(large); + dlevel.setFont(large); + + const QFont& normal=qt_settings->normalFont(); + str.setFont(normal); + dex.setFont(normal); + con.setFont(normal); + intel.setFont(normal); + wis.setFont(normal); + cha.setFont(normal); + gold.setFont(normal); + hp.setFont(normal); + power.setFont(normal); + ac.setFont(normal); + level.setFont(normal); + exp.setFont(normal); + align.setFont(normal); + time.setFont(normal); + score.setFont(normal); + hunger.setFont(normal); + confused.setFont(normal); + sick_fp.setFont(normal); + sick_il.setFont(normal); + blind.setFont(normal); + stunned.setFont(normal); + hallu.setFont(normal); + encumber.setFont(normal); + + updateStats(); +} + +QWidget* NetHackQtStatusWindow::Widget() { return this; } + +void NetHackQtStatusWindow::Clear() +{ +} +void NetHackQtStatusWindow::Display(bool block) +{ +} +void NetHackQtStatusWindow::CursorTo(int,int y) +{ + cursy=y; +} +void NetHackQtStatusWindow::PutStr(int attr, const char* text) +{ + // do a complete update when line 0 is done (as per X11 fancy status) + if (cursy==0) updateStats(); +} + +void NetHackQtStatusWindow::resizeEvent(QResizeEvent*) +{ + const float SP_name=0.13; // the (large) + const float SP_dlev=0.13; // Level 3 in The Dungeons of Doom (large) + const float SP_atr1=0.25; // STR DEX CON INT WIS CHA + const float SP_hln1=0.02; // --- + const float SP_atr2=0.09; // Au HP PW AC LVL EXP + const float SP_hln2=0.02; // --- + const float SP_time=0.09; // time score + const float SP_hln3=0.02; // --- + const float SP_stat=0.25; // Alignment, Poisoned, Hungry, Sick, etc. + + int h=height(); + int x=0,y=0; + + int iw; // Width of an item across line + int lh; // Height of a line of values + + lh=int(h*SP_name); + name.setGeometry(0,0,width(),lh); y+=lh; + lh=int(h*SP_dlev); + dlevel.setGeometry(0,y,width(),lh); y+=lh; + + lh=int(h*SP_hln1); + hline1.setGeometry(0,y,width(),lh); y+=lh; + + lh=int(h*SP_atr1); + iw=width()/6; + str.setGeometry(x,y,iw,lh); x+=iw; + dex.setGeometry(x,y,iw,lh); x+=iw; + con.setGeometry(x,y,iw,lh); x+=iw; + intel.setGeometry(x,y,iw,lh); x+=iw; + wis.setGeometry(x,y,iw,lh); x+=iw; + cha.setGeometry(x,y,iw,lh); x+=iw; + x=0; y+=lh; + + lh=int(h*SP_hln2); + hline2.setGeometry(0,y,width(),lh); y+=lh; + + lh=int(h*SP_atr2); + iw=width()/6; + gold.setGeometry(x,y,iw,lh); x+=iw; + hp.setGeometry(x,y,iw,lh); x+=iw; + power.setGeometry(x,y,iw,lh); x+=iw; + ac.setGeometry(x,y,iw,lh); x+=iw; + level.setGeometry(x,y,iw,lh); x+=iw; + exp.setGeometry(x,y,iw,lh); x+=iw; + x=0; y+=lh; + + lh=int(h*SP_hln3); + hline3.setGeometry(0,y,width(),lh); y+=lh; + + lh=int(h*SP_time); + iw=width()/3; x+=iw/2; + time.setGeometry(x,y,iw,lh); x+=iw; + score.setGeometry(x,y,iw,lh); x+=iw; + x=0; y+=lh; + + lh=int(h*SP_stat); + iw=width()/9; + align.setGeometry(x,y,iw,lh); x+=iw; + hunger.setGeometry(x,y,iw,lh); x+=iw; + confused.setGeometry(x,y,iw,lh); x+=iw; + sick_fp.setGeometry(x,y,iw,lh); x+=iw; + sick_il.setGeometry(x,y,iw,lh); x+=iw; + blind.setGeometry(x,y,iw,lh); x+=iw; + stunned.setGeometry(x,y,iw,lh); x+=iw; + hallu.setGeometry(x,y,iw,lh); x+=iw; + encumber.setGeometry(x,y,iw,lh); x+=iw; + x=0; y+=lh; +} + + +/* + * Set all widget values to a null string. This is used after all spacings + * have been calculated so that when the window is popped up we don't get all + * kinds of funny values being displayed. + */ +void NetHackQtStatusWindow::nullOut() +{ +} + +void NetHackQtStatusWindow::fadeHighlighting() +{ + name.dissipateHighlight(); + dlevel.dissipateHighlight(); + + str.dissipateHighlight(); + dex.dissipateHighlight(); + con.dissipateHighlight(); + intel.dissipateHighlight(); + wis.dissipateHighlight(); + cha.dissipateHighlight(); + + gold.dissipateHighlight(); + hp.dissipateHighlight(); + power.dissipateHighlight(); + ac.dissipateHighlight(); + level.dissipateHighlight(); + exp.dissipateHighlight(); + align.dissipateHighlight(); + + time.dissipateHighlight(); + score.dissipateHighlight(); + + hunger.dissipateHighlight(); + confused.dissipateHighlight(); + sick_fp.dissipateHighlight(); + sick_il.dissipateHighlight(); + blind.dissipateHighlight(); + stunned.dissipateHighlight(); + hallu.dissipateHighlight(); + encumber.dissipateHighlight(); +} + +/* + * Update the displayed status. The current code in botl.c updates + * two lines of information. Both lines are always updated one after + * the other. So only do our update when we update the second line. + * + * Information on the first line: + * name, attributes, alignment, score + * + * Information on the second line: + * dlvl, gold, hp, power, ac, {level & exp or HD **} + * status (hunger, conf, halu, stun, sick, blind), time, encumbrance + * + * [**] HD is shown instead of level and exp if mtimedone is non-zero. + */ +void NetHackQtStatusWindow::updateStats() +{ + if (!parentWidget()) return; + + char buf[BUFSZ]; + + if (cursy != 0) return; /* do a complete update when line 0 is done */ + + if (ACURR(A_STR) > 118) { + Sprintf(buf,"STR:%d",ACURR(A_STR)-100); + } else if (ACURR(A_STR)==118) { + Sprintf(buf,"STR:18/**"); + } else if(ACURR(A_STR) > 18) { + Sprintf(buf,"STR:18/%02d",ACURR(A_STR)-18); + } else { + Sprintf(buf,"STR:%d",ACURR(A_STR)); + } + str.setLabel(buf,NetHackQtLabelledIcon::NoNum,ACURR(A_STR)); + + dex.setLabel("DEX:",(long)ACURR(A_DEX)); + con.setLabel("CON:",(long)ACURR(A_CON)); + intel.setLabel("INT:",(long)ACURR(A_INT)); + wis.setLabel("WIS:",(long)ACURR(A_WIS)); + cha.setLabel("CHA:",(long)ACURR(A_CHA)); + const char* hung=hu_stat[u.uhs]; + if (hung[0]==' ') { + hunger.hide(); + } else { + hunger.setIcon(u.uhs ? p_hungry : p_satiated); + hunger.setLabel(hung); + hunger.show(); + } + if (Confusion) confused.show(); else confused.hide(); + if (Sick) { + if (u.usick_type & SICK_VOMITABLE) { + sick_fp.show(); + } else { + sick_fp.hide(); + } + if (u.usick_type & SICK_NONVOMITABLE) { + sick_il.show(); + } else { + sick_il.hide(); + } + } else { + sick_fp.hide(); + sick_il.hide(); + } + if (Blind) blind.show(); else blind.hide(); + if (Stunned) stunned.show(); else stunned.hide(); + if (Hallucination) hallu.show(); else hallu.hide(); + const char* enc=enc_stat[near_capacity()]; + if (enc[0]==' ' || !enc[0]) { + encumber.hide(); + } else { + encumber.setIcon(p_encumber[near_capacity()-1]); + encumber.setLabel(enc); + encumber.show(); + } + Strcpy(buf, g.plname); + if ('a' <= buf[0] && buf[0] <= 'z') buf[0] += 'A'-'a'; + Strcat(buf, " the "); + if (u.mtimedone) { + char mname[BUFSZ]; + int k = 0; + + Strcpy(mname, mons[u.umonnum].mname); + while(mname[k] != 0) { + if ((k == 0 || (k > 0 && mname[k-1] == ' ')) + && 'a' <= mname[k] && mname[k] <= 'z') + { + mname[k] += 'A' - 'a'; + } + k++; + } + Strcat(buf, mname); + } else { + Strcat(buf, rank_of(u.ulevel, pl_character[0], ::flags.female)); + } + name.setLabel(buf,NetHackQtLabelledIcon::NoNum,u.ulevel); + + if (describe_level(buf)) { + dlevel.setLabel(buf,(bool)TRUE); + } else { + Sprintf(buf, "%s, level ", dungeons[u.uz.dnum].dname); + dlevel.setLabel(buf,(long)depth(&u.uz)); + } + + gold.setLabel("Au:", money_cnt(g.invent)); + if (u.mtimedone) { + // You're a monster! + + Sprintf(buf, "/%d", u.mhmax); + hp.setLabel("HP:",u.mh > 0 ? u.mh : 0,buf); + level.setLabel("HD:",(long)mons[u.umonnum].mlevel); + } else { + // You're normal. + + Sprintf(buf, "/%d", u.uhpmax); + hp.setLabel("HP:",u.uhp > 0 ? u.uhp : 0,buf); + level.setLabel("Level:",(long)u.ulevel); + } + Sprintf(buf, "/%d", u.uenmax); + power.setLabel("Pow:",u.uen,buf); + ac.setLabel("AC:",(long)u.uac); + if (::flags.showexp) { + exp.setLabel("Exp:",(long)u.uexp); + } else + { + exp.setLabel(""); + } + if (u.ualign.type==A_CHAOTIC) { + align.setIcon(p_chaotic); + align.setLabel("Chaotic"); + } else if (u.ualign.type==A_NEUTRAL) { + align.setIcon(p_neutral); + align.setLabel("Neutral"); + } else { + align.setIcon(p_lawful); + align.setLabel("Lawful"); + } + + if (::flags.time) time.setLabel("Time:",(long)g.moves); + else time.setLabel(""); +#ifdef SCORE_ON_BOTL + if (::flags.showscore) { + score.setLabel("Score:",(long)botl_score()); + } else +#endif + { + score.setLabel(""); + } + + if (first_set) + { + first_set=FALSE; + + name.highlightWhenChanging(); + dlevel.highlightWhenChanging(); + + str.highlightWhenChanging(); + dex.highlightWhenChanging(); + con.highlightWhenChanging(); + intel.highlightWhenChanging(); + wis.highlightWhenChanging(); + cha.highlightWhenChanging(); + + gold.highlightWhenChanging(); + hp.highlightWhenChanging(); + power.highlightWhenChanging(); + ac.highlightWhenChanging(); ac.lowIsGood(); + level.highlightWhenChanging(); + exp.highlightWhenChanging(); + align.highlightWhenChanging(); + + //time.highlightWhenChanging(); + score.highlightWhenChanging(); + + hunger.highlightWhenChanging(); + confused.highlightWhenChanging(); + sick_fp.highlightWhenChanging(); + sick_il.highlightWhenChanging(); + blind.highlightWhenChanging(); + stunned.highlightWhenChanging(); + hallu.highlightWhenChanging(); + encumber.highlightWhenChanging(); + } +} + +/* + * Turn off hilighted status values after a certain amount of turns. + */ +void NetHackQtStatusWindow::checkTurnEvents() +{ +} + + + +NetHackQtMenuDialog::NetHackQtMenuDialog() : + QDialog(qApp->mainWidget(),0,FALSE) +{ +} + +void NetHackQtMenuDialog::resizeEvent(QResizeEvent*) +{ + emit Resized(); +} + +void NetHackQtMenuDialog::Accept() +{ + accept(); +} + +void NetHackQtMenuDialog::Reject() +{ + reject(); +} + +void NetHackQtMenuDialog::SetResult(int r) +{ + setResult(r); +} + +void NetHackQtMenuDialog::done(int i) +{ + setResult(i); + qApp->exit_loop(); +} + +// Table view columns: +// +// [pick-count] [accel] [glyph] [string] +// +// Maybe accel should be near string. We'll see. +// pick-count normally blank. +// double-clicking or click-on-count gives pop-up entry +// string is green when selected +// +NetHackQtMenuWindow::NetHackQtMenuWindow(NetHackQtKeyBuffer& ks) : + QTableView(), + keysource(ks), + dialog(new NetHackQtMenuDialog()), + prompt(0), + pressed(-1) +{ + setNumCols(4); + setCellHeight(QMAX(qt_settings->glyphs().height()+1,fontMetrics().height())); + setBackgroundColor(lightGray); + setFrameStyle(Panel|Sunken); + setLineWidth(2); + + ok=new QPushButton("Ok",dialog); + connect(ok,SIGNAL(clicked()),dialog,SLOT(accept())); + + cancel=new QPushButton("Cancel",dialog); + connect(cancel,SIGNAL(clicked()),dialog,SLOT(reject())); + + all=new QPushButton("All",dialog); + connect(all,SIGNAL(clicked()),this,SLOT(All())); + + none=new QPushButton("None",dialog); + connect(none,SIGNAL(clicked()),this,SLOT(ChooseNone())); + + invert=new QPushButton("Invert",dialog); + connect(invert,SIGNAL(clicked()),this,SLOT(Invert())); + + search=new QPushButton("Search",dialog); + connect(search,SIGNAL(clicked()),this,SLOT(Search())); + + QPoint pos(0,ok->height()); + recreate(dialog,0,pos); + prompt.recreate(dialog,0,pos); + + setBackgroundColor(lightGray); + + connect(dialog,SIGNAL(Resized()),this,SLOT(Layout())); + + setTableFlags(Tbl_autoHScrollBar|Tbl_autoVScrollBar + |Tbl_smoothScrolling|Tbl_clipCellPainting); + setFocusPolicy(StrongFocus); +} + +NetHackQtMenuWindow::~NetHackQtMenuWindow() +{ + // Remove from dialog before we destruct it + recreate(0,0,QPoint(0,0)); + delete dialog; +} + +void NetHackQtMenuWindow::focusInEvent(QFocusEvent *) +{ + // Don't repaint at all, since nothing is using the focus colour +} +void NetHackQtMenuWindow::focusOutEvent(QFocusEvent *) +{ + // Don't repaint at all, since nothing is using the focus colour +} + +int NetHackQtMenuWindow::cellWidth(int col) +{ + switch (col) { + case 0: + return fontMetrics().width("All "); + break; case 1: + return fontMetrics().width(" m "); + break; case 2: + return qt_settings->glyphs().width(); + break; case 3: + return str_width; + } + impossible("Extra column (#%d) in MenuWindow",col); + return 0; +} + +QWidget* NetHackQtMenuWindow::Widget() { return dialog; } + +void NetHackQtMenuWindow::StartMenu() +{ + setNumRows((itemcount=0)); + str_width=200; + str_fixed=FALSE; + next_accel=0; + has_glyphs=FALSE; +} + +NetHackQtMenuWindow::MenuItem::MenuItem() : + str(0) +{ +} + +NetHackQtMenuWindow::MenuItem::~MenuItem() +{ + if (str) free((void*)str); +} + +#define STR_MARGIN 4 + +void NetHackQtMenuWindow::AddMenu(int glyph, const ANY_P* identifier, + char ch, char gch, int attr, const char* str, bool presel) +{ + if (!ch && identifier->a_void!=0) { + // Supply a keyboard accelerator. Limited supply. + static char accel[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + if (accel[next_accel]) { + ch=accel[next_accel++]; + } + } + + if ((int)item.size() < itemcount+1) { + item.resize(itemcount*4+10); + } + item[itemcount].glyph=glyph; + item[itemcount].identifier=*identifier; + item[itemcount].ch=ch; + item[itemcount].attr=attr; + item[itemcount].str=strdup(str); + item[itemcount].selected=presel; + item[itemcount].count=-1; + ++itemcount; + + str_fixed=str_fixed || strstr(str," "); + if (glyph!=NO_GLYPH) has_glyphs=TRUE; +} +void NetHackQtMenuWindow::EndMenu(const char* p) +{ + prompt.setText(p ? p : ""); +} +void NetHackQtMenuWindow::Layout() +{ + int butw=totalWidth()/6; // 6 buttons + int buth=fontMetrics().height()+8; // 8 for spacing & mitres + int prompth=(prompt.text().isNull() ? 0 : buth); + + prompt.setGeometry(6,buth,dialog->width()-6,prompth); + int h=dialog->height()-buth-prompth; + setGeometry(0,buth+prompth, dialog->width(), h); + + // Below, we take care to use up full width + int x=0; + ok->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/5; + cancel->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/4; + all->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/3; + none->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/2; + invert->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/1; + search->setGeometry(x,0,butw,buth); +} + +int NetHackQtMenuWindow::SelectMenu(int h, MENU_ITEM_P **menu_list) +{ + setFont(str_fixed ? + qt_settings->normalFixedFont() : qt_settings->normalFont()); + + for (int i=0; iglyphs().height()+1,fontMetrics().height())); + setNumRows(itemcount); + + int buth=fontMetrics().height()+8; // 8 for spacing & mitres + + how=h; + + ok->setEnabled(how!=PICK_ONE);ok->setDefault(how!=PICK_ONE); + cancel->setEnabled(TRUE); + all->setEnabled(how==PICK_ANY); + none->setEnabled(how==PICK_ANY); + invert->setEnabled(how==PICK_ANY); + search->setEnabled(how!=PICK_NONE); + + dialog->SetResult(-1); + + // 20 allows for scrollbar or spacing + // 4 for frame borders + int mh = QApplication::desktop()->height()*3/5; + if ( qt_compact_mode && totalHeight() > mh ) { + // big, so make it fill + dialog->showMaximized(); + } else { + dialog->resize(totalWidth()+20, + QMIN(totalHeight(), mh)+buth+4+(prompt.text().isNull() ? 0 : buth)); + if ( dialog->width() > QApplication::desktop()->width() ) + dialog->resize(QApplication::desktop()->width(),dialog->height()+16); + centerOnMain(dialog); + dialog->show(); + } + + setFocus(); + while (dialog->result()<0) { + // changed the defaults below to the values in wintype.h 000119 - azy + if (!keysource.Empty()) { + char k=keysource.GetAscii(); + k=map_menu_cmd(k); /* added 000119 - azy */ + if (k=='\033') + dialog->Reject(); + else if (k=='\r' || k=='\n' || k==' ') + dialog->Accept(); + else if (k==MENU_SEARCH) + Search(); + else if (k==MENU_SELECT_ALL) + All(); + else if (k==MENU_INVERT_ALL) + Invert(); + else if (k==MENU_UNSELECT_ALL) + ChooseNone(); + else { + for (int i=0; iresult()<0) + qApp->enter_loop(); + } + //if ( (nhid != WIN_INVEN || !iflags.perm_invent) ) // doesn't work yet + { + dialog->hide(); + } + int result=dialog->result(); + + // Consume ^M (which QDialog steals for default button) + while (!keysource.Empty() && + (keysource.TopAscii()=='\n' || keysource.TopAscii()=='\r')) + keysource.GetAscii(); + + *menu_list=0; + if (how==PICK_NONE) + return result==0 ? -1 : 0; + + if (result>0) { + if (how==PICK_ONE) { + int i; + for (i=0; istate()&ShiftButton)) { + if (event->key()==Key_Prior) { + setYOffset(yOffset()-viewHeight()); + } else if (event->key()==Key_Next) { + setYOffset(yOffset()+viewHeight()); + } else { + event->ignore(); + } + } else { + event->ignore(); + } +} + +void NetHackQtMenuWindow::All() +{ + for (int i=0; iAccept(); + } + } +} + + +void NetHackQtMenuWindow::paintCell(QPainter* painter, int row, int col) +{ + // [pick-count] [accel] [glyph] [string] + + MenuItem& i = item[row]; + + painter->setPen(black); + painter->setFont(font()); + + if (i.selected) { + painter->setPen(darkGreen); + } + + switch (col) { + case 0: + if ( i.ch || i.attr!=ATR_INVERSE ) { + QString text; + if ( i.selected && i.count == -1 ) { + if ( i.str[0]>='0' && i.str[0]<='9' ) + text = "All"; + else + text = "*"; + } else if ( i.count<0 ) { + text = "-"; + } else { + text.sprintf("%d",i.count); + } + painter->drawText(0,0,cellWidth(col),cellHeight(), + AlignHCenter|AlignVCenter,text); + } + break; case 1: + if ((signed char)i.ch >= 0) { + char text[2]={i.ch,0}; + painter->drawText(0,0,cellWidth(col),cellHeight(), + AlignHCenter|AlignVCenter,text); + } + break; case 2: + if (i.glyph!=NO_GLYPH) { + // Centered in height + int y=(cellHeight()-qt_settings->glyphs().height())/2; + if (y<0) y=0; + qt_settings->glyphs().drawGlyph(*painter, i.glyph, 0, y); + } + break; case 3: + // XXX should qt_settings have ALL the various fonts + QFont newfont=font(); + + if (i.attr) { + switch(i.attr) { + case ATR_ULINE: + newfont.setUnderline(TRUE); + break; case ATR_BOLD: + painter->setPen(red); + break; case ATR_BLINK: + newfont.setItalic(TRUE); + break; case ATR_INVERSE: + newfont=qt_settings->largeFont(); + newfont.setWeight(QFont::Bold); + + if (i.selected) { + painter->setPen(blue); + } else { + painter->setPen(darkBlue); + } + } + } + painter->setFont(newfont); + + painter->drawText(STR_MARGIN,0,cellWidth(col),cellHeight(), + AlignLeft|AlignVCenter,i.str); + } +} + +void NetHackQtMenuWindow::mousePressEvent(QMouseEvent* event) +{ + int col=findCol(event->pos().x()); + int row=findRow(event->pos().y()); + + if (col<0 || row<0 || !item[row].Selectable()) return; + + if (how!=PICK_NONE) { + if (col==0) { + // Changing count. + NetHackQtStringRequestor requestor(keysource,"Count:"); + char buf[BUFSZ]; + + if (item[row].count>0) + Sprintf(buf,"%d", item[row].count); + else + Strcpy(buf, ""); + + requestor.SetDefault(buf); + if (requestor.Get(buf)) { + item[row].count=atoi(buf); + if (item[row].count==0) { + item[row].count=-1; + if (item[row].selected) ToggleSelect(row); + } else { + if (!item[row].selected) ToggleSelect(row); + } + updateCell(row,0); + } + } else { + pressed=row; + was_sel=item[row].selected; + ToggleSelect(row); + updateCell(row,0); + } + } +} + +void NetHackQtMenuWindow::mouseReleaseEvent(QMouseEvent* event) +{ + if (pressed>=0) { + int p=pressed; + pressed=-1; + updateCell(p,3); + } +} + +void NetHackQtMenuWindow::mouseMoveEvent(QMouseEvent* event) +{ + if (pressed>=0) { + int col=findCol(event->pos().x()); + int row=findRow(event->pos().y()); + + if (row>=0 && col>=0) { + if (pressed!=row) { + // reset to initial state + if (item[pressed].selected!=was_sel) + ToggleSelect(pressed); + } else { + // reset to new state + if (item[pressed].selected==was_sel) + ToggleSelect(pressed); + } + } + } +} + + +class NetHackQtTextListBox : public QListBox { +public: + NetHackQtTextListBox(QWidget* parent) : QListBox(parent) { } + + int TotalWidth() + { + doLayout(); + return contentsWidth(); + } + int TotalHeight() + { + doLayout(); + return contentsHeight(); + } + + virtual void setFont(const QFont &font) + { + QListBox::setFont(font); + } + void keyPressEvent(QKeyEvent* e) + { + QListBox::keyPressEvent(e); + } +}; + + +QPixmap* NetHackQtRIP::pixmap=0; + +NetHackQtRIP::NetHackQtRIP(QWidget* parent) : + QWidget(parent) +{ + if (!pixmap) { + pixmap=new QPixmap; + tryload(*pixmap, "rip.xpm"); + } + riplines=0; + resize(pixmap->width(),pixmap->height()); + setFont(QFont("times",12)); // XXX may need to be configurable +} + +void NetHackQtRIP::setLines(char** l, int n) +{ + line=l; + riplines=n; +} + +QSize NetHackQtRIP::sizeHint() const +{ + return pixmap->size(); +} + +void NetHackQtRIP::paintEvent(QPaintEvent* event) +{ + if ( riplines ) { + int pix_x=(width()-pixmap->width())/2; + int pix_y=(height()-pixmap->height())/2; + + // XXX positions based on RIP image + int rip_text_x=pix_x+156; + int rip_text_y=pix_y+67; + int rip_text_h=94/riplines; + + QPainter painter; + painter.begin(this); + painter.drawPixmap(pix_x,pix_y,*pixmap); + for (int i=0; imainWidget(),0,FALSE), + keysource(ks), + use_rip(FALSE), + str_fixed(FALSE), + ok("Dismiss",this), + search("Search",this), + lines(new NetHackQtTextListBox(this)), + rip(this) +{ + ok.setDefault(TRUE); + connect(&ok,SIGNAL(clicked()),this,SLOT(accept())); + connect(&search,SIGNAL(clicked()),this,SLOT(Search())); + connect(qt_settings,SIGNAL(fontChanged()),this,SLOT(doUpdate())); + + QVBoxLayout* vb = new QVBoxLayout(this); + vb->addWidget(&rip); + QHBoxLayout* hb = new QHBoxLayout(vb); + hb->addWidget(&ok); + hb->addWidget(&search); + vb->addWidget(lines); +} + +void NetHackQtTextWindow::doUpdate() +{ + update(); +} + + +NetHackQtTextWindow::~NetHackQtTextWindow() +{ + +} + +QWidget* NetHackQtTextWindow::Widget() +{ + return this; +} + +bool NetHackQtTextWindow::Destroy() +{ + return !isVisible(); +} + +void NetHackQtTextWindow::UseRIP(int how, time_t when) +{ +// Code from X11 windowport +#define STONE_LINE_LEN 16 /* # chars that fit on one line */ +#define NAME_LINE 0 /* line # for player name */ +#define GOLD_LINE 1 /* line # for amount of gold */ +#define DEATH_LINE 2 /* line # for death description */ +#define YEAR_LINE 6 /* line # for year */ + +static char** rip_line=0; + if (!rip_line) { + rip_line=new char*[YEAR_LINE+1]; + for (int i=0; i STONE_LINE_LEN) { + for(i = STONE_LINE_LEN; + ((i0 > STONE_LINE_LEN) && i); i--) + if(dpx[i] == ' ') i0 = i; + if(!i) i0 = STONE_LINE_LEN; + } + tmpchar = dpx[i0]; + dpx[i0] = 0; + strcpy(rip_line[line], dpx); + if (tmpchar != ' ') { + dpx[i0] = tmpchar; + dpx= &dpx[i0]; + } else dpx= &dpx[i0+1]; + } + + /* Put year on stone */ + year = yyyymmdd(when) / 10000L; + Sprintf(rip_line[YEAR_LINE], "%4ld", year); + + rip.setLines(rip_line,YEAR_LINE+1); + + use_rip=TRUE; +} + +void NetHackQtTextWindow::Clear() +{ + lines->clear(); + use_rip=FALSE; + str_fixed=FALSE; +} + +void NetHackQtTextWindow::Display(bool block) +{ + if (str_fixed) { + lines->setFont(qt_settings->normalFixedFont()); + } else { + lines->setFont(qt_settings->normalFont()); + } + + int h=0; + if (use_rip) { + h+=rip.height(); + ok.hide(); + search.hide(); + rip.show(); + } else { + h+=ok.height()*2; + ok.show(); + search.show(); + rip.hide(); + } + int mh = QApplication::desktop()->height()*3/5; + if ( qt_compact_mode && (lines->TotalHeight() > mh || use_rip) ) { + // big, so make it fill + showMaximized(); + } else { + resize(QMAX(use_rip ? rip.width() : 200, + lines->TotalWidth()+24), + QMIN(mh, lines->TotalHeight()+h)); + centerOnMain(this); + show(); + } + if (block) { + setResult(-1); + while (result()==-1) { + qApp->enter_loop(); + if (result()==-1 && !keysource.Empty()) { + char k=keysource.GetAscii(); + if (k=='\033' || k==' ' || k=='\r' || k=='\n') { + accept(); + } else if (k=='/') { + Search(); + } + } + } + } +} + +void NetHackQtTextWindow::PutStr(int attr, const char* text) +{ + str_fixed=str_fixed || strstr(text," "); + lines->insertItem(text); +} + +void NetHackQtTextWindow::done(int i) +{ + setResult(i+1000); + hide(); + qApp->exit_loop(); +} + +void NetHackQtTextWindow::keyPressEvent(QKeyEvent* e) +{ + if ( e->ascii() != '\r' && e->ascii() != '\n' && e->ascii() != '\033' ) + lines->keyPressEvent(e); + else + QDialog::keyPressEvent(e); +} + +void NetHackQtTextWindow::Search() +{ + NetHackQtStringRequestor requestor(keysource,"Search for:"); + static char line[256]=""; + requestor.SetDefault(line); + if (requestor.Get(line)) { + int current=lines->currentItem(); + for (uint i=1; icount(); i++) { + int lnum=(i+current)%lines->count(); + QString str=lines->text(lnum); + if (str.contains(line)) { + lines->setCurrentItem(lnum); + lines->centerCurrentItem(); + return; + } + } + lines->setCurrentItem(-1); + } +} + + +NetHackQtDelay::NetHackQtDelay(int ms) : + msec(ms) +{ +} + +void NetHackQtDelay::wait() +{ + startTimer(msec); + qApp->enter_loop(); +} + +void NetHackQtDelay::timerEvent(QTimerEvent* timer) +{ + qApp->exit_loop(); + killTimers(); +} + +NetHackQtInvUsageWindow::NetHackQtInvUsageWindow(QWidget* parent) : + QWidget(parent) +{ +} + +void NetHackQtInvUsageWindow::drawWorn(QPainter& painter, obj* nhobj, int x, int y, bool canbe) +{ + short int glyph; + if (nhobj) + glyph=obj_to_glyph(nhobj, rn2_on_display_rng); + else if (canbe) + glyph=cmap_to_glyph(S_room); + else + glyph=cmap_to_glyph(S_stone); + + qt_settings->glyphs().drawCell(painter,glyph,x,y); +} + +void NetHackQtInvUsageWindow::paintEvent(QPaintEvent*) +{ + // 012 + // + //0 WhB + //1 s"w + //2 gCg + //3 =A= + //4 T + //5 S + + QPainter painter; + painter.begin(this); + + // Blanks + drawWorn(painter,0,0,4,FALSE); + drawWorn(painter,0,0,5,FALSE); + drawWorn(painter,0,2,4,FALSE); + drawWorn(painter,0,2,5,FALSE); + + drawWorn(painter,uarm,1,3); // Armour + drawWorn(painter,uarmc,1,2); // Cloak + drawWorn(painter,uarmh,1,0); // Helmet + drawWorn(painter,uarms,0,1); // Shield + drawWorn(painter,uarmg,0,2); // Gloves - repeated + drawWorn(painter,uarmg,2,2); // Gloves - repeated + drawWorn(painter,uarmf,1,5); // Shoes (feet) + drawWorn(painter,uarmu,1,4); // Undershirt + drawWorn(painter,uleft,0,3); // RingL + drawWorn(painter,uright,2,3); // RingR + + drawWorn(painter,uwep,2,1); // Weapon + drawWorn(painter,uswapwep,0,0); // Secondary weapon + drawWorn(painter,uamul,1,1); // Amulet + drawWorn(painter,ublindf,2,0); // Blindfold + + painter.end(); +} + +class SmallToolButton : public QToolButton { +public: + SmallToolButton(const QPixmap & pm, const QString &textLabel, + const QString& grouptext, + QObject * receiver, const char* slot, + QToolBar * parent) : + QToolButton(pm, textLabel, +#if QT_VERSION < 210 + QString::null, +#else + grouptext, +#endif + receiver, slot, parent) + { + } + + QSize sizeHint() const + { + // get just a couple more pixels for the map + return QToolButton::sizeHint()-QSize(0,2); + } +}; + + +NetHackQtMainWindow::NetHackQtMainWindow(NetHackQtKeyBuffer& ks) : + message(0), map(0), status(0), invusage(0), + keysink(ks), dirkey(0) +{ + QToolBar* toolbar = new QToolBar(this); +#if QT_VERSION >= 210 + setToolBarsMovable(FALSE); + toolbar->setHorizontalStretchable(TRUE); + toolbar->setVerticalStretchable(TRUE); +#endif + addToolBar(toolbar); + menubar = menuBar(); + + setCaption("Qt NetHack"); + if ( qt_compact_mode ) + setIcon(QPixmap(nh_icon_small)); + else + setIcon(QPixmap(nh_icon)); + + QPopupMenu* game=new QPopupMenu; + QPopupMenu* apparel=new QPopupMenu; + QPopupMenu* act1=new QPopupMenu; + QPopupMenu* act2 = qt_compact_mode ? new QPopupMenu : act1; + QPopupMenu* magic=new QPopupMenu; + QPopupMenu* info=new QPopupMenu; + + QPopupMenu *help; + +#ifdef KDE + help = kapp->getHelpMenu( TRUE, "" ); + help->insertSeparator(); +#else + help = qt_compact_mode ? info : new QPopupMenu; +#endif + + enum { OnDesktop=1, OnHandhelds=2 }; + struct Macro { + QPopupMenu* menu; + const char* name; + const char* action; + int flags; + } item[] = { + { game, 0, 0, 3}, + { game, "Version\tv", "v", 3}, + { game, "Compilation\tAlt+V", "\366", 3}, + { game, "History\tShift+V", "V", 3}, + { game, "Redraw\tCtrl+R", "\022", 0}, // useless + { game, "Options\tShift+O", "O", 3}, + { game, "Explore mode\tShift+X", "X", 3}, + { game, 0, 0, 3}, + { game, "Save\tSy", "Sy", 3}, + { game, "Quit\tAlt+Q", "\361", 3}, + + { apparel, "Apparel off\tShift+A", "A", 2}, + { apparel, "Remove many\tShift+A", "A", 1}, + { apparel, 0, 0, 3}, + { apparel, "Wield weapon\tw", "w", 3}, + { apparel, "Exchange weapons\tx", "x", 3}, + { apparel, "Two weapon combat\t#two", "#tw", 3}, + { apparel, "Load quiver\tShift+Q", "Q", 3}, + { apparel, 0, 0, 3}, + { apparel, "Wear armour\tShift+W", "W", 3}, + { apparel, "Take off armour\tShift+T", "T", 3}, + { apparel, 0, 0, 3}, + { apparel, "Put on non-armour\tShift+P", "P", 3}, + { apparel, "Remove non-armour\tShift+R", "R", 3}, + + { act1, "Again\tCtrl+A", "\001", 2}, + { act1, 0, 0, 3}, + { act1, "Apply\ta?", "a?", 3}, + { act1, "Chat\tAlt+C", "\343", 3}, + { act1, "Close door\tc", "c", 3}, + { act1, "Down\t>", ">", 3}, + { act1, "Drop many\tShift+D", "D", 2}, + { act1, "Drop\td?", "d?", 2}, + { act1, "Eat\te?", "e?", 2}, + { act1, "Engrave\tShift+E", "E", 3}, + { act1, "Fight\tShift+F", "F", 3}, + { act1, "Fire from quiver\tf", "f", 2}, + { act1, "Force\tAlt+F", "\346", 3}, + { act1, "Get\t,", ",", 2}, + { act1, "Jump\tAlt+J", "\352", 3}, + { act2, "Kick\tCtrl+D", "\004", 2}, + { act2, "Loot\tAlt+L", "\354", 3}, + { act2, "Open door\to", "o", 3}, + { act2, "Pay\tp", "p", 3}, + { act2, "Rest\t.", ".", 2}, + { act2, "Ride\t#ri", "#ri", 3}, + { act2, "Search\ts", "s", 3}, + { act2, "Sit\tAlt+S", "\363", 3}, + { act2, "Throw\tt", "t", 2}, + { act2, "Untrap\t#u", "#u", 3}, + { act2, "Up\t<", "<", 3}, + { act2, "Wipe face\tAlt+W", "\367", 3}, + + { magic, "Quaff potion\tq?", "q?", 3}, + { magic, "Read scroll/book\tr?", "r?", 3}, + { magic, "Zap wand\tz?", "z?", 3}, + { magic, "Zap spell\tShift+Z", "Z", 3}, + { magic, "Dip\tAlt+D", "\344", 3}, + { magic, "Rub\tAlt+R", "\362", 3}, + { magic, "Invoke\tAlt+I", "\351", 3}, + { magic, 0, 0, 3}, + { magic, "Offer\tAlt+O", "\357", 3}, + { magic, "Pray\tAlt+P", "\360", 3}, + { magic, 0, 0, 3}, + { magic, "Teleport\tCtrl+T", "\024", 3}, + { magic, "Monster action\tAlt+M", "\355", 3}, + { magic, "Turn undead\tAlt+T", "\364", 3}, + + { help, "Help\t?", "?", 3}, + { help, 0, 0, 3}, + { help, "What is here\t:", ":", 3}, + { help, "What is there\t;", ";", 3}, + { help, "What is...\t/y", "/y", 2}, + { help, 0, 0, 1}, + + { info, "Inventory\ti", "i", 3}, +#ifdef SLASHEM + { info, "Angbandish inventory\t*", "*", 3}, +#endif + { info, "Conduct\t#co", "#co", 3}, + { info, "Discoveries\t\\", "\\", 3}, + { info, "List/reorder spells\t+", "+", 3}, + { info, "Adjust letters\tAlt+A", "\341", 2}, + { info, 0, 0, 3}, + { info, "Name object\tAlt+N", "\356y?", 3}, + { info, "Name object type\tAlt+N", "\356n?", 3}, + { info, "Name creature\tShift+C", "C", 3}, + { info, 0, 0, 3}, + { info, "Qualifications\tAlt+E", "\345", 3}, + + { 0, 0, 0, 0 } + }; + + int i; + int count=0; + for (i=0; item[i].menu; i++) + if (item[i].name) count++; + + macro=new const char* [count]; + + game->insertItem("Qt settings...",1000); + help->insertItem("About Qt NetHack...",2000); + //help->insertItem("NetHack Guidebook...",3000); + help->insertSeparator(); + + count=0; + for (i=0; item[i].menu; i++) { + if ( item[i].flags & (qt_compact_mode ? 1 : 2) ) { + if (item[i].name) { + QString name = item[i].name; + if ( qt_compact_mode ) // accelerators aren't + name.replace(QRegExp("\t.*"),""); + item[i].menu->insertItem(name,count); + macro[count++]=item[i].action; + } else { + item[i].menu->insertSeparator(); + } + } + } + + menubar->insertItem("Game",game); + menubar->insertItem("Gear",apparel); + + if ( qt_compact_mode ) { + menubar->insertItem("A-J",act1); + menubar->insertItem("K-Z",act2); + menubar->insertItem("Magic",magic); + menubar->insertItem(QPixmap(info_xpm),info); + menubar->insertItem(QPixmap(map_xpm), this, SLOT(raiseMap())); + menubar->insertItem(QPixmap(msg_xpm), this, SLOT(raiseMessages())); + menubar->insertItem(QPixmap(stat_xpm), this, SLOT(raiseStatus())); + } else { + menubar->insertItem("Action",act1); + menubar->insertItem("Magic",magic); + menubar->insertItem("Info",info); + menubar->insertSeparator(); + menubar->insertItem("Help",help); + } + + QSignalMapper* sm = new QSignalMapper(this); + connect(sm, SIGNAL(mapped(const QString&)), this, SLOT(doKeys(const QString&))); + QToolButton* tb; + tb = new SmallToolButton( QPixmap(again_xpm),"Again","Action", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "\001" ); + tb = new SmallToolButton( QPixmap(get_xpm),"Get","Action", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "," ); + tb = new SmallToolButton( QPixmap(kick_xpm),"Kick","Action", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "\004" ); + tb = new SmallToolButton( QPixmap(throw_xpm),"Throw","Action", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "t" ); + tb = new SmallToolButton( QPixmap(fire_xpm),"Fire","Action", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "f" ); + tb = new SmallToolButton( QPixmap(drop_xpm),"Drop","Action", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "D" ); + tb = new SmallToolButton( QPixmap(eat_xpm),"Eat","Action", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "e" ); + tb = new SmallToolButton( QPixmap(rest_xpm),"Rest","Action", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "." ); + tb = new SmallToolButton( QPixmap(cast_a_xpm),"Cast A","Magic", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "Za" ); + tb = new SmallToolButton( QPixmap(cast_b_xpm),"Cast B","Magic", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "Zb" ); + tb = new SmallToolButton( QPixmap(cast_c_xpm),"Cast C","Magic", sm, SLOT(map()), toolbar ); + sm->setMapping(tb, "Zc" ); + if ( !qt_compact_mode ) { + QWidget* filler = new QWidget(toolbar); + filler->setBackgroundMode(PaletteButton); + toolbar->setStretchableWidget(filler); + } + + connect(menubar,SIGNAL(activated(int)),this,SLOT(doMenuItem(int))); + +#ifdef KDE + setMenu (menubar); +#endif + + int x=0,y=0; + int w=QApplication::desktop()->width()-10; // XXX arbitrary extra space for frame + int h=QApplication::desktop()->height()-50; + + int maxwn; + int maxhn; + if (qt_tilewidth != NULL) { + maxwn = atoi(qt_tilewidth) * COLNO + 10; + } else { + maxwn = 1400; + } + if (qt_tileheight != NULL) { + maxhn = atoi(qt_tileheight) * ROWNO * 6/4; + } else { + maxhn = 1024; + } + + // Be exactly the size we want to be - full map... + if (w>maxwn) { + x+=(w-maxwn)/2; + w=maxwn; // Doesn't need to be any wider + } + if (h>maxhn) { + y+=(h-maxhn)/2; + h=maxhn; // Doesn't need to be any taller + } + + setGeometry(x,y,w,h); + + if ( qt_compact_mode ) { + stack = new QWidgetStack(this); + setCentralWidget(stack); + } else { + setCentralWidget(new QWidget(this)); + invusage = new NetHackQtInvUsageWindow(centralWidget()); + } +} + +void NetHackQtMainWindow::zoomMap() +{ + qt_settings->toggleGlyphSize(); +} + +void NetHackQtMainWindow::raiseMap() +{ + if ( stack->id(stack->visibleWidget()) == 0 ) { + zoomMap(); + } else { + stack->raiseWidget(0); + } +} + +void NetHackQtMainWindow::raiseMessages() +{ + stack->raiseWidget(1); +} + +void NetHackQtMainWindow::raiseStatus() +{ + stack->raiseWidget(2); +} + +class NetHackMimeSourceFactory : public QMimeSourceFactory { +public: + const QMimeSource* data(const QString& abs_name) const + { + const QMimeSource* r = 0; + if ( (NetHackMimeSourceFactory*)this == QMimeSourceFactory::defaultFactory() ) + r = QMimeSourceFactory::data(abs_name); + else + r = QMimeSourceFactory::defaultFactory()->data(abs_name); + if ( !r ) { + int sl = abs_name.length(); + do { + sl = abs_name.findRev('/',sl-1); + QString name = sl>=0 ? abs_name.mid(sl+1) : abs_name; + int dot = name.findRev('.'); + if ( dot >= 0 ) + name = name.left(dot); + if ( name == "map" ) + r = new QImageDrag(QImage(map_xpm)); + else if ( name == "msg" ) + r = new QImageDrag(QImage(msg_xpm)); + else if ( name == "stat" ) + r = new QImageDrag(QImage(stat_xpm)); + } while (!r && sl>0); + } + return r; + } +}; + +void NetHackQtMainWindow::doMenuItem(int id) +{ + switch (id) { + case 1000: + centerOnMain(qt_settings); + qt_settings->show(); + break; + case 2000: + QMessageBox::about(this, "About Qt NetHack", aboutMsg()); + break; + case 3000: { + QDialog dlg(this,0,TRUE); + (new QVBoxLayout(&dlg))->setAutoAdd(TRUE); + QTextBrowser browser(&dlg); + NetHackMimeSourceFactory ms; + browser.setMimeSourceFactory(&ms); + browser.setSource(QDir::currentDirPath()+"/Guidebook.html"); + if ( qt_compact_mode ) + dlg.showMaximized(); + dlg.exec(); + } + break; + default: + if ( id >= 0 ) + doKeys(macro[id]); + } +} + +void NetHackQtMainWindow::doKeys(const QString& k) +{ + keysink.Put(k); + qApp->exit_loop(); +} + +void NetHackQtMainWindow::AddMessageWindow(NetHackQtMessageWindow* window) +{ + message=window; + ShowIfReady(); +} + +void NetHackQtMainWindow::AddMapWindow(NetHackQtMapWindow* window) +{ + map=window; + ShowIfReady(); + connect(map,SIGNAL(resized()),this,SLOT(layout())); +} + +void NetHackQtMainWindow::AddStatusWindow(NetHackQtStatusWindow* window) +{ + status=window; + ShowIfReady(); +} + +void NetHackQtMainWindow::RemoveWindow(NetHackQtWindow* window) +{ + if (window==status) { + status=0; + ShowIfReady(); + } else if (window==map) { + map=0; + ShowIfReady(); + } else if (window==message) { + message=0; + ShowIfReady(); + } +} + +void NetHackQtMainWindow::updateInventory() +{ + if ( invusage ) + invusage->repaint(FALSE); +} + +void NetHackQtMainWindow::fadeHighlighting() +{ + if (status) { + status->fadeHighlighting(); + } +} + +void NetHackQtMainWindow::layout() +{ + if ( qt_compact_mode ) + return; + if (message && map && status) { + QSize maxs=map->Widget()->maximumSize(); + int maph=QMIN(height()*2/3,maxs.height()); + + QWidget* c = centralWidget(); + int h=c->height(); + int toph=h-maph; + int iuw=3*qt_settings->glyphs().width(); + int topw=(c->width()-iuw)/2; + + message->Widget()->setGeometry(0,0,topw,toph); + invusage->setGeometry(topw,0,iuw,toph); + status->Widget()->setGeometry(topw+iuw,0,topw,toph); + map->Widget()->setGeometry(QMAX(0,(c->width()-maxs.width())/2), + toph,c->width(),maph); + } +} + +void NetHackQtMainWindow::resizeEvent(QResizeEvent*) +{ + layout(); +#ifdef KDE + updateRects(); +#endif +} + +void NetHackQtMainWindow::keyReleaseEvent(QKeyEvent* event) +{ + if ( dirkey ) { + doKeys(QString(QChar(dirkey))); + if ( !event->isAutoRepeat() ) + dirkey = 0; + } +} + +void NetHackQtMainWindow::keyPressEvent(QKeyEvent* event) +{ + // Global key controls + + // For desktop, arrow keys scroll map, since we don't want players + // to think that's the way to move. For handhelds, the normal way is to + // click-to-travel, so we allow the cursor keys for fine movements. + + // 321 + // 4 0 + // 567 + + if ( event->isAutoRepeat() && + event->key() >= Key_Left && event->key() <= Key_Down ) + return; + + const char* d = Cmd.dirchars; + switch (event->key()) { + case Key_Up: + if ( dirkey == d[0] ) + dirkey = d[1]; + else if ( dirkey == d[4] ) + dirkey = d[3]; + else + dirkey = d[2]; + break; case Key_Down: + if ( dirkey == d[0] ) + dirkey = d[7]; + else if ( dirkey == d[4] ) + dirkey = d[5]; + else + dirkey = d[6]; + break; case Key_Left: + if ( dirkey == d[2] ) + dirkey = d[1]; + else if ( dirkey == d[6] ) + dirkey = d[7]; + else + dirkey = d[0]; + break; case Key_Right: + if ( dirkey == d[2] ) + dirkey = d[3]; + else if ( dirkey == d[6] ) + dirkey = d[5]; + else + dirkey = d[4]; + break; case Key_Prior: + dirkey = 0; + if (message) message->Scroll(0,-1); + break; case Key_Next: + dirkey = 0; + if (message) message->Scroll(0,+1); + break; case Key_Space: + if ( flags.rest_on_space ) { + event->ignore(); + return; + } + case Key_Enter: + if ( map ) + map->clickCursor(); + break; default: + dirkey = 0; + event->ignore(); + } +} + +void NetHackQtMainWindow::closeEvent(QCloseEvent* e) +{ + if ( g.program_state.something_worth_saving ) { + switch ( QMessageBox::information( this, "NetHack", + "This will end your NetHack session", + "&Save", "&Cancel", 0, 1 ) ) + { + case 0: + // See dosave() function + if (dosave0()) { + u.uhp = -1; + NetHackQtBind::qt_exit_nhwindows(0); + nh_terminate(EXIT_SUCCESS); + } + break; + case 1: + break; // ignore the event + } + } else { + e->accept(); + } +} + +void NetHackQtMainWindow::ShowIfReady() +{ + if (message && map && status) { + QPoint pos(0,0); + QWidget* p = qt_compact_mode ? stack : centralWidget(); + message->Widget()->recreate(p,0,pos); + map->Widget()->recreate(p,0,pos); + status->Widget()->recreate(p,0,pos); + if ( qt_compact_mode ) { + message->setMap(map); + stack->addWidget(map->Widget(), 0); + stack->addWidget(message->Widget(), 1); + stack->addWidget(status->Widget(), 2); + raiseMap(); + } else { + layout(); + } + showMaximized(); + } else if (isVisible()) { + hide(); + } +} + + +NetHackQtYnDialog::NetHackQtYnDialog(NetHackQtKeyBuffer& keysrc,const char* q,const char* ch,char df) : + QDialog(qApp->mainWidget(),0,FALSE), + question(q), choices(ch), def(df), + keysource(keysrc) +{ + setCaption("NetHack: Question"); +} + +char NetHackQtYnDialog::Exec() +{ + QString ch(choices); + int ch_per_line=6; + QString qlabel; + QString enable; + if ( qt_compact_mode && !choices ) { + // expand choices from prompt + // ##### why isn't choices set properly??? + const char* c=question; + while ( *c && *c != '[' ) + c++; + qlabel = QString(question).left(c-question); + if ( *c ) { + c++; + if ( *c == '-' ) + ch.append(*c++); + char from=0; + while ( *c && *c != ']' && *c != ' ' ) { + if ( *c == '-' ) { + from = c[-1]; + } else if ( from ) { + for (char f=from+1; f<=*c; f++) + ch.append(f); + from = 0; + } else { + ch.append(*c); + from = 0; + } + c++; + } + if ( *c == ' ' ) { + while ( *c && *c != ']' ) { + if ( *c == '*' || *c == '?' ) + ch.append(*c); + c++; + } + } + } + if ( strstr(question, "what direction") ) { + // We replace this regardless, since sometimes you get choices. + const char* d = Cmd.dirchars; + enable=ch; + ch=""; + ch.append(d[1]); + ch.append(d[2]); + ch.append(d[3]); + ch.append(d[0]); + ch.append('.'); + ch.append(d[4]); + ch.append(d[7]); + ch.append(d[6]); + ch.append(d[5]); + ch.append(d[8]); + ch.append(d[9]); + ch_per_line = 3; + def = ' '; + } else { + // Hmm... they'll have to use a virtual keyboard + } + } else { + qlabel = question; + } + if (!ch.isNull()) { + QVBoxLayout vb(this); + vb.setAutoAdd(TRUE); + bool bigq = qlabel.length()>40; + if ( bigq ) { + QLabel* q = new QLabel(qlabel,this); + q->setAlignment(AlignLeft|WordBreak); + q->setMargin(4); + } + QButtonGroup group(ch_per_line, Horizontal, + bigq ? QString::null : qlabel, this); + + int nchoices=ch.length(); + + bool allow_count=ch.contains('#'); + + const int margin=8; + const int gutter=8; + const int extra=fontMetrics().height(); // Extra for group + int x=margin, y=extra+margin; + int butsize=fontMetrics().height()*2+5; + + QPushButton* button; + for (int i=0; isetEnabled(FALSE); + } + button->setFixedSize(butsize,butsize); // Square + if (ch[i]==def) button->setDefault(TRUE); + if (i%10==9) { + // last in row + x=margin; + y+=butsize+gutter; + } else { + x+=butsize+gutter; + } + } + + connect(&group,SIGNAL(clicked(int)),this,SLOT(doneItem(int))); + + QLabel* lb=0; + QLineEdit* le=0; + + if (allow_count) { + QHBox *hb = new QHBox(this); + lb=new QLabel("Count: ",hb); + le=new QLineEdit(hb); + } + + adjustSize(); + centerOnMain(this); + show(); + char choice=0; + char ch_esc=0; + for (uint i=0; i= 1000 ) { + choice = ch[result() - 1000].latin1(); + } + if ( !choice ) + qApp->enter_loop(); + } + hide(); + if (allow_count && !le->text().isEmpty()) { + yn_number=atoi(le->text()); + choice='#'; + } + return choice; + } else { + QLabel label(qlabel,this); + QPushButton cancel("Dismiss",this); + label.setFrameStyle(QFrame::Box|QFrame::Sunken); + label.setAlignment(AlignCenter); + label.resize(fontMetrics().width(qlabel)+60,30+fontMetrics().height()); + cancel.move(width()/2-cancel.width()/2,label.geometry().bottom()+8); + connect(&cancel,SIGNAL(clicked()),this,SLOT(reject())); + centerOnMain(this); + setResult(-1); + show(); + while (result()<0 && keysource.Empty()) { + qApp->enter_loop(); + } + hide(); + if (keysource.Empty()) { + return '\033'; + } else { + return keysource.GetAscii(); + } + } +} +void NetHackQtYnDialog::keyPressEvent(QKeyEvent* event) +{ + // Don't want QDialog's Return/Esc behaviour + event->ignore(); +} + +void NetHackQtYnDialog::doneItem(int i) +{ + done(i+1000); +} + +void NetHackQtYnDialog::done(int i) +{ + setResult(i); + qApp->exit_loop(); +} + +NetHackQtGlyphs::NetHackQtGlyphs() +{ + const char* tile_file = "nhtiles.bmp"; + if ( iflags.wc_tile_file ) + tile_file = iflags.wc_tile_file; + + if (!img.load(tile_file)) { + tile_file = "x11tiles"; + if (!img.load(tile_file)) { + QString msg; + msg.sprintf("Cannot load x11tiles or nhtiles.bmp"); + QMessageBox::warning(0, "IO Error", msg); + } else { + tiles_per_row = TILES_PER_ROW; + if (img.width()%tiles_per_row) { + impossible( + "Tile file \"%s\" has %d columns, not multiple of row count (%d)", + tile_file, img.width(), tiles_per_row); + } + } + } else { + tiles_per_row = 40; + } + + if ( iflags.wc_tile_width ) + tilefile_tile_W = iflags.wc_tile_width; + else + tilefile_tile_W = img.width() / tiles_per_row; + if ( iflags.wc_tile_height ) + tilefile_tile_H = iflags.wc_tile_height; + else + tilefile_tile_H = tilefile_tile_W; + + setSize(tilefile_tile_W, tilefile_tile_H); +} + +void NetHackQtGlyphs::drawGlyph(QPainter& painter, int glyph, int x, int y) +{ + int tile = glyph2tile[glyph]; + int px = (tile%tiles_per_row)*width(); + int py = tile/tiles_per_row*height(); + + painter.drawPixmap( + x, + y, + pm, + px,py, + width(),height() + ); +} +void NetHackQtGlyphs::drawCell(QPainter& painter, int glyph, int cellx, int celly) +{ + drawGlyph(painter,glyph,cellx*width(),celly*height()); +} +void NetHackQtGlyphs::setSize(int w, int h) +{ + if ( size == QSize(w,h) ) + return; + + bool was1 = size == pm1.size(); + size = QSize(w,h); + if (!w || !h) + return; // Still not decided + + if ( size == pm1.size() ) { + pm = pm1; + return; + } + if ( size == pm2.size() ) { + pm = pm2; + return; + } + + if (w==tilefile_tile_W && h==tilefile_tile_H) { + pm.convertFromImage(img); + } else { + QApplication::setOverrideCursor( Qt::waitCursor ); + QImage scaled = img.smoothScale( + w*img.width()/tilefile_tile_W, + h*img.height()/tilefile_tile_H + ); + pm.convertFromImage(scaled,Qt::ThresholdDither|Qt::PreferDither); + QApplication::restoreOverrideCursor(); + } + (was1 ? pm2 : pm1) = pm; +} + + +////////////////////////////////////////////////////////////// +// +// The ugly C binding classes... +// +////////////////////////////////////////////////////////////// + + +NetHackQtMenuOrTextWindow::NetHackQtMenuOrTextWindow(NetHackQtKeyBuffer& ks) : + actual(0), + keysource(ks) +{ +} + +QWidget* NetHackQtMenuOrTextWindow::Widget() +{ + if (!actual) impossible("Widget called before we know if Menu or Text"); + return actual->Widget(); +} + +// Text +void NetHackQtMenuOrTextWindow::Clear() +{ + if (!actual) + impossible("Clear called before we know if Menu or Text"); + else + actual->Clear(); +} + +void NetHackQtMenuOrTextWindow::Display(bool block) +{ + if (!actual) + impossible("Display called before we know if Menu or Text"); + else + actual->Display(block); +} + +bool NetHackQtMenuOrTextWindow::Destroy() +{ + bool res = FALSE; + + if (!actual) + impossible("Destroy called before we know if Menu or Text"); + else + res = actual->Destroy(); + + return res; +} + +void NetHackQtMenuOrTextWindow::PutStr(int attr, const char* text) +{ + if (!actual) actual=new NetHackQtTextWindow(keysource); + actual->PutStr(attr,text); +} + +// Menu +void NetHackQtMenuOrTextWindow::StartMenu() +{ + if (!actual) actual=new NetHackQtMenuWindow(keysource); + actual->StartMenu(); +} + +void NetHackQtMenuOrTextWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, + const char* str, bool presel) +{ + if (!actual) impossible("AddMenu called before we know if Menu or Text"); + actual->AddMenu(glyph,identifier,ch,gch,attr,str,presel); +} + +void NetHackQtMenuOrTextWindow::EndMenu(const char* prompt) +{ + if (!actual) impossible("EndMenu called before we know if Menu or Text"); + actual->EndMenu(prompt); +} + +int NetHackQtMenuOrTextWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) +{ + if (!actual) impossible("SelectMenu called before we know if Menu or Text"); + return actual->SelectMenu(how,menu_list); +} + + +// XXX Should be from Options +// +// XXX Hmm. Tricky part is that perhaps some macros should only be active +// XXX when a key is about to be gotten. For example, the user could +// XXX define "-" to do "E-yyyyyyyy\r", but would still need "-" for +// XXX other purposes. Maybe just too bad. +// +struct { + int key; + int state; + const char* macro; +} key_macro[]={ + { Qt::Key_F1, 0, "n100." }, // Rest (x100) + { Qt::Key_F2, 0, "n20s" }, // Search (x20) + { Qt::Key_F3, 0, "o8o4o6o2o8o4o6o2o8o4o6o2" }, // Open all doors (x3) + { Qt::Key_Tab, 0, "\001" }, + { 0, 0, 0 } +}; + + +NetHackQtBind::NetHackQtBind(int& argc, char** argv) : +#ifdef KDE + KApplication(argc,argv) +#elif defined(QWS) // not quite the right condition + QPEApplication(argc,argv) +#else + QApplication(argc,argv) +#endif +{ + QPixmap pm("nhsplash.xpm"); + if ( iflags.wc_splash_screen && !pm.isNull() ) { + QVBox *vb = new QVBox(0,0, + WStyle_Customize | WStyle_NoBorder | nh_WX11BypassWM | WStyle_StaysOnTop ); + splash = vb; + QLabel *lsplash = new QLabel(vb); + lsplash->setAlignment(AlignCenter); + lsplash->setPixmap(pm); + QLabel* capt = new QLabel("Loading...",vb); + capt->setAlignment(AlignCenter); + if ( pm.mask() ) { + lsplash->setFixedSize(pm.size()); + lsplash->setMask(*pm.mask()); + } + splash->move((QApplication::desktop()->width()-pm.width())/2, + (QApplication::desktop()->height()-pm.height())/2); + //splash->setGeometry(0,0,100,100); + if ( qt_compact_mode ) { + splash->showMaximized(); + } else { + vb->setFrameStyle(QFrame::WinPanel|QFrame::Raised); + vb->setMargin(10); + splash->adjustSize(); + splash->show(); + } + + // force content refresh outside event loop + splash->repaint(FALSE); + lsplash->repaint(FALSE); + capt->repaint(FALSE); + qApp->flushX(); + + } else { + splash = 0; + } + main = new NetHackQtMainWindow(keybuffer); +#if defined(QWS) // not quite the right condition + showMainWidget(main); +#else + setMainWidget(main); +#endif + qt_settings=new NetHackQtSettings(main->width(),main->height()); +} + +void NetHackQtBind::qt_init_nhwindows(int* argc, char** argv) +{ +#ifdef UNIX +// Userid control +// +// Michael Hohmuth ... +// +// As the game runs setuid games, it must seteuid(getuid()) before +// calling XOpenDisplay(), and reset the euid afterwards. +// Otherwise, it can't read the $HOME/.Xauthority file and whines about +// not being able to open the X display (if a magic-cookie +// authorization mechanism is being used). + + uid_t gamesuid=geteuid(); + seteuid(getuid()); +#endif + + QApplication::setColorSpec(ManyColor); + instance=new NetHackQtBind(*argc,argv); + +#ifdef UNIX + seteuid(gamesuid); +#endif + +#ifdef _WS_WIN_ + // This nethack engine feature should be moved into windowport API + nt_kbhit = NetHackQtBind::qt_kbhit; +#endif +} + +int NetHackQtBind::qt_kbhit() +{ + return !keybuffer.Empty(); +} + +static bool have_asked = FALSE; + +void NetHackQtBind::qt_player_selection() +{ + if ( !have_asked ) + qt_askname(); +} + +NetHackQtSavedGameSelector::NetHackQtSavedGameSelector(const char** saved) : + QDialog(qApp->mainWidget(),"sgsel",TRUE) +{ + QVBoxLayout *vbl = new QVBoxLayout(this,6); + QHBox* hb; + + QLabel* logo = new QLabel(this); vbl->addWidget(logo); + logo->setAlignment(AlignCenter); + logo->setPixmap(QPixmap("nhsplash.xpm")); + QLabel* attr = new QLabel("by the NetHack DevTeam",this); + attr->setAlignment(AlignCenter); + vbl->addWidget(attr); + vbl->addStretch(2); + /* + QLabel* logo = new QLabel(hb); + hb = new QHBox(this); + vbl->addWidget(hb, AlignCenter); + logo->setPixmap(QPixmap(nh_icon)); + logo->setAlignment(AlignRight|AlignVCenter); + new QLabel(nh_attribution,hb); + */ + + hb = new QHBox(this); + vbl->addWidget(hb, AlignCenter); + QPushButton* q = new QPushButton("Quit",hb); + connect(q, SIGNAL(clicked()), this, SLOT(reject())); + QPushButton* c = new QPushButton("New Game",hb); + connect(c, SIGNAL(clicked()), this, SLOT(accept())); + c->setDefault(TRUE); + + QButtonGroup* bg = new QButtonGroup(3, Horizontal, "Saved Characters",this); + vbl->addWidget(bg); + connect(bg, SIGNAL(clicked(int)), this, SLOT(done(int))); + for (int i=0; saved[i]; i++) { + QPushButton* b = new QPushButton(saved[i],bg); + bg->insert(b, i+2); + } +} + +int NetHackQtSavedGameSelector::choose() +{ +#if defined(QWS) // probably safe with Qt 3, too (where show!=exec in QDialog). + if ( qt_compact_mode ) + showMaximized(); +#endif + return exec()-2; +} + +void NetHackQtBind::qt_askname() +{ + have_asked = TRUE; + + // We do it all here, and nothing in askname + + char** saved = get_saved_games(); + int ch = -1; + if ( saved && *saved ) { + if ( splash ) splash->hide(); + NetHackQtSavedGameSelector sgsel((const char**)saved); + ch = sgsel.choose(); + if ( ch >= 0 ) + strcpy(g.plname,saved[ch]); + } + free_saved_games(saved); + + switch (ch) { + case -1: + if ( splash ) splash->hide(); + if (NetHackQtPlayerSelector(keybuffer).Choose()) + return; + case -2: + break; + default: + return; + } + + // Quit + clearlocks(); + qt_exit_nhwindows(0); + nh_terminate(0); +} + +void NetHackQtBind::qt_get_nh_event() +{ +} + +#if defined(QWS) +// Kludge to access lastWindowClosed() signal. +class TApp : public QApplication { +public: + TApp(int& c, char**v) : QApplication(c,v) {} + void lwc() { emit lastWindowClosed(); } +}; +#endif + +void NetHackQtBind::qt_exit_nhwindows(const char *) +{ +#if defined(QWS) + // Avoids bug in SHARP SL5500 + ((TApp*)qApp)->lwc(); + qApp->quit(); +#endif + + delete instance; // ie. qApp +} + +void NetHackQtBind::qt_suspend_nhwindows(const char *) +{ +} + +void NetHackQtBind::qt_resume_nhwindows() +{ +} + +static QArray id_to_window; + +winid NetHackQtBind::qt_create_nhwindow(int type) +{ + winid id; + for (id = 0; id < (winid) id_to_window.size(); id++) { + if ( !id_to_window[id] ) + break; + } + if ( id == (winid) id_to_window.size() ) + id_to_window.resize(id+1); + + NetHackQtWindow* window=0; + + switch (type) { + case NHW_MAP: { + NetHackQtMapWindow* w=new NetHackQtMapWindow(clickbuffer); + main->AddMapWindow(w); + window=w; + } break; case NHW_MESSAGE: { + NetHackQtMessageWindow* w=new NetHackQtMessageWindow; + main->AddMessageWindow(w); + window=w; + } break; case NHW_STATUS: { + NetHackQtStatusWindow* w=new NetHackQtStatusWindow; + main->AddStatusWindow(w); + window=w; + } break; case NHW_MENU: + window=new NetHackQtMenuOrTextWindow(keybuffer); + break; case NHW_TEXT: + window=new NetHackQtTextWindow(keybuffer); + } + + window->nhid = id; + + // Note: use of isHidden does not work with Qt 2.1 + if ( splash +#if QT_VERSION >= 300 + && !main->isHidden() +#else + && main->isVisible() +#endif + ) + { + delete splash; + splash = 0; + } + + id_to_window[id] = window; + return id; +} + +void NetHackQtBind::qt_clear_nhwindow(winid wid) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->Clear(); +} + +void NetHackQtBind::qt_display_nhwindow(winid wid, BOOLEAN_P block) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->Display(block); +} + +void NetHackQtBind::qt_destroy_nhwindow(winid wid) +{ + NetHackQtWindow* window=id_to_window[wid]; + main->RemoveWindow(window); + if (window->Destroy()) + delete window; + id_to_window[wid] = 0; +} + +void NetHackQtBind::qt_curs(winid wid, int x, int y) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->CursorTo(x,y); +} + +void NetHackQtBind::qt_putstr(winid wid, int attr, const char *text) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->PutStr(attr,text); +} + +void NetHackQtBind::qt_display_file(const char *filename, BOOLEAN_P must_exist) +{ + NetHackQtTextWindow* window=new NetHackQtTextWindow(keybuffer); + bool complain = FALSE; + +#ifdef DLB + { + dlb *f; + char buf[BUFSZ]; + char *cr; + + window->Clear(); + f = dlb_fopen(filename, "r"); + if (!f) { + complain = must_exist; + } else { + while (dlb_fgets(buf, BUFSZ, f)) { + if ((cr = index(buf, '\n')) != 0) *cr = 0; +#ifdef MSDOS + if ((cr = index(buf, '\r')) != 0) *cr = 0; +#endif + if (index(buf, '\t') != 0) (void) tabexpand(buf); + window->PutStr(ATR_NONE, buf); + } + window->Display(FALSE); + (void) dlb_fclose(f); + } + } +#else + QFile file(filename); + + if (file.open(IO_ReadOnly)) { + char line[128]; + while (file.readLine(line,127) >= 0) { + line[strlen(line)-1]=0;// remove newline + window->PutStr(ATR_NONE,line); + } + window->Display(FALSE); + } else { + complain = must_exist; + } +#endif + + if (complain) { + QString message; + message.sprintf("File not found: %s\n",filename); + QMessageBox::message("File Error", (const char*)message, "Ignore"); + } +} + +void NetHackQtBind::qt_start_menu(winid wid) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->StartMenu(); +} + +void NetHackQtBind::qt_add_menu(winid wid, int glyph, + const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr, + const char *str, BOOLEAN_P presel) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->AddMenu(glyph, identifier, ch, gch, attr, str, presel); +} + +void NetHackQtBind::qt_end_menu(winid wid, const char *prompt) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->EndMenu(prompt); +} + +int NetHackQtBind::qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list) +{ + NetHackQtWindow* window=id_to_window[wid]; + return window->SelectMenu(how,menu_list); +} + +void NetHackQtBind::qt_update_inventory() +{ + if (main) + main->updateInventory(); + /* doesn't work yet + if (g.program_state.something_worth_saving && iflags.perm_invent) + display_inventory(NULL, FALSE); + */ +} + +void NetHackQtBind::qt_mark_synch() +{ +} + +void NetHackQtBind::qt_wait_synch() +{ +} + +void NetHackQtBind::qt_cliparound(int x, int y) +{ + // XXXNH - winid should be a parameter! + qt_cliparound_window(WIN_MAP,x,y); +} + +void NetHackQtBind::qt_cliparound_window(winid wid, int x, int y) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->ClipAround(x,y); +} +void NetHackQtBind::qt_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph, int bkglyph) +{ + NetHackQtWindow* window=id_to_window[wid]; + window->PrintGlyph(x,y,glyph); +} +//void NetHackQtBind::qt_print_glyph_compose(winid wid,XCHAR_P x,XCHAR_P y,int glyph1, int glyph2) +//{ + //NetHackQtWindow* window=id_to_window[wid]; + //window->PrintGlyphCompose(x,y,glyph1,glyph2); +//} + +void NetHackQtBind::qt_raw_print(const char *str) +{ + puts(str); +} + +void NetHackQtBind::qt_raw_print_bold(const char *str) +{ + puts(str); +} + +int NetHackQtBind::qt_nhgetch() +{ + if (main) + main->fadeHighlighting(); + + // Process events until a key arrives. + // + while (keybuffer.Empty() +#ifdef SAFERHANGUP + && !g.program_state.done_hup +#endif + ) { + qApp->enter_loop(); + } + +#ifdef SAFERHANGUP + if (g.program_state.done_hup && keybuffer.Empty()) return '\033'; +#endif + return keybuffer.GetAscii(); +} + +int NetHackQtBind::qt_nh_poskey(int *x, int *y, int *mod) +{ + if (main) + main->fadeHighlighting(); + + // Process events until a key or map-click arrives. + // + while (keybuffer.Empty() && clickbuffer.Empty() +#ifdef SAFERHANGUP + && !g.program_state.done_hup +#endif + ) { + qApp->enter_loop(); + } +#ifdef SAFERHANGUP + if (g.program_state.done_hup && keybuffer.Empty()) return '\033'; +#endif + if (!keybuffer.Empty()) { + return keybuffer.GetAscii(); + } else { + *x=clickbuffer.NextX(); + *y=clickbuffer.NextY(); + *mod=clickbuffer.NextMod(); + clickbuffer.Get(); + return 0; + } +} + +void NetHackQtBind::qt_nhbell() +{ + QApplication::beep(); +} + +int NetHackQtBind::qt_doprev_message() +{ + // Don't need it - uses scrollbar + // XXX but could make this a shortcut + return 0; +} + +char NetHackQtBind::qt_yn_function(const char *question, const char *choices, CHAR_P def) +{ + if (qt_settings->ynInMessages() && WIN_MESSAGE!=WIN_ERR) { + // Similar to X11 windowport `slow' feature. + + char message[BUFSZ]; + char yn_esc_map='\033'; + + if (choices) { + char *cb, choicebuf[QBUFSZ]; + Strcpy(choicebuf, choices); + if ((cb = index(choicebuf, '\033')) != 0) { + // anything beyond is hidden + *cb = '\0'; + } + (void)strncpy(message, question, QBUFSZ-1); + message[QBUFSZ-1] = '\0'; + Sprintf(eos(message), " [%s]", choicebuf); + if (def) Sprintf(eos(message), " (%c)", def); + Strcat(message, " "); + // escape maps to 'q' or 'n' or default, in that order + yn_esc_map = (index(choices, 'q') ? 'q' : + (index(choices, 'n') ? 'n' : def)); + } else { + Strcpy(message, question); + } + +#ifdef USE_POPUPS + // Improve some special-cases (DIRKS 08/02/23) + if (strcmp (choices,"ynq") == 0) { + switch (QMessageBox::information (qApp->mainWidget(),"NetHack",question,"&Yes","&No","&Quit",0,2)) + { + case 0: return 'y'; + case 1: return 'n'; + case 2: return 'q'; + } + } + + if (strcmp (choices,"yn") == 0) { + switch (QMessageBox::information(qApp->mainWidget(),"NetHack",question,"&Yes", "&No",0,1)) + { + case 0: return 'y'; + case 1: return 'n'; + } + } +#endif + + NetHackQtBind::qt_putstr(WIN_MESSAGE, ATR_BOLD, message); + + int result=-1; + while (result<0) { + char ch=NetHackQtBind::qt_nhgetch(); + if (ch=='\033') { + result=yn_esc_map; + } else if (choices && !index(choices,ch)) { + if (def && (ch==' ' || ch=='\r' || ch=='\n')) { + result=def; + } else { + NetHackQtBind::qt_nhbell(); + // and try again... + } + } else { + result=ch; + } + } + + NetHackQtBind::qt_clear_nhwindow(WIN_MESSAGE); + + return result; + } else { + NetHackQtYnDialog dialog(keybuffer,question,choices,def); + return dialog.Exec(); + } +} + +void NetHackQtBind::qt_getlin(const char *prompt, char *line) +{ + NetHackQtStringRequestor requestor(keybuffer,prompt); + if (!requestor.Get(line)) { + line[0]=0; + } +} + +NetHackQtExtCmdRequestor::NetHackQtExtCmdRequestor(NetHackQtKeyBuffer& ks) : + QDialog(qApp->mainWidget(), "ext-cmd", FALSE), + keysource(ks) +{ + int marg=4; + QVBoxLayout *l = new QVBoxLayout(this,marg,marg); + + QPushButton* can = new QPushButton("Cancel", this); + can->setDefault(TRUE); + can->setMinimumSize(can->sizeHint()); + l->addWidget(can); + + QButtonGroup *group=new QButtonGroup("",0); + QGroupBox *grid=new QGroupBox("Extended commands",this); + l->addWidget(grid); + + int i; + int butw=50; + QFontMetrics fm = fontMetrics(); + for (i=0; extcmdlist[i].ef_txt; i++) { + butw = QMAX(butw,30+fm.width(extcmdlist[i].ef_txt)); + } + int ncols=4; + int nrows=(i+ncols-1)/ncols; + + QVBoxLayout* bl = new QVBoxLayout(grid,marg); + bl->addSpacing(fm.height()); + QGridLayout* gl = new QGridLayout(nrows,ncols,marg); + bl->addLayout(gl); + for (i=0; extcmdlist[i].ef_txt; i++) { + QPushButton* pb=new QPushButton(extcmdlist[i].ef_txt, grid); + pb->setMinimumSize(butw,pb->sizeHint().height()); + group->insert(pb); + gl->addWidget(pb,i/ncols,i%ncols); + } + connect(group,SIGNAL(clicked(int)),this,SLOT(done(int))); + + bl->activate(); + l->activate(); + resize(1,1); + + connect(can,SIGNAL(clicked()),this,SLOT(cancel())); +} + +void NetHackQtExtCmdRequestor::cancel() +{ + setResult(-1); + qApp->exit_loop(); +} + +void NetHackQtExtCmdRequestor::done(int i) +{ + setResult(i); + qApp->exit_loop(); +} + +int NetHackQtExtCmdRequestor::get() +{ + const int none = -10; + char str[32]; + int cursor=0; + resize(1,1); // pack + centerOnMain(this); + show(); + setResult(none); + while (result()==none) { + while (result()==none && !keysource.Empty()) { + char k=keysource.GetAscii(); + if (k=='\r' || k=='\n' || k==' ' || k=='\033') { + setResult(-1); + } else { + str[cursor++] = k; + int r=-1; + for (int i=0; extcmdlist[i].ef_txt; i++) { + if (qstrnicmp(str, extcmdlist[i].ef_txt, cursor)==0) { + if ( r == -1 ) + r = i; + else + r = -2; + } + } + if ( r == -1 ) { // no match! + QApplication::beep(); + cursor=0; + } else if ( r != -2 ) { // only one match + setResult(r); + } + } + } + if (result()==none) + qApp->enter_loop(); + } + hide(); + return result(); +} + + +int NetHackQtBind::qt_get_ext_cmd() +{ + NetHackQtExtCmdRequestor requestor(keybuffer); + return requestor.get(); +} + +void NetHackQtBind::qt_number_pad(int) +{ + // Ignore. +} + +void NetHackQtBind::qt_delay_output() +{ + NetHackQtDelay delay(15); + delay.wait(); +} + +void NetHackQtBind::qt_start_screen() +{ + // Ignore. +} + +void NetHackQtBind::qt_end_screen() +{ + // Ignore. +} + +void NetHackQtBind::qt_outrip(winid wid, int how, time_t when) +{ + NetHackQtWindow* window=id_to_window[wid]; + + window->UseRIP(how, when); +} + +bool NetHackQtBind::notify(QObject *receiver, QEvent *event) +{ + // Ignore Alt-key navigation to menubar, it's annoying when you + // use Alt-Direction to move around. + if ( main && event->type()==QEvent::KeyRelease && main==receiver + && ((QKeyEvent*)event)->key() == Key_Alt ) + return TRUE; + + bool result=QApplication::notify(receiver,event); +#ifdef SAFERHANGUP + if (g.program_state.done_hup) { + keybuffer.Put('\033'); + qApp->exit_loop(); + return TRUE; + } +#endif + if (event->type()==QEvent::KeyPress) { + QKeyEvent* key_event=(QKeyEvent*)event; + + if (!key_event->isAccepted()) { + const int k=key_event->key(); + bool macro=FALSE; + for (int i=0; !macro && key_macro[i].key; i++) { + if (key_macro[i].key==k + && ((key_macro[i].state&key_event->state())==key_macro[i].state)) + { + keybuffer.Put(key_macro[i].macro); + macro=TRUE; + } + } + char ch=key_event->ascii(); + if ( !ch && (key_event->state() & Qt::ControlButton) ) { + // On Mac, it aint-ncessarily-control + if ( k>=Qt::Key_A && k<=Qt::Key_Z ) + ch = k - Qt::Key_A + 1; + } + if (!macro && ch) { + bool alt = (key_event->state()&AltButton) || + (k >= Key_0 && k <= Key_9 && (key_event->state()&ControlButton)); + keybuffer.Put(key_event->key(),ch + (alt ? 128 : 0), + key_event->state()); + key_event->accept(); + result=TRUE; + } + + if (ch || macro) { + qApp->exit_loop(); + } + } + } + return result; +} + +NetHackQtBind* NetHackQtBind::instance=0; +NetHackQtKeyBuffer NetHackQtBind::keybuffer; +NetHackQtClickBuffer NetHackQtBind::clickbuffer; +NetHackQtMainWindow* NetHackQtBind::main=0; +QWidget* NetHackQtBind::splash=0; + + +extern "C" struct window_procs Qt_procs; + +struct window_procs Qt_procs = { + "Qt", + WC_COLOR|WC_HILITE_PET| + WC_ASCII_MAP|WC_TILED_MAP| + WC_FONT_MAP|WC_TILE_FILE|WC_TILE_WIDTH|WC_TILE_HEIGHT| + WC_PLAYER_SELECTION|WC_SPLASH_SCREEN, + 0L, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */ + NetHackQtBind::qt_init_nhwindows, + NetHackQtBind::qt_player_selection, + NetHackQtBind::qt_askname, + NetHackQtBind::qt_get_nh_event, + NetHackQtBind::qt_exit_nhwindows, + NetHackQtBind::qt_suspend_nhwindows, + NetHackQtBind::qt_resume_nhwindows, + NetHackQtBind::qt_create_nhwindow, + NetHackQtBind::qt_clear_nhwindow, + NetHackQtBind::qt_display_nhwindow, + NetHackQtBind::qt_destroy_nhwindow, + NetHackQtBind::qt_curs, + NetHackQtBind::qt_putstr, + genl_putmixed, + NetHackQtBind::qt_display_file, + NetHackQtBind::qt_start_menu, + NetHackQtBind::qt_add_menu, + NetHackQtBind::qt_end_menu, + NetHackQtBind::qt_select_menu, + genl_message_menu, /* no need for X-specific handling */ + NetHackQtBind::qt_update_inventory, + NetHackQtBind::qt_mark_synch, + NetHackQtBind::qt_wait_synch, +#ifdef CLIPPING + NetHackQtBind::qt_cliparound, +#endif +#ifdef POSITIONBAR + donull, +#endif + NetHackQtBind::qt_print_glyph, + //NetHackQtBind::qt_print_glyph_compose, + NetHackQtBind::qt_raw_print, + NetHackQtBind::qt_raw_print_bold, + NetHackQtBind::qt_nhgetch, + NetHackQtBind::qt_nh_poskey, + NetHackQtBind::qt_nhbell, + NetHackQtBind::qt_doprev_message, + NetHackQtBind::qt_yn_function, + NetHackQtBind::qt_getlin, + NetHackQtBind::qt_get_ext_cmd, + NetHackQtBind::qt_number_pad, + NetHackQtBind::qt_delay_output, +#ifdef CHANGE_COLOR /* only a Mac option currently */ + donull, + donull, +#endif + /* other defs that really should go away (they're tty specific) */ + NetHackQtBind::qt_start_screen, + NetHackQtBind::qt_end_screen, +#ifdef GRAPHIC_TOMBSTONE + NetHackQtBind::qt_outrip, +#else + genl_outrip, +#endif + genl_preference_update, + genl_getmsghistory, + genl_putmsghistory, + genl_status_init, + genl_status_finish, + genl_status_enablefield, + genl_status_update, + genl_can_suspend_yes, +}; + +extern "C" void play_usersound(const char* filename, int volume) +{ +#ifdef USER_SOUNDS +#ifndef QT_NO_SOUND + QSound::play(filename); +#endif +#endif +} + +#include "qt3_win.moc" +#ifndef KDE +#include "qt3_kde0.moc" +#endif +#if QT_VERSION >= 300 +#include "qt3tableview.moc" +#endif diff --git a/include/qt_win.h b/win/Qt3/qt3_win.h similarity index 99% rename from include/qt_win.h rename to win/Qt3/qt3_win.h index 136e8a6ef..8de29d92f 100644 --- a/include/qt_win.h +++ b/win/Qt3/qt3_win.h @@ -1,4 +1,4 @@ -// NetHack 3.6 qt_win.h $NHDT-Date: 1447755972 2015/11/17 10:26:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.17 $ +// NetHack 3.6 qt_win.h $NHDT-Date: 1575917700 2019/12/09 18:55:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.0 $ // Copyright (c) Warwick Allison, 1999. // NetHack may be freely redistributed. See license for details. // @@ -52,7 +52,7 @@ #include #endif -#include "qt_clust.h" +#include "qt3_clust.h" class QVBox; class QMenuBar; @@ -737,7 +737,7 @@ class NetHackQtInvUsageWindow : public QWidget // note the actual class of the windows. // #ifndef KDE -#include "qt_kde0.h" +#include "qt3_kde0.h" #endif class NetHackQtMainWindow : public KTopLevelWidget diff --git a/win/Qt3/qt3_xpms.h b/win/Qt3/qt3_xpms.h new file mode 100644 index 000000000..5667c13c0 --- /dev/null +++ b/win/Qt3/qt3_xpms.h @@ -0,0 +1,1422 @@ +/* clang-format off */ +/* XPM */ +static const char *blind_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 5 1", +/* colors */ +" c #000000", +". c None", +"X c #909090", +"o c #606060", +"O c #303030", +/* pixels */ +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"....ooooooooooooooooooooooooooooooooX...", +".... o...", +".... o...", +".... o...", +".... o...", +"......o ..o ......", +"......X O..X O......", +"....... o... o......", +".......o ....o .......", +"........O X.....O X.......", +".........O X.......O X........", +"..........o OX.........o OX.........", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................", +"........................................" +}; +/* XPM */ +static const char *cha_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 14 1", +/* colors */ +" c #F85848", +". c #949E9E", +"X c #F8B090", +"o c #E00028", +"O c #D4D4D4", +"+ c None", +"@ c #B0B0B0", +"# c #F82C24", +"$ c #F89E6C", +"% c #FF0000", +"& c #909090", +"* c #FFFFFF", +"= c #CEAA90", +"- c #DADAB6", +/* pixels */ +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"+++++++++++++++=#%#=+=#%% ++++++++++++++", +"++++++++++++++ %O%%%#%$$%o%=++++++++++++", +"+++++++++++++# +#%%o%%o%%%%% +++++++++++", +"+++++++++++ %%%%%%%%%%%%%%%%o#=+++++++++", +"+++++++++ o%%%%%%%%%%%%%%%%%%%%# +++++++", +"++++++ #%%%%%%o%%%o%%o%%o%o%%%%%o%o +++", +"++=#%%o%%%#= =*+**O*+**O*+- = =%%%%#@+++", +"++++ %=++*+*+**O****O****O*O*O*OO%=+++++", +"+++++.%=OO+*O*OO****+****+*O*+O&%=@+++++", +"++++++=%=*OO+**O**O*O**O*O*OO+$%=+++++++", +"+++++++#% +*OOOO****+****@O+*#%=++++++++", +"++++++++#%#*+**+O+OO+O+OOO*O#o#+++++++++", +"+++++++++o% O**+****O****O*#%%=+++++++++", +"+++++++++ %%#O*O****+****+ %o#++++++++++", +"++++++++++o%% XO*O**O*O**#%%%+++++++++++", +"++++++++++ %%%o%$-**+**$%%%%=+++++++++++", +"+++++++++++o%%$X$%%%%%%#= o#++++++++++++", +"++++++++++@ %%%o#O$$+$$$%%%=++++++++++++", +"++++++++++++#o%%%%%%%%o%%%=@++++++++++++", +"+++++++++++++ %%%%%%%%%%o=++++++++++++++", +"+++++++++++++++= & & @++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++" +}; +/* XPM */ +static const char *chaotic_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 9 1", +/* colors */ +" c #000000", +". c #5C7A7A", +"X c None", +"o c #B0B0B0", +"O c #909090", +"+ c #788C8C", +"@ c #606060", +"# c #FFFFFF", +"$ c #303030", +/* pixels */ +"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXXX@$ @XXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXX$$+#X$ $XXXXXXXXXX", +"XXXXXXXXXXXXXXXXXX@$#o @XXXXXXXXX", +"XXXXXXXXXXXXXXXXXX$XX OXXXXXXXX", +"XXXXXXXXXXXXXXXXX@ # $@$ $XXXXXXXX", +"XXXXXXXXXXXXXXXXX@.+ $XXXO @XXXXXXX", +"XXXXXXXXXXXXXXXXX O@ XXXXX@ @XXXXXXX", +"XXXXXXXXXXXXXXXXX @O $XXXXX@$ @XXXXXXX", +"XXXXXXXXXXXXXXXXX O+ @XXXXO++ @XXXXXXX", +"XXXXXXXXXXXXXXXXX @+ $@OXO$#$ XXXXXXXX", +"XXXXXXXXXXXXXXXXX O@ $ @$Xo $XXXXXXXX", +"XXXXXXXXXXXXXXXXX +O $X##+ $XXXXXXXXX", +"XXXXXXXXXXXXXXXXX +@ $XXXXXXXXXX", +"XXXXXXXXXXXXXXXXX oO $XXXXXXXXXXX", +"XXXXXXXXO@@@@@ +# $XXXXXXXXXXXX", +"XXXXXXO +o########$ $@XXXXXXXXX", +"XXXXXX +#+.$XXXXXXXX", +"XXXXXX @O @XXXXXXX", +"XXXXXX$ $@ $@@$ @XXXXXXX", +"XXXXXXX@@@@XXXXXX + @XXXX@$ OXXXXXXX", +"XXXXXXXXXXXXXXXX@ # @XXXXXXX@@OXXXXXXXX", +"XXXXXXXXXXXXXXXX@.+ @XXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX$O@ XXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX @O XXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX #$ @XXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX # @XXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX # @XXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX@ # @XXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX@ # OXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX@.X XXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX ++ XXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX @+ XXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX O@ @XXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX +O @XXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX @XXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXX$ OXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX@@OXXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" +}; +/* XPM */ +static const char *cns_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 19 1", +/* colors */ +" c #000000", +". c #F85848", +"X c #949E9E", +"o c #F8B090", +"O c #E00028", +"+ c #7C3400", +"@ c None", +"# c #B0B0B0", +"$ c #F82C24", +"% c #F89E6C", +"& c #FF0000", +"* c #B64700", +"= c #909090", +"- c #788C8C", +"; c #606060", +": c #C80050", +"> c #CEAA90", +", c #303030", +"< c #FFB691", +/* pixels */ +"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@.oo.o$ ;@@@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@>.o.%%O,@@@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@$oo.o. ,@@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@.oo$oo+ =@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@..o&oo$ ,@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@#.o.oo. =@.$%@@@@@@@@@@@@@@", +"@@@@@@@@@@@@@.o..oo& O.%ooo@@@@@@@@@@@@@", +"@@@@@@@@@@@@@.o.&%o.$oo%O++;@@@@@@@@@@@@", +"@@@@@@@@@@@@@.o.+$%$o.@@@@@@@@@@@", +"@@@@@@@@@@@@@.oo++o%$$ ,@@$.oo@@@@@@@@@@", +"@@@@@@@@@@@@>.oo+Oo$o%.@@$oo..-@@@@@@@@@", +"@@@@@@@@@@@@..o%;.o&%.$..o%O ++>@@@@@@@@", +"@@@@@@@@@@@@>.$O:%o.O::::O* $oooo@@@@@@@", +"@@@@@@@@@@@@::::::$$:OO&OO::oo%.;=@@@@@@", +"@@@@@@@@@@@.::::::::O&&&&&O::++ ,@@@@@@", +"@@@@@@@@@@>:::O&&OO&&&&&&&&:: ;@@@@@", +"@@@@@@@@@@=::O&&&&&O:O&&&&&O: ,=@@@@@@@", +"@@@@@@@@@@:::&&&&&&&&:&&&&&O: ;@@@@@@@@", +"@@@@@@@@@@::O&&&&&&&&:&O&&&O:, ;@@@@@@@@", +"@@@@@@@@@@::O&&&&O&O&OO&O&&O:+ ;@@@@@@@@", +"@@@@@@@@@@::&&&O&&&&&O:&&&&O:, @@@@@@@@", +"@@@@@@@@@@::O&&&&&O&&&:O&O&::+ @@@@@@@@", +"@@@@@@@@@@::O&&O&&&&O&OO&&&:: @@@@@@@@", +"@@@@@@@@@@=::O&&&&O&&&O:&&&:: @@@@@@@@", +"@@@@@@@@@@.:::O&&O&&&&&:&OO:: @@@@@@@@", +"@@@@@@@@@@@:::::&&&&O&O:&&O:, @@@@@@@@", +"@@@@@@@@@@.>:::::O&&&&&:&&::+ ;@@@@@@@@", +"@@@@@@@@@@>.<::::O&&O&O:&&:: @@@@@@@@@", +"@@@@@@@@@@@.o%,:::O&&&O:&O:, @@@@@@@@@", +"@@@@@@@@@@@$o. :::OO&OO&::, ;@@@@@@@@@", +"@@@@@@@@@@@&o%+ ,::O&OO&O:: =@@@@@@@@@", +"@@@@@@@@@@@.oo+ :::OO::: ,@@@@@@@@@@", +"@@@@@@@@@@@..oO +::::: =@@@@@@@@@@", +"@@@@@@@@@@@@.<.+ ,+, ,@@@@@@@@@@@", +"@@@@@@@@@@@@Oo<+ @X, ,@@@@@@@@@@@@", +"@@@@@@@@@@@@.%o$ @@@@@;, ;@@@@@@@@@@@@@", +"@@@@@@@@@@@@@.o., =@@@@@@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" +}; +/* XPM */ +static const char *confused_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 13 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #FFFFFF", +"* c #303030", +"= c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOO.=.+OO=.+O.OO+O+OO.+OOOOOO", +"OOOOOOOOOOO++=====O=====+=O+==++=O+OOOOO", +"OOOOOOOOOOO+=.=====.=++++===OO==+O=+OOOO", +"OOOOOOOOOOO=+===.+=o==o===+&OoO======OOO", +"OOOOOOOO+O+====OO+=o&&&&Oo==o&oO+==+=.O.", +"OOOO+.+=+O==+&&o=oooOo&o&ooo=&oooO==O=+=", +"OOOOOOOO++O===oo=oo&=&o&&oo=o==&o+==++==", +"OOOOOOOO=o.=O====o&OO&o&oo&o&&oo=======O", +"OOOOOOOo===+=O=O=ooO=ooooOOo=o&O=====OOO", +"OOOOOOOOO+==+=======O=oo====O=o=O===+OOO", +"OOOOOOOOO.=#=X=+====O========O======OOOO", +"OOOOOOO.#Xo++.=#%====O==========OO==+OOO", +"OOOOOO+Xo#+#+.#=.==X====+====O=+=+==+OOO", +"OOOOO.+.+O===##.#=X.====oX##===o+OO.OOOO", +"OOOOO#+####O#O##o.#+==#X#O#+...=OOo=+OOO", +"OOOO++#o+#+X++++#.#O.#+#X.#+X+==+OO=oOOO", +"OOOO#+.+..X+.##X++#++#..+XX#+##+..OOOOOO", +"OOOO##....O+#++#+.++#+X+#+#X..+#+#OOOOOO", +"OOOO++#+.+.#+#O+X#X#XX#.++##.#++.X$OOOOO", +"OOOOO#+#+.+++#++.+++##+X###+X+X##+**OOOO", +"OOOOO#..#OO#+.##o###.+..++.+#X+#+#* @OOO", +"OOOOO+#.#O+#+#O.+++.###+##++###+.#* $OOO", +"OOOOOOXX+#+#+#o..X##++#+..##.#+### *OOO", +"OOOOOOOX#.#X+#+#+#+.#+..+####%XX%% OOO", +"OOOOOOOO.%%X.#+#+#.++#+#+#+.X++=.% *OOO", +"OOOOOOOOO.* *##+#+.O####.+XX%%%%#% $OOO", +"OOOOOOOOOOO. %X.+.#+++XXX=.+++#X $OOO", +"OOOOOOOOOOOO.* %%X..#X%=.####%X* $OOO", +"OOOOOOOOOOOOOO.$ *XX%%%=.#X%###=* OOOO", +"OOOOOOOOOOOOOOOOOO+%%%=%%#.+.#=* @OOOO", +"OOOOOOOOOOOOOOOOOOo=%%%==X##X%* OOOOO", +"OOOOOOOOOOOOOOOOOOO+X%%%%X=%* @OOOOO", +"OOOOOOOOOOOOOOOOOOOOX%%%%X *@OOOOOO", +"OOOOOOOOOOOOOOOOOOOO=%%%X* *$$OOOOOOOO", +"OOOOOOOOOOOOOOOOOOOO+X%%= .OOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOX%%% OOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOO=%%* $OOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOO=%%% $OOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOO+%%% $OOOOOOOOOOOOO" +}; +/* XPM */ +static const char *dex_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 19 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #F8B090", +"o c #5C7A7A", +"O c #D4D4D4", +"+ c #F87A24", +"@ c #7C3400", +"# c None", +"$ c #B0B0B0", +"% c #F89E6C", +"& c #B64700", +"* c #909090", +"= c #606060", +"- c #CEAA90", +"; c #DADAB6", +": c #303030", +"> c #F86800", +", c #FFB691", +"< c #F88C48", +/* pixels */ +"########################################", +"########################################", +"########################################", +"########################################", +"########################################", +"########################################", +"###############-%-######################", +"##############-%X<-#####################", +"#########-<<-#-%XX+==###################", +"#########%,X< :<,X%@ :##################", +"#########-XX%: @;X%+ *#################", +"##########<,X& :<<%+: :#################", +"######->+#-%%%: <,XX@ #################", +"######%X%@ <,,& @XXX+ :++-#############", +"######-: +XX+ #########", +"#####+%%@@,X%<,XXXXXXX<:@XXX<: =########", +"####$%XX< <,<,XX& ########", +"#####$%<%X@%XXXX<%XX< =#######", +"#######<;X%XXXXX<<,XXXXXX%,XXXXXXXXX%@ #######", +"##########- c #788C8C", +", c #606060", +"< c #406868", +"1 c #C80050", +"2 c #FFFFFF", +"3 c #FFFF00", +"4 c #00B6FF", +"5 c #CEAA90", +"6 c #DADAB6", +"7 c #F86800", +"8 c #FFB691", +"9 c #6C91B6", +"0 c #F88C48", +"q c #0000FF", +/* pixels */ +"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", +"$$$$$$$$$$$$$$$353333335*$$$$$$$$$$$$$$$", +"$$$$$$$$$$$$*33333333#7@3335$$$$$$$$$$$$", +"$$$$$$$$$65333333333@7777#333*$$$$$$$$$$", +"$$$$$$$$$3333333333377777733333===%$$$$$", +"$$$$$$$533333333333#7777777333%=====$$$$", +"$$$$$$ #3333333333o>7777773330======%$$$", +"$$$$5---O#33333o3944077777333*=======$$$", +"$$$$-----O333333>4444.77333330======%$$$", +"$$$ ---O--;3333344444443333333:====5$$$$", +"$$$ O-----733333444444433333333 ==035$$$", +"$$$3--O--O333333>44444>33333333333333$$$", +"$$533---O33333333944493333#333333333356$", +"$$33867733333o33333:o333333o3333333333$$", +"$532+2233333#333333333333oooo3#3333333%$", +"6522222+33333333333333333oooooo33o3333*$", +"$+22+22263333333o3333333ooooooo333333356", +"662222+2533333333333333#ooooooo33333333$", +"$32+22223333o3#33333o333ooooooo3#333333%", +"$33222233333333333#333333ooooo333333333$", +"$33368333333333333330626*oooo#333333o33%", +"%333335== 33oo333333222223#333333333333$", +"$3333=====:ooooo333+22+2263333333.>o333%", +"$5333=====oooooo33322222223333339444935$", +"$*33 ====>ooooooo3362+222633333.44444>3$", +"$%330====:ooooooo333222+23333334444444$$", +"$$333177 =oooXoo#333*626333333;4444444$$", +"$$53##777&3oooo3333333333333#--,444449$$", +"$$$3;77777#3o333333333333333O---94449$$$", +"$$%*@77777#33333333333333337O----O:o3$$$", +"$$$5777777333 333333333333;---O-O73$$$$", +"$$$$#7777730====#:.,33333333------3$$$$$", +"$$$$$577333=====qqqq<0333333#O---35$$$$$", +"$$$$$%53335====qqqqqq.33o333337735$$$$$$", +"$$$$$$$533 ====qqqqqqq3333333333%$$$$$$$", +"$$$$$$$$%33====qqqqqqq333333333%$$$$$$$$", +"$$$$$$$$$$50===qqqqqq,3333333:$$$$$$$$$$", +"$$$$$$$$$%6%5503,qqq<333#335%$$$$$$$$$$$", +"$$$$$$$$$$$$$%$*53,03335o$%%$$$$$$$$$$$$", +"$$$$$$$$$$$$$$$$$$$$$%$$+$$$$$$$$$$$$$$$" +}; +/* XPM */ +static const char *hungry_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 15 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #FFFFFF", +"* c #CEAA90", +"= c #DADAB6", +"- c #303030", +"; c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO========OOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOO=============OOOOOOOOOOOOO", +"OO;XX;@OOOOO================OOOOOOOO;XOO", +"OO;%-;$OOOO==================OOOOOOO;XOO", +"OO;-%;$OOO========@$#@========OOOOO+;;$O", +"OO;%-;$OO=======- -*======*OOOO.;;$O", +"OO;-%;$O======* @====.$$&=====@OOO.;;$O", +"OO;X%;$O====== -========*@=====*.OO+;;$O", +"OO;;;X$o====* -==========@======$OO;;;$O", +"OO+;;-+o====- =============o====#@O+;;$O", +"OOO;%$O===== @=============&====*$O;;;$O", +"OOO+%OO====@ ==============&=====-OO;;$O", +"OOo;-Oo====$ ==============o&==== OO;;$O", +"OOO+%OO====@ ==============&===== O+;;#O", +"OOO;-Oo====$-==============&&==== O+;;-O", +"OOO;;+O=====$*============&&====* OO;;%+", +"OOO;;$o=====$.============&&====X-OO;;$O", +"OOO;;$O======*.===&======&&=====-$=O;;$O", +"OOO;;$Oo=====.==========&&=====* @O+;;$O", +"OOO;;$OO=======oo=====&&&======$-OOO;;$O", +"OOO;;$OOo=======&o&&&&&&======$ @OOO;;$O", +"OOO;;$OOOO========&=&========* $OOOO;;$O", +"OO+;;$OOOOo=================* -OOOOO#;$O", +"OOO;;$OOOOO=*==============@ -=OOOOO;;$O", +"OOO;;$OOOOOOO+*==========*- $OOOOOOO;;$O", +"OOOX-$OOOOOOOO@X@*====*#- -.OOOOOOOOX-$O", +"OOOOOOOOOOOOOO=*@$- -$.=OOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOO=O==O=O=OOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" +}; +/* XPM */ +static const char *hvy_enc_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 13 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #FFFFFF", +"* c #303030", +"= c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOoO+OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOoOXX==OOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOoO=OO+==OOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOoXOO.*$=$OOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO=+# *.X *OOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO==.OO=+@ $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOXO==.OO $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOO+=@$@* @OOOOOOOOOOOOOO", +"OOOOOOOOOOO&&&&&&&&&&&&&&&.OOOOOOOOOOOOO", +"OOOOOOOOOOOo==============X*OOOOOOOOOOOO", +"OOOOOOOOOOoO===X====X=====X**OOOOOOOOOOO", +"OOOOOOOOOO&============X===% $OOOOOOOOOO", +"OOOOOOOOOoo===*%====***%===%* OOOOOOOOOO", +"OOOOOOOOOoO==% %===* %==X* @OOOOOOOOO", +"OOOOOOOOO&===% *==% X==**===% $OOOOOOOOO", +"OOOOOOOOoo===% %==% ===% ===X OOOOOOOOO", +"OOOOOOOOoO==== *== *==== *==X* @OOOOOOOO", +"OOOOOOOO&===== %== %==== %===% $OOOOOOOO", +"OOOOOOOoo===== *== *==== *===%* OOOOOOOO", +"OOOOOOOoO===== %==% ===* ====X* @OOOOOOO", +"OOOOOOO&===X== *==% X==**=====% $OOOOOOO", +"OOOOOOoo===== *==* %=====X OOOOOOO", +"OOOOOOoO=====*%%X===*%*X======%* @OOOOOO", +"OOOOOOo====================X===* $OOOOOO", +"OOOOOOO=%X%XXXX%XXXXXXXXX%X=%X% OOOOOO", +"OOOOOOO.=********************** OOOOOO", +"OOOOOOOOO OOOOOO", +"OOOOOOOOO. @OOOOOO", +"OOOOOOOOOOOoOOoOoOoOoOoOoOOoOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" +}; +/* XPM */ +static const char *int_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 12 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #303030", +"* c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOO+#.X.##@#OOOOOOOOOOOOOOOOOO", +"OOOOOOOO+##@X#O++.#+#.##OOOOOOOOOOOOOOOO", +"OOOOOO+#Xo++#X#%#+##o#O#.#+OOOOOOOOOOOOO", +"OOOOO.Xo#+#++##+.XX#..+.+..XOOOOOOOOOOOO", +"OOOO++.+O.+O##+#.X###..OX#.+X+OOOOOOOOOO", +"OOOO#+####O#O##o##+###X#+#+.#..OOOOOOOOO", +"OOO.+#o+#+X++++#.#O+#+#X.#+X++X+OOOOOOOO", +"OOO.+.+..X+.##X++#++#..+XX#+#X+..OOOOOOO", +"OOO##....O+#++#+.++#+X+#+#X..+#+#OOOOOOO", +"OOO++#+.+.#+#O+X#X#XX#.++##.#++.X$OOOOOO", +"OOOO#+#+.+++#++.+++##+X###+X+X##+&&OOOOO", +"OOOO#..#OO#+.##o###.+..++.+#X+#+#& @OOOO", +"OOOO.#.#O+#+#O.+++.###+##++###+.# $OOOO", +"OOOOOXX+#+#+#o..X##++#+..##.#+### &OOOO", +"OOOOOOX#.#X+#+#+#+.#+..+####XX%X% OOOO", +"OOOOOOO.%%X.#+#+#.++#+#+#+.%++*+% &OOOO", +"OOOOOOOO@& &##+#+.O####.+XXX%%%#% $OOOO", +"OOOOOOOOOO. %X.+.#+++XXX*.+++#% $OOOO", +"OOOOOOOOOOO@& %%X..#XXX.####%%& $OOOO", +"OOOOOOOOOOOOO@$ &XX%%%*.#X%###*& OOOOO", +"OOOOOOOOOOOOOOOOO+%%%*%%#.+.#*& @OOOOO", +"OOOOOOOOOOOOOOOOOO*%%%*.X##XX& OOOOOO", +"OOOOOOOOOOOOOOOOOOOX%%%%X*%& @OOOOOO", +"OOOOOOOOOOOOOOOOOOOX%%%%% &@OOOOOOO", +"OOOOOOOOOOOOOOOOOOO*%%%X& &$$OOOOOOOOO", +"OOOOOOOOOOOOOOOOOOO+%%%* .OOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOO+*%%% OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOO*%%& $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOO*%%% $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOO+%%& $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOoOOOOOOOOOOOOOOOO" +}; +/* XPM */ +static const char *lawful_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 10 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #606060", +"$ c #FFFFFF", +"% c #303030", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOo$$$$$$oOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOO$$o$$o$$$$$OOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOo$$$$$$$o$$ooOOOOOOOOO", +"OOOOOOOOOOOOOOOOOO$o$$$o$$$$$$$oOOOOOOOO", +"OOOOOOOOOOOOOOOOOo$$$$+ .o$$$$$oOOOOOOOO", +"OOOOOOOOOOOOOOOOOo$$$+%OOOO$o$$$oOOOOOOO", +"OOOOOOOOOOOOOOOOO$$o$X@OOOOo$$$ooOOOOOOO", +"OOOOOOOOOOOOOOOOO$$$$%OOOOOo$$$..OOOOOOO", +"OOOOOOOOOOOOOOOOO$$$$@OOOOo$$oo##OOOOOOO", +"OOOOOOOOOOOOOOOO+$$o$$ooOoo$$$o OOOOOOOO", +"OOOOOOOOOOOOOOOOO$$$$$$$o$$$$o#%OOOOOOOO", +"OOOOOOOOOOOOOOOO+$$o$$o$$$$$o@%OOOOOOOOO", +"OOOOOOOOOOOOOOOOO$$$$$$$$o$o.%OOOOOOOOOO", +"OOOOOOOOOOOOOOOOOo$$$o$$oo@#%OOOOOOOOOOO", +"OOOOOOOOoooooo$$$$$$$$$$$% %OOOOOOOOOOOO", +"OOOOOOO$$$$$$$$$$$$o$$o$$$$$$$oOOOOOOOOO", +"OOOOOO$$$$$$$$$o$$$$$$$$$$$$o$$oOOOOOOOO", +"OOOOOO$$o$ooooo##+o$$+##@oo$$$$$oOOOOOOO", +"OOOOOOo$$#% %#$$$+%##%%#ooo$O#OOOOOOO", +"OOOOOOOo@##OOOOO+$$$##OOOO#%%##%@OOOOOOO", +"OOOOOOOOOOOOOOOOo$$$##OOOOOOO##@OOOOOOOO", +"OOOOOOOOOOOOOOOOo$$o##OOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO$$oo OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO+$$$o OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO$$$##OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO$o$##OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO$$$##OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOo$$$##OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOo$$o%@OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOo$$o OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO$$oo OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO$$$o OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO$$$##OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOo$$##OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO$$o##OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOo$# @OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO.#@OOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" +}; +/* XPM */ +static const char *mod_enc_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 13 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #FFFFFF", +"* c #303030", +"= c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOoO+OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOoOXX==OOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOoO=OO+==OOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOoXOO.*$=$OOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO=+# *.X *OOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO==.OO=+@ $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOXO==.OO $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOO+=@$@* @OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOo&&&&&&&&&oXOOOOOOOOOOOOOOO", +"OOOOOOOOOOOO+&=========X%@OOOOOOOOOOOOOO", +"OOOOOOOOOOOOO&=====X====% @OOOOOOOOOOOOO", +"OOOOOOOOOOOOoO==X=======X* OOOOOOOOOOOOO", +"OOOOOOOOOOOO&====*%*%*===* $OOOOOOOOOOOO", +"OOOOOOOOOOO+&===X ===% *OOOOOOOOOOOO", +"OOOOOOOOOOOoO===**=======X* OOOOOOOOOOOO", +"OOOOOOOOOOO&===% %=======X% $OOOOOOOOOOO", +"OOOOOOOOOOO&===% %*%%=====% *OOOOOOOOOOO", +"OOOOOOOOOOoO===* ====X* OOOOOOOOOOO", +"OOOOOOOOOO&=========* X===X% $OOOOOOOOOO", +"OOOOOOOOO+&=========% *====% *OOOOOOOOOO", +"OOOOOOOOOoO===% %=== %====%* OOOOOOOOOO", +"OOOOOOOOO&====* *==X===% $OOOOOOOOO", +"OOOOOOOOO&======*%*%X=======% *OOOOOOOOO", +"OOOOOOOOOo==X===============% OOOOOOOOO", +"OOOOOOOOO=XXXXXXXXXX%X%X%X%%% $OOOOOOOO", +"OOOOOOOOOO=%**************** $OOOOOOOO", +"OOOOOOOOOOO$ $OOOOOOOO", +"OOOOOOOOOOOO* *OOOOOOOOO", +"OOOOOOOOOOOOOoOOoOoOoOoOoOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" +}; +/* XPM */ +static const char *neutral_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 14 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #FFFFFF", +"* c #00B6FF", +"= c #303030", +"- c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOO.------.OOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOO-+O&o.-----OOOOOOOOOO", +"OOOOOOOOOOOOOOOOOO+-&o--------.OOOOOOOOO", +"OOOOOOOOOOOOOOOOOO-oo----------+OOOOOOOO", +"OOOOOOOOOOOOOOOOO+-&--% #-------OOOOOOOO", +"OOOOOOOOOOOOOOOOO-OO-X=OOO.-----+OOOOOOO", +"OOOOOOOOOOOOOOOOO-oO-%#OOOO.-----OOOOOOO", +"OOOOOOOOOOOOOOOOO--O-=OOOOO+---X#OOOOOOO", +"OOOOOOOOOOOOOOOOO-oO-XOOOO+OO--=$OOOOOOO", +"OOOOOOOOOOOOOOOOO-OO--++OO-&--- OOOOOOOO", +"OOOOOOOOOOOOOOOOO-OO-----+oo--%=OOOOOOOO", +"OOOOOOOOOOOOOOOOO--O--+o&&o--%=OOOOOOOOO", +"OOOOOOOOOOOOOOOOO-oo*-------%=OOOOOOOOOO", +"OOOOOOOOOOOOOOOOO-oO------%%=OOOOOOOOOOO", +"OOOOOOOO+.+-+.---O&------= =OOOOOOOOOOOO", +"OOOOOO+-oo&&&&&&&&------------.OOOOOOOOO", +"OOOOOO---------------X-----O&Oo-OOOOOOOO", +"OOOOOO---------%=%---%%=%----OO-.OOOOOOO", +"OOOOOO---== =%---%=%%===----%XOOOOOOO", +"OOOOOOO-#$%OOOOOO-+-%$OOOO%===%=@OOOOOOO", +"OOOOOOOOOOOOOOOO.-&-=%OOOOOOO%%#OOOOOOOO", +"OOOOOOOOOOOOOOOo-O+-%$OOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO-oO- OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO-OO- OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO-&-%%OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO-&-%$OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO-&-=$OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO--o-%$OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO+-&- .OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO-Oo- OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO-OO- OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO-oO- OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO-OO%%OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO-o-%$OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO---%$OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO--% #OOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOX$@OOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" +}; +/* XPM */ +static const char *ovr_enc_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 13 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #FFFFFF", +"* c #303030", +"= c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOoO+=+OOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOo=#===+OOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOo=.OO@X=OOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOo#OO* #X @OOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO+=.XX+=#* @OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO+=O=.=OO $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOO#.=+OO@ $OOOOOOOOOOOOOO", +"OOOOOOOOOooooooooo&O.#+#XooooOOOOOOOOOOO", +"OOOOOOOOO&OOoOoOoOOOOOOOOOoO%@OOOOOOOOOO", +"OOOOOOOOoO==================X*@OOOOOOOOO", +"OOOOOOOO&===================X% @OOOOOOOO", +"OOOOOOOO&==%*%*%*%*%*%*%*%*==% *OOOOOOOO", +"OOOOOOOoO==%*%%*%%*%%*%*%*%==X* OOOOOOOO", +"OOOOOOO&======================* $OOOOOOO", +"OOOOOO+&=== ===% *OOOOOOO", +"OOOOOOoO======================X* OOOOOOO", +"OOOOOO&=======================X% $OOOOOO", +"OOOOOOo========================% *OOOOOO", +"OOOOOoO===*%X=====%%======%%===X* OOOOOO", +"OOOOO&==% %==% *==== %==* $OOOOO", +"OOOOO&== *==**== **% *=X% %%* ==% *OOOOO", +"OOOOoO==%%==* =* ===% == %=== %=X* OOOOO", +"OOOO&=======% =**===% %X %X==* =X% $OOOO", +"OOOO&======% %= %==== %% ====* ==% *OOOO", +"OOOoO=====% *== *==== %* ====% ==X* OOOO", +"OOO&====XX *===**===% X% X=== *===* $OOO", +"OO+&====X *====* ===% == *=== %===% *OOO", +"OOoO===% %*%*== *** %==% %** ====X* OOO", +"OO&====% ==X *====* %====X% $OO", +"OO&================================% *OO", +"OOo===X============================% OO", +"OO=XXXXXXXXXXXX%XXXX%X%X%XXXXX%X%X%% $O", +"OOO=%****************************** $O", +"OOOO$ $O", +"OOOOO* *OO", +"OOOOOOOOOOoOOoOOoOOoOOoOOoOOoOOoOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" +}; +/* XPM */ +static const char *pet_mark_xpm[] = { +/* width height ncolors chars_per_pixel */ +"8 7 2 1", +/* colors */ +". c None", +" c #FF0000", +/* pixels */ +"........", +".. . .", +". ", +". ", +".. .", +"... ..", +".... ..." +}; +/* XPM */ +static const char *pet_mark_small_xpm[] = { +/* width height ncolors chars_per_pixel */ +"5 5 2 1", +/* colors */ +". c None", +"X c #FF0000", +/* pixels */ +".X.X.", +"XXXXX", +".XXX.", +"..X.." +}; +/* XPM */ +static const char *pile_mark_xpm[] = { +/* width height ncolors chars_per_pixel */ +"5 5 2 1", +/* colors */ +". c None", +"X c #00FF00", +/* pixels */ +"..X..", +"..X..", +"XXXXX", +"..X..", +"..X.." +}; +/* XPM */ +static const char *satiated_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 23 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #F8B090", +"o c #5C7A7A", +"O c #D4D4D4", +"+ c #F87A24", +"@ c #7C3400", +"# c None", +"$ c #B0B0B0", +"% c #F89E6C", +"& c #914700", +"* c #B64700", +"= c #909090", +"- c #788C8C", +"; c #606060", +": c #406868", +"> c #FFFFFF", +", c #CEAA90", +"< c #DADAB6", +"1 c #303030", +"2 c #FFB691", +"3 c #6C91B6", +"4 c #F88C48", +/* pixels */ +"########################################", +"########################################", +"########################################", +"########################################", +"########################################", +"########################################", +"########################################", +"################<<<<<<<<################", +"##############<<<<<<<<<<$#$$$###########", +"############<<<<<<<<<<$:31:3:###########", +"###########<<<<<<%42<<#:3:133-##########", +"##########<<<<<%<<;;=o$131:33;##########", +"#########<<<<<<,1 ::31:33;,#########", +"########<<<<<<, =<<<<.13:133;<=########", +"########<<<%2, 1<<<<<<#333:33;<,=#######", +"#######<<<3-=<33;<<@o######", +"#######O<<<<<,#<<<<<<<<.3:<3-;<, =######", +"########<<<<2<<<<<<<<<>#31<33o<11#######", +"########O<<<<44<>O>>>>>#3:<3.;- =#######", +"##########<<<4<<<<><><<$3:<331 ;<#######", +"##########<<<<<<<%2<<<<$3:<33 1#########", +"###########O,<<<<<<<<<<#31<331##########", +"#############.<<<<<<<<<$3:133;##########", +"##############=;=,<<<<,o 1;;=##########", +"###############<=;1 1;=##############", +"#################<# c #B64700", +", c #909090", +"< c #788C8C", +"1 c #606060", +"2 c #406868", +"3 c #FFFFFF", +"4 c #CEAA90", +"5 c #DADAB6", +"6 c #303030", +"7 c #F86800", +"8 c #FFB691", +"9 c #6C91B6", +"0 c #F88C48", +"q c #0000FF", +/* pixels */ +"****************************************", +"*************#333333333#****************", +"***********##33333#333333#**************", +"**********#33333#33333#33*==************", +"*********#33##33-;-3#3333399************", +"********#33#33#3-@ 33333#33=.***********", +"********#3*#33-;;;;;-33333#99***********", +"*******#3*3333-;;;;@ 33#333#9=**********", +"*******#333#33#3-;-33#*##33399**********", +"******#3#3333333-@-#333#9933*9=*********", +"******#333#33#3333333#333*9999=*********", +"******#333333333#3#33333333*999*********", +"******#3#33#33333333#33#3333#9=*********", +"******#333334>&&:&&>::44,3#33#9*********", +"******#33*::&41OOO6:4O 0::4433=*********", +"******#3:>,0:O0O1O+O:OXO,O+2+OOo4<+1104:>:#*********", +"******.&:1OOO,14X2O48:O80,440:,*********", +"******4::>OOO%8-X4O4%O,84+O0X&>=********", +"******.::>,O 99*X+<$,+.o*1O4&0:*********", +"******>:0&4O5qq9#10OO3qq9,+X:1:*********", +"****=>,,::,O4qq9X+O>O-qq9O2X0,>*********", +"******4:>OOOO48882OOOO+4OOO07*4*********", +"******4*,4OO+OXX3O5************", +"*********=0%,OO,>:>>O +1OO4*************", +"**********=%+OO:::1:::6+:7**************", +"***********7&OO:O+O,O1OO+1**************", +"***********40OO,O4:OOO11O<5*************", +"**********=4 +O1O2+O2+O0O***************", +"************72O+1+21-OOO%5**************", +"************0%1OOOO+O+174***************", +"*************%%O,OO1407-=***************", +"**************-$>%0%:74*****************", +"****************54044*=*****************", +"*****************=*=********************" +}; +/* XPM */ +static const char *sick_il_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 23 1", +/* colors */ +" c #F85848", +". c #949E9E", +"X c #F8B090", +"o c #E00028", +"O c #D4D4D4", +"+ c #F87A24", +"@ c #7C3400", +"# c None", +"$ c #B0B0B0", +"% c #F89E6C", +"& c #FF0000", +"* c #914700", +"= c #B64700", +"- c #909090", +"; c #606060", +": c #FFFFFF", +"> c #CEAA90", +", c #DADAB6", +"< c #F86800", +"1 c #FFB691", +"2 c #6C91B6", +"3 c #F88C48", +"4 c #0000FF", +/* pixels */ +"########################################", +"#############O:::::::::O################", +"###########OO:::::O::::::O##############", +"##########O:::::O:::::O::#$$############", +"#########O::OO::%&%:O:::::22############", +"########O::O::O:%o :::::O::$.###########", +"########O:#O::%&&&&&%:::::O22###########", +"#######O:#::::%&&&&o ::O:::O2$##########", +"#######O:::O::O:%&%::O#OO:::22##########", +"######O:O:::::::%o%O:::O22::#2$#########", +"######O:::O::O:::::::O:::#2222$#########", +"######O:::::::::O:O::::::::#222#########", +"######O:O::O::::::::O::O::::O2$#########", +"######O:::::>=@@=**=**>>-:O::O2#########", +"######O::#**@3>%* ;=>=3;<@>>::$#########", +"######O:** >=>XXXX1X >>+>%*%*;O#########", +"######O3@*,X%XXXXXXX>X%XX >*=*O#########", +"######.@@3XXXXXXXXXXXXXXX>X>3*-#########", +"######>***>X% >XXXXX3XXXXXX%>*=>########", +"######.***> 22#XXX<%X22#XXX@+;#########", +"######=*3@X>O442OXX==%XX11111O1+%X111XX%<#>#########", +"######.,;XXXXXX1O1X%3XXXXX%+3###########", +"########3=XXXXXX:XXXXXXXXX+<>$##########", +"########>+XXXXXX%-3->XXXX%+<############", +"#########%3XXXXXX>- -%XXX%<%$###########", +"#########$############", +"##########+%XXXXXXXXXXXX%+<#############", +"##########%3XXX>=****3XX%<%#############", +"##########>+XXX**=3-*@3>3+##############", +"###########<%XX >XX%X;%X3+##############", +"###########%3XX>XX++XXXX<%$#############", +"##########$>+XXXXXXXXXXX<###############", +"############<%XXXXXXXXX3+###############", +"###########$%+XXXXXXXX%<>###############", +"#############++XXXXXX%<%$###############", +"#############$%<<3333<%#################", +"#################%3>>$##################", +"#################$#$####################" +}; +/* XPM */ +static const char *slt_enc_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 13 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #FFFFFF", +"* c #303030", +"= c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOoO+OOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOoOXX==OOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOoO=OO+==OOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOoXOO.*$=$OOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO=+# *.X *OOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO==.OO=+@ $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOXO==.OO $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOO+=@$@* @OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOO&&&&&&&X @OOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOo======X*OOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOoO======X**OOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOO&====X===% $OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOoo==%* %==%* OOOOOOOOOOOOOO", +"OOOOOOOOOOOOOoO=% % =X* @OOOOOOOOOOOOO", +"OOOOOOOOOOOOO&==**==% %=% $OOOOOOOOOOOOO", +"OOOOOOOOOOOOoo==%%==* %=X OOOOOOOOOOOOO", +"OOOOOOOOOOOOoO=====* X==X* @OOOOOOOOOOOO", +"OOOOOOOOOOOO&=====* %====% $OOOOOOOOOOOO", +"OOOOOOOOOOOoo==== X=====%* OOOOOOOOOOOO", +"OOOOOOOOOOOo+===* *%*%%==X* @OOOOOOOOOOO", +"OOOOOOOOOOO&==== %===% $OOOOOOOOOOO", +"OOOOOOOOOOO&==============% OOOOOOOOOOO", +"OOOOOOOOOOO==============X% @OOOOOOOOOO", +"OOOOOOOOOOO+%%%%%%%%%%%%%% $OOOOOOOOOO", +"OOOOOOOOOOOOO% $OOOOOOOOOO", +"OOOOOOOOOOOOO@ @OOOOOOOOOO", +"OOOOOOOOOOOOOO@$$$$$$$$$$$$$@OOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" +}; +/* XPM */ +static const char *str_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 17 1", +/* colors */ +" c #000000", +". c #F8B090", +"X c #5C7A7A", +"o c #F87A24", +"O c #7C3400", +"+ c None", +"@ c #B0B0B0", +"# c #F89E6C", +"$ c #B64700", +"% c #909090", +"& c #606060", +"* c #CEAA90", +"= c #DADAB6", +"- c #303030", +"; c #F86800", +": c #FFB691", +"> c #F88C48", +/* pixels */ +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"++++++++++++++++++++++++++++++++++++++++", +"+++++++++++++++++++*>*>#++++++++++++++++", +"++++++++++++++++*#o>..*#o*++++++++++++++", +"+++++++++++++++o#.#>.....o++++++++++++++", +"+++++++++++++++;>;#.o.>..#$X++++++++++++", +"+++++++++++++++o#>.o.>:...o %++++++++++", +"++++++++++++++o##>>#o##>..#O -++++++++++", +"++++++++++++++>#.oo#>..>...O ++++++++++", +"++++++++++++++*o##.>>;o#...o ++++++++++", +"+++++++++++++++*;o#........>- &+++++++++", +"+++++++++++++++++#>>;o......O -+++++++++", +"+++++++++++++++++@+@+o>.....$ +++++++++", +"+++++++++++++++++++++*;.#...>- %++++++++", +"++++++++++++++++++++++;>o....$ &++++++++", +"++++++++++++++++++++++#>>....>- %+++++++", +"+++++++++++++++++++++++;#>....; -+++++++", +"+++++++++++++++++++++++o#>....>O %++++++", +"+++++++++++++++++++++++*>o.....; -++++++", +"+++++++++++++#>**+++++++;#.....>O %+++++", +"+o#+++++++*o;>>>>o#+++++o##.....; -+++++", +"+:#o*++++oo#..*..*>;*+++#>#.....>O %++++", +"+:=#o#+*;>.:==:....#;*++@o.......; &++++", +"+::..>;o#.=::::......o*++;.......>O ++++", +"+.....#o.:.=:.........o#+;........$ ++++", +"+......#o..:...........#o;>.......o &+++", +"+........#..............*>o......:o- +++", +"+..................#o>#...#o.......O +++", +"+...............>o>#.......#>......O &++", +"+..................................o -++", +"+..................................> ++", +"+..................................> ++", +"+.................................#$ &+", +"+................................>$ &+", +"+..#>$o>#..............#>;>>>oOOO- ++", +"+...#O OOOOO$>>>>>>>$OO %++", +"+...o -&&++++", +"+..#O -&&%++++++++++", +"++++++++++++++++++++++++++++++++++++++++" +}; +/* XPM */ +static const char *stunned_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 12 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c #D4D4D4", +"O c None", +"+ c #B0B0B0", +"@ c #909090", +"# c #788C8C", +"$ c #606060", +"% c #406868", +"& c #303030", +"* c #6C91B6", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOO&$OOOO@OOO@@OO@OOOOOOOOOOOOO", +"OOOOOOOOOOO@& $OO@&&$$@ O@$$OOOOOOOOOOOO", +"OOOOOOOOOOOO$$ @@@$ &&OOO@$OOOOOOOOOOOO", +"OOOOOOOOOOOOO@@&$$$$&O$OO$O &@O@OOOOOOOO", +"OOOOOO@@@@@@OO@$$O$&$@@OO& &&$O&OOOOOOO", +"OOOOOO&&&& & $ &&@$ &O@$& &&&$ & $OOOOOO", +"OOOOOO$&OO &&&$ $$ $& $$&$&&&OOOOOOO", +"OOOOOO@@O@$ &+ # &O$$ $$&O@OOOOO", +"OOOOOOOO@X%$ %& %% & && $$@@@@OOOO", +"OOOOOOO+$$@+ &%%%&%& & &@OOO&&OOO", +"OOOOOO.Xo%+ &&%%%%%&& & OO@$&&OOO", +"OOOOO++ $$&&$ && %&%%& &O@&$&OOOO", +"OOOOO####$ X&&& && &%& & &&OOOO", +"OOOO++#.+## $&# %& & & &$ OOOO", +"OOOO#+++.@&%&& &#&%& & $ @OOOOOO", +"OOOO##....#+$#@%#& $%$&@&$$% & X##$@OOOO", +"OOOO.+#+.+@#+#+$&$X#%&%.+& %&#++.$&OOOOO", +"OOOOO#+#+.+++#$$%&++&X+X#&#+&+&##+ &OOOO", +"OOOOO#..#OO#+@%#o##X.@..++.+$&+#+#& @OOO", +"OOOOO+#.#O+#+#O@++@$$##+##++###+.#& $OOO", +"OOOOOOXX+#+#+#o.@%&$++#+..##.#+### &OOO", +"OOOOOOOX#.#X+#+#+##&#+..+####%XX%% OOO", +"OOOOOOOO+%%X.#+#+#.++#+#+#+.X++*.% &OOO", +"OOOOOOOOO@& &##+#+.O####.+XX%%%%#% $OOO", +"OOOOOOOOOOO. %X.+.#+++XXX*.+++#X $OOO", +"OOOOOOOOOOOO@& %%X..#X%#.####%X& $OOO", +"OOOOOOOOOOOOOO@$ &XX%%%*.#X%###*& OOOO", +"OOOOOOOOOOOOOOOOOO+%%%*%%#.+.#*& @OOOO", +"OOOOOOOOOOOOOOOOOOO*%%%**X##X%& OOOOO", +"OOOOOOOOOOOOOOOOOOOOX%%%%X*X& @OOOOO", +"OOOOOOOOOOOOOOOOOOOOX%%%%X &@OOOOOO", +"OOOOOOOOOOOOOOOOOOOO*%%%X& &$$OOOOOOOO", +"OOOOOOOOOOOOOOOOOOOO+X%%* @OOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOX%%& OOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOO*%%% $OOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOO*%%% $OOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOO.X%& $OOOOOOOOOOOOO" +}; +/* XPM */ +static const char *wis_xpm[] = { +/* width height ncolors chars_per_pixel */ +"40 40 13 1", +/* colors */ +" c #000000", +". c #949E9E", +"X c #5C7A7A", +"o c None", +"O c #B0B0B0", +"+ c #909090", +"@ c #788C8C", +"# c #606060", +"$ c #406868", +"% c #FFFFFF", +"& c #303030", +"* c #6C91B6", +"= c #0000FF", +/* pixels */ +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooo+#& &#oooooooooooooooooooo", +"oooooooooooo+& #oooooooooooooooooo", +"ooooooooooo+ &====&& &ooooooooooooooooo", +"oooooooooo+ &==& ===%& +ooooooooooooooo", +"ooooooooo+&%=== ===%%o&&oooooooooooooo", +"oooooooo.&%%===& ===%o& #+ooooooooooo", +"oooo&###&&%%*=======$#&ooo#& #+oooooooo", +"ooooo###o+&X$=====& #oo##oooo+######oooo", +"oooooooooooo######@oo##ooooooooooooooooo", +"oooooooooooooOoOoOo##ooooooooooooooooooo", +"ooooooooooooooooo+#+ooo+&#oooooooooooooo", +"ooooooooooooooooooooooo#oooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo", +"oooooooooooooooooooooooooooooooooooooooo" +}; +/* clang-format on */ diff --git a/win/Qt/qttableview.cpp b/win/Qt3/qt3tableview.cpp similarity index 99% rename from win/Qt/qttableview.cpp rename to win/Qt3/qt3tableview.cpp index b53e8a415..8bbc78cd6 100644 --- a/win/Qt/qttableview.cpp +++ b/win/Qt3/qt3tableview.cpp @@ -1,5 +1,5 @@ /********************************************************************** -** $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.4 $ $NHDT-Date: 1524684508 2018/04/25 19:28:28 $ +** $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.0 $ $NHDT-Date: 1575917720 2019/12/09 18:55:20 $ ** $Id: qttableview.cpp,v 1.2 2002/03/09 03:13:15 jwalz Exp $ ** ** Implementation of QtTableView class @@ -13,7 +13,7 @@ ** **********************************************************************/ -#include "qttableview.h" +#include "qt3tableview.h" #if QT_VERSION >= 300 #ifndef QT_NO_QTTABLEVIEW #include diff --git a/include/qttableview.h b/win/Qt3/qt3tableview.h similarity index 100% rename from include/qttableview.h rename to win/Qt3/qt3tableview.h diff --git a/win/Qt/tileedit.cpp b/win/Qt3/tileedit.cpp similarity index 100% rename from win/Qt/tileedit.cpp rename to win/Qt3/tileedit.cpp diff --git a/win/Qt/tileedit.h b/win/Qt3/tileedit.h similarity index 100% rename from win/Qt/tileedit.h rename to win/Qt3/tileedit.h diff --git a/win/Qt4/.gitattributes b/win/Qt4/.gitattributes deleted file mode 100644 index 68792d904..000000000 --- a/win/Qt4/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* NH_filestag=(file%s_for_the_Qt_4_widget_library_-_X11,_Windows,_Mac_OS_X) diff --git a/win/Qt4/qt4win.cpp b/win/Qt4/qt4win.cpp deleted file mode 100644 index ca0abe57b..000000000 --- a/win/Qt4/qt4win.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Warwick Allison, 1999. -// Qt4 conversion copyright (c) Ray Chason, 2012-2014. -// NetHack may be freely redistributed. See license for details. - -// Qt Binding for NetHack 3.4 -// -// Copyright (C) 1996-2001 by Warwick W. Allison (warwick@troll.no) -// -// Contributors: -// Michael Hohmuth -// - Userid control -// Svante Gerhard -// - .nethackrc tile and font size settings -// Dirk Schoenberger -// - KDE support -// - SlashEm support -// and many others for bug reports. -// -// Unfortunately, this doesn't use Qt as well as I would like, -// primarily because NetHack is fundamentally a getkey-type program -// rather than being event driven (hence the ugly key and click buffer) -// and also because this is my first major application of Qt. -// -// The problem of NetHack's getkey requirement is solved by intercepting -// key events by overiding QApplicion::notify(...), and putting them in -// a buffer. Mouse clicks on the map window are treated with a similar -// buffer. When the NetHack engine calls for a key, one is taken from -// the buffer, or if that is empty, QApplication::exec() is called. -// Whenever keys or clicks go into the buffer, QApplication::exit() -// is called. -// -// Another problem is that some NetHack players are decade-long players who -// demand complete keyboard control (while Qt and X11 conspire to make this -// difficult by having widget-based focus rather than application based - -// a good thing in general). This problem is solved by again using the key -// event buffer. -// -// Out of all this hackery comes a silver lining however, as macros for -// the super-expert and menus for the ultra-newbie are also made possible -// by the key event buffer. -// - -// This includes all the definitions we need from the NetHack main -// engine. We pretend MSC is a STDC compiler, because C++ is close -// enough, and we undefine NetHack macros which conflict with Qt -// identifiers. - -#define QT_DEPRECATED_WARNINGS -#include "hack.h" -#undef Invisible -#undef Warning -#undef index -#undef msleep -#undef rindex -#undef wizard -#undef yn -#undef min -#undef max - -#include -#if QT_VERSION >= 0x050000 -#include -#endif -#include "qt4win.h" -#include "qt4bind.h" -#include "qt4click.h" -#include "qt4glyph.h" -#include "qt4inv.h" -#include "qt4key.h" -#include "qt4icon.h" -#include "qt4map.h" -#include "qt4menu.h" -#include "qt4msg.h" -#include "qt4set.h" - -#include - -#include "qt4clust.h" - -#include - -#ifdef _WS_X11_ -// For userid control -#include -#endif - -#ifdef USER_SOUNDS -#if QT_VERSION >= 0x050000 -# include -# else -# include -# endif -#endif - - -#ifdef USER_SOUNDS -extern void play_sound_for_message(const std::string& str); -#endif - -namespace nethack_qt4 { - -void -centerOnMain( QWidget* w ) -{ - QWidget* m = NetHackQtBind::mainWidget(); - if (!m) m = qApp->desktop(); - QPoint p = m->mapToGlobal(QPoint(0,0)); - w->move( p.x() + m->width()/2 - w->width()/2, - p.y() + m->height()/2 - w->height()/2 ); -} - -NetHackQtWindow::NetHackQtWindow() -{ -} -NetHackQtWindow::~NetHackQtWindow() -{ -} - -// XXX Use "expected ..." for now, abort or default later. -// -void NetHackQtWindow::Clear() { puts("unexpected Clear"); } -void NetHackQtWindow::Display(bool block) { puts("unexpected Display"); } -bool NetHackQtWindow::Destroy() { return true; } -void NetHackQtWindow::CursorTo(int x,int y) { puts("unexpected CursorTo"); } -void NetHackQtWindow::PutStr(int attr, const QString& text) { puts("unexpected PutStr"); } -void NetHackQtWindow::StartMenu() { puts("unexpected StartMenu"); } -void NetHackQtWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, - const QString& str, bool presel) { puts("unexpected AddMenu"); } -void NetHackQtWindow::EndMenu(const QString& prompt) { puts("unexpected EndMenu"); } -int NetHackQtWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) { puts("unexpected SelectMenu"); return 0; } -void NetHackQtWindow::ClipAround(int x,int y) { puts("unexpected ClipAround"); } -void NetHackQtWindow::PrintGlyph(int x,int y,int glyph) { puts("unexpected PrintGlyph"); } -//void NetHackQtWindow::PrintGlyphCompose(int x,int y,int,int) { puts("unexpected PrintGlyphCompose"); } -void NetHackQtWindow::UseRIP(int how, time_t when) { puts("unexpected UseRIP"); } - -} // namespace nethack_qt4 diff --git a/win/X11/winX.c b/win/X11/winX.c index 85725d144..8378fa568 100644 --- a/win/X11/winX.c +++ b/win/X11/winX.c @@ -107,6 +107,7 @@ struct window_procs X11_procs = { WC2_FLUSH_STATUS | WC2_RESET_STATUS | WC2_HILITE_STATUS | #endif 0L, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */ X11_init_nhwindows, X11_player_selection, X11_askname, X11_get_nh_event, X11_exit_nhwindows, X11_suspend_nhwindows, X11_resume_nhwindows, X11_create_nhwindow, diff --git a/win/X11/winmap.c b/win/X11/winmap.c index b8f0be3d4..f8571af91 100644 --- a/win/X11/winmap.c +++ b/win/X11/winmap.c @@ -107,7 +107,7 @@ int bkglyph UNUSED; #endif /* map glyph to character and color */ - (void) mapglyph(glyph, &och, &color, &special, x, y); + (void) mapglyph(glyph, &och, &color, &special, x, y, 0); ch = (uchar) och; if (special != map_info->tile_map.glyphs[y][x].special) { diff --git a/win/curses/cursdial.c b/win/curses/cursdial.c index 30ac3cfec..cf88c022b 100644 --- a/win/curses/cursdial.c +++ b/win/curses/cursdial.c @@ -392,6 +392,7 @@ curses_ext_cmd() extwin = newwin(1, w - 2, y0 + 1, x0 + 1); if (w - 4 < maxlen) maxlen = w - 4; + nhUse(h); /* needed only to give getmaxyx three arguments */ } else { curses_get_window_xy(MESSAGE_WIN, &winx, &winy); curses_get_window_size(MESSAGE_WIN, &messageh, &messagew); @@ -758,11 +759,10 @@ curses_display_nhmenu(winid wid, int how, MENU_ITEM_P ** _selected) menu_determine_pages(current_menu); /* Display pre and post-game menus centered */ - if (((g.moves <= 1) && !g.invent) || g.program_state.gameover) { + if ((g.moves <= 1 && !g.invent) || g.program_state.gameover) { win = curses_create_window(current_menu->width, current_menu->height, CENTER); } else { /* Display during-game menus on the right out of the way */ - win = curses_create_window(current_menu->width, current_menu->height, RIGHT); } @@ -999,13 +999,13 @@ static void menu_win_size(nhmenu *menu) { int maxwidth, maxheight, curentrywidth, lastline; - int maxentrywidth = (int) strlen(menu->prompt); - int maxheaderwidth = 0; + int maxentrywidth = 0; + int maxheaderwidth = menu->prompt ? (int) strlen(menu->prompt) : 0; nhmenu_item *menu_item_ptr; if (g.program_state.gameover) { /* for final inventory disclosure, use full width */ - maxwidth = term_cols - 2; + maxwidth = term_cols - 2; /* +2: borders assumed */ } else { /* this used to be 38, which is 80/2 - 2 (half a 'normal' sized screen minus room for a border box), but some data files @@ -1028,7 +1028,7 @@ menu_win_size(nhmenu *menu) maxheaderwidth = curentrywidth; } } else { - /* Add space for accelerator */ + /* Add space for accelerator (selector letter) */ curentrywidth += 4; #if 0 /* FIXME: menu glyphs */ if (menu_item_ptr->glyph != NO_GLYPH && iflags.use_menu_glyphs) @@ -1040,20 +1040,20 @@ menu_win_size(nhmenu *menu) } } - /* If widest entry is smaller than maxwidth, reduce maxwidth - accordingly (but not too far; minimum width will be applied below) */ - if (maxentrywidth < maxwidth) { - maxwidth = maxentrywidth; - } - - /* Try not to wrap headers/normal text lines if possible. We can - go wider than half the screen for this purpose if need be */ - - if (maxheaderwidth > maxwidth) { - if (maxheaderwidth < (term_cols - 2)) - maxwidth = maxheaderwidth; - else - maxwidth = term_cols - 2; + /* + * 3.6.3: This used to set maxwidth to maxheaderwidth when that was + * bigger but only set it to maxentrywidth if the latter was smaller, + * so entries wider than the default would always wrap unless at + * least one header or separator line was long, even when there was + * lots of space available to display them without wrapping. The + * reason to force narrow menus isn't known. It may have been to + * reduce the amount of map rewriting when menu is dismissed, but if + * so, that was an issue due to excessive screen writing for the map + * (output was flushed for each character) which was fixed long ago. + */ + maxwidth = max(maxentrywidth, maxheaderwidth); + if (maxwidth > term_cols - 2) { /* -2: space for left and right borders */ + maxwidth = term_cols - 2; } /* Possibly reduce height if only 1 page */ @@ -1176,7 +1176,7 @@ menu_display_page(nhmenu *menu, WINDOW * win, int page_num, char *selectors) if (menu_item_ptr->glyph != NO_GLYPH && iflags.use_menu_glyphs) { unsigned special; /*notused */ - mapglyph(menu_item_ptr->glyph, &curletter, &color, &special, 0, 0); + mapglyph(menu_item_ptr->glyph, &curletter, &color, &special, 0, 0, 0); curses_toggle_color_attr(win, color, NONE, ON); mvwaddch(win, menu_item_ptr->line_num + 1, start_col, curletter); curses_toggle_color_attr(win, color, NONE, OFF); diff --git a/win/curses/cursinit.c b/win/curses/cursinit.c index 366454150..1b07395c6 100644 --- a/win/curses/cursinit.c +++ b/win/curses/cursinit.c @@ -462,7 +462,7 @@ curses_choose_character() tmpchoice[count] = toupper(tmpchoice[count]); } - sprintf(choice, "%s%s", choice, tmpchoice); + strcat(choice, tmpchoice); /* prevent an unnecessary prompt */ rigid_role_checks(); @@ -782,17 +782,14 @@ curses_init_options() set_wc_option_mod_status(WC_ALIGN_MESSAGE | WC_ALIGN_STATUS, SET_IN_GAME); /* Remove a few options that are irrelevant to this windowport */ - /*set_option_mod_status("DECgraphics", SET_IN_FILE); */ set_option_mod_status("eight_bit_tty", SET_IN_FILE); - /* Make sure that DECgraphics is not set to true via the config - file, as this will cause display issues. We can't disable it in - options.c in case the game is compiled with both tty and curses. */ - if (!g.symset[PRIMARY].name - || !strcmpi(g.symset[PRIMARY].name, "DECgraphics")) { + /* If we don't have a symset defined, load the curses symset by default */ + if (!g.symset[PRIMARY].explicitly) load_symset("curses", PRIMARY); + if (!g.symset[ROGUESET].explicitly) load_symset("default", ROGUESET); - } + #ifdef PDCURSES /* PDCurses for SDL, win32 and OS/2 has the ability to set the terminal size programatically. If the user does not specify a @@ -819,6 +816,9 @@ curses_init_options() */ #endif /* PDCURSES */ + /* FIXME: this overrides explicit OPTIONS=!use_inverse */ + iflags.wc_inverse = TRUE; /* aka iflags.use_inverse; default is False */ + /* fix up pet highlighting */ if (iflags.wc2_petattr == -1) /* shouldn't happen */ iflags.wc2_petattr = A_NORMAL; diff --git a/win/curses/cursinvt.c b/win/curses/cursinvt.c index c31effe48..64fd0197d 100644 --- a/win/curses/cursinvt.c +++ b/win/curses/cursinvt.c @@ -125,7 +125,7 @@ curses_add_inv(int y, int symbol = 0; attr_t glyphclr; - mapglyph(glyph, &symbol, &color, &dummy, u.ux, u.uy); + mapglyph(glyph, &symbol, &color, &dummy, u.ux, u.uy, 0); glyphclr = curses_color_attr(color, 0); wattron(win, glyphclr); wprintw(win, "%c ", symbol); diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index feadfe389..434d85c55 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -24,12 +24,22 @@ extern char erase_char, kill_char; extern long curs_mesg_suppress_turn; /* from cursmesg.c */ +/* stubs for curses_procs{} */ +#ifdef POSITIONBAR +static void dummy_update_position_bar(char *); +#endif +#ifdef CHANGE_COLOR +static void dummy_change_color(int, long, int); +static char *dummy_get_color_string(VOID_ARGS); +#endif + /* Public functions for curses NetHack interface */ /* Interface definition, for windows.c */ struct window_procs curses_procs = { "curses", - (WC_ALIGN_MESSAGE | WC_ALIGN_STATUS | WC_COLOR | WC_HILITE_PET + (WC_ALIGN_MESSAGE | WC_ALIGN_STATUS | WC_COLOR | WC_INVERSE + | WC_HILITE_PET #ifdef NCURSES_MOUSE_VERSION /* (this macro name works for PDCURSES too) */ | WC_MOUSE_SUPPORT #endif @@ -41,6 +51,7 @@ struct window_procs curses_procs = { | WC2_FLUSH_STATUS | WC2_TERM_SIZE | WC2_STATUSLINES | WC2_WINDOWBORDERS | WC2_PETATTR | WC2_GUICOLOR | WC2_SUPPRESS_HIST), + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */ curses_init_nhwindows, curses_player_selection, curses_askname, @@ -68,7 +79,7 @@ struct window_procs curses_procs = { curses_cliparound, #endif #ifdef POSITIONBAR - donull, + dummy_update_position_bar, #endif curses_print_glyph, curses_raw_print, @@ -82,9 +93,13 @@ struct window_procs curses_procs = { curses_get_ext_cmd, curses_number_pad, curses_delay_output, -#ifdef CHANGE_COLOR /* only a Mac option currently */ - donull, - donull, +#ifdef CHANGE_COLOR + dummy_change_color, +#ifdef MAC /* old OS 9, not OSX */ + (void (*)(int)) 0, + (short (*)(winid, char *)) 0, +#endif + dummy_get_color_string, #endif curses_start_screen, curses_end_screen, @@ -196,8 +211,11 @@ curses_init_nhwindows(int *argcp UNUSED, getmaxyx(base_term, term_rows, term_cols); counting = FALSE; curses_init_options(); - if ((term_rows < 15) || (term_cols < 40)) { - panic("Terminal too small. Must be minumum 40 width and 15 height"); + if (term_rows < 15 || term_cols < 40) { + panic("Terminal is too small; must have at least %s%s%s.", + (term_rows < 15) ? "15 rows" : "", + (term_rows < 15 && term_cols < 40) ? " and " : "", + (term_cols < 40) ? "40 columns" : ""); } /* during line input, deletes the most recently typed character */ erase_char = erasechar(); /* / or possibly */ @@ -651,16 +669,16 @@ curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph, int attr = -1; /* map glyph to character and color */ - mapglyph(glyph, &ch, &color, &special, x, y); + mapglyph(glyph, &ch, &color, &special, x, y, 0); if ((special & MG_PET) && iflags.hilite_pet) { attr = iflags.wc2_petattr; } if ((special & MG_DETECT) && iflags.use_inverse) { attr = A_REVERSE; } - if (!g.symset[PRIMARY].name || !strcmpi(g.symset[PRIMARY].name, "curses")) { + if (SYMHANDLING(H_DEC)) ch = curses_convert_glyph(ch, glyph); - } + if (wid == NHW_MAP) { /* hilite stairs not in 3.6, yet if ((special & MG_STAIRS) && iflags.hilite_hidden_stairs) { @@ -673,6 +691,11 @@ curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph, else attr = A_REVERSE; } + /* water and lava look the same except for color; when color is off, + render lava in inverse video so that they look different */ + if ((special & MG_BW_LAVA) && iflags.use_inverse) { + attr = A_REVERSE; /* mapglyph() only sets this if color is off */ + } } curses_putch(wid, x, y, ch, color, attr); @@ -939,4 +962,28 @@ curs_reset_windows(boolean redo_main, boolean redo_status) } } +/* stubs for curses_procs{} */ + +#ifdef POSITIONBAR +static void +dummy_update_position_bar(char *arg UNUSED) +{ + return; +} +#endif + +#ifdef CHANGE_COLOR +static void +dummy_change_color(int a1 UNUSED, long a2 UNUSED, int a3 UNUSED) +{ + return; +} + +static char * +dummy_get_color_string(VOID_ARGS) +{ + return (char *) 0; +} +#endif + /*cursmain.c*/ diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index 30c9ebced..6e625aef3 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -202,7 +202,7 @@ curses_block(boolean noscroll) /* noscroll - blocking because of msgtype prev_x = mx, prev_y = my; blink = 0; } - moreattr = !iflags.wc2_guicolor ? A_REVERSE : NONE; + moreattr = !iflags.wc2_guicolor ? (int) A_REVERSE : NONE; curses_toggle_color_attr(win, MORECOLOR, moreattr, ON); if (blink) { wattron(win, A_BLINK); diff --git a/win/curses/cursmisc.c b/win/curses/cursmisc.c index daf6b11e4..314efe5af 100644 --- a/win/curses/cursmisc.c +++ b/win/curses/cursmisc.c @@ -40,13 +40,18 @@ static int parse_escape_sequence(void); int curses_read_char() { - int ch, tmpch; + int ch; +#if defined(ALT_0) || defined(ALT_9) || defined(ALT_A) || defined(ALT_Z) + int tmpch; +#endif /* cancel message suppression; all messages have had a chance to be read */ curses_got_input(); ch = getch(); +#if defined(ALT_0) || defined(ALT_9) || defined(ALT_A) || defined(ALT_Z) tmpch = ch; +#endif ch = curses_convert_keys(ch); if (ch == 0) { @@ -69,7 +74,7 @@ curses_read_char() #ifdef KEY_RESIZE /* Handle resize events via get_nh_event, not this code */ if (ch == KEY_RESIZE) { - ch = '\033'; /* NetHack doesn't know what to do with KEY_RESIZE */ + ch = C('r'); /* NetHack doesn't know what to do with KEY_RESIZE */ } #endif @@ -372,7 +377,6 @@ curses_str_remainder(const char *str, int width, int line_num) int strsize = strlen(str) + 1; #if __STDC_VERSION__ >= 199901L char substr[strsize]; - char curstr[strsize]; char tmpstr[strsize]; strcpy(substr, str); @@ -381,7 +385,6 @@ curses_str_remainder(const char *str, int width, int line_num) #define BUFSZ 256 #endif char substr[BUFSZ * 2]; - char curstr[BUFSZ * 2]; char tmpstr[BUFSZ * 2]; if (strsize > (BUFSZ * 2) - 1) { @@ -409,11 +412,7 @@ curses_str_remainder(const char *str, int width, int line_num) if (last_space == 0) { /* No spaces found */ last_space = count - 1; } - for (count = 0; count < last_space; count++) { - curstr[count] = substr[count]; - } - curstr[count] = '\0'; - if (substr[count] == '\0') { + if (substr[last_space] == '\0') { break; } for (count = (last_space + 1); count < (int) strlen(substr); count++) { @@ -458,62 +457,121 @@ curses_is_text(winid wid) } } - -/* Replace certain characters with portable drawing characters if -cursesgraphics option is enabled */ - +/* convert nethack's DECgraphics encoding into curses' ACS encoding */ int curses_convert_glyph(int ch, int glyph) { - int symbol; + /* The DEC line drawing characters use 0x5f through 0x7e instead + of the much more straightforward 0x60 through 0x7f, possibly + because 0x7f is effectively a control character (Rubout); + nethack ORs 0x80 to flag line drawing--that's stripped below */ + static int decchars[33]; /* for chars 0x5f through 0x7f (95..127) */ + ch &= 0xff; /* 0..255 only */ + if (!(ch & 0x80)) + return ch; /* no conversion needed */ + + /* this conversion routine is only called for SYMHANDLING(H_DEC) and + we decline to support special graphics symbols on the rogue level */ if (Is_rogue_level(&u.uz)) { + /* attempting to use line drawing characters will end up being + rendered as lowercase gibberish */ + ch &= ~0x80; return ch; } - /* Save some processing time by returning if the glyph represents - an object that we don't have custom characters for */ - if (!glyph_is_cmap(glyph)) { - return ch; + /* + * Curses has complete access to all characters that DECgraphics uses. + * However, their character value isn't consistent between terminals + * and implementations. For actual DEC terminals and faithful emulators, + * line-drawing characters are specified as lowercase letters (mostly) + * and a control code is sent to the terminal telling it to switch + * character sets (that's how the tty interface handles them). + * Curses remaps the characters instead. + */ + + /* one-time initialization; some ACS_x aren't compile-time constant */ + if (!decchars[0]) { + /* [0] is non-breakable space; irrelevant to nethack */ + decchars[0x5f - 0x5f] = ' '; /* NBSP */ + decchars[0x60 - 0x5f] = ACS_DIAMOND; /* [1] solid diamond */ + decchars[0x61 - 0x5f] = ACS_CKBOARD; /* [2] checkerboard */ + /* several "line drawing" characters are two-letter glyphs + which could be substituted for invisible control codes; + nethack's DECgraphics doesn't use any of them so we're + satisfied with conversion to a simple letter; + [3] "HT" as one char, with small raised upper case H over + and/or preceding small lowered upper case T */ + decchars[0x62 - 0x5f] = 'H'; /* "HT" (horizontal tab) */ + decchars[0x63 - 0x5f] = 'F'; /* "FF" as one char (form feed) */ + decchars[0x64 - 0x5f] = 'C'; /* "CR" as one (carriage return) */ + decchars[0x65 - 0x5f] = 'L'; /* [6] "LF" as one (line feed) */ + decchars[0x66 - 0x5f] = ACS_DEGREE; /* small raised circle */ + /* [8] plus or minus sign, '+' with horizontal line below */ + decchars[0x67 - 0x5f] = ACS_PLMINUS; + decchars[0x68 - 0x5f] = 'N'; /* [9] "NL" as one char (new line) */ + decchars[0x69 - 0x5f] = 'V'; /* [10] "VT" as one (vertical tab) */ + decchars[0x6a - 0x5f] = ACS_LRCORNER; /* lower right corner */ + decchars[0x6b - 0x5f] = ACS_URCORNER; /* upper right corner, 7-ish */ + decchars[0x6c - 0x5f] = ACS_ULCORNER; /* upper left corner */ + decchars[0x6d - 0x5f] = ACS_LLCORNER; /* lower left corner, 'L' */ + /* [15] center cross, like big '+' sign */ + decchars[0x6e - 0x5f] = ACS_PLUS; + decchars[0x6f - 0x5f] = ACS_S1; /* very high horizontal line */ + decchars[0x70 - 0x5f] = ACS_S3; /* medium high horizontal line */ + decchars[0x71 - 0x5f] = ACS_HLINE; /* centered horizontal line */ + decchars[0x72 - 0x5f] = ACS_S7; /* medium low horizontal line */ + decchars[0x73 - 0x5f] = ACS_S9; /* very low horizontal line */ + /* [21] left tee, 'H' with right-hand vertical stroke removed; + note on left vs right: the ACS name (also DEC's terminal + documentation) refers to vertical bar rather than cross stroke, + nethack's left/right refers to direction of the cross stroke */ + decchars[0x74 - 0x5f] = ACS_LTEE; /* ACS left tee, NH right tee */ + /* [22] right tee, 'H' with left-hand vertical stroke removed */ + decchars[0x75 - 0x5f] = ACS_RTEE; /* ACS right tee, NH left tee */ + /* [23] bottom tee, '+' with lower half of vertical stroke + removed and remaining stroke pointed up (unside-down 'T'); + nethack is inconsistent here--unlike with left/right, its + bottom/top directions agree with ACS */ + decchars[0x76 - 0x5f] = ACS_BTEE; /* bottom tee, stroke up */ + /* [24] top tee, '+' with upper half of vertical stroke removed */ + decchars[0x77 - 0x5f] = ACS_TTEE; /* top tee, stroke down, 'T' */ + decchars[0x78 - 0x5f] = ACS_VLINE; /* centered vertical line */ + decchars[0x79 - 0x5f] = ACS_LEQUAL; /* less than or equal to */ + /* [27] greater than or equal to, '>' with underscore */ + decchars[0x7a - 0x5f] = ACS_GEQUAL; + /* [28] Greek pi ('n'-like; case is ambiguous: small size + suggests lower case but flat top suggests upper case) */ + decchars[0x7b - 0x5f] = ACS_PI; + /* [29] not equal sign, combination of '=' and '/' */ + decchars[0x7c - 0x5f] = ACS_NEQUAL; + /* [30] British pound sign (curly 'L' with embellishments) */ + decchars[0x7d - 0x5f] = ACS_STERLING; + decchars[0x7e - 0x5f] = ACS_BULLET; /* [31] centered dot */ + /* [32] is not used for DEC line drawing but is a potential + value for someone who assumes that 0x60..0x7f is the valid + range, so we're prepared to accept--and sanitize--it */ + decchars[0x7f - 0x5f] = '?'; } - symbol = glyph_to_cmap(glyph); + /* high bit set means special handling */ + if (ch & 0x80) { + int convindx, symbol; - /* If user selected a custom character for this object, don't - override this. */ - if (((glyph_is_cmap(glyph)) && (ch != g.showsyms[symbol]))) { - return ch; - } - - switch (symbol) { - case S_vwall: - return ACS_VLINE; - case S_hwall: - return ACS_HLINE; - case S_tlcorn: - return ACS_ULCORNER; - case S_trcorn: - return ACS_URCORNER; - case S_blcorn: - return ACS_LLCORNER; - case S_brcorn: - return ACS_LRCORNER; - case S_crwall: - return ACS_PLUS; - case S_tuwall: - return ACS_BTEE; - case S_tdwall: - return ACS_TTEE; - case S_tlwall: - return ACS_RTEE; - case S_trwall: - return ACS_LTEE; - case S_tree: - return ACS_PLMINUS; - case S_corr: - return ACS_CKBOARD; - case S_litcorr: - return ACS_CKBOARD; + ch &= ~0x80; /* force plain ASCII for last resort */ + convindx = ch - 0x5f; + /* if it's in the lower case block of ASCII (which includes + a few punctuation characters), use the conversion table */ + if (convindx >= 0 && convindx < SIZE(decchars)) { + ch = decchars[convindx]; + /* in case ACS_foo maps to 0 when current terminal is unable + to handle a particular character; if so, revert to default + rather than using DECgr value with high bit stripped */ + if (!ch) { + symbol = glyph_to_cmap(glyph); + ch = (int) defsyms[symbol].sym; + } + } } return ch; @@ -815,6 +873,9 @@ curses_convert_keys(int key) readchar() and stripping the value down to 0..255 yields ^G! */ ret = C('H'); break; +#ifdef KEY_B1 + case KEY_B1: +#endif case KEY_LEFT: if (iflags.num_pad) { ret = '4'; @@ -822,6 +883,9 @@ curses_convert_keys(int key) ret = 'h'; } break; +#ifdef KEY_B3 + case KEY_B3: +#endif case KEY_RIGHT: if (iflags.num_pad) { ret = '6'; @@ -829,6 +893,9 @@ curses_convert_keys(int key) ret = 'l'; } break; +#ifdef KEY_A2 + case KEY_A2: +#endif case KEY_UP: if (iflags.num_pad) { ret = '8'; @@ -836,6 +903,9 @@ curses_convert_keys(int key) ret = 'k'; } break; +#ifdef KEY_C2 + case KEY_C2: +#endif case KEY_DOWN: if (iflags.num_pad) { ret = '2'; @@ -845,40 +915,44 @@ curses_convert_keys(int key) break; #ifdef KEY_A1 case KEY_A1: +#endif + case KEY_HOME: if (iflags.num_pad) { ret = '7'; } else { - ret = 'y'; + ret = !g.Cmd.swap_yz ? 'y' : 'z'; } break; -#endif /* KEY_A1 */ #ifdef KEY_A3 case KEY_A3: +#endif + case KEY_PPAGE: if (iflags.num_pad) { ret = '9'; } else { ret = 'u'; } break; -#endif /* KEY_A3 */ #ifdef KEY_C1 case KEY_C1: +#endif + case KEY_END: if (iflags.num_pad) { ret = '1'; } else { ret = 'b'; } break; -#endif /* KEY_C1 */ #ifdef KEY_C3 case KEY_C3: +#endif + case KEY_NPAGE: if (iflags.num_pad) { ret = '3'; } else { ret = 'n'; } break; -#endif /* KEY_C3 */ #ifdef KEY_B2 case KEY_B2: if (iflags.num_pad) { diff --git a/win/curses/cursstat.c b/win/curses/cursstat.c index e4e9738b3..a9b801da6 100644 --- a/win/curses/cursstat.c +++ b/win/curses/cursstat.c @@ -209,8 +209,8 @@ static void draw_status() { WINDOW *win = curses_get_nhwin(STATUS_WIN); - int orient = curses_get_window_orientation(STATUS_WIN); - boolean horiz = (orient != ALIGN_RIGHT && orient != ALIGN_LEFT); + orient statorient = (orient) curses_get_window_orientation(STATUS_WIN); + boolean horiz = (statorient != ALIGN_RIGHT && statorient != ALIGN_LEFT); boolean border = curses_window_has_border(STATUS_WIN); /* Figure out if we have proper window dimensions for horizontal @@ -228,6 +228,7 @@ draw_status() curs_reset_windows(TRUE, TRUE); win = curses_get_nhwin(STATUS_WIN); } + nhUse(ax); /* getmaxyx macro isn't sufficient */ } werase(win); @@ -513,6 +514,7 @@ boolean border; conditions would go if they were on this line */ condstart += (cap_and_hunger == 2) ? spacing[BL_CAP] : (cap_and_hunger == 0) ? 1 : 0; + nhUse(conddummy); /* getyx needed 3 args */ } if (!(cap_and_hunger & 1)) continue; @@ -533,6 +535,7 @@ boolean border; t = (width - (border ? 0 : 1)) - (ex - 1); ebuf[max(t, 2)] = '\0'; /* might still wrap... */ } + nhUse(ey); /* getyx needed 3 args */ } break; case BL_SCORE: @@ -1719,18 +1722,14 @@ void curses_update_stats(void) { WINDOW *win = curses_get_nhwin(STATUS_WIN); + orient statorient = (orient) curses_get_window_orientation(STATUS_WIN); + boolean horiz = (statorient != ALIGN_RIGHT && statorient != ALIGN_LEFT); + boolean border = curses_window_has_border(STATUS_WIN); /* Clear the window */ werase(win); - int orient = curses_get_window_orientation(STATUS_WIN); - - boolean horiz = FALSE; - if ((orient != ALIGN_RIGHT) && (orient != ALIGN_LEFT)) - horiz = TRUE; - boolean border = curses_window_has_border(STATUS_WIN); - - /* Figure out if we have proper window dimensions for horizontal statusbar. */ + /* Figure out if we have proper window dimensions for horizontal status */ if (horiz) { /* correct y */ int cy = 3; @@ -1749,7 +1748,8 @@ curses_update_stats(void) curses_last_messages(); doredraw(); - /* Reset XP highlight (since classic_status and new show different numbers) */ + /* Reset XP highlight (since classic_status and new show + different numbers) */ prevexp.highlight_turns = 0; curses_update_stats(); return; @@ -1775,7 +1775,7 @@ curses_update_stats(void) hpmax = u.mhmax; } - if (orient != ALIGN_RIGHT && orient != ALIGN_LEFT) + if (horiz) draw_horizontal(x, y, hp, hpmax); else draw_vertical(x, y, hp, hpmax); @@ -1788,7 +1788,8 @@ curses_update_stats(void) if (first) { first = FALSE; - /* Zero highlight timers. This will call curses_update_status again if needed */ + /* Zero highlight timers. This will call curses_update_status again + if needed */ curses_decrement_highlights(TRUE); } } diff --git a/win/curses/curswins.c b/win/curses/curswins.c index ad194c598..5dc6fc3fa 100644 --- a/win/curses/curswins.c +++ b/win/curses/curswins.c @@ -87,7 +87,7 @@ curses_create_window(int width, int height, orient orientation) switch (orientation) { default: impossible("curses_create_window: Bad orientation"); - /* fall through to centre */ + /*FALLTHRU*/ case CENTER: startx = (term_cols / 2) - (width / 2); starty = (term_rows / 2) - (height / 2); @@ -504,7 +504,7 @@ curses_puts(winid wid, int attr, const char *text) if (curses_is_menu(wid) || curses_is_text(wid)) { if (!curses_menu_exists(wid)) { impossible( - "curses_puts: Attempted write to nonexistant window %d!", + "curses_puts: Attempted write to nonexistent window %d!", wid); return; } diff --git a/win/gem/.gitattributes b/win/gem/.gitattributes index 133df44a1..3c4d1eef1 100644 --- a/win/gem/.gitattributes +++ b/win/gem/.gitattributes @@ -1 +1 @@ -* NH_filestag=(file%s_for_GEM_versions_-_untested_for_3.6.2) +* NH_filestag=(file%s_for_GEM_versions_-_untested_for_3.6.4) diff --git a/win/gem/wingem.c b/win/gem/wingem.c index 4d3143837..d215a7ae3 100644 --- a/win/gem/wingem.c +++ b/win/gem/wingem.c @@ -43,7 +43,9 @@ struct window_procs Gem_procs = { | WC_FONT_TEXT | WC_FONT_MAP | WC_FONTSIZ_MESSAGE | WC_FONTSIZ_STATUS | WC_FONTSIZ_MENU | WC_FONTSIZ_TEXT | WC_FONTSIZ_MAP | WC_TILE_WIDTH | WC_TILE_HEIGHT | WC_TILE_FILE | WC_VARY_MSGCOUNT | WC_ASCII_MAP, - 0L, Gem_init_nhwindows, Gem_player_selection, Gem_askname, + 0L, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */ + Gem_init_nhwindows, Gem_player_selection, Gem_askname, Gem_get_nh_event, Gem_exit_nhwindows, Gem_suspend_nhwindows, Gem_resume_nhwindows, Gem_create_nhwindow, Gem_clear_nhwindow, Gem_display_nhwindow, Gem_destroy_nhwindow, Gem_curs, Gem_putstr, @@ -930,7 +932,7 @@ int glyph; unsigned special; /* map glyph to character and color */ - (void) mapglyph(glyph, &ch, &color, &special, x, y); + (void) mapglyph(glyph, &ch, &color, &special, x, y, 0); #ifdef TEXTCOLOR /* Turn off color if rogue level. */ diff --git a/win/gnome/.gitattributes b/win/gnome/.gitattributes index b1449f357..6f8e9f364 100644 --- a/win/gnome/.gitattributes +++ b/win/gnome/.gitattributes @@ -1 +1 @@ -* NH_filestag=(file%s_for_GNOME_versions_-_untested_for_3.6.2) +* NH_filestag=(file%s_for_GNOME_versions_-_untested_for_3.6.4) diff --git a/win/gnome/gnbind.c b/win/gnome/gnbind.c index 0b85b30d1..1ba8005d1 100644 --- a/win/gnome/gnbind.c +++ b/win/gnome/gnbind.c @@ -24,7 +24,9 @@ extern NEARDATA winid WIN_STATUS; /* Interface definition, for windows.c */ struct window_procs Gnome_procs = { - "Gnome", WC_COLOR | WC_HILITE_PET | WC_INVERSE, 0L, gnome_init_nhwindows, + "Gnome", WC_COLOR | WC_HILITE_PET | WC_INVERSE, 0L, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */ + gnome_init_nhwindows, gnome_player_selection, gnome_askname, gnome_get_nh_event, gnome_exit_nhwindows, gnome_suspend_nhwindows, gnome_resume_nhwindows, gnome_create_nhwindow, gnome_clear_nhwindow, gnome_display_nhwindow, diff --git a/win/macosx/NetHackGuidebook.applescript b/win/macosx/NetHackGuidebook.applescript index e91d12e03..977d4d713 100644 --- a/win/macosx/NetHackGuidebook.applescript +++ b/win/macosx/NetHackGuidebook.applescript @@ -1,5 +1,5 @@ #!/usr/bin/osascript -# NetHack 3.6.2 NetHackGuidebook.applescript $NHDT-Date: 1524684596 2018/04/25 19:29:56 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.8 $ +# NetHack 3.6 NetHackGuidebook.applescript $NHDT-Date: 1575245175 2019/12/02 00:06:15 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.10 $ # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2011 # NetHack may be freely redistributed. See license for details. diff --git a/win/macosx/NetHackTerm.applescript b/win/macosx/NetHackTerm.applescript index a4936d021..7c31b1610 100644 --- a/win/macosx/NetHackTerm.applescript +++ b/win/macosx/NetHackTerm.applescript @@ -1,5 +1,5 @@ #!/usr/bin/osascript -# NetHack 3.6.2 NetHackTerm.applescript $NHDT-Date: 1524684597 2018/04/25 19:29:57 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.8 $ +# NetHack 3.6.3 NetHackTerm.applescript $NHDT-Date: 1575245179 2019/12/02 00:06:19 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.10 $ # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2011 # NetHack may be freely redistributed. See license for details. diff --git a/win/Qt/nhicns.uu b/win/share/nhicns.uu similarity index 100% rename from win/Qt/nhicns.uu rename to win/share/nhicns.uu diff --git a/win/Qt/nhsplash.xpm b/win/share/nhsplash.xpm similarity index 100% rename from win/Qt/nhsplash.xpm rename to win/share/nhsplash.xpm diff --git a/win/share/safeproc.c b/win/share/safeproc.c index ab5cb1c5a..927744c4e 100644 --- a/win/share/safeproc.c +++ b/win/share/safeproc.c @@ -67,6 +67,7 @@ struct window_procs safe_procs = { "safe-startup", 0L, 0L, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */ safe_init_nhwindows, safe_player_selection, safe_askname, safe_get_nh_event, safe_exit_nhwindows, safe_suspend_nhwindows, safe_resume_nhwindows, safe_create_nhwindow, safe_clear_nhwindow, safe_display_nhwindow, @@ -113,6 +114,8 @@ int optn; safe_procs.win_raw_print_bold = stdio_raw_print_bold; safe_procs.win_nhgetch = stdio_nhgetch; safe_procs.win_wait_synch = stdio_wait_synch; + if (optn == 2) + safe_procs.win_raw_print = stdio_nonl_raw_print; } return &safe_procs; } @@ -541,6 +544,17 @@ const char *str; return; } +/* no newline variation, add to your code: + windowprocs.win_raw_print = stdio_nonl_raw_print; */ +void +stdio_nonl_raw_print(str) +const char *str; +{ + if (str) + fprintf(stdout, "%s", str); + return; +} + /* Add to your code: windowprocs.win_raw_print_bold = stdio_raw_print_bold; */ void stdio_raw_print_bold(str) diff --git a/win/share/tilemap.c b/win/share/tilemap.c index 39f3d4fc3..6651332e9 100644 --- a/win/share/tilemap.c +++ b/win/share/tilemap.c @@ -54,7 +54,7 @@ struct conditionals { #ifndef CHARON /* not supported yet */ { MON_GLYPH, PM_CROESUS, "Charon" }, #endif -#ifndef MAIL +#ifndef MAIL_STRUCTURES { MON_GLYPH, PM_FAMINE, "mail daemon" }, #endif /* commented out in monst.c at present */ @@ -69,7 +69,7 @@ struct conditionals { /* allow slime mold to look like slice of pizza, since we * don't know what a slime mold should look like when renamed anyway */ -#ifndef MAIL +#ifndef MAIL_STRUCTURES { OBJ_GLYPH, SCR_STINKING_CLOUD + EXTRA_SCROLL_DESCR_COUNT, "stamped / mail" }, #endif diff --git a/win/tty/termcap.c b/win/tty/termcap.c index ee9d6ff75..dbbd8164d 100644 --- a/win/tty/termcap.c +++ b/win/tty/termcap.c @@ -495,12 +495,10 @@ tty_end_screen() /* Cursor movements */ /* Note to overlay tinkerers. The placement of this overlay controls the - location - of the function xputc(). This function is not currently in trampoli.[ch] - files for what is deemed to be performance reasons. If this define is - moved - and or xputc() is taken out of the ROOT overlay, then action must be taken - in trampoli.[ch]. */ + location of the function xputc(). This function is not currently in + trampoli.[ch] files for what is deemed to be performance reasons. If + this define is moved and or xputc() is taken out of the ROOT overlay, + then action must be taken in trampoli.[ch]. */ void nocmov(x, y) @@ -528,7 +526,7 @@ int x, y; cmov(x, y); } else { while ((int) ttyDisplay->cury < y) { - xputc('\n'); + (void) xputc('\n'); ttyDisplay->curx = 0; ttyDisplay->cury++; } @@ -561,16 +559,27 @@ register int x, y; ttyDisplay->curx = x; } -/* See note above. xputc() is a special function. */ -void +/* See note above. xputc() is a special function for overlays. */ +int xputc(c) -#if defined(apollo) - int c; -#else - char c; -#endif +int c; /* actually char, but explicitly specify its widened type */ { - (void) putchar(c); + /* + * Note: xputc() as a direct all to putchar() doesn't make any + * sense _if_ putchar() is a function. But if it is a macro, an + * overlay configuration would want to avoid hidden code bloat + * from multiple putchar() expansions. And it gets passed as an + * argument to tputs() so we have to guarantee an actual function + * (while possibly lacking ANSI's (func) syntax to override macro). + * + * xputc() used to be declared as 'void xputc(c) char c; {}' but + * avoiding the proper type 'int' just to avoid (void) casts when + * ignoring the result can't have been sufficent reason to add it. + * It also had '#if apollo' conditional to have the arg be int. + * Matching putchar()'s declaration and using explicit casts where + * warranted is more robust, so we're just a jacket around that. + */ + return putchar(c); } void @@ -579,13 +588,9 @@ const char *s; { #ifndef TERMLIB (void) fputs(s, stdout); -#else -#if defined(NHSTDC) || defined(ULTRIX_PROTO) - tputs(s, 1, (int (*) ()) xputc); #else tputs(s, 1, xputc); #endif -#endif } void @@ -599,7 +604,7 @@ cl_end() /* this looks terrible, especially on a slow terminal but is better than nothing */ while (cx < CO) { - xputc(' '); + (void) xputc(' '); cx++; } tty_curs(BASE_WINDOW, (int) ttyDisplay->curx + 1, @@ -754,25 +759,18 @@ tty_delay_output() /* BUG: if the padding character is visible, as it is on the 5620 then this looks terrible. */ if (flags.null) { + tputs( #ifdef TERMINFO -/* cbosgd!cbcephus!pds for SYS V R2 */ -#ifdef NHSTDC - tputs("$<50>", 1, (int (*) ()) xputc); + "$<50>", #else - tputs("$<50>", 1, xputc); -#endif -#else -#if defined(NHSTDC) || defined(ULTRIX_PROTO) - tputs("50", 1, (int (*) ()) xputc); -#else - tputs("50", 1, xputc); -#endif + "50", #endif + 1, xputc); } else if (ospeed > 0 && ospeed < SIZE(tmspc10) && nh_CM) { /* delay by sending cm(here) an appropriate number of times */ register int cmlen = - strlen(tgoto(nh_CM, ttyDisplay->curx, ttyDisplay->cury)); + (int) strlen(tgoto(nh_CM, ttyDisplay->curx, ttyDisplay->cury)); register int i = 500 + tmspc10[ospeed] / 2; while (i > 0) { @@ -794,7 +792,7 @@ cl_eos() /* free after Robert Viduya */ while (cy <= LI - 2) { cl_end(); - xputc('\n'); + (void) xputc('\n'); cy++; } cl_end(); @@ -1284,41 +1282,6 @@ int color; xputs(hilites[color]); } -/* not to be confused with has_colors() in unixtty.c */ -int -has_color(color) -int color; -{ -#ifdef X11_GRAPHICS - /* XXX has_color() should be added to windowprocs */ - if (windowprocs.name != NULL && !strcmpi(windowprocs.name, "X11")) - return 1; -#endif -#ifdef GEM_GRAPHICS - /* XXX has_color() should be added to windowprocs */ - if (windowprocs.name != NULL && !strcmpi(windowprocs.name, "Gem")) - return 1; -#endif -#ifdef QT_GRAPHICS - /* XXX has_color() should be added to windowprocs */ - if (windowprocs.name != NULL && !strcmpi(windowprocs.name, "Qt")) - return 1; -#endif -#ifdef CURSES_GRAPHICS - /* XXX has_color() should be added to windowprocs */ - /* iflags.wc_color is set to false and the option disabled if the - terminal cannot display color */ - if (windowprocs.name != NULL && !strcmpi(windowprocs.name, "curses")) - return iflags.wc_color; -#endif -#ifdef AMII_GRAPHICS - /* hilites[] not used */ - return iflags.use_color ? 1 : 0; -#else - return hilites[color] != (char *) 0; -#endif -} - #endif /* TEXTCOLOR */ #endif /* TTY_GRAPHICS && !NO_TERMS */ diff --git a/win/tty/topl.c b/win/tty/topl.c index 242ba78c7..042d1fd20 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -302,7 +302,7 @@ char c; register struct WinDesc *cw = wins[WIN_MESSAGE]; if (cw == (struct WinDesc *) 0) - panic("Putsym window MESSAGE nonexistant"); + panic("Putsym window MESSAGE nonexistent"); switch (c) { case '\b': diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 934a452c6..2c61f07e7 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 wintty.c $NHDT-Date: 1558400902 2019/05/21 01:08:22 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.209 $ */ +/* NetHack 3.6 wintty.c $NHDT-Date: 1575245194 2019/12/02 00:06:34 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.227 $ */ /* Copyright (c) David Cohrs, 1991 */ /* NetHack may be freely redistributed. See license for details. */ @@ -95,6 +95,11 @@ struct window_procs tty_procs = { | WC2_RESET_STATUS #endif | WC2_DARKGRAY | WC2_SUPPRESS_HIST | WC2_STATUSLINES), +#ifdef TEXTCOLOR + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */ +#else + {1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1}, +#endif tty_init_nhwindows, tty_player_selection, tty_askname, tty_get_nh_event, tty_exit_nhwindows, tty_suspend_nhwindows, tty_resume_nhwindows, tty_create_nhwindow, tty_clear_nhwindow, tty_display_nhwindow, @@ -133,7 +138,6 @@ struct window_procs tty_procs = { genl_can_suspend_yes, }; -static int maxwin = 0; /* number of windows in use */ winid BASE_WINDOW; struct WinDesc *wins[MAXWIN]; struct DisplayDesc *ttyDisplay; /* the tty display descriptor */ @@ -204,7 +208,7 @@ static boolean FDECL(check_fields, (BOOLEAN_P, int *)); static void NDECL(render_status); static void FDECL(tty_putstatusfield, (const char *, int, int)); static boolean NDECL(check_windowdata); -static int NDECL(condition_size); +static void NDECL(set_condition_length); static int FDECL(make_things_fit, (BOOLEAN_P)); static void FDECL(shrink_enc, (int)); static void FDECL(shrink_dlvl, (int)); @@ -1051,7 +1055,7 @@ reset_role_filtering() add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, - "Uncceptable alignments", MENU_UNSELECTED); + "Unacceptable alignments", MENU_UNSELECTED); setup_algnmenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE); end_menu(win, "Pick all that apply"); @@ -1418,10 +1422,18 @@ int type; int i, rowoffset; int newid; - if (maxwin == MAXWIN) + for (newid = 0; newid < MAXWIN; ++newid) + if (wins[newid] == 0) + break; + if (newid == MAXWIN) { + panic("No window slots!"); + /*NOTREACHED*/ return WIN_ERR; + } + + newwin = (struct WinDesc *) alloc(sizeof (struct WinDesc)); + wins[newid] = newwin; - newwin = (struct WinDesc *) alloc(sizeof(struct WinDesc)); newwin->type = type; newwin->flags = 0; newwin->active = FALSE; @@ -1488,17 +1500,7 @@ int type; break; default: panic("Tried to create window type %d\n", (int) type); - return WIN_ERR; - } - - for (newid = 0; newid < MAXWIN; newid++) { - if (wins[newid] == 0) { - wins[newid] = newwin; - break; - } - } - if (newid == MAXWIN) { - panic("No window slots!"); + /*NOTREACHED*/ return WIN_ERR; } @@ -2445,7 +2447,7 @@ winid window; free_window_info(cw, TRUE); free((genericptr_t) cw); - wins[window] = 0; + wins[window] = 0; /* available for re-use */ } void @@ -3379,7 +3381,7 @@ int bkglyph UNUSED; } #endif /* map glyph to character and color */ - (void) mapglyph(glyph, &ch, &color, &special, x, y); + (void) mapglyph(glyph, &ch, &color, &special, x, y, 0); print_vt_code2(AVTC_SELECT_WINDOW, window); @@ -3613,7 +3615,7 @@ char *posbar; * and tries a few different ways to squish a representation * of the status window values onto the 80 column tty display. * ->check_fields() - * ->condition_size() - get the width of all conditions + * ->set_condition_length() - update the width of conditions * ->shrink_enc() - shrink encumbrance message word * ->shrink_dlvl() - reduce the width of Dlvl:42 * @@ -3959,7 +3961,7 @@ unsigned long *colormasks; enclev = stat_cap_indx(); break; } - /* 3.6.2 we only render on BL_FLUSH (or BL_RESET) */ + /* As of 3.6.2 we only render on BL_FLUSH (or BL_RESET) */ return; } @@ -3967,7 +3969,7 @@ static int make_things_fit(force_update) boolean force_update; { - int trycnt, fitting = 0, condsz, requirement; + int trycnt, fitting = 0, requirement; int rowsz[3], num_rows, condrow, otheroptions = 0; num_rows = (iflags.wc2_statuslines < 3) ? 2 : 3; @@ -3977,7 +3979,7 @@ boolean force_update; shrink_enc(0); if (dlvl_shrinklvl > 0) shrink_dlvl(0); - condsz = condition_size(); + set_condition_length(); for (trycnt = 0; trycnt < 6 && !fitting; ++trycnt) { /* FIXME: this remeasures each line every time even though it is only attempting to shrink one of them and the other one @@ -3995,7 +3997,7 @@ boolean force_update; if (trycnt < 2) { if (cond_shrinklvl < trycnt + 1) { cond_shrinklvl = trycnt + 1; - condsz = condition_size(); + set_condition_length(); } continue; } @@ -4209,21 +4211,24 @@ int x, y; text++; } } - } else { - /* Now we're truncating */ - if (truncation_expected) - ; /* but we knew in advance */ } +#if 0 + else { + if (truncation_expected) { + /* Now we're truncating */ + ; /* but we knew in advance */ + } + } +#endif } /* caller must set cond_shrinklvl (0..2) before calling us */ -static int -condition_size() +static void +set_condition_length() { long mask; - int c, lth; + int c, lth = 0; - lth = 0; if (tty_condition_bits) { for (c = 0; c < SIZE(conditions); ++c) { mask = conditions[c].mask; @@ -4232,7 +4237,6 @@ condition_size() } } tty_status[NOW][BL_CONDITION].lth = lth; - return lth; } static void @@ -4305,7 +4309,7 @@ unsigned long *bmarray; the condition where this gets used always has the same value */ #define condcolor(bm,bmarray) NO_COLOR #define term_start_color(color) /*empty*/ -#define term_end_color(color) /*empty*/ +#define term_end_color() /*empty*/ #endif /* TEXTCOLOR */ static int diff --git a/win/win32/NetHackW.rc b/win/win32/NetHackW.rc index c0d9fbc26..ee9cbb398 100644 --- a/win/win32/NetHackW.rc +++ b/win/win32/NetHackW.rc @@ -172,12 +172,12 @@ BEGIN CONTROL "Chaotic",IDC_PLSEL_ALIGN_CHAOTIC,"Button",BS_AUTORADIOBUTTON,168,72,38,10 CONTROL "Male",IDC_PLSEL_GENDER_MALE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,168,108,30,10 CONTROL "Female",IDC_PLSEL_GENDER_FEMALE,"Button",BS_AUTORADIOBUTTON,168,120,38,10 - GROUPBOX "Alignment",IDC_STATIC,162,36,48,54 - GROUPBOX "Gender",IDC_STATIC,162,96,48,42 - GROUPBOX "Role",IDC_STATIC,6,36,72,150 - GROUPBOX "Race",IDC_STATIC,84,36,72,72 + GROUPBOX "Alignment",IDC_PLSEL_ALIGNMENT_GROUP,162,36,48,54 + GROUPBOX "Gender",IDC_PLSEL_GENDER_GROUP,162,96,48,42 + GROUPBOX "Role",IDC_PLSEL_ROLE_GROUP,6,36,72,150 + GROUPBOX "Race",IDC_PLSEL_RACE_GROUP,84,36,72,72 PUSHBUTTON "Random",IDC_PLSEL_RANDOM,90,192,54,14,WS_GROUP - GROUPBOX "Name",IDC_STATIC,6,0,120,30 + GROUPBOX "Name",IDC_PLSEL_NAME_GROUP,6,0,120,30 CONTROL "",IDC_PLSEL_ROLE_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_OWNERDRAWFIXED | LVS_ALIGNLEFT | LVS_NOSCROLL | LVS_NOCOLUMNHEADER | WS_BORDER | WS_GROUP | WS_TABSTOP,12,48,60,130 CONTROL "",IDC_PLSEL_RACE_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_OWNERDRAWFIXED | LVS_ALIGNLEFT | LVS_NOSCROLL | LVS_NOCOLUMNHEADER | WS_BORDER | WS_GROUP | WS_TABSTOP,90,48,60,51 END diff --git a/win/win32/dgnstuff-mingw32.mak b/win/win32/dgnstuff-mingw32.mak deleted file mode 100644 index d81c95795..000000000 --- a/win/win32/dgnstuff-mingw32.mak +++ /dev/null @@ -1,93 +0,0 @@ -# $NHDT-Date: 1524689255 2018/04/25 20:47:35 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.12 $ -# Copyright (c) 2018 by Michael Allison -# NetHack may be freely redistributed. See license for details. - -# Set all of these or none of them. -# -# bison and flex are the ones found in GnuWin32, which -# is probably the easiest set of these tools to find -# on Windows. -# -#YACC = bison.exe -y -#LEX = flex.exe -#YTABC = y.tab.c -#YTABH = y.tab.h -#LEXYYC = lex.yy.c -SHELL=cmd.exe - -default: all - -all: tools ../util/dgn_yacc.c ../util/dgn_lex.c - -rebuild: clean all - -clean: - -del ..\util\dgn_lex.c - -del ..\util\dgn_yacc.c - -del ..\include\dgn_comp.h - -tools: -ifneq "$(YACC)" "" - @echo Yacc-alike set to $(YACC) - @echo YTABC set to $(YTABC) - @echo YTABH set to $(YTABH) -endif - -ifneq "$(LEX)" "" - @echo Lex-alike set to $(LEX) - @echo LEXYYC set to $(LEXYYC) -endif - -#========================================== -# Dungeon Compiler Stuff -#========================================== - -../include/dgn_comp.h : ../util/dgn_comp.y -ifeq "$(YACC)" "" - @echo Using pre-built dgn_comp.h - chdir ..\include - copy /y ..\sys\share\dgn_comp.h - copy /b dgn_comp.h+,, - chdir ..\src -else - chdir ..\util - $(YACC) -d dgn_comp.y - copy $(YTABC) $@ - copy $(YTABH) ..\include\dgn_comp.h - @del $(YTABC) - @del $(YTABH) - chdir ..\build -endif - -../util/dgn_yacc.c : ../util/dgn_comp.y -ifeq "$(YACC)" "" - @echo Using pre-built dgn_yacc.c - chdir ..\util - copy /y ..\sys\share\dgn_yacc.c - copy /b dgn_yacc.c+,, - chdir ..\src -else - chdir ..\util - $(YACC) -d dgn_comp.y - copy $(YTABC) $@ - copy $(YTABH) ..\include\dgn_comp.h - @del $(YTABC) - @del $(YTABH) - chdir ..\build -endif - -../util/dgn_lex.c: ../util/dgn_comp.l -ifeq "$(LEX)" "" - @echo Using pre-built dgn_lex.c - chdir ..\util - copy /y ..\sys\share\dgn_lex.c - copy /b dgn_lex.c+,, - chdir ..\src -else - chdir ..\util - $(LEX) dgn_comp.l - copy $(LEXYYC) $@ - @del $(LEXYYC) - chdir ..\build -endif - diff --git a/win/win32/dgnstuff.mak b/win/win32/dgnstuff.mak deleted file mode 100644 index 2339a8a5a..000000000 --- a/win/win32/dgnstuff.mak +++ /dev/null @@ -1,93 +0,0 @@ -# $NHDT-Date: 1524689255 2018/04/25 20:47:35 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.12 $ -# Copyright (c) 2018 by Michael Allison -# NetHack may be freely redistributed. See license for details. - -# Set all of these or none of them. -# -# bison and flex are the ones found in GnuWin32, which -# is probably the easiest set of these tools to find -# on Windows. -# -#YACC = bison.exe -y -#LEX = flex.exe -#YTABC = y.tab.c -#YTABH = y.tab.h -#LEXYYC = lex.yy.c - - -default: all - -all: tools ..\util\dgn_yacc.c ..\util\dgn_lex.c - -rebuild: clean all - -clean: - -del ..\util\dgn_lex.c - -del ..\util\dgn_yacc.c - -del ..\include\dgn_comp.h - -tools: -!IFDEF YACC - @echo Yacc-alike set to $(YACC) - @echo YTABC set to $(YTABC) - @echo YTABH set to $(YTABH) -!ENDIF - -!IFDEF LEX - @echo Lex-alike set to $(LEX) - @echo LEXYYC set to $(LEXYYC) -!ENDIF - - -#========================================== -# Dungeon Compiler Stuff -#========================================== - -..\include\dgn_comp.h : ..\util\dgn_comp.y -!IF "$(YACC)"=="" - @echo Using pre-built dgn_comp.h - chdir ..\include - copy /y ..\sys\share\dgn_comp.h - copy /b dgn_comp.h+,, - chdir ..\src -!ELSE - chdir ..\util - $(YACC) -d dgn_comp.y - copy $(YTABC) $@ - copy $(YTABH) ..\include\dgn_comp.h - @del $(YTABC) - @del $(YTABH) - chdir ..\build -!ENDIF - -..\util\dgn_yacc.c : ..\util\dgn_comp.y -!IF "$(YACC)"=="" - @echo Using pre-built dgn_yacc.c - chdir ..\util - copy /y ..\sys\share\dgn_yacc.c - copy /b dgn_yacc.c+,, - chdir ..\src -!ELSE - chdir ..\util - $(YACC) -d dgn_comp.y - copy $(YTABC) $@ - copy $(YTABH) ..\include\dgn_comp.h - @del $(YTABC) - @del $(YTABH) - chdir ..\build -!ENDIF - -..\util\dgn_lex.c: ..\util\dgn_comp.l -!IF "$(LEX)"=="" - @echo Using pre-built dgn_lex.c - chdir ..\util - copy /y ..\sys\share\dgn_lex.c - copy /b dgn_lex.c+,, - chdir ..\src -!ELSE - chdir ..\util - $(LEX) dgn_comp.l - copy $(LEXYYC) $@ - @del $(LEXYYC) - chdir ..\build -!ENDIF diff --git a/win/win32/levstuff-mingw32.mak b/win/win32/levstuff-mingw32.mak deleted file mode 100644 index 524755c1f..000000000 --- a/win/win32/levstuff-mingw32.mak +++ /dev/null @@ -1,100 +0,0 @@ -# $NHDT-Date: 1524689255 2018/04/25 20:47:35 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.12 $ -# Copyright (c) 2018 by Michael Allison -# NetHack may be freely redistributed. See license for details. - -# Set all of these or none of them. -# -# bison and flex are the ones found in GnuWin32, which -# is probably the easiest set of these tools to find -# on Windows. -# -#YACC = bison.exe -y -#LEX = flex.exe -#YTABC = y.tab.c -#YTABH = y.tab.h -#LEXYYC = lex.yy.c -SHELL = cmd.exe - -default: all - -all: tools ../util/lev_yacc.c ../util/lev_lex.c - -rebuild: clean all - -clean: - -del ..\util\lev_lex.c - -del ..\util\lev_yacc.c - -del ..\include\lev_comp.h - -tools: -ifneq "$(YACC)" "" - @echo Yacc-alike set to "$(YACC)" - @echo YTABC set to $(YTABC) - @echo YTABH set to $(YTABH) -endif - -ifneq "$(LEX)" "" - @echo Lex-alike set to "$(LEX)" - @echo LEXYYC set to $(LEXYYC) -endif - -#========================================== -# Level Compiler Stuff -#========================================== - -../include/lev_comp.h: ../util/lev_comp.y - @echo Yacc-alike set to "$(YACC)" -ifeq "$(YACC)" "" - @echo Using pre-built lev_comp.h - chdir ..\include - copy /y ..\sys\share\lev_comp.h - copy /b lev_comp.h+,, - chdir ..\src -else - @echo Generating lev_yacc.c and lev_comp.h - chdir ..\util - $(YACC) -d lev_comp.y - copy $(YTABC) $@ - copy $(YTABH) ..\include\lev_comp.h - @del $(YTABC) - @del $(YTABH) - chdir ..\src -endif - -../util/lev_yacc.c: ../util/lev_comp.y - @echo Yacc-alike set to "$(YACC)" -ifeq "$(YACC)" "" - @echo Using pre-built lev_yacc.c - chdir ..\util - copy /y ..\sys\share\lev_yacc.c - copy /b lev_yacc.c+,, - chdir ..\src -else - @echo Generating lev_yacc.c and lev_comp.h - chdir ..\util - $(YACC) -d lev_comp.y - copy $(YTABC) $@ - copy $(YTABH) ..\include\lev_comp.h - @del $(YTABC) - @del $(YTABH) - chdir ..\src -endif - -../util/lev_lex.c: ../util/lev_comp.l - @echo Lex-alike set to "$(LEX)" -ifeq "$(LEX)" "" - @echo Using pre-built lev_lex.c - chdir ..\util - copy /y ..\sys\share\lev_lex.c - copy /b lev_lex.c+,, - chdir ..\src -else - @echo Generating lev_lex.c - chdir ..\util - $(LEX) lev_comp.l - copy $(LEXYYC) $@ - @del $(LEXYYC) - chdir ..\src -endif - - diff --git a/win/win32/levstuff.mak b/win/win32/levstuff.mak deleted file mode 100644 index 0a38390d1..000000000 --- a/win/win32/levstuff.mak +++ /dev/null @@ -1,96 +0,0 @@ -# $NHDT-Date: 1524689255 2018/04/25 20:47:35 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.12 $ -# Copyright (c) 2018 by Michael Allison -# NetHack may be freely redistributed. See license for details. - -# Set all of these or none of them. -# -# bison and flex are the ones found in GnuWin32, which -# is probably the easiest set of these tools to find -# on Windows. -# -#YACC = bison.exe -y -#LEX = flex.exe -#YTABC = y.tab.c -#YTABH = y.tab.h -#LEXYYC = lex.yy.c - - -default: all - -all: tools ..\util\lev_yacc.c ..\util\lev_lex.c - -rebuild: clean all - -clean: - -del ..\util\lev_lex.c - -del ..\util\lev_yacc.c - -del ..\include\lev_comp.h - -tools: -!IFDEF YACC - @echo Yacc-alike set to $(YACC) - @echo YTABC set to $(YTABC) - @echo YTABH set to $(YTABH) -!ENDIF - -!IFDEF LEX - @echo Lex-alike set to $(LEX) - @echo LEXYYC set to $(LEXYYC) -!ENDIF - -#========================================== -# Level Compiler Stuff -#========================================== - -..\include\lev_comp.h: ..\util\lev_comp.y -!IFNDEF YACC - @echo Using pre-built lev_comp.h - chdir ..\include - copy /y ..\sys\share\lev_comp.h - copy /b lev_comp.h+,, - chdir ..\src -!ELSE - @echo Generating lev_yacc.c and lev_comp.h - chdir ..\util - $(YACC) -d lev_comp.y - copy $(YTABC) $@ - copy $(YTABH) ..\include\lev_comp.h - @del $(YTABC) - @del $(YTABH) - chdir ..\src -!ENDIF - -..\util\lev_yacc.c: ..\util\lev_comp.y -!IFNDEF YACC - @echo Using pre-built lev_yacc.c - chdir ..\util - copy /y ..\sys\share\lev_yacc.c - copy /b lev_yacc.c+,, - chdir ..\src -!ELSE - @echo Generating lev_yacc.c and lev_comp.h - chdir ..\util - $(YACC) -d lev_comp.y - copy $(YTABC) $@ - copy $(YTABH) ..\include\lev_comp.h - @del $(YTABC) - @del $(YTABH) - chdir ..\src -!ENDIF - -..\util\lev_lex.c: ..\util\lev_comp.l -!IFNDEF LEX - @echo Using pre-built lev_lex.c - chdir ..\util - copy /y ..\sys\share\lev_lex.c - copy /b lev_lex.c+,, - chdir ..\src -!ELSE - @echo Generating lev_lex.c - chdir ..\util - $(LEX) lev_comp.l - copy $(LEXYYC) $@ - @del $(LEXYYC) - chdir ..\src -!ENDIF - diff --git a/win/win32/mhdlg.c b/win/win32/mhdlg.c index b4616f247..cac7bbff8 100644 --- a/win/win32/mhdlg.c +++ b/win/win32/mhdlg.c @@ -4,6 +4,7 @@ /* various dialog boxes are defined here */ +#include "win10.h" #include "winMS.h" #include "hack.h" #include "func_tab.h" @@ -12,6 +13,7 @@ #include + /*---------------------------------------------------------------*/ /* data for getlin dialog */ struct getlin_data { @@ -276,22 +278,68 @@ ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) /*---------------------------------------------------------------*/ /* player selector dialog */ + +/* NOTE: this enumeration is in control tab order */ +enum player_selector_control { + psc_name_group, + psc_role_group, + psc_race_group, + psc_alignment_group, + psc_gender_group, + psc_name_box, + psc_role_list, + psc_race_list, + psc_lawful_button, + psc_neutral_button, + psc_chaotic_button, + psc_male_button, + psc_female_button, + psc_play_button, + psc_random_button, + psc_quit_button, + psc_control_count +}; + +static const s_psc_id[psc_control_count] = { + IDC_PLSEL_NAME_GROUP, + IDC_PLSEL_ROLE_GROUP, + IDC_PLSEL_RACE_GROUP, + IDC_PLSEL_ALIGNMENT_GROUP, + IDC_PLSEL_GENDER_GROUP, + IDC_PLSEL_NAME, + IDC_PLSEL_ROLE_LIST, + IDC_PLSEL_RACE_LIST, + IDC_PLSEL_ALIGN_LAWFUL, + IDC_PLSEL_ALIGN_NEUTRAL, + IDC_PLSEL_ALIGN_CHAOTIC, + IDC_PLSEL_GENDER_MALE, + IDC_PLSEL_GENDER_FEMALE, + IDOK, + IDC_PLSEL_RANDOM, + IDCANCEL +}; + +typedef struct { + int id; + POINT pos; + SIZE size; + HWND hWnd; +} control_t; + typedef struct plsel_data { + HWND dialog; + HWND focus; + control_t controls[psc_control_count]; + SIZE client_size; int config_race; int config_role; int config_gender; int config_alignment; - HWND control_role; - HWND control_race; - HWND control_genders[ROLE_GENDERS]; - HWND control_aligns[ROLE_ALIGNS]; int role_count; int race_count; - HWND focus; } plsel_data_t; INT_PTR CALLBACK PlayerSelectorDlgProc(HWND, UINT, WPARAM, LPARAM); -static void plselInitDialog(HWND hWnd); static void plselAdjustSelections(HWND hWnd); static boolean plselRandomize(plsel_data_t * data); static BOOL plselDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam); @@ -322,38 +370,314 @@ mswin_player_selection_window() return ok; } +int +list_view_height(HWND hWnd, int count) +{ + return (ListView_ApproximateViewRect(hWnd, -1, -1, count)) >> 16; +} + +/* calculate the size and position of the controls taking into account + the per-monitor DPI expressed as a scaling factor on sizes at 96 DPI */ +void +calculate_player_selector_layout(plsel_data_t * data) +{ + MonitorInfo monitorInfo; + win10_monitor_info(data->dialog, &monitorInfo); + + double scale = monitorInfo.scale; + + /* Note these hard coded sizes are in 96DPI pixels and must be + scaled by the per-monitor DPI scaling factor */ + int list_width = (int) (120 * scale); + int group_border = (int) (16 * scale); + int client_border = (int) (16 * scale); + int group_spacing = (int) (16 * scale); + int button_width = (int) (80 * scale); + int button_height = (int) (28 * scale); + + /* set control sizes */ + control_t * name_box = &data->controls[psc_name_box]; + name_box->size.cx = (int) (280 * scale); + name_box->size.cy = (int) (24 * scale); + + control_t * role_list = &data->controls[psc_role_list]; + /* NOTE: we dont' scale the list view reported height as it appears these + values are the actual size the control will be drawn at using the + existing DPI value */ + role_list->size.cy = list_view_height(role_list->hWnd, data->role_count); + role_list->size.cx = list_width; + + control_t * race_list = &data->controls[psc_race_list]; + race_list->size.cy = list_view_height(race_list->hWnd, data->race_count); + race_list->size.cx = list_width; + + for(int i = psc_lawful_button; i <= psc_quit_button; i++) { + data->controls[i].size.cx = button_width; + data->controls[i].size.cy = button_height; + } + + for(int i = 0; i < 3; i++) { + control_t * group_control = &data->controls[psc_name_group + i]; + control_t * inner_control = &data->controls[psc_name_box + i]; + group_control->size.cx = inner_control->size.cx + (2 * group_border); + group_control->size.cy = inner_control->size.cy + (2 * group_border); + } + + control_t * alignment_group = &data->controls[psc_alignment_group]; + alignment_group->size.cx = button_width + (2 * group_border); + alignment_group->size.cy = (3 * button_height) + (2 * group_border); + + control_t * gender_group = &data->controls[psc_gender_group]; + gender_group->size.cx = button_width + (2 * group_border); + gender_group->size.cy = (2 * button_height) + (2 * group_border); + + /* set control positions */ + control_t * name_group = &data->controls[psc_name_group]; + name_group->pos.x = client_border; + name_group->pos.y = client_border; + + control_t * role_group = &data->controls[psc_role_group]; + role_group->pos.x = client_border; + role_group->pos.y = name_group->pos.y + name_group->size.cy + group_spacing; + + control_t * race_group = &data->controls[psc_race_group]; + race_group->pos.x = role_group->pos.x + role_group->size.cx + group_spacing; + race_group->pos.y = role_group->pos.y; + + for(int i = 0; i < 3; i++) { + control_t * group_control = &data->controls[psc_name_group + i]; + control_t * inner_control = &data->controls[psc_name_box + i]; + inner_control->pos.x = group_control->pos.x + group_border; + inner_control->pos.y = group_control->pos.y + group_border; + } + + alignment_group->pos.x = race_group->pos.x + race_group->size.cx + group_spacing; + alignment_group->pos.y = race_group->pos.y; + + for(int i = psc_lawful_button; i <= psc_chaotic_button; i++) { + data->controls[i].pos.x = alignment_group->pos.x + group_border; + data->controls[i].pos.y = alignment_group->pos.y + group_border + + ((i -psc_lawful_button) * button_height); + } + + gender_group->pos.x = alignment_group->pos.x; + gender_group->pos.y = alignment_group->pos.y + alignment_group->size.cy + group_spacing; + + for(int i = psc_male_button; i <= psc_female_button; i++) { + data->controls[i].pos.x = gender_group->pos.x + group_border; + data->controls[i].pos.y = gender_group->pos.y + group_border + + ((i - psc_male_button) * button_height); + } + + int group_bottom = role_group->pos.y + role_group->size.cy; + if (group_bottom < race_group->pos.y + race_group->size.cy) + group_bottom = race_group->pos.y + race_group->size.cy; + if (group_bottom < gender_group->pos.y + gender_group->size.cy) + group_bottom = gender_group->pos.y + gender_group->size.cy; + + control_t * play_button = &data->controls[psc_play_button]; + play_button->pos.y = group_bottom + group_spacing; + play_button->pos.x = role_group->pos.x; + + control_t * random_button = &data->controls[psc_random_button]; + random_button->pos.y = play_button->pos.y; + random_button->pos.x = race_list->pos.x; + + control_t * quit_button = &data->controls[psc_quit_button]; + quit_button->pos.y = play_button->pos.y; + quit_button->pos.x = data->controls[psc_female_button].pos.x; + + data->client_size.cx = alignment_group->pos.x + alignment_group->size.cx; + data->client_size.cy = quit_button->pos.y + quit_button->size.cy; + data->client_size.cx += client_border; + data->client_size.cy += client_border; +} + +void +get_rect_size(RECT * rect, SIZE * size) +{ + size->cx = rect->right - rect->left + 1; + size->cy = rect->bottom - rect->top + 1; +} + +/* center given dialog in the main window */ +void +center_dialog(HWND dialog) +{ + RECT main_rect; + SIZE main_size; + RECT dialog_rect; + SIZE dialog_size; + POINT pos; + + GetWindowRect(GetNHApp()->hMainWnd, &main_rect); + get_rect_size(&main_rect, &main_size); + + GetWindowRect(dialog, &dialog_rect); + get_rect_size(&dialog_rect, &dialog_size); + + pos.x = main_rect.left + (main_size.cx - dialog_size.cx) / 2; + pos.y = main_rect.top + (main_size.cy - dialog_size.cy) / 2; + + MoveWindow(dialog, pos.x, pos.y, dialog_size.cx, dialog_size.cy, + TRUE); +} + +/* size the dialog such that it has the given client rect size */ +void +size_dialog(HWND dialog, SIZE new_client_size) +{ + RECT dialog_rect; + SIZE dialog_size; + RECT client_rect; + SIZE client_size; + + GetWindowRect(dialog, &dialog_rect); + get_rect_size(&dialog_rect, &dialog_size); + + GetClientRect(dialog, &client_rect); + get_rect_size(&client_rect, &client_size); + + dialog_size.cx += new_client_size.cx - client_size.cx; + dialog_size.cy += new_client_size.cy - client_size.cy; + + MoveWindow(dialog, dialog_rect.left, dialog_rect.top, + dialog_size.cx, dialog_size.cy, TRUE); +} + +/* helper routine to move all controls according to there position + and size information */ +void +move_controls(control_t * controls, int count) +{ + control_t * control = controls; + while(count-- > 0) { + MoveWindow(control->hWnd, control->pos.x, control->pos.y, + control->size.cx, control->size.cy, TRUE); + control++; + } +} + +/* adjust the size and positions of all controls in the player + selection dialog taking into account the per-monitor DPI. */ +void +do_player_selector_layout(plsel_data_t * data) +{ + calculate_player_selector_layout(data); + move_controls(data->controls, psc_control_count); + size_dialog(data->dialog, data->client_size); +} + +/* initialize player selector dialog */ +void +plselInitDialog(struct plsel_data * data) +{ + TCHAR wbuf[BUFSZ]; + LVCOLUMN lvcol; + + SetWindowLongPtr(data->dialog, GWLP_USERDATA, (LONG_PTR) data); + + for(int i = 0; i < psc_control_count; i++) { + data->controls[i].id = s_psc_id[i]; + data->controls[i].hWnd = GetDlgItem(data->dialog, s_psc_id[i]); + } + + control_t * role_list = &data->controls[psc_role_list]; + + ZeroMemory(&lvcol, sizeof(lvcol)); + lvcol.mask = LVCF_WIDTH; + lvcol.cx = 1024; + + /* build role list */ + ListView_InsertColumn(role_list->hWnd, 0, &lvcol); + data->role_count = 0; + for (int i = 0; roles[i].name.m; i++) { + LVITEM lvitem; + ZeroMemory(&lvitem, sizeof(lvitem)); + + lvitem.mask = LVIF_STATE | LVIF_TEXT; + lvitem.iItem = i; + lvitem.iSubItem = 0; + lvitem.state = 0; + lvitem.stateMask = LVIS_FOCUSED; + if (flags.female && roles[i].name.f) + lvitem.pszText = NH_A2W(roles[i].name.f, wbuf, BUFSZ); + else + lvitem.pszText = NH_A2W(roles[i].name.m, wbuf, BUFSZ); + if (ListView_InsertItem(role_list->hWnd, &lvitem) == -1) { + panic("cannot insert menu item"); + } + data->role_count++; + } + + /* build race list */ + control_t * race_list = &data->controls[psc_race_list]; + ListView_InsertColumn(race_list->hWnd, 0, &lvcol); + data->race_count = 0; + for (int i = 0; races[i].noun; i++) { + LVITEM lvitem; + ZeroMemory(&lvitem, sizeof(lvitem)); + + lvitem.mask = LVIF_STATE | LVIF_TEXT; + lvitem.iItem = i; + lvitem.iSubItem = 0; + lvitem.state = 0; + lvitem.stateMask = LVIS_FOCUSED; + lvitem.pszText = NH_A2W(races[i].noun, wbuf, BUFSZ); + if (ListView_InsertItem(race_list->hWnd, &lvitem) == -1) { + panic("cannot insert menu item"); + } + data->race_count++; + } + + /* set gender radio button state */ + control_t * gender_buttons = &data->controls[psc_male_button]; + for (int i = 0; i < ROLE_GENDERS; i++) + Button_Enable(gender_buttons[i].hWnd, TRUE); + + Button_SetCheck(data->controls[psc_male_button].hWnd, BST_CHECKED); + + /* set alignment radio button state */ + control_t * alignment_buttons = &data->controls[psc_lawful_button]; + for (int i = 0; i < ROLE_ALIGNS; i++) + Button_Enable(alignment_buttons[i].hWnd, TRUE); + + Button_SetCheck(data->controls[psc_lawful_button].hWnd, BST_CHECKED); + + /* set player name */ + control_t * name_box = &data->controls[psc_name_box]; + SetDlgItemText(data->dialog, name_box->id, NH_A2W(g.plname, wbuf, sizeof(wbuf))); + + plselRandomize(data); + + /* populate select boxes */ + plselAdjustSelections(data->dialog); + + /* set tab order */ + control_t * control = &data->controls[psc_quit_button]; + for(int i = psc_quit_button; i >= psc_name_box; i--, control++) + SetWindowPos(control->hWnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + + do_player_selector_layout(data); + + center_dialog(data->dialog); +} + INT_PTR CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - struct plsel_data *data; - RECT main_rt, dlg_rt; - SIZE dlg_sz; + plsel_data_t *data; switch (message) { case WM_INITDIALOG: - data = (struct plsel_data *) lParam; - SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) data); - /* center dialog in the main window */ - GetWindowRect(GetNHApp()->hMainWnd, &main_rt); - GetWindowRect(hWnd, &dlg_rt); - dlg_sz.cx = dlg_rt.right - dlg_rt.left; - dlg_sz.cy = dlg_rt.bottom - dlg_rt.top; + data = (plsel_data_t *) lParam; + data->dialog = hWnd; - dlg_rt.left = (main_rt.left + main_rt.right - dlg_sz.cx) / 2; - dlg_rt.right = dlg_rt.left + dlg_sz.cx; - dlg_rt.top = (main_rt.top + main_rt.bottom - dlg_sz.cy) / 2; - dlg_rt.bottom = dlg_rt.top + dlg_sz.cy; - MoveWindow(hWnd, (main_rt.left + main_rt.right - dlg_sz.cx) / 2, - (main_rt.top + main_rt.bottom - dlg_sz.cy) / 2, dlg_sz.cx, - dlg_sz.cy, TRUE); - - /* init dialog */ - plselInitDialog(hWnd); + plselInitDialog(data); /* tell windows to set the focus */ return TRUE; - break; case WM_DRAWITEM: if (wParam == IDC_PLSEL_ROLE_LIST || wParam == IDC_PLSEL_RACE_LIST) @@ -367,20 +691,23 @@ PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) data = (struct plsel_data *) GetWindowLongPtr(hWnd, GWLP_USERDATA); + control_t * role_control = &data->controls[psc_role_list]; + control_t * race_control = &data->controls[psc_race_list]; + switch (nmhdr->code) { case LVN_KEYDOWN: { LPNMLVKEYDOWN lpnmkeydown = (LPNMLVKEYDOWN) lParam; if (lpnmkeydown->wVKey == ' ') { - if (control == data->control_role) { - int i = ListView_GetNextItem(data->control_role, -1, LVNI_FOCUSED); - assert(i == -1 || ListView_GetNextItem(data->control_role, i, LVNI_FOCUSED) == -1); + if (control == role_control->hWnd) { + int i = ListView_GetNextItem(control, -1, LVNI_FOCUSED); + assert(i == -1 || ListView_GetNextItem(control, i, LVNI_FOCUSED) == -1); flags.initrole = i; plselAdjustSelections(hWnd); - } else if (control == data->control_race) { - int i = ListView_GetNextItem(data->control_race, -1, LVNI_FOCUSED); - assert(i == -1 || ListView_GetNextItem(data->control_race, i, LVNI_FOCUSED) == -1); + } else if (control == race_control->hWnd) { + int i = ListView_GetNextItem(control, -1, LVNI_FOCUSED); + assert(i == -1 || ListView_GetNextItem(control, i, LVNI_FOCUSED) == -1); if (ok_race(flags.initrole, i, ROLE_RANDOM, ROLE_RANDOM)) { flags.initrace = i; plselAdjustSelections(hWnd); @@ -395,10 +722,10 @@ PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) int i = lpnmitem->iItem; if (i == -1) return FALSE; - if (control == data->control_role) { + if (control == role_control->hWnd) { flags.initrole = i; plselAdjustSelections(hWnd); - } else if(control == data->control_race) { + } else if(control == race_control->hWnd) { if (ok_race(flags.initrole, i, ROLE_RANDOM, ROLE_RANDOM)) { flags.initrace = i; plselAdjustSelections(hWnd); @@ -408,12 +735,12 @@ PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) break; case NM_KILLFOCUS: { - if (data->focus == data->control_race) { + if (data->focus == race_control->hWnd) { data->focus = NULL; - ListView_RedrawItems(data->control_race, 0, data->race_count - 1); - } else if (data->focus == data->control_role) { + ListView_RedrawItems(race_control->hWnd, 0, data->race_count - 1); + } else if (data->focus == role_control->hWnd) { data->focus = NULL; - ListView_RedrawItems(data->control_role, 0, data->role_count - 1); + ListView_RedrawItems(role_control->hWnd, 0, data->role_count - 1); } } break; @@ -421,11 +748,11 @@ PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { data->focus = control; - if (control == data->control_race) { - data->focus = data->control_race; + if (control == race_control->hWnd) { + data->focus = control; plselAdjustSelections(hWnd); - } else if (control == data->control_role) { - data->focus = data->control_role; + } else if (control == role_control->hWnd) { + data->focus = control; plselAdjustSelections(hWnd); } } @@ -478,109 +805,29 @@ PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } break; + + case WM_DPICHANGED: + { + data = (struct plsel_data *) GetWindowLongPtr(hWnd, GWLP_USERDATA); + + do_player_selector_layout(data); + + InvalidateRect(hWnd, NULL, TRUE); + } break; } + return FALSE; } -/* initialize player selector dialog */ -void -plselInitDialog(HWND hWnd) -{ - struct plsel_data * data = (plsel_data_t *) GetWindowLongPtr(hWnd, GWLP_USERDATA); - TCHAR wbuf[BUFSZ]; - LVCOLUMN lvcol; - data->control_role = GetDlgItem(hWnd, IDC_PLSEL_ROLE_LIST); - data->control_race = GetDlgItem(hWnd, IDC_PLSEL_RACE_LIST); - - ZeroMemory(&lvcol, sizeof(lvcol)); - lvcol.mask = LVCF_WIDTH; - lvcol.cx = GetSystemMetrics(SM_CXFULLSCREEN); - - /* build role list */ - ListView_InsertColumn(data->control_role, 0, &lvcol); - data->role_count = 0; - for (int i = 0; roles[i].name.m; i++) { - LVITEM lvitem; - ZeroMemory(&lvitem, sizeof(lvitem)); - - lvitem.mask = LVIF_STATE | LVIF_TEXT; - lvitem.iItem = i; - lvitem.iSubItem = 0; - lvitem.state = 0; - lvitem.stateMask = LVIS_FOCUSED; - if (flags.female && roles[i].name.f) - lvitem.pszText = NH_A2W(roles[i].name.f, wbuf, BUFSZ); - else - lvitem.pszText = NH_A2W(roles[i].name.m, wbuf, BUFSZ); - if (ListView_InsertItem(data->control_role, &lvitem) == -1) { - panic("cannot insert menu item"); - } - data->role_count++; - } - - /* build race list */ - ListView_InsertColumn(data->control_race, 0, &lvcol); - data->race_count = 0; - for (int i = 0; races[i].noun; i++) { - LVITEM lvitem; - ZeroMemory(&lvitem, sizeof(lvitem)); - - lvitem.mask = LVIF_STATE | LVIF_TEXT; - lvitem.iItem = i; - lvitem.iSubItem = 0; - lvitem.state = 0; - lvitem.stateMask = LVIS_FOCUSED; - lvitem.pszText = NH_A2W(races[i].noun, wbuf, BUFSZ); - if (ListView_InsertItem(data->control_race, &lvitem) == -1) { - panic("cannot insert menu item"); - } - data->race_count++; - } - - for(int i = 0; i < ROLE_GENDERS; i++) - data->control_genders[i] = GetDlgItem(hWnd, IDC_PLSEL_GENDER_MALE + i); - - for(int i = 0; i < ROLE_ALIGNS; i++) - data->control_aligns[i] = GetDlgItem(hWnd, IDC_PLSEL_ALIGN_LAWFUL + i); - - /* set gender radio button state */ - for (int i = 0; i < ROLE_GENDERS; i++) - Button_Enable(data->control_genders[i], TRUE); - - Button_SetCheck(data->control_genders[0], BST_CHECKED); - - /* set alignment radio button state */ - for (int i = 0; i < ROLE_ALIGNS; i++) - Button_Enable(data->control_aligns[i], TRUE); - - Button_SetCheck(data->control_aligns[0], BST_CHECKED); - - /* set player name */ - SetDlgItemText(hWnd, IDC_PLSEL_NAME, NH_A2W(g.plname, wbuf, sizeof(wbuf))); - - plselRandomize(data); - - /* populate select boxes */ - plselAdjustSelections(hWnd); - - /* set tab order */ - SetWindowPos(GetDlgItem(hWnd, IDCANCEL), NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - SetWindowPos(GetDlgItem(hWnd, IDC_PLSEL_RANDOM), NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - SetWindowPos(GetDlgItem(hWnd, IDOK), NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - for(int i = ROLE_GENDERS - 1; i >= 0; i--) - SetWindowPos(data->control_genders[i], NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - for(int i = ROLE_ALIGNS - 1; i >= 0; i--) - SetWindowPos(data->control_aligns[i], NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - SetWindowPos(data->control_race, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - SetWindowPos(data->control_role, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - -} void plselAdjustSelections(HWND hWnd) { struct plsel_data * data = (plsel_data_t *) GetWindowLongPtr(hWnd, GWLP_USERDATA); + control_t * role_control = &data->controls[psc_role_list]; + control_t * race_control = &data->controls[psc_race_list]; + if (!ok_race(flags.initrole, flags.initrace, ROLE_RANDOM, ROLE_RANDOM)) flags.initrace = pick_race(flags.initrole, ROLE_RANDOM, ROLE_RANDOM, ROLE_RANDOM); @@ -590,29 +837,31 @@ plselAdjustSelections(HWND hWnd) if (!ok_align(flags.initrole, flags.initrace, flags.initgend, flags.initalign)) flags.initalign = pick_align(flags.initrole, flags.initrace, flags.initgend , ROLE_RANDOM); - ListView_RedrawItems(data->control_role, 0, data->role_count - 1); - ListView_RedrawItems(data->control_race, 0, data->race_count - 1); + ListView_RedrawItems(role_control->hWnd, 0, data->role_count - 1); + ListView_RedrawItems(race_control->hWnd, 0, data->race_count - 1); /* set gender radio button state */ for (int i = 0; i < ROLE_GENDERS; i++) { + HWND button = data->controls[psc_male_button+i].hWnd; BOOL enable = ok_gend(flags.initrole, flags.initrace, i, flags.initalign); - Button_Enable(data->control_genders[i], enable); - LRESULT state = Button_GetCheck(data->control_genders[i]); + Button_Enable(button, enable); + LRESULT state = Button_GetCheck(button); if (state == BST_CHECKED && flags.initgend != i) - Button_SetCheck(data->control_genders[i], BST_UNCHECKED); + Button_SetCheck(button, BST_UNCHECKED); if (state == BST_UNCHECKED && flags.initgend == i) - Button_SetCheck(data->control_genders[i], BST_CHECKED); + Button_SetCheck(button, BST_CHECKED); } /* set alignment radio button state */ for (int i = 0; i < ROLE_ALIGNS; i++) { + HWND button = data->controls[psc_lawful_button+i].hWnd; BOOL enable = ok_align(flags.initrole, flags.initrace, flags.initgend, i); - Button_Enable(data->control_aligns[i], enable); - LRESULT state = Button_GetCheck(data->control_aligns[i]); + Button_Enable(button, enable); + LRESULT state = Button_GetCheck(button); if (state == BST_CHECKED && flags.initalign != i) - Button_SetCheck(data->control_aligns[i], BST_UNCHECKED); + Button_SetCheck(button, BST_UNCHECKED); if (state == BST_UNCHECKED && flags.initalign == i) - Button_SetCheck(data->control_aligns[i], BST_CHECKED); + Button_SetCheck(button, BST_CHECKED); } } diff --git a/win/win32/mhmain.c b/win/win32/mhmain.c index 15da747ce..19f04114e 100644 --- a/win/win32/mhmain.c +++ b/win/win32/mhmain.c @@ -4,7 +4,11 @@ #include "winMS.h" #include +#if !defined(CROSSCOMPILE) #include "date.h" +#else +#include "config.h" +#endif #include "patchlevel.h" #include "resource.h" #include "mhmsg.h" @@ -1063,11 +1067,11 @@ About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) SetDlgItemText(hDlg, IDC_ABOUT_VERSION, NH_A2W(buf, wbuf, sizeof(wbuf))); + Sprintf(buf, "%s\n%s\n%s\n%s", + COPYRIGHT_BANNER_A, COPYRIGHT_BANNER_B, + COPYRIGHT_BANNER_C, COPYRIGHT_BANNER_D); SetDlgItemText(hDlg, IDC_ABOUT_COPYRIGHT, - NH_A2W(COPYRIGHT_BANNER_A "\n" COPYRIGHT_BANNER_B - "\n" COPYRIGHT_BANNER_C - "\n" COPYRIGHT_BANNER_D, - wbuf, BUFSZ)); + NH_A2W(buf, wbuf, sizeof(wbuf))); /* center dialog in the main window */ GetWindowRect(GetNHApp()->hMainWnd, &main_rt); diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index 315de0719..28308913d 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -710,7 +710,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) mgch = ' '; } else { (void) mapglyph(data->map[col][row], &mgch, &color, - &special, col, row); + &special, col, row, 0); } msg_data->buffer[index] = mgch; index++; @@ -824,7 +824,7 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect) #ifdef USE_PILEMARK /* rely on NetHack core helper routine */ (void) mapglyph(data->map[i][j], &mgch, &color, &special, - i, j); + i, j, 0); if ((glyph != NO_GLYPH) && (special & MG_PET) #else if ((glyph != NO_GLYPH) && glyph_is_pet(glyph) @@ -899,7 +899,7 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect) #else /* rely on NetHack core helper routine */ (void) mapglyph(data->map[i][j], &mgch, &color, - &special, i, j); + &special, i, j, 0); ch = (char) mgch; if (((special & MG_PET) && iflags.hilite_pet) || ((special & (MG_DETECT | MG_BW_LAVA)) diff --git a/win/win32/mhsplash.c b/win/win32/mhsplash.c index 0271c8081..c5600177d 100644 --- a/win/win32/mhsplash.c +++ b/win/win32/mhsplash.c @@ -8,7 +8,11 @@ #include "mhsplash.h" #include "mhmsg.h" #include "mhfont.h" +#if !defined(CROSSCOMPILE) #include "date.h" +#else +#include "config.h" +#endif #include "patchlevel.h" #include "dlb.h" @@ -170,6 +174,7 @@ mswin_display_splash_window(BOOL show_ver) FILE *nf; iflags.news = 0; /* prevent newgame() from re-displaying news */ + /* BUG: this relies on current working directory */ nf = fopen(NEWS, "r"); if (nf != NULL) { char line[LLEN + 1]; @@ -258,6 +263,7 @@ NHSplashWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_COMMAND: switch (LOWORD(wParam)) { + case IDCANCEL: case IDOK: mswin_window_mark_dead(mswin_winid_from_handle(hWnd)); if (GetNHApp()->hMainWnd == hWnd) diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index 1d9907b42..4b23b5b4f 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mswproc.c $NHDT-Date: 1545705822 2018/12/25 02:43:42 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.130 $ */ +/* NetHack 3.6 mswproc.c $NHDT-Date: 1575245201 2019/12/02 00:06:41 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.137 $ */ /* Copyright (C) 2001 by Alex Kompel */ /* NetHack may be freely redistributed. See license for details. */ @@ -90,7 +90,9 @@ struct window_procs mswin_procs = { #ifdef STATUS_HILITES WC2_HITPOINTBAR | WC2_FLUSH_STATUS | WC2_RESET_STATUS | WC2_HILITE_STATUS | #endif - 0L, mswin_init_nhwindows, mswin_player_selection, mswin_askname, + 0L, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */ + mswin_init_nhwindows, mswin_player_selection, mswin_askname, mswin_get_nh_event, mswin_exit_nhwindows, mswin_suspend_nhwindows, mswin_resume_nhwindows, mswin_create_nhwindow, mswin_clear_nhwindow, mswin_display_nhwindow, mswin_destroy_nhwindow, mswin_curs, mswin_putstr, @@ -142,6 +144,7 @@ mswin_init_nhwindows(int *argc, char **argv) # ifdef _DEBUG if (showdebug(NHTRACE_LOG) && !_s_debugfp) { /* truncate trace file */ + /* BUG: this relies on current working directory */ _s_debugfp = fopen(NHTRACE_LOG, "w"); } # endif @@ -2313,7 +2316,7 @@ logDebug(const char *fmt, ...) /* Reading and writing settings from the registry. */ #define CATEGORYKEY "Software" #define COMPANYKEY "NetHack" -#define PRODUCTKEY "NetHack 3.6.2" +#define PRODUCTKEY "NetHack 3.6.4" #define SETTINGSKEY "Settings" #define MAINSHOWSTATEKEY "MainShowState" #define MAINMINXKEY "MainMinX" @@ -3090,7 +3093,7 @@ mswin_status_update(int idx, genericptr_t ptr, int chg, int percent, int color, ochar = GOLD_SYM; else mapglyph(objnum_to_glyph(GOLD_PIECE), - &ochar, &ocolor, &ospecial, 0, 0); + &ochar, &ocolor, &ospecial, 0, 0, 0); buf[0] = ochar; p = strchr(text, ':'); if (p) { diff --git a/win/win32/resource.h b/win/win32/resource.h index 6be779811..fdd864f12 100644 --- a/win/win32/resource.h +++ b/win/win32/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by winhack.rc +// Used by NetHackW.rc // #define IDC_MYICON 2 #define IDD_WINHACK_DIALOG 102 @@ -114,6 +114,11 @@ #define IDC_PLSEL_ALIGN_CHAOTIC 1336 #define IDC_PLSEL_GENDER_MALE 1337 #define IDC_PLSEL_GENDER_FEMALE 1338 +#define IDC_PLSEL_NAME_GROUP 1339 +#define IDC_PLSEL_ROLE_GROUP 1340 +#define IDC_PLSEL_RACE_GROUP 1341 +#define IDC_PLSEL_ALIGNMENT_GROUP 1342 +#define IDC_PLSEL_GENDER_GROUP 1343 #define IDM_SAVE 32771 #define IDM_HELP_LONG 32772 #define IDM_HELP_COMMANDS 32773 diff --git a/win/win32/vs2017/.gitignore b/win/win32/vs2017/.gitignore index f87237325..c4775b3c5 100644 --- a/win/win32/vs2017/.gitignore +++ b/win/win32/vs2017/.gitignore @@ -2,3 +2,11 @@ *.db-shm *.db-wal paniclog +_pkginfo.txt +AppPackages +BundleArtifacts +report.xml +*.cer +*.appxbundle +NetHackPackage_StoreKey.pfx +NetHackPackage_TemporaryKey.pfx diff --git a/win/win32/vs2017/Images/BadgeLogo.scale-100.png b/win/win32/vs2017/Images/BadgeLogo.scale-100.png new file mode 100644 index 000000000..0c1dff1b4 Binary files /dev/null and b/win/win32/vs2017/Images/BadgeLogo.scale-100.png differ diff --git a/win/win32/vs2017/Images/BadgeLogo.scale-125.png b/win/win32/vs2017/Images/BadgeLogo.scale-125.png new file mode 100644 index 000000000..45aa7773c Binary files /dev/null and b/win/win32/vs2017/Images/BadgeLogo.scale-125.png differ diff --git a/win/win32/vs2017/Images/BadgeLogo.scale-150.png b/win/win32/vs2017/Images/BadgeLogo.scale-150.png new file mode 100644 index 000000000..6a911cb2a Binary files /dev/null and b/win/win32/vs2017/Images/BadgeLogo.scale-150.png differ diff --git a/win/win32/vs2017/Images/BadgeLogo.scale-200.png b/win/win32/vs2017/Images/BadgeLogo.scale-200.png new file mode 100644 index 000000000..21e20fb67 Binary files /dev/null and b/win/win32/vs2017/Images/BadgeLogo.scale-200.png differ diff --git a/win/win32/vs2017/Images/BadgeLogo.scale-400.png b/win/win32/vs2017/Images/BadgeLogo.scale-400.png new file mode 100644 index 000000000..10fdb8f1e Binary files /dev/null and b/win/win32/vs2017/Images/BadgeLogo.scale-400.png differ diff --git a/win/win32/vs2017/Images/LargeTile.scale-100.png b/win/win32/vs2017/Images/LargeTile.scale-100.png new file mode 100644 index 000000000..2c00fc94e Binary files /dev/null and b/win/win32/vs2017/Images/LargeTile.scale-100.png differ diff --git a/win/win32/vs2017/Images/LargeTile.scale-125.png b/win/win32/vs2017/Images/LargeTile.scale-125.png new file mode 100644 index 000000000..fb1ba8d8e Binary files /dev/null and b/win/win32/vs2017/Images/LargeTile.scale-125.png differ diff --git a/win/win32/vs2017/Images/LargeTile.scale-150.png b/win/win32/vs2017/Images/LargeTile.scale-150.png new file mode 100644 index 000000000..f3ccd1107 Binary files /dev/null and b/win/win32/vs2017/Images/LargeTile.scale-150.png differ diff --git a/win/win32/vs2017/Images/LargeTile.scale-200.png b/win/win32/vs2017/Images/LargeTile.scale-200.png new file mode 100644 index 000000000..0c40a8a72 Binary files /dev/null and b/win/win32/vs2017/Images/LargeTile.scale-200.png differ diff --git a/win/win32/vs2017/Images/LargeTile.scale-400.png b/win/win32/vs2017/Images/LargeTile.scale-400.png new file mode 100644 index 000000000..5c11c508b Binary files /dev/null and b/win/win32/vs2017/Images/LargeTile.scale-400.png differ diff --git a/win/win32/vs2017/Images/LockScreenLogo.scale-200.png b/win/win32/vs2017/Images/LockScreenLogo.scale-200.png new file mode 100644 index 000000000..735f57adb Binary files /dev/null and b/win/win32/vs2017/Images/LockScreenLogo.scale-200.png differ diff --git a/win/win32/vs2017/Images/SmallTile.scale-100.png b/win/win32/vs2017/Images/SmallTile.scale-100.png new file mode 100644 index 000000000..f7e719d06 Binary files /dev/null and b/win/win32/vs2017/Images/SmallTile.scale-100.png differ diff --git a/win/win32/vs2017/Images/SmallTile.scale-125.png b/win/win32/vs2017/Images/SmallTile.scale-125.png new file mode 100644 index 000000000..e5aa2ea1b Binary files /dev/null and b/win/win32/vs2017/Images/SmallTile.scale-125.png differ diff --git a/win/win32/vs2017/Images/SmallTile.scale-150.png b/win/win32/vs2017/Images/SmallTile.scale-150.png new file mode 100644 index 000000000..57d16d648 Binary files /dev/null and b/win/win32/vs2017/Images/SmallTile.scale-150.png differ diff --git a/win/win32/vs2017/Images/SmallTile.scale-200.png b/win/win32/vs2017/Images/SmallTile.scale-200.png new file mode 100644 index 000000000..5e5e0ece8 Binary files /dev/null and b/win/win32/vs2017/Images/SmallTile.scale-200.png differ diff --git a/win/win32/vs2017/Images/SmallTile.scale-400.png b/win/win32/vs2017/Images/SmallTile.scale-400.png new file mode 100644 index 000000000..3ed4e6994 Binary files /dev/null and b/win/win32/vs2017/Images/SmallTile.scale-400.png differ diff --git a/win/win32/vs2017/Images/SplashScreen.scale-100.png b/win/win32/vs2017/Images/SplashScreen.scale-100.png new file mode 100644 index 000000000..d4bab84e3 Binary files /dev/null and b/win/win32/vs2017/Images/SplashScreen.scale-100.png differ diff --git a/win/win32/vs2017/Images/SplashScreen.scale-125.png b/win/win32/vs2017/Images/SplashScreen.scale-125.png new file mode 100644 index 000000000..d97a15fc2 Binary files /dev/null and b/win/win32/vs2017/Images/SplashScreen.scale-125.png differ diff --git a/win/win32/vs2017/Images/SplashScreen.scale-150.png b/win/win32/vs2017/Images/SplashScreen.scale-150.png new file mode 100644 index 000000000..2ce132a50 Binary files /dev/null and b/win/win32/vs2017/Images/SplashScreen.scale-150.png differ diff --git a/win/win32/vs2017/Images/SplashScreen.scale-200.png b/win/win32/vs2017/Images/SplashScreen.scale-200.png new file mode 100644 index 000000000..cbffd4a6a Binary files /dev/null and b/win/win32/vs2017/Images/SplashScreen.scale-200.png differ diff --git a/win/win32/vs2017/Images/SplashScreen.scale-400.png b/win/win32/vs2017/Images/SplashScreen.scale-400.png new file mode 100644 index 000000000..05424b307 Binary files /dev/null and b/win/win32/vs2017/Images/SplashScreen.scale-400.png differ diff --git a/win/win32/vs2017/Images/Square150x150Logo.scale-100.png b/win/win32/vs2017/Images/Square150x150Logo.scale-100.png new file mode 100644 index 000000000..778506203 Binary files /dev/null and b/win/win32/vs2017/Images/Square150x150Logo.scale-100.png differ diff --git a/win/win32/vs2017/Images/Square150x150Logo.scale-125.png b/win/win32/vs2017/Images/Square150x150Logo.scale-125.png new file mode 100644 index 000000000..6c625595e Binary files /dev/null and b/win/win32/vs2017/Images/Square150x150Logo.scale-125.png differ diff --git a/win/win32/vs2017/Images/Square150x150Logo.scale-150.png b/win/win32/vs2017/Images/Square150x150Logo.scale-150.png new file mode 100644 index 000000000..d0471de30 Binary files /dev/null and b/win/win32/vs2017/Images/Square150x150Logo.scale-150.png differ diff --git a/win/win32/vs2017/Images/Square150x150Logo.scale-200.png b/win/win32/vs2017/Images/Square150x150Logo.scale-200.png new file mode 100644 index 000000000..105037a99 Binary files /dev/null and b/win/win32/vs2017/Images/Square150x150Logo.scale-200.png differ diff --git a/win/win32/vs2017/Images/Square150x150Logo.scale-400.png b/win/win32/vs2017/Images/Square150x150Logo.scale-400.png new file mode 100644 index 000000000..3b5c7146b Binary files /dev/null and b/win/win32/vs2017/Images/Square150x150Logo.scale-400.png differ diff --git a/win/win32/vs2017/Images/Square44x44Logo.altform-unplated_targetsize-16.png b/win/win32/vs2017/Images/Square44x44Logo.altform-unplated_targetsize-16.png new file mode 100644 index 000000000..c37bb5650 Binary files /dev/null and b/win/win32/vs2017/Images/Square44x44Logo.altform-unplated_targetsize-16.png differ diff --git a/win/win32/vs2017/Images/Square44x44Logo.altform-unplated_targetsize-256.png b/win/win32/vs2017/Images/Square44x44Logo.altform-unplated_targetsize-256.png new file mode 100644 index 000000000..c5a031ec3 Binary files /dev/null and b/win/win32/vs2017/Images/Square44x44Logo.altform-unplated_targetsize-256.png differ diff --git a/win/win32/vs2017/Images/Square44x44Logo.altform-unplated_targetsize-32.png b/win/win32/vs2017/Images/Square44x44Logo.altform-unplated_targetsize-32.png new file mode 100644 index 000000000..33651c0e2 Binary files /dev/null and b/win/win32/vs2017/Images/Square44x44Logo.altform-unplated_targetsize-32.png differ diff --git a/win/win32/vs2017/Images/Square44x44Logo.altform-unplated_targetsize-48.png b/win/win32/vs2017/Images/Square44x44Logo.altform-unplated_targetsize-48.png new file mode 100644 index 000000000..3be7763d0 Binary files /dev/null and b/win/win32/vs2017/Images/Square44x44Logo.altform-unplated_targetsize-48.png differ diff --git a/win/win32/vs2017/Images/Square44x44Logo.scale-100.png b/win/win32/vs2017/Images/Square44x44Logo.scale-100.png new file mode 100644 index 000000000..b0b2e6cfd Binary files /dev/null and b/win/win32/vs2017/Images/Square44x44Logo.scale-100.png differ diff --git a/win/win32/vs2017/Images/Square44x44Logo.scale-125.png b/win/win32/vs2017/Images/Square44x44Logo.scale-125.png new file mode 100644 index 000000000..7497e6315 Binary files /dev/null and b/win/win32/vs2017/Images/Square44x44Logo.scale-125.png differ diff --git a/win/win32/vs2017/Images/Square44x44Logo.scale-150.png b/win/win32/vs2017/Images/Square44x44Logo.scale-150.png new file mode 100644 index 000000000..d8291fea8 Binary files /dev/null and b/win/win32/vs2017/Images/Square44x44Logo.scale-150.png differ diff --git a/win/win32/vs2017/Images/Square44x44Logo.scale-200.png b/win/win32/vs2017/Images/Square44x44Logo.scale-200.png new file mode 100644 index 000000000..aa5dce320 Binary files /dev/null and b/win/win32/vs2017/Images/Square44x44Logo.scale-200.png differ diff --git a/win/win32/vs2017/Images/Square44x44Logo.scale-400.png b/win/win32/vs2017/Images/Square44x44Logo.scale-400.png new file mode 100644 index 000000000..ec0fa86b7 Binary files /dev/null and b/win/win32/vs2017/Images/Square44x44Logo.scale-400.png differ diff --git a/win/win32/vs2017/Images/Square44x44Logo.targetsize-16.png b/win/win32/vs2017/Images/Square44x44Logo.targetsize-16.png new file mode 100644 index 000000000..c2f20ed08 Binary files /dev/null and b/win/win32/vs2017/Images/Square44x44Logo.targetsize-16.png differ diff --git a/win/win32/vs2017/Images/Square44x44Logo.targetsize-24.png b/win/win32/vs2017/Images/Square44x44Logo.targetsize-24.png new file mode 100644 index 000000000..87a34d0aa Binary files /dev/null and b/win/win32/vs2017/Images/Square44x44Logo.targetsize-24.png differ diff --git a/win/win32/vs2017/Images/Square44x44Logo.targetsize-24_altform-unplated.png b/win/win32/vs2017/Images/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 000000000..1e2c78548 Binary files /dev/null and b/win/win32/vs2017/Images/Square44x44Logo.targetsize-24_altform-unplated.png differ diff --git a/win/win32/vs2017/Images/Square44x44Logo.targetsize-256.png b/win/win32/vs2017/Images/Square44x44Logo.targetsize-256.png new file mode 100644 index 000000000..d7793c819 Binary files /dev/null and b/win/win32/vs2017/Images/Square44x44Logo.targetsize-256.png differ diff --git a/win/win32/vs2017/Images/Square44x44Logo.targetsize-32.png b/win/win32/vs2017/Images/Square44x44Logo.targetsize-32.png new file mode 100644 index 000000000..089f3635f Binary files /dev/null and b/win/win32/vs2017/Images/Square44x44Logo.targetsize-32.png differ diff --git a/win/win32/vs2017/Images/Square44x44Logo.targetsize-48.png b/win/win32/vs2017/Images/Square44x44Logo.targetsize-48.png new file mode 100644 index 000000000..fcd6b9b25 Binary files /dev/null and b/win/win32/vs2017/Images/Square44x44Logo.targetsize-48.png differ diff --git a/win/win32/vs2017/Images/StoreLogo.backup.png b/win/win32/vs2017/Images/StoreLogo.backup.png new file mode 100644 index 000000000..a90d0b6cd Binary files /dev/null and b/win/win32/vs2017/Images/StoreLogo.backup.png differ diff --git a/win/win32/vs2017/Images/StoreLogo.scale-100.png b/win/win32/vs2017/Images/StoreLogo.scale-100.png new file mode 100644 index 000000000..7eda4fa47 Binary files /dev/null and b/win/win32/vs2017/Images/StoreLogo.scale-100.png differ diff --git a/win/win32/vs2017/Images/StoreLogo.scale-125.png b/win/win32/vs2017/Images/StoreLogo.scale-125.png new file mode 100644 index 000000000..c1a3b87e2 Binary files /dev/null and b/win/win32/vs2017/Images/StoreLogo.scale-125.png differ diff --git a/win/win32/vs2017/Images/StoreLogo.scale-150.png b/win/win32/vs2017/Images/StoreLogo.scale-150.png new file mode 100644 index 000000000..09163a158 Binary files /dev/null and b/win/win32/vs2017/Images/StoreLogo.scale-150.png differ diff --git a/win/win32/vs2017/Images/StoreLogo.scale-200.png b/win/win32/vs2017/Images/StoreLogo.scale-200.png new file mode 100644 index 000000000..854fafb9b Binary files /dev/null and b/win/win32/vs2017/Images/StoreLogo.scale-200.png differ diff --git a/win/win32/vs2017/Images/StoreLogo.scale-400.png b/win/win32/vs2017/Images/StoreLogo.scale-400.png new file mode 100644 index 000000000..9d4176160 Binary files /dev/null and b/win/win32/vs2017/Images/StoreLogo.scale-400.png differ diff --git a/win/win32/vs2017/Images/Wide310x150Logo.scale-100.png b/win/win32/vs2017/Images/Wide310x150Logo.scale-100.png new file mode 100644 index 000000000..3a29f0911 Binary files /dev/null and b/win/win32/vs2017/Images/Wide310x150Logo.scale-100.png differ diff --git a/win/win32/vs2017/Images/Wide310x150Logo.scale-125.png b/win/win32/vs2017/Images/Wide310x150Logo.scale-125.png new file mode 100644 index 000000000..5bde11842 Binary files /dev/null and b/win/win32/vs2017/Images/Wide310x150Logo.scale-125.png differ diff --git a/win/win32/vs2017/Images/Wide310x150Logo.scale-150.png b/win/win32/vs2017/Images/Wide310x150Logo.scale-150.png new file mode 100644 index 000000000..8f35b96b8 Binary files /dev/null and b/win/win32/vs2017/Images/Wide310x150Logo.scale-150.png differ diff --git a/win/win32/vs2017/Images/Wide310x150Logo.scale-200.png b/win/win32/vs2017/Images/Wide310x150Logo.scale-200.png new file mode 100644 index 000000000..a0be94e1a Binary files /dev/null and b/win/win32/vs2017/Images/Wide310x150Logo.scale-200.png differ diff --git a/win/win32/vs2017/Images/Wide310x150Logo.scale-400.png b/win/win32/vs2017/Images/Wide310x150Logo.scale-400.png new file mode 100644 index 000000000..cbffd4a6a Binary files /dev/null and b/win/win32/vs2017/Images/Wide310x150Logo.scale-400.png differ diff --git a/win/win32/vs2017/NetHack.sln b/win/win32/vs2017/NetHack.sln index 172bb7293..5d7fdde7a 100644 --- a/win/win32/vs2017/NetHack.sln +++ b/win/win32/vs2017/NetHack.sln @@ -7,29 +7,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NetHackW", "NetHackW.vcxpro ProjectSection(ProjectDependencies) = postProject {93F10526-209E-41D7-BBEA-775787876895} = {93F10526-209E-41D7-BBEA-775787876895} {63F9B82B-F589-4082-ABE5-D4F0682050AB} = {63F9B82B-F589-4082-ABE5-D4F0682050AB} - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} = {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} {BA3DD34C-04B7-40D0-B373-9329AA9E8945} = {BA3DD34C-04B7-40D0-B373-9329AA9E8945} {642BC75D-ABAF-403E-8224-7C725FD4CB42} = {642BC75D-ABAF-403E-8224-7C725FD4CB42} - {6813477F-64B6-4B97-B230-438D0D233385} = {6813477F-64B6-4B97-B230-438D0D233385} {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC} = {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC} - {8A3F81C7-2968-49A8-86BF-2669412AD7DE} = {8A3F81C7-2968-49A8-86BF-2669412AD7DE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dgncomp", "dgncomp.vcxproj", "{8A3F81C7-2968-49A8-86BF-2669412AD7DE}" - ProjectSection(ProjectDependencies) = postProject - {642BC75D-ABAF-403E-8224-7C725FD4CB42} = {642BC75D-ABAF-403E-8224-7C725FD4CB42} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dlb", "dlb.vcxproj", "{0303A585-3F83-4BB7-AF6B-1E12C8FB54AC}" ProjectSection(ProjectDependencies) = postProject {63F9B82B-F589-4082-ABE5-D4F0682050AB} = {63F9B82B-F589-4082-ABE5-D4F0682050AB} - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} = {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} - {BA3DD34C-04B7-40D0-B373-9329AA9E8945} = {BA3DD34C-04B7-40D0-B373-9329AA9E8945} - {8A3F81C7-2968-49A8-86BF-2669412AD7DE} = {8A3F81C7-2968-49A8-86BF-2669412AD7DE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "levcomp", "levcomp.vcxproj", "{9DD9C52E-E8C9-4533-BD22-83C055C0AABA}" - ProjectSection(ProjectDependencies) = postProject {BA3DD34C-04B7-40D0-B373-9329AA9E8945} = {BA3DD34C-04B7-40D0-B373-9329AA9E8945} EndProjectSection EndProject @@ -39,13 +24,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "recover", "recover.vcxproj" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tile2bmp", "tile2bmp.vcxproj", "{642BC75D-ABAF-403E-8224-7C725FD4CB42}" ProjectSection(ProjectDependencies) = postProject - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} = {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} {BA3DD34C-04B7-40D0-B373-9329AA9E8945} = {BA3DD34C-04B7-40D0-B373-9329AA9E8945} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tilemap", "tilemap.vcxproj", "{93F10526-209E-41D7-BBEA-775787876895}" ProjectSection(ProjectDependencies) = postProject - {8A3F81C7-2968-49A8-86BF-2669412AD7DE} = {8A3F81C7-2968-49A8-86BF-2669412AD7DE} + {BA3DD34C-04B7-40D0-B373-9329AA9E8945} = {BA3DD34C-04B7-40D0-B373-9329AA9E8945} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "uudecode", "uudecode.vcxproj", "{63F9B82B-F589-4082-ABE5-D4F0682050AB}" @@ -56,11 +40,9 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NetHack", "NetHack.vcxproj", "{609BC774-C6F8-4B2B-AA7D-5B3D0EA95751}" ProjectSection(ProjectDependencies) = postProject {63F9B82B-F589-4082-ABE5-D4F0682050AB} = {63F9B82B-F589-4082-ABE5-D4F0682050AB} - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} = {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} {BA3DD34C-04B7-40D0-B373-9329AA9E8945} = {BA3DD34C-04B7-40D0-B373-9329AA9E8945} {6813477F-64B6-4B97-B230-438D0D233385} = {6813477F-64B6-4B97-B230-438D0D233385} {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC} = {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC} - {8A3F81C7-2968-49A8-86BF-2669412AD7DE} = {8A3F81C7-2968-49A8-86BF-2669412AD7DE} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nhdefkey", "nhdefkey.vcxproj", "{6813477F-64B6-4B97-B230-438D0D233385}" @@ -85,6 +67,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution NetHackProperties.props = NetHackProperties.props EndProjectSection EndProject +Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "NetHackPackage", "NetHackPackage.wapproj", "{6838EC9D-F25D-4779-9CD7-2EDB61E49429}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -101,14 +85,6 @@ Global {CEC5D360-8804-454F-8591-002184C23499}.Release|Win32.Build.0 = Release|Win32 {CEC5D360-8804-454F-8591-002184C23499}.Release|x64.ActiveCfg = Release|x64 {CEC5D360-8804-454F-8591-002184C23499}.Release|x64.Build.0 = Release|x64 - {8A3F81C7-2968-49A8-86BF-2669412AD7DE}.Debug|Win32.ActiveCfg = Debug|Win32 - {8A3F81C7-2968-49A8-86BF-2669412AD7DE}.Debug|Win32.Build.0 = Debug|Win32 - {8A3F81C7-2968-49A8-86BF-2669412AD7DE}.Debug|x64.ActiveCfg = Debug|x64 - {8A3F81C7-2968-49A8-86BF-2669412AD7DE}.Debug|x64.Build.0 = Debug|x64 - {8A3F81C7-2968-49A8-86BF-2669412AD7DE}.Release|Win32.ActiveCfg = Release|Win32 - {8A3F81C7-2968-49A8-86BF-2669412AD7DE}.Release|Win32.Build.0 = Release|Win32 - {8A3F81C7-2968-49A8-86BF-2669412AD7DE}.Release|x64.ActiveCfg = Release|x64 - {8A3F81C7-2968-49A8-86BF-2669412AD7DE}.Release|x64.Build.0 = Release|x64 {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC}.Debug|Win32.ActiveCfg = Debug|Win32 {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC}.Debug|Win32.Build.0 = Debug|Win32 {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC}.Debug|x64.ActiveCfg = Debug|x64 @@ -117,14 +93,6 @@ Global {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC}.Release|Win32.Build.0 = Release|Win32 {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC}.Release|x64.ActiveCfg = Release|x64 {0303A585-3F83-4BB7-AF6B-1E12C8FB54AC}.Release|x64.Build.0 = Release|x64 - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA}.Debug|Win32.ActiveCfg = Debug|Win32 - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA}.Debug|Win32.Build.0 = Debug|Win32 - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA}.Debug|x64.ActiveCfg = Debug|x64 - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA}.Debug|x64.Build.0 = Debug|x64 - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA}.Release|Win32.ActiveCfg = Release|Win32 - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA}.Release|Win32.Build.0 = Release|Win32 - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA}.Release|x64.ActiveCfg = Release|x64 - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA}.Release|x64.Build.0 = Release|x64 {BA3DD34C-04B7-40D0-B373-9329AA9E8945}.Debug|Win32.ActiveCfg = Debug|Win32 {BA3DD34C-04B7-40D0-B373-9329AA9E8945}.Debug|Win32.Build.0 = Debug|Win32 {BA3DD34C-04B7-40D0-B373-9329AA9E8945}.Debug|x64.ActiveCfg = Debug|x64 @@ -205,6 +173,18 @@ Global {BAA70D0F-3EC7-4D10-91F0-974F1F49308B}.Release|Win32.Build.0 = Release|Win32 {BAA70D0F-3EC7-4D10-91F0-974F1F49308B}.Release|x64.ActiveCfg = Release|x64 {BAA70D0F-3EC7-4D10-91F0-974F1F49308B}.Release|x64.Build.0 = Release|x64 + {6838EC9D-F25D-4779-9CD7-2EDB61E49429}.Debug|Win32.ActiveCfg = Debug|Win32 + {6838EC9D-F25D-4779-9CD7-2EDB61E49429}.Debug|Win32.Build.0 = Debug|Win32 + {6838EC9D-F25D-4779-9CD7-2EDB61E49429}.Debug|Win32.Deploy.0 = Debug|Win32 + {6838EC9D-F25D-4779-9CD7-2EDB61E49429}.Debug|x64.ActiveCfg = Debug|x64 + {6838EC9D-F25D-4779-9CD7-2EDB61E49429}.Debug|x64.Build.0 = Debug|x64 + {6838EC9D-F25D-4779-9CD7-2EDB61E49429}.Debug|x64.Deploy.0 = Debug|x64 + {6838EC9D-F25D-4779-9CD7-2EDB61E49429}.Release|Win32.ActiveCfg = Release|Win32 + {6838EC9D-F25D-4779-9CD7-2EDB61E49429}.Release|Win32.Build.0 = Release|Win32 + {6838EC9D-F25D-4779-9CD7-2EDB61E49429}.Release|Win32.Deploy.0 = Release|Win32 + {6838EC9D-F25D-4779-9CD7-2EDB61E49429}.Release|x64.ActiveCfg = Release|x64 + {6838EC9D-F25D-4779-9CD7-2EDB61E49429}.Release|x64.Build.0 = Release|x64 + {6838EC9D-F25D-4779-9CD7-2EDB61E49429}.Release|x64.Deploy.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/win/win32/vs2017/NetHack.vcxproj b/win/win32/vs2017/NetHack.vcxproj index 4b9563347..924900537 100644 --- a/win/win32/vs2017/NetHack.vcxproj +++ b/win/win32/vs2017/NetHack.vcxproj @@ -45,7 +45,7 @@ Default Speed true - $(WinWin32Dir);$(IncDir);$(SysWinntDir);$(SysShareDir);$(WinShareDir);%(AdditionalIncludeDirectories) + $(WinWin32Dir);$(IncDir);$(SysWinntDir);$(SysShareDir);$(WinShareDir);$(LuaDir);%(AdditionalIncludeDirectories) TILES;WIN32CON;DLB;MSWIN_GRAPHICS;SAFEPROCS;_LIB;%(PreprocessorDefinitions) @@ -53,6 +53,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -111,6 +144,8 @@ + + @@ -134,10 +169,6 @@ - - - - @@ -213,7 +244,6 @@ - @@ -222,6 +252,7 @@ + @@ -230,7 +261,6 @@ - diff --git a/win/win32/vs2017/NetHackPackage.appxmanifest b/win/win32/vs2017/NetHackPackage.appxmanifest new file mode 100644 index 000000000..8eebc3cc4 --- /dev/null +++ b/win/win32/vs2017/NetHackPackage.appxmanifest @@ -0,0 +1,29 @@ + + + + + NetHack 3.6 + NetHack DevTeam + Images\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/win/win32/vs2017/NetHackPackage.wapproj b/win/win32/vs2017/NetHackPackage.wapproj new file mode 100644 index 000000000..514baa251 --- /dev/null +++ b/win/win32/vs2017/NetHackPackage.wapproj @@ -0,0 +1,145 @@ + + + + 15.0 + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + $(MSBuildExtensionsPath)\Microsoft\DesktopBridge\ + + + + + + $(BinDir) + + + 6838ec9d-f25d-4779-9cd7-2edb61e49429 + 10.0.17763.0 + 10.0.15063.0 + en-US + NetHackPackage_StoreKey.pfx + NetHackW.vcxproj + 19591BE8832D6EFED75019EACE7C4CA42ABC90D4 + False + True + x86 + 1 + OnApplicationRun + + + Always + + + Always + + + Always + + + Always + + + + Designer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NetHackW\.nethackrc.template + + + NetHackW\Guidebook.txt + + + NetHackW\license + + + NetHackW\nhdat$(VERSION_MAJOR)$(VERSION_MINOR)$(PATCHLEVEL) + + + NetHackW\opthelp + + + NetHackW\symbols.template + + + NetHackW\sysconf.template + + + + + + + + + + \ No newline at end of file diff --git a/win/win32/vs2017/NetHackW.vcxproj b/win/win32/vs2017/NetHackW.vcxproj index 4ee75a4b7..1ea3ce9e5 100644 --- a/win/win32/vs2017/NetHackW.vcxproj +++ b/win/win32/vs2017/NetHackW.vcxproj @@ -31,7 +31,7 @@ /Gs /Oi- %(AdditionalOptions) Disabled true - $(WinWin32Dir);$(IncDir);$(SysWinntDir);$(SysShareDir);$(WinShareDir);%(AdditionalIncludeDirectories) + $(WinWin32Dir);$(IncDir);$(SysWinntDir);$(SysShareDir);$(WinShareDir);$(LuaDir);%(AdditionalIncludeDirectories) TILES;_WINDOWS;DLB;MSWIN_GRAPHICS;SAFEPROCS;NOTTYGRAPHICS;%(PreprocessorDefinitions) @@ -47,6 +47,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -105,6 +138,8 @@ + + @@ -128,10 +163,6 @@ - - - - @@ -206,6 +237,18 @@ + + + + + + + + + + + + diff --git a/win/win32/vs2017/Package.StoreAssociation.xml b/win/win32/vs2017/Package.StoreAssociation.xml new file mode 100644 index 000000000..1200895f3 --- /dev/null +++ b/win/win32/vs2017/Package.StoreAssociation.xml @@ -0,0 +1,373 @@ + + + CN=8BDC628A-FAAA-4EBA-8B5B-EB61BA93BA1F + NetHack DevTeam + AAD + http://www.w3.org/2001/04/xmlenc#sha256 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30485NetHackDevTeam.NetHack3.6 + + NetHack 3.6 + + + + 30485NetHackDevTeam.NetHackBeta + + + \ No newline at end of file diff --git a/win/win32/vs2017/ScreenShot.PNG b/win/win32/vs2017/ScreenShot.PNG new file mode 100644 index 000000000..36d9f9876 Binary files /dev/null and b/win/win32/vs2017/ScreenShot.PNG differ diff --git a/win/win32/vs2017/afterdgncomp.proj b/win/win32/vs2017/afterdgncomp.proj deleted file mode 100644 index 38aee3247..000000000 --- a/win/win32/vs2017/afterdgncomp.proj +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/win/win32/vs2017/afterlevcomp.proj b/win/win32/vs2017/afterlevcomp.proj deleted file mode 100644 index c0d8dd464..000000000 --- a/win/win32/vs2017/afterlevcomp.proj +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/win/win32/vs2017/aftermakedefs.proj b/win/win32/vs2017/aftermakedefs.proj index 4ebea25a4..52af2a8be 100644 --- a/win/win32/vs2017/aftermakedefs.proj +++ b/win/win32/vs2017/aftermakedefs.proj @@ -11,9 +11,7 @@ - - diff --git a/win/win32/vs2017/afternethack.proj b/win/win32/vs2017/afternethack.proj index 912d75e89..ca39fddfc 100644 --- a/win/win32/vs2017/afternethack.proj +++ b/win/win32/vs2017/afternethack.proj @@ -3,13 +3,12 @@ - - - - + Inputs="$(SysWinntDir).nethackrc.template;$(DocDir)Guidebook.txt;$(DatDir)license;$(SysWinntDir)sysconf.template;$(DocDir)nethack.txt;$(DatDir)symbols;$(WinWin32Dir)record;$(DatDir)opthelp" + Outputs="$(BinDir).nethackrc.template;$(BinDir)Guidebook.txt;$(BinDir)license;$(BinDir)sysconf.template;$(BinDir)symbols.template;$(BinDir)record;$(BinDir)opthelp"> + + - + diff --git a/win/win32/vs2017/common.props b/win/win32/vs2017/common.props index 8f5d2a450..ee802873c 100644 --- a/win/win32/vs2017/common.props +++ b/win/win32/vs2017/common.props @@ -9,7 +9,7 @@ Level3 - WIN32;CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;WINVER=0x0601;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) Console diff --git a/win/win32/vs2017/dgncomp.vcxproj b/win/win32/vs2017/dgncomp.vcxproj deleted file mode 100644 index cb2fc0375..000000000 --- a/win/win32/vs2017/dgncomp.vcxproj +++ /dev/null @@ -1,132 +0,0 @@ - - - - - {8A3F81C7-2968-49A8-86BF-2669412AD7DE} - - - - - - - - - - - - - - - - - - - - - - - $(IncDir);$(SysWinntDir);$(SysShareDir);%(AdditionalIncludeDirectories) - WIN32CON;DLB;MSWIN_GRAPHICS;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Lex; - Yacc; - $(BuildDependsOn); - - - - - - - NoLex; - NoYacc; - $(BuildDependsOn); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/win/win32/vs2017/dirs.props b/win/win32/vs2017/dirs.props index 0ebb31a25..8e884b1d0 100644 --- a/win/win32/vs2017/dirs.props +++ b/win/win32/vs2017/dirs.props @@ -2,7 +2,7 @@ $(MSBuildProjectDirectory)\..\..\..\ - $(RootDir)bin\$(Configuration)\$(Platform)\ + $(RootDir)binary\$(Configuration)\$(Platform)\ $(ProjectDir)obj\$(Configuration)\$(Platform)\$(TargetName)\ $(ProjectDir)symbols\$(Configuration)\$(Platform)\$(TargetName)\ $(RootDir)tools\$(Configuration)\$(Platform)\ @@ -10,6 +10,7 @@ $(RootDir)dat\ $(RootDir)doc\ $(RootDir)include\ + $(RootDir)lib\lua-5.3.5\src\ $(RootDir)src\ $(RootDir)sys\ $(RootDir)util\ @@ -22,7 +23,7 @@ $(ObjDir) $(RootDir)win\curses\ - - $(RootDir)..\PDCurses\ + + $(RootDir)lib\PDCurses\ diff --git a/win/win32/vs2017/dlb.vcxproj b/win/win32/vs2017/dlb.vcxproj index d189827b5..ed248279b 100644 --- a/win/win32/vs2017/dlb.vcxproj +++ b/win/win32/vs2017/dlb.vcxproj @@ -25,7 +25,7 @@ - $(IncDir);$(SysWinntDir);$(SysShareDir);%(AdditionalIncludeDirectories) + $(IncDir);$(SysWinntDir);$(SysShareDir);$(LuaDir);%(AdditionalIncludeDirectories) WIN32CON;DLB;MSWIN_GRAPHICS;%(PreprocessorDefinitions) diff --git a/win/win32/vs2017/files.props b/win/win32/vs2017/files.props index 483ec1eb1..c388b6898 100644 --- a/win/win32/vs2017/files.props +++ b/win/win32/vs2017/files.props @@ -11,168 +11,137 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -206,7 +175,6 @@ - @@ -220,8 +188,7 @@ - - + diff --git a/win/win32/vs2017/levcomp.vcxproj b/win/win32/vs2017/levcomp.vcxproj deleted file mode 100644 index 8cb2fb75d..000000000 --- a/win/win32/vs2017/levcomp.vcxproj +++ /dev/null @@ -1,95 +0,0 @@ - - - - - {9DD9C52E-E8C9-4533-BD22-83C055C0AABA} - - - - - - - - - - - - - - - - - - - - - - - $(IncDir);$(SysWinntDir);$(SysShareDir);%(AdditionalIncludeDirectories) - WIN32CON;DLB;MSWIN_GRAPHICS;YY_NO_UNISTD_H;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - Lex; - Yacc; - $(BuildDependsOn); - - - - - - - NoLex; - NoYacc; - $(BuildDependsOn); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/win/win32/vs2017/makedefs.vcxproj b/win/win32/vs2017/makedefs.vcxproj index 1f6c1c49f..00dab103c 100644 --- a/win/win32/vs2017/makedefs.vcxproj +++ b/win/win32/vs2017/makedefs.vcxproj @@ -25,7 +25,7 @@ - $(IncDir);$(SysWinntDir);%(AdditionalIncludeDirectories) + $(IncDir);$(SysWinntDir);$(LuaDir);%(AdditionalIncludeDirectories) WIN32CON;DLB;MSWIN_GRAPHICS;ENUM_PM;%(PreprocessorDefinitions) @@ -46,10 +46,21 @@ - + + + + + + + + + diff --git a/win/win32/vs2017/nh340key.vcxproj b/win/win32/vs2017/nh340key.vcxproj index 36278a8a3..3f54c336a 100644 --- a/win/win32/vs2017/nh340key.vcxproj +++ b/win/win32/vs2017/nh340key.vcxproj @@ -30,7 +30,7 @@ - $(IncDir);$(SysWinntDir);%(AdditionalIncludeDirectories) + $(IncDir);$(SysWinntDir);$(LuaDir);%(AdditionalIncludeDirectories) $(ToolsDir)$(TargetName).lib diff --git a/win/win32/vs2017/nhdefkey.vcxproj b/win/win32/vs2017/nhdefkey.vcxproj index 71334f591..3201aa79f 100644 --- a/win/win32/vs2017/nhdefkey.vcxproj +++ b/win/win32/vs2017/nhdefkey.vcxproj @@ -30,7 +30,7 @@ - $(IncDir);$(SysWinntDir);%(AdditionalIncludeDirectories) + $(IncDir);$(SysWinntDir);$(LuaDir);%(AdditionalIncludeDirectories) $(ToolsDir)$(TargetName).lib diff --git a/win/win32/vs2017/nhraykey.vcxproj b/win/win32/vs2017/nhraykey.vcxproj index 5e0e43b2d..e37c6a426 100644 --- a/win/win32/vs2017/nhraykey.vcxproj +++ b/win/win32/vs2017/nhraykey.vcxproj @@ -30,7 +30,7 @@ - $(IncDir);$(SysWinntDir);%(AdditionalIncludeDirectories) + $(IncDir);$(SysWinntDir);$(LuaDir);%(AdditionalIncludeDirectories) $(ToolsDir)$(TargetName).lib diff --git a/win/win32/vs2017/recover.vcxproj b/win/win32/vs2017/recover.vcxproj index f9cc6de8a..d7f593065 100644 --- a/win/win32/vs2017/recover.vcxproj +++ b/win/win32/vs2017/recover.vcxproj @@ -28,7 +28,7 @@ - $(IncDir);$(SysWinntDir);%(AdditionalIncludeDirectories) + $(IncDir);$(SysWinntDir);$(LuaDir);%(AdditionalIncludeDirectories) WIN32CON;DLB;MSWIN_GRAPHICS;%(PreprocessorDefinitions) diff --git a/win/win32/vs2017/tile2bmp.vcxproj b/win/win32/vs2017/tile2bmp.vcxproj index ab1145c70..c5d14ebf2 100644 --- a/win/win32/vs2017/tile2bmp.vcxproj +++ b/win/win32/vs2017/tile2bmp.vcxproj @@ -25,7 +25,7 @@ - $(IncDir);$(SysWinntDir);$(SysShareDir);%(AdditionalIncludeDirectories) + $(IncDir);$(SysWinntDir);$(SysShareDir);$(LuaDir);%(AdditionalIncludeDirectories) WIN32CON;DLB;MSWIN_GRAPHICS;%(PreprocessorDefinitions) diff --git a/win/win32/vs2017/tilemap.vcxproj b/win/win32/vs2017/tilemap.vcxproj index cb0ba0bd4..139dd17a2 100644 --- a/win/win32/vs2017/tilemap.vcxproj +++ b/win/win32/vs2017/tilemap.vcxproj @@ -25,7 +25,7 @@ - $(IncDir);$(SysWinntDir);$(SysShareDir);%(AdditionalIncludeDirectories) + $(IncDir);$(SysWinntDir);$(SysShareDir);$(LuaDir);%(AdditionalIncludeDirectories) WIN32CON;DLB;MSWIN_GRAPHICS;%(PreprocessorDefinitions) diff --git a/win/win32/vs2017/travisci.sh b/win/win32/vs2017/travisci.sh new file mode 100644 index 000000000..b3e7de13e --- /dev/null +++ b/win/win32/vs2017/travisci.sh @@ -0,0 +1,43 @@ +set -x +export VSVER=2017 +export MSVER=14.16.27023 +export SDKVER=10.0.17763.0 +export FRAMEVER=4.0.30319 +export NETFXVER=4.6.1 +export WKITVER=10.0.17134.0 +#export TOOLSVER=Enterprise +export TOOLSVER=BuildTools +export PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/Common7/IDE/VC/VCPackages:$PATH +export PATH=/c/Program\ Files\ \(x86\)/Windows\ Kits/10/bin/$WKITVER/x64:$PATH +export PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/VC/Tools/MSVC/$MSVER/bin/HostX64/x64:$PATH +export PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/VC/Tools/MSVC/$MSVER/bin/HostX64/x86:$PATH +export PATH=$PATH:/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/Common7/IDE/CommonExtensions/Microsoft/TestWindow +export PATH=$PATH:/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/MSBuild/Current/bin/Roslyn +export INCLUDE=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/$TOOLSVER/VC/Tools/MSVC/$MSVER/include +export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/Include/$WKITVER/ucrt +export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/include/$WKITVER/ucrt +export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/include/$WKITVER/shared +export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/include/$WKITVER/um +export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/include/$WKITVER/winrt +export INCLUDE=$INCLUDE:/c/Program\ Files\ \(x86\)/Windows\ Kits/10/include/$WKITVER/cppwinrt +export LIB=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/VC/Tools/MSVC/$MSVER/ATLMFC/lib/x86 +export LIB=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/$VSVER/$TOOLSVER/VC/Tools/MSVC/$MSVER/lib/x86:$LIB +export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/10/lib/$WKITVER/ucrt/x86:$LIB +export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/10/lib/$WKITVER/um/x86:$LIB +mkdir -p lib +cd lib +git clone --depth 1 https://github.com/wmcbrine/PDCurses.git pdcurses +git clone --depth 1 https://github.com/universal-ctags/ctags.git ctags +curl -R -O http://www.lua.org/ftp/lua-5.3.5.tar.gz +tar zxf lua-5.3.5.tar.gz +cd ctags +nmake -f mk_mvc.mak +cd ../../ +export ADD_CURSES=Y +export PDCURSES_TOP=../lib/pdcurses +export +cd src +cp ../sys/winnt/Makefile.msc ./Makefile +nmake install +cd .. +powershell -Command "Compress-Archive -U -Path binary/* -DestinationPath $TRAVIS_TAG.x86.zip"