Commit Graph

39 Commits

Author SHA1 Message Date
nhmall
45b2a6c49a more C standard progress
There was a transcription error in the comments in cstd.h for
the standard list of header files, where only the description
remained for <stdlib.h>, not the name of the file itself.

Remove several extraneous inclusions of the standard C99 headers.

Tested on the following afterwards:
Linux (using hints/linux.370) including tty, curses, qt6, and X11
macOS (using hints/macOS.370) including tty, curses, qt5, and X11
Windows MSYS2 using sys/windows/GNUmakefile
Windows Visual Studio using sys/windows/Makefile.nmake
msdos cross-compile on Ubuntu using djgpp cross-compiler
2024-12-20 10:32:38 -05:00
nhmall
04082a2033 Remove TEXTCOLOR build option 2023-11-22 16:01:58 -05:00
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
2fc0d25d45 introduce support for coloring the frame behind a map location
Also includes support by paxed for polearm targeting using the
frame color.

Also renames USE_TILES to TILES_IN_GLYPHMAP which is a more
accurate description.

Not all window interfaces have full support for the color framing
of the background square yet.

MS-DOS needs further work (to bring it to both VESA and VGA, with
and without tiles.

Windows GUI is missing support.

X11 and Qt have been started, but may require further refinement.
2023-01-01 19:55:02 -05:00
nhmall
99a93fe50b some C99 changes
Instead of using index() macro defined to strchr, use C99 strchr.
Instead of using rindex() macro defined to strrchr, use C99 strrchr.

If you want to try building on a platform that doesn't offer those
two functions, these are available:
    define NOT_C99       /* to make some non-C99 code available */
    define NEED_INDEX    /* to define a macro for index()  */
    define NEED_RINDX    /* to define a macro for rindex() */
2022-10-29 10:54:25 -04:00
nhmall
88f6df2d8b some tabs to spaces
cd src
    grep -P -n '\t' *.c | grep -v "1:"
    cd ../include
    grep -P -n '\t' *.h | grep -v "1:"
    cd ..

side note: win/Qt/*.cpp are full of tabs
2022-10-26 14:21:23 -04:00
nhmall
39713783d1 some trailing whitespace in src, include 2021-10-16 12:12:21 -04:00
nhmall
8c42d306f7 purge trampoli.h 2020-12-13 10:27:49 -05:00
nhmall
5dcc328759 be more consistent with CROSS_TO_target macro names for cross-compiles
-DCROSS_TO_MSDOS	msdos cross-compile (djgpp cross-compiler)
-DCROSS_TO_AMIGA	Amiga cross-compile
-DCROSS_TO_WASM		wasm cross-compile (emscripten)
2020-10-08 13:49:24 -04:00
nhmall
cb223271cb add cross-compile recipe for amiga
Disclaimer: This is a minimal recipe, just to get someone else
started if they have a desire to get a full cross-compile of
NetHack-3.7 going for the Amiga. Some NetHack code bitrot was
corrected, and it does seem able to compile the game itself
to a point. See caveats below.

- If you want to obtain the cross-compiler and tools/libs for Amiga
         https://github.com/bebbo/amiga-gcc

  To our knowledge, a pre-built copy isn't available, so you have to
  obtain the source via git and build it on your system.

  The build prerequisite packages for Ubuntu are easily obtained:

    sudo apt install make wget git gcc g++ lhasa libgmp-dev \
        libmpfr-dev libmpc-dev flex bison gettext texinfo ncurses-dev \
        autoconf rsync

  The build prerequisite packages for macOS are apparently easily
  obtained via homebrew, but that was not tested:

    brew install bash wget make lhasa gmp mpfr libmpc flex gettext \
    texinfo gcc make autoconf

  After installing the prerequite packages and the cross-compiler
  it was a straightforward build:

        git clone https://github.com/bebbo/amiga-gcc.git
        cd amiga-gcc
        make update
    [Note that you may have to take ownership of the files in the
     bebbo repo via chown before succesfully carrying out the next
     steps]
        make clean
        make clean-prefix
        date; make all -j3 >&b.log; date
  The compiler pieces are installed in /opt/amiga by default which
  was satisfactory for our initial attempt, but if you want you can
  alter the prefix before you build if you want. That is all
  spelled out on the page at: https://github.com/bebbo/amiga-gcc

  The Amiga cross-compile can then be carried out by specifying
  CROSS_TO_AMIGA=1 on the make command line.

  For example:
       make CROSS_TO_AMIGA=1 all
       make CROSS_TO_AMIGA=1 package

You can explicitly include tty and curses support if desired, otherwise
you'll end up with a tty-only cross-compile build. The SDL1 pdcurses
support has not been tested.

       make WANT_WIN_TTY=1 WANT_WIN_CURSES=1 CROSS_TO_AMIGA=1 all

Also note that building the amiga targets using the make command
above, does not preclude you from building local linux or macOS
targets as well. Just drop the CROSS_TO_AMIGA=1 from the make
command line.

The cross-compiler hints additions are enclosed inside ifdef sections
and won't interfere with the non-cross-compile build in that case.

CAVEATS: The original NetHack Amiga build steps included the source for
some utilities that were built and executed on the amiga: txt2iff and
xpm2iff as part of the NetHack build procedure on amiga. Those did not
compile out-of-the-box on the linux host. They will either have to be:
    - ported to build and run on the linux or macOS cross-compile host

   or

    - their functionality will have to be rolled into amiga NetHack
      itself and executed on the target Amiga the first time the game
      is run, perhaps.

Good luck amiga aficionados, perhaps you'll be able to take this
initial effort forward and get NetHack-3.7 available on the amiga or
amiga-emulator. Let us know if you do, and we can roll changes in
if you provide them.
2020-09-28 17:30:22 -04:00
nhmall
ac9ba38449 file header bump from "NetHack 3.6" to "NetHack 3.7" 2020-08-03 22:07:36 -04:00
nhmall
5a437b336a remove SYSFLAGS and MFLOPPY code
A check into github issue 364 confirmed that
ba6edbe5dc
had incorrectly updated the bwrite sizeof entry for sysflags.

The SYSFLAGS and MFLOPPY code is all in the outdated part of the tree, so just
remove it rather than re-correct it.

Closes #364
Closes #207
2020-07-05 08:50:13 -04:00
nhmall
ffec86b244 Merge branch 'NetHack-3.6' 2019-11-02 22:53:46 -04:00
Bart House
2b9e6a057b Removed the redundant #if definded(MSDOS). 2019-11-02 18:17:10 -07:00
nhmall
b377771849 Merge branch 'NetHack-3.6' 2019-10-31 12:26:27 -04:00
nhmall
b110ee9eaf msdos build fix following recent files.c change 2019-10-31 12:00:59 -04:00
nhmall
ba0f6ed47f updated files 2019-06-23 00:57:38 -04:00
Pasi Kallinen
217671e00f Remove built-in speaker support
The changes to amiga, mac and msdos builds are untested.
2019-05-11 11:10:00 +03:00
Patric Mueller
97b8d0a50b Don't define Rand() if isaac64 is used 2019-01-28 10:02:09 +01:00
nhmall
3f609bf9ad define Rand() in isaac4 config
Rand() was typically defined to random() or to rand().

gcc seems to provide a random() to link to on linux
when sys/share/random.c is linked in, but other platforms
such as Windows got an undefined refence to random()
when RANDOM wasn't defined.

The only direct use seems to be in get_rnd_txt() these
days, in rumors.c

Under the USE_ISAAC64 config, neither srandom()
nor srand() are being invoked to seed those routines,
and it really should be using isaac64 when USE_ISAAC64
is defined anyway.
2019-01-28 10:02:09 +01:00
keni
d8c49ec9d1 Add updated copyright lines, part 1. 2018-04-25 15:00:13 -04:00
nhmall
78857961d2 some of Ray Chason's MSDOS and other fixes 2016-03-05 14:44:50 -05:00
Pasi Kallinen
99925ff155 Update version numbers in source comments 2015-11-06 16:05:36 +02:00
Sean Hunt
1c081b1647 Remove stale version control lines. 2015-05-25 09:21:31 +09:00
Sean Hunt
8b57d96fd2 Reformat .h files.
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.
2015-05-25 09:21:15 +09:00
karnov
2a907f894e Version number increment 2015-05-06 22:04:27 -04:00
Sean Hunt
0001534d04 Make REDO unconditional. 2015-02-27 19:33:52 -05:00
keni
03140969ee Bulk recovery of file CVS headers and addition of NHDT- headers. 2015-02-26 09:19:03 -05:00
keni
df20791e59 Add RCS version lines 2009-05-06 10:45:32 +00:00
nethack.allison
0abece54c1 more dos bits 2006-07-10 02:10:22 +00:00
nethack.allison
00768fce8b bits
- catch up on a couple of DOS bits
- fix a copy-and-paste error on hack.c function
2006-07-09 22:17:57 +00:00
nethack.allison
c146fe012d housekeeping: mark trunk sources 3.5 (include) 2005-01-02 16:50:12 +00:00
nethack.allison
416412f92b Remove vestiges of old overlay source split
[trunk only]
2003-09-05 02:45:18 +00:00
nethack.allison
08bbe34a9f suppress DOS djgpp build warning
gcc -c -O -I../include -DDLB -DUSE_TILES -oo/cmd.o ../src/cmd.c
../src/cmd.c: In function `rhack':
../src/cmd.c:1800: warning: case value out of range
../src/cmd.c:1801: warning: case value out of range
2003-07-08 00:30:40 +00:00
nethack.allison
2a83f1b830 more MSDOS build 2003-02-17 02:55:46 +00:00
nethack.allison
6b47ae351d more NOCWD_ASSUMPTIONS
The NOCWD_ASSUMPTIONS conditional code allows readonly
parts of NetHack to be separated from areas that require write-access.
This allows the recent panic log needed a prefix.
2002-06-29 12:44:54 +00:00
nethack.allison
14ec6fe03b some 3.4.1 preparation
Update patchlevel.h
Update some strings from 3.4.0 to 3.4.1.
2002-03-29 06:30:33 +00:00
nethack.allison
06528d1002 3.3.2 to 3.4.0 2002-02-04 16:06:00 +00:00
jwalz
182c4c24f9 *** empty log message *** 2002-01-05 21:05:48 +00:00