GNU make looks first for a file called GNUmakefile, ahead of
looking for Makefile and then makefile.
Renaming sys/windows/Makefile.mingw32 to sys/windows/GNUmakefile
allows:
o src/GNUmakefile (for use by GNU make) and src/Makefile (for use
Microsoft nmake) to both reside in the src folder during build.
o src/GNUmakefile will be used by GNU make, without having to
explicitly specify "-f GNUmakefile" on the GNU make command line.
o src/Makefile will be used by Microsoft nmake, without having to
explicitly specify "-f Makefile" on the Microsoft nmake command line.
For the gcc build, the movemement of sys/windows/GNUmakefile needs
to be copied to src/GNUmakefile as part of the build process (see
sys/windows/build-msys2.txt).
For the Microsoft Visual Studio command line build with nmake,
sys/windows/Makefile.nmake needs to be copied to src/Makefile as
part of the build process (see sys/windows/build-nmake.txt).
They are both copied to the src folder from their respective
repository source file names when the nhsetup.bat file is used.
When a mimic in door form is hit by a wand of locking or wand of
opening or corresponding spell, bring it out of concealment like
was recently done for being zapped while in chest form. And give
some feedback rather than just changing the mimic's form to 'm'.
Give more detailed feedback when bumping into a mimic while moving.
The pull request was:
https://github.com/NetHack/NetHack/pull/1331
by @guillaumebrunerie
The text by @guillaumebrunerie that accompanied the pull request was:
I have been working on a browser/mobile port of NetHack 3.7 using
cross-compilation to WebAssembly (it is very playable already, you can
try it at https://guillaumebrunerie.github.io/nethack/).
[screen shot]
The existing code for compiling to WebAssembly was a great help, although
it wasn't fully up to date and was missing a number of things in order
to be able to create a proper window port (for instance there was no way
to set 'iflags.window_inited' to true, 'print_glyph' was not working
properly as its signature changed, and various other things).
This pull request contains various fixes and additions that I found were
needed/helpful.
Changes:
* export more constants/pointers/globals.
* fix various types that are incorrect.
* disable compression of save files, as it uses fork which isn't supported
in WebAssembly.
* include 'genl_player_setup' when 'SHIM_GRAPHICS' is defined, in order to
make it possible to reuse the existing player selection code.
* move initialization of JavaScript global constants up, as I was running
in some issue when 'raw_print' was being called before initialization.
* change various compilation options for Emscripten, in particular it now
generates an ES6 module (easier to use in a modern Javascript project)
and exports more methods from Emscripten (for instance to be able to use
the virtual file system when saving).
* simplify the implementation of the main loop to avoid 'setTimeout' which
can be pretty slow in the browser when called many times.
* change the way pointer arguments are being sent to JavaScript in 'getArg'
(they were being sent as a pointer to the pointer itself on the stack,
which doesn't really make sense, now the pointer itself is sent).
Because newsym() would be called only on the head position of the worm,
if hilite_pet was on, the segments and head of a long worm would have
mismatched highlighting in the immediate aftermath of taming or
untaming.
There was an issue with Windows mingw build because the function
prototypes were not available. Place them into a distinct
header file nhregex.h and include it from extern.h, and
available for cppregex.cpp to include without the rest of
extern.h (which can give some problems with c++).
gcc has recognized various "magic comments" for white-listing
occurrences of implicit fallthrough in switch statements for
a long time:
The range and shape of "falls through" comments accepted are
contingent upon the level of the warning. (The default level is =3.)
-Wimplicit-fallthrough=0 disables the warning altogether.
-Wimplicit-fallthrough=1 treats any kind of comment as a "falls through" comment.
-Wimplicit-fallthrough=2 essentially accepts any comment that contains something
that matches (case insensitively) "falls?[ \t-]*thr(ough|u)" regular expression.
-Wimplicit-fallthrough=3 case sensitively matches a wide range of regular
expressions, listed in the GCC manual. E.g., all of these are accepted:
/* Falls through. */
/* fall-thru */
/* Else falls through. */
/* FALLTHRU */
/* ... falls through ... */
etc.
-Wimplicit-fallthrough=4 also, case sensitively matches a range of regular
expressions but is much more strict than level =3.
-Wimplicit-fallthrough=5 doesn't recognize any comments.
Plenty of other compilers did not recognize the gcc comment convention,
and up until now the compiler warning for detecting unintended
fallthrough had to be suppressed on other compilers. That's because the code
in NetHack has been relying on the gcc approach, and only the gcc approach.
The C23 standard introduces an attribute [[fallthrough]] for the
functionality, when implicit fallthrough warnings have been enabled.
Several popular compilers already support that, or a very similar attribute
style approach, today, even ahead of their C23 support:
C compiler whitelist approach
--------------------------- -------------------------------------
C23 conforming compilers [[fallthrough]]
clang versions supporting
standards prior to
C23 __attribute__((__fallthrough__))
Microsoft Visual Studio
since VS 2022 17.4.
The warning C5262 controls
whether the implict
fallthrough is detected and
warned about with
/std:clatest. [[fallthrough]]
This adds support to NetHack for the attribute approach by inserting a
macro FALLTHROUGH to the existing cases that require white-listing, so
other compilers can analyze things too.
The definition of the FALLTHROUGH macro is controlled in include/tradstdc.h.
The gcc comment approach has also been left in place at this time.
Issue reported by elunna: sleeping mimics can grab the hero, and
zapping a concealed mimic with a wand of sleep describes the target
as a mimic but doesn't bring it out of concealment.
The grab-when-asleep case is reasonable. It's a reflexive counter-
attack by a magical creature. And the mimic wakes up in the process.
But the mimic wasn't being brought out of concealment. Do that.
Unconceal mimics hit by wand of sleep unless already sleeping.
Fixes#1299
Issue reported by youkan700: shape change anomalies. Shapechangers
could change shape despite active protection-from-shape-changers if
hero wore two rings of protection from shape changers and took one
off. Shapechangers who migrated to a not-yet-visited level that
eventually got visited with protection from shape changers in effect
would be stuck in their current shape, even if the PfSC attribute
got toggled off and back on.
The issue included suggested fixes and those are what I've used. I
noticed a third case that only applies to wizard mode: if player
used #wizintrinsic to set a timed value for PfSC, monsters wouldn't
resume changing shape after it timed out, unless/until it got toggled
on and back off via a PfSC ring or hero left the level and returned.
Fixes#1312
If a vampire in fog cloud form moves under a closed door and then
before moving further gets killed and revives in vampire form,
destroy the door instead of moving the vampire to a nearby open
spot (which might be a distant spot if the map is crowded). If the
door is trapped, explode the trap. That will damage the vampire but
usually not by enough to kill it.
This probably ought to be generalized to be done for any shape change
at a closed location but I ran out of gas.
In case someone switches from NetHack-3.6 to NetHack-3.7 and does
'make spotless' after the switch instead of before, get rid of out
of date lev_comp and dgn_comp.
Change noit_mon_nam() to work as if it was noit_y_monnam() (without
renaming it or adding yet another monster naming routine) to use
"your <mon>" rather than "the <mon>" when <mon> is a pet that can
be seen (so not the case where "it" gets replaced by "someone" or
"something").
Commit c4a1f298e8 two and a half
months ago gave lawful Angels and Archons a chance to start with
a mace instead of a long sword so that they might get Demonbane.
It was a bit convulted; this redoes it to be more straightforward.
Fix a FIXME in Amulet_off() for removing an amulet of magical
breathing when within a poison gas cloud.
Redo message sequencing for both Amulet_on() and Amulet_off().
Use up an amulet of change if put on while the Unchanging attribute
is active (via #wizintrinsic) instead of wearing it with no effect.
Don't discover amulet of strangulation if put on while already
Strangled (via #wizintrinsic).
Add enlightenment feedback for Sunsword's blocking of becoming blind
from light flashes. It uses an extra property so that wizard mode
can report the reason.
EDITLEVEL is being incremented, so existing save and bones files are
invalidated.
When accessiblemsg is Off, coordiates supplied for various messages
stayed put after becoming stale. If you used 'mO' to toggle that
option On, you could see things like
(2east):'accessiblemsg' option toggled on.
After that, accessibility message coordinates behaved as intended.
Clear a11y.msg_loc.x,y for every pline instead of just when they
are used to augment the current message.
Most players who use accessiblemsg are bound to set it in their
config file rather than toggle it interactively so never noticed.
Misc 1: option.c doesn't need '#include <ctype.h>' because
cstd.h includes it unconditionally. Several other src/*.c are in
the same situation but I didn't touch them.
Misc 2: move set_msg_dir() and set_msg_xy() out of a warning
suppression block that isn't relevant to them.
If eating a tin killed the hero (choked, turned to stone, poly'd into
a new man with new Xp too low to survive) and bones were saved, the
tin remained intact in them.
When hero who is poly'd into metallivore form eats a tin, give a
little extra nutrition for the tin itself. Also, eat it immediately
by skipping the "It smells like <creature>" message and "Eat it? [yn]"
prompt. (The message while eating it also reports <creature>, so
skipping the 'smells' one doesn't end up hiding anything.)