High altars and normal temple altars had identical altarmasks, so
there was no way to distinguish between the two based on the altarmask
alone. Instead, anywhere it was necessary to determine whether an altar
was a high altar included a check whether the hero was currently the
Astral Plane or Moloch's Sanctum, and assumed any temple altar was the
high altar.
Since there's an extra, unused bit in altarmask anyway, use it to
explicitly mark high altars -- the lua level files already distinguish
between normal temple altars and so-called 'sanctum' altars anyway, so
rather than throwing away this distinction when generating the level,
keep it in the altarmask and use it in place of various u.uz checks.
I think this would require incrementing EDITLEVEL again...
Implement a better fix for commit 2f4f7d22d ("Fix align type
mixup wth align mask") which was reverted in commit 4e35e8b5a
("Revert "Fix align type mixup wth align mask"").
In the present code, the field align in both struct altar and
struct monster is not an aligntyp, but an align mask with extra flags.
Change the type to match its actual use and improve the naming.
Consolidate duplicated code into a single routine.
Change the return type of induced_align() to be unsigned to match
amask usage.
Change the special level align mask values to be separate from
the normal align mask values.
The overview code could reveal the true alignment of an altar
if hero saw a mimic pretending to be an altar on that spot, or
reveal junk for the alignment when mimicking at altar on some
other spot.
Avoid passing macros that might evaluate their arguments more
than once to other macros which might also do that. The hidden
code expansion can easily get out of hand (although in this case
it was modest).
Also, get rid of the unused MSA_foo alignment values since two
of them had the values swapped. Lastly, make Amask2align() more
robust in case a value with the shrine bit set gets passed to it.
Game is playable, and should compile on linux and Windows.
Assumes you have a lua 5.3 library available.
Removes level compiler and associated files.
Replaces special level des-files with lua scripts.
Exposes some NetHack internals to lua:
- des-table with commands to create special levels
- nh-table with NetHack core commands
- nhc-table with some constants
- u-table with some player-specific data (u-struct)
- selection userdata
Adds some rudimentary tests.
Adds new extended command #wizloadlua to run a specific script,
and #wizloaddes to run a specific level-creation script.
nhlib.lua is loaded for every lua script.
Download and untar lua:
mkdir lib
cd lib
curl -R -O http://www.lua.org/ftp/lua-5.3.5.tar.gz
tar zxf lua-5.3.5.tar.gz
Then make nethack normally.
I did my best to exempt some of the bigger aligned blocks from the reformatting
using the /* clang-format off */ and /* clang-format on */ tags. Probably some
that shouldn't have been formatted were anyway; if you encounter them, please
fix.
The clang-format tags were left in on the basis that it's much easier to prune
those out later than to put them back in, and it means that, modulo my custom
version of clang-format, I should be able to run clang-format on the source tree
again without changing anything, now that Pat has fixed the VA_DECL issues.