Commit Graph

2370 Commits

Author SHA1 Message Date
nhmall
2185d325c4 header file changes hack.h, decl.h/.c, system.h, wintty.h
- Move secondary preprocessor defines down further in config.h
so that they can be overridden via [platform]conf.h which is
included from global.h, specifically:
    LIVELOGFILE when LIVELOG is defined
    DUMPLOG_FILE when DUMPLOG is defined

- Minimize platform-specific, or compiler-specific code in hack.h and decl.h.

- reorganize src/decl.c to align with include/decl.h.

- a new header file cstd.h added, containing calls to C99
standard header files.

- hack.h, decl.h, and decl.c have been cleaned up and had code
moved so that things line up as follows:

     hack.h     defines values that are available to all
                NetHack source files, contains enums for use in all
                NetHack source files, and contains a number of
                struct definitions for use in all NetHack source files.
                It does not contain variable declarations or variable
                definitions.

     decl.h     contains the extern declarations for variables that
                are defined in decl.c. These variables are global and
                available to all NetHack source files. The location of
                the variables within decl.h was random, so give it some
                order for now.

     decl.c     contains the definition of the variables declared in
                decl.h, and initializes them where appropriate. The
                variable definitions are laid out in much the
                same order as their declarations in decl.h.

- wintty.h: There were some varying terminal-related prototypes in
system.h, and that was the only thing left that demanded that
system.h be included. Those have been replaced by an #include
<term.h> in include/wintty.h to get the more current (and hopefully
more correct) prototypes, rather than hardcoding them in NetHack
sources.

For edge-case platform compatiblity, there is no #include <term.h>
if the build defines NO_TERMCAP_HEADERS. In that case one set of
hardcoded prototypes is still used in include/wintty.h.

The added #include "term.h" is also bypassed for NO_TERMS builds (builds
that don't link to terminfo/termcap at all, but still present a tty
interface using platform or window-port specific functions to fulfill
the same role as that of terminfo/termcap).

- some scattered, unnecessary #include "integer.h" were removed from
various files, since that's always included in current NetHack-3.7
sources, either directly from config.h or indirectly from #include
"hack.h".

- system.h references removed.

- new cstd.h added; the #include "system.h" references in Makefiles
and project files (Xcode, visual studio), were replaced
with #include "cstd.h" references. A "make depends" is probably
warranted.

Also:

 - Use of <term.h>, which defines clear_screen() as a macro, conflicts
with an actual function with that name in win/tty/termcap.c. The most
straight-forward course of action was to rename the NetHack function,
and change the references to it, from clear_screen() to
term_clear_screen(), so that was done.
2023-04-05 11:49:09 -04:00
nhmall
85feda8774 comment out WANT_ASAN=1 for now
encountered an error testing it on macOS
2023-03-29 22:09:19 -04:00
nhmall
d783afbda1 support WANT_ASAN=1 on make command line in linux.370 and macOS.370
When the address sanitizer is in use for gcc, clang, or visual studio,
(-fsanitize=address) define the NetHack preprocessor symbol USING_ADDRESS_SANITIZER.
2023-03-29 21:39:44 -04:00
nhmall
de64ae538c update tested versions of Visual Studio 2023-03-25 2023-03-25 11:38:36 -04:00
nhmall
8f142020a1 some Windows fixes
remove a couple of extraneous files from visual studio project
remove several trailing whitespace at end of line
remove an address sanitizer bounds error during player dialog init
rework fix for darkened lit tiles (fix issue #997)
2023-03-22 11:29:10 -04:00
nhmall
64eeafc2d7 remove package from visual studio solution for now 2023-03-02 22:17:51 -05:00
nhmall
11d83bbad3 retarget Visual Studio SDK 2023-03-02 22:06:14 -05:00
nhmall
76e82d1312 fix remaining contrived issues re HANGUPHANDLING 2023-03-01 12:01:43 -05:00
Pasi Kallinen
fc7a32b86e Tutorial level
Add a tutorial level to teach commands to new players.
Very much a WIP.

Breaks save and bones compat.
2023-03-01 14:00:29 +02:00
nhmall
d31db79558 more macOS.370 macro usage 2023-02-27 11:47:09 -05:00
nhmall
a2047714d1 fix a 'make bundle' error
make[1]: *** No rule to make target `../util/uudecode', needed by `/Users/testuser/nethack/NHsource/bundle/NetHackTerm.app/Contents/Resources/NetHackTerm.icns'.  Stop.
make: *** [bundle] Error 2
2023-02-27 11:08:51 -05:00
nhmall
abdc8e6cbe Revert "update Makefile.nmake"
This reverts commit 8c7922635e.
2023-02-26 09:42:35 -05:00
nhmall
8c7922635e update Makefile.nmake 2023-02-25 16:28:58 -05:00
nhmall
cb0c7e00d1 update Xcode project 2023-02-25 16:20:10 -05:00
nhmall
9168e1f30b remove a maintenance/synchronization requirement
adds a file include/seffects.h
2023-02-25 16:05:27 -05:00
nhmall
52c2ce0caf Makefile.mingw32 placement 2023-02-24 17:45:02 -05:00
nhmall
db60679665 Windows: add lua files dependency 2023-02-24 17:40:35 -05:00
nhmall
700ca5a7b2 update tested versions of Visual Studio 2023-02-21 2023-02-21 23:51:02 -05:00
PatR
998b5af644 non-Unix sysconf updates
For non-Unix systems, disable the "description of NetHack's command
line" entry in the help command's menu.
2023-02-21 11:15:08 -08:00
nhmall
a92ed87c93 fix recover on Linux
Also, recover should be a target-side utility, not host. That
really only makes a difference if you are cross-compiling.
2023-02-19 15:06:55 -05:00
nhmall
84390fa600 expand C99=1 with macOS.370 and linux.370 hints
In addition to C99=1 on the make command line, also allow
C89=1 or C11=1 or C23=1.

NOTE: Those won't all lead to a successful build of NetHack,
and the use of C23=1 (-std=c2x) will only be valid on recent
compiler versions (clang-15, for one, accepts it).
2023-02-18 11:35:40 -05:00
nhmall
24dab18167 allow setting the standard
CSTD can be manually set near the top of src/Makefile, util/Makefile
or by including c99=1 or C99=1 on the build make command line if
using the linux.370 or macOS.370 hints files.
2023-02-17 10:23:40 -05:00
nhmall
10cafddcb0 more bundle work for macOS
This iteration:

Places the resulting bundle folder off the top of the tree, rather than as a subdirectory of src.

Leaves the Applescript files out for now.

Builds the Info.plist (for now) via hard-coded values in the Makefile.

Builds the bundle launch script on the fly at make-time.

I think this revision may be working, at lease on my test machine.
There are more improvements to be done.
2023-02-12 01:19:05 -05:00
PatR
df18c96840 Makefile management
Have 'make clean' and 'make spotless' in 3.7 cleanup include/tile.h
from 3.6.  Otherwise use of 'cc -I../include -I../win/share' in
util/Makefile will get 3.6's include/tile.h instead of 3.7's
win/share/tile.h; use of FDECL() causes the old header to break when
used in various tiles utilities.
2023-02-10 16:42:01 -08:00
nhmall
24461058e6 more work on bundle and starting from Finder 2023-02-10 01:55:49 -05:00
nhmall
738bccc344 updated to Makefile bundling 2023-02-09 15:25:42 -05:00
nhmall
4ce722b8b2 more follow-up 2023-02-08 18:12:15 -05:00
nhmall
c67d9e96a6 correct a typo 2023-02-08 17:48:26 -05:00
nhmall
aad0586239 add new macOS target 'bundle'
This creates a new target 'bundle' for make on macOS, when using
sys/hints/macOS.370.

The 'bundle' recipe:
    - creates a subdirectory of src called 'bundle', and creates
      a bundle (nethack.app/ etc) below that.
    - the executable that is placed inside the bundle
      (bundle/nethack.app/Contents/MacOS/nethack) will find resources
      within the bundle, including the sounds, so a manual placement
      of the sounds into your '~/Library/Sounds' is no longer
      required when using the executable that's inside the bundle.
    - the sounds are included in the bundle if a soundlib option is
      chose at build time (for example 'make WANT_MACSOUND=1'), such
      that the bundled executable supports sounds.
    - the executable inside the bundle seems to find the resources
      it needs, even if invoked through a symlink elsewhere that points
      to the executable that's inside the bundle (only limited testing of that
      has been done).
    - at some point, its probably appropriate to add a
      'mv bundle/nethack.app <proper location>', possibly under
      a subsequent 'make install' step.
    - right now, the bundle step has a dependency on 'update'. I don't
      know if that's the right ordering or not, yet.

make WANT_MACSOUND=1 update
make WANT_MACSOUND=1 bundle

or, you can probably get away with:

make WANT_MACSOUND=1 bundle

if the nethack bundle is the goal anyway.

make clean
will clear the bundle subdirectory and everything below it.
2023-02-08 17:17:43 -05:00
PatR
bfd3cee886 Unix Makefiles
Move building uudecode for unpacking .Wav files from Makefile.dat to
Makefile.utl and add uudecode to util's 'make spotless'.
2023-02-08 11:38:47 -08:00
nhmall
fbd9a7bae8 another update to the soundlib interface
sound_verbal(char *text, int32_t gender, int32_t tone, int32_t vol,
             int32_t moreinfo);
    -- NetHack will call this function when it wants to pass text of
       spoken language by a character or creature within the game.
    -- text is a transcript of what has been spoken.
    -- gender indicates MALE or FEMALE sounding voice.
    -- tone indicates the tone of the voice.
    -- vol is the volume (1% - 100%) for the sound.
    -- moreinfo is used to provide additional information to the soundlib.
    -- there may be some accessibility uses for this function.

It may be useful for accessibility purposes too.

A preliminary implementation has been attempted for macsound to test
the interface on macOS. No tinkering of the voices has been done.

Use of the test implementation requires the following at build time with make.
    WANT_SPEECH=1
That needs to be included on the make command line to enable the test code,
otherwise just the interface update is compiled in.

I don't know for certain when AVSpeechSynthesizer went into macOS, but older versions
likely don't support it, and would just leave off the WANT_SPEECH=1.

If built with WANT_SPEECH=1, the 'voices' NetHack option needs to be enabled.

It was a bit strange, when I first started up the test, to hear Asidonhopo,
the shopkeeper, talking to me as I entered his shop and interacted with him.
2023-02-07 00:44:36 -05:00
PatR
6cf077a684 depend.awk update
cppregex.cpp recently had `#include "extern.h"' added as the last
quoted include.  That gets set to "" while collecting dependencies,
then preceded by a space when output.  So the unexpected trailing
space was new and wasn't caused by a change of awk versions as I
was suspecting.  This removes it.
2023-02-04 12:58:06 -08:00
nhmall
36ca64acdb start to add some SOUND_TRIGGER_ACHIEVEMENTS code
Start to add supporting code to windsound and macsound. The latter
remains commented out because I haven't had a chance to try
it on macOS yet.

In order to test it out, I added two more stock sounds:
sa2_xplevelup and sa2_xpleveldown.
2023-02-04 14:28:59 -05:00
PatR
87c3d07645 3.7.x 'make depend'
Makefile.src didn't know about 'sndprocs.h' yet.

Something weird is going on with 'make depend'.  It has started
adding a trailing space to
|$(TARGETPFX)cppregex.o: ../sys/share/cppregex.cpp $(CONFIG_H)
(actual trailing space omitted here).  It's repeatable.  I don't
understand it and have not tried to fix it, just removed the space
from the generated Makefile before putting into place as modified
Makefile.src and making this commit.
2023-02-03 15:48:46 -08:00
nhmall
8ee42f5644 further work on soundlib support code
move some inline code into functions
replace some magic numbers

The mingw code is not tested yet.
2023-01-31 22:19:29 -05:00
nhmall
e6012ab658 Only embed wav resources if soundlib defined 2023-01-31 02:22:25 -05:00
nhmall
2c5bbdc0ed fix a naming conflict 2023-01-31 01:10:02 -05:00
nhmall
ce0a4f60ca more windows Makefile tinkering
It looks like the Windows API call for PlaySound using SND_RESOURCE, from a
mingw32 built program, cannot find the resources that are
embeded into the .exe by the mingw32 resource compiler. That works fine
from visual studio.

For now, fall back to not using the SND_RESOURCE flag, use an ordinary
wav file name in the filesystem. Makefile.mingw32 has been modified
to copy the wav files to the binary directory along with the exe.

This probably won't be the final approach, but it will get things
working for now.
2023-01-31 00:45:27 -05:00
nhmall
a7b8099ecb some Makefile.nmake fixups 2023-01-30 19:24:21 -05:00
nhmall
8bb1feab61 remove a value used for a test run of nmake 2023-01-29 22:09:54 -05:00
nhmall
6ce2994646 Windows Makefiles easier soundlib opt-in or opt-out 2023-01-29 22:07:31 -05:00
nhmall
86368148bf soundlib in the Makefile hints updated
Move pieces of the Makefile hints sound-related changes that
are not macOS-specific from sys/unix/hints/macOS.370 to some new
include files. The WANT_MACSOUND block stays in
sys/unix/hints/macOS.370 because it is system-specific.

Before this change, the various Makefiles were assembled via
hints files macOS.370 or linux.370. Both were using included
portions from the following files in the sys/unix/hints/include
directory, in this sequence:

    -INCLUDE multiw-1.370
    -INCLUDE multiw-2.370
    -INCLUDE compiler.370
    -INCLUDE multiw-3.370
    -INCLUDE cross-pre.370
    -INCLUDE gbdates-pre.370
    -INCLUDE gbdates-post.370
    -INCLUDE cross-post.370

After this change, the various Makefiles will still be assembled
via hints files macOS.370 or linux.370. They will continue to use
included portions from the following files in the
sys/unix/hints/include directory, but with three additional
include files related to sound and soundlibs. This is the new
sequence:

    -INCLUDE multiw-1.370
    -INCLUDE multiw-2.370
    -INCLUDE compiler.370
    -INCLUDE multiw-3.370
+   -INCLUDE multisnd1-pre.370
    -INCLUDE cross-pre.370
    -INCLUDE gbdates-pre.370
+   -INCLUDE multisnd2-pre.370
    -INCLUDE gbdates-post.370
+   -INCLUDE multisnd-post.370
    -INCLUDE cross-post.370

The include mechanism continues to allow common portions that can
be shared between macOS and Linux to be maintained in a single
place only, with minimal duplication. Now, that has been extended
to include Makefile lines related to sounds and soundlib.
2023-01-28 22:43:48 -05:00
Pasi Kallinen
777f53c212 Add hellfill.lua to VMS install 2023-01-27 19:48:13 +02:00
nhmall
446044e1d5 1st of a few sequencing changes
rename display_gamewindows() to init_sound_and_display_gamewindows()
(I know that's getting pretty long-named).

move activate_chosen_soundlib() into init_sound_and_display_gamewindows()
from moveloop_preamble().

Also included was a missing break in a switch related to sounds.
2023-01-26 17:15:59 -05:00
nhmall
021cda2bdd transcription error 2023-01-25 23:10:51 -05:00
nhmall
8e0ed1e69d smooth use of soundlib(s) in Makefile.nmake
Related: also add a preprocesor #if defined(SND_LIB_WINDSOUND) around the
assign_soundlib() call in sys/windows/windmain.c
2023-01-25 23:05:36 -05:00
nhmall
8bbf9a5b8f add missing entries to visual studio files.props 2023-01-25 09:41:20 -05:00
nhmall
a48e32a1f9 add missing Magic_Flute files 2023-01-25 01:16:08 -05:00
nhmall
8fe423d65d Merge branch 'fix-makefile' of https://github.com/argrath/NetHack into NetHack-3.7 2023-01-24 14:44:16 -05:00
SHIRAKATA Kentaro
06615b6e9e substitute non-ASCII chararacters in Makefile.nmake 2023-01-25 04:09:02 +09:00