Commit Graph

64 Commits

Author SHA1 Message Date
nhmall
686618f34d move early arg and enum dump processing to own file 2026-04-01 08:32:13 -04:00
Pasi Kallinen
d0b9846367 Move item actions into separate src file
Haven't tested compilation on Windows and VMS ...
2026-01-11 14:46:25 +02:00
nhmall
f4a6da2e52 save/restore changes - part 2
This is the second of a series of changes related to save/restore.

    No EDITLEVEL bump has been included, because although the code
    is changed extensively by this, the content of the savefiles have
    not been changed.

    Push the use of the structlevel bwrite() and mread() function use
    out of the core and into sfstruct.c. This is groundwork for upcoming
    changes.

    In the core, replace the bwrite() and mread() calls with the
    use of type-specific savefile output (Sfo) and savefile
    input (Sfi) macros.  The macros are defined in a new header file
    savefile.h, which also contains the prototypes for the sfo_* and
    sfi_* functions that the macros ultimately expand to. The functions
    themselves are in src/sfbase.c.

    On C99, each Sfo or Sfi macro expansion refers directly to the
    corresponding  type-specific sfo_* or sfi_* function.

    If C23 or later is is use, the majority (all but 3 types) of the
    macros refer to a single _Generic output routine sfo(nhfp, dt, tag),
    and a single _Generic input routine sfi(nhfp, dt, tag), which handles
    the dispatch of the type-specific underlying functions. This was
    somewhat experimental, but turned out to be practical because the
    compiler would gripe if the type for a variable was not included in
    the _Generic when passed as an argument, so it could be fixed.

    This alters the savefile verication process by having a common set
    return values for the related functions such as uptodate(),
    check_version(), etc. The new return values return more information
    about savefile incompatibilities, beyond failure/sucess. The
    additional information will be useful for an upcoming addition.
    The expanded return values are:
     SF_UPTODATE                     (0) everything matched and looks good
     SF_OUTDATED                     (1) savefile is outdated
     SF_CRITICAL_BYTE_COUNT_MISMATCH (2) critical size count mismatch
     SF_DM_IL32LLP64_ON_ILP32LL64    (3) Windows x64 savefile on x86
     SF_DM_I32LP64_ON_ILP32LL64      (4) Unix 64 savefile on x86
     SF_DM_ILP32LL64_ON_I32LP64      (5) x86 savefile on Unix 64
     SF_DM_ILP32LL64_ON_IL32LLP64    (6) x86 savefile on Windows x64
     SF_DM_I32LP64_ON_IL32LLP64      (7) Unix 64 savefile on Windows x64
     SF_DM_IL32LLP64_ON_I32LP64      (8) Windows x64 savefile on Unix 64
     SF_DM_MISMATCH                  (9) some other mismatch
    The callers in the core have been adjusted to deal with the expanded
    return values.

    Other miscellaneous inclusions:

       - go.oracle_loc -> svo.oracle_loc.
       - add a bit (1UL << 30) to  called SFCTOOL_BIT as groundwork
         for changes to follow.
2025-05-25 15:03:13 -04:00
nhmall
78a4fd2fb8 split config file processing into its own src file 2025-05-21 23:58:01 -04:00
nhmall
1f99638bbf ren nhconst.h -> weight.h
The speed related values were not used, except for NORMAL_SPEED,
which has been moved back to permonst.h
2025-03-19 17:14:07 -04:00
nhmall
a943c4c10b replace some weight-related magic numbers
adds a header file include/nhconst.h  (I'm open to a better name)
2025-03-19 13:29:58 -04:00
nhmall
ba00dc9066 sever extracolors from utf8map and ENHANCED_SYMBOLS
move the custom color data into its own field in the glyphmap
and disassociate it from the unicode/utf8 stuff.

move the glyphcache stuff during options processing and parsing
into new file glyphs.c and out of utf8map.c, and make it
general, and not part of ENHANCED_SYMBOLS.

Do the groundwork for allowing glyph color customizations to
work when any symset is loaded and not restrict it only to
the enhanced1 H_UTF8 symsets.

The customizations in effect are still affiliated with a particular
symset.

Also closes #1224, but the PR itself references a data structure
made obsolete by this commit. The curses comment from the PR was
added into the code.

The PR also made several suggestions, but only the first
one has been included in this commit (and no longer based on
the handler), that being:
"allow defining colors if other symbol handling modes are used
(possibly limited to the standard 16 colors)."

FredrIQ also wrote the following suggestions in PR#1224:

Something I was also contemplating, unrelated to implementation of this
support in curses, would be the ability for the following:

allow defining colors if other symbol handling modes are used (possibly limited to the standard 16 colors)
allow defining attributes (for example: glyph:G_pet_female_kitten:U+0066/red/underline)
allow specifying glyphs as wildcards for defining global color/attribute changes

Something I also want to see are keywords for "don't change the current defined data". If this
were to be added, you could for example do this:
OPTIONS=glyph:G_*_fox:U+0064/blue
OPTIONS=glyph:G_statue_*:basechar/gray/underline
for "make all foxes use a blue color, make all statues gray with underline" without needing
to specify the relevant character for every statue. This ("basechar", "basefg", etc)
should perhaps also be added for MENUCOLORS and statushilites, so that you can, for
example, underline all items being worn without needing to specify a bunch of
near-duplicate rules for combining BUC colors + underline worn items
as per #1064
2024-03-23 15:36:22 -04:00
nhmall
50811037f3 split some code into separate files
new .h files: hacklib.h selvar.h stairs.h

new .c files: calendar.c, getpos.c, report.c, selvar.c, stairs.c,
              strutil.c, wizcmds.c

cleanup of hacklib.c and mdlib.c

hacklib contains functions that do not have to link with the core

relocate wiz commands from cmd.c to wizcmds.c

relocate CRASHREPORT stuff to report.c

relocate getpos stuff from do_name.c to getpos.c

remove temporary struct definition from extern.h

cross-compile PRE-section split into cross-pre1.370 and cross-pre2.370

Windows sys/windows/Makefile.nmake and sys/windows/Makefile.mingw32 and
visual studio project file updates

Unix sys/unix/Makefile.src, sys/unix/Makefile.utl

populate selvar.c and selvar.h

build on MS-DOS (not cross-compile) Makefile updates
for sys/msdos/Makefile.GCC (untested)

vms updates for above (untested)
2024-03-07 11:01:04 -05:00
PatR
65debc1adb incorporate 3.6.7+ build fix for VMS
Make sure CLR_MAX is defined when winprocs.h uses it.
sys/vms/vmsmail.c uses wintypes.h and winprocs.h without hack.h;
a change in 3.6.3 broke that but wasn't noticed until now.

I haven't added a fixes entry since we don't know whether 3.7.x
will eventually be buildable on VMS.
2023-05-10 12:47:42 -07:00
nhmall
9bb96322a8 compile NetHack-3.7 without makedefs-generated .h files
This evolves and hopefully eases the game-build requirements by
removing game-compile dependencies on any header files generated
by the makedefs utility, including:

date.h dependency and its inclusion is removed and comparable functionality
is produced at runtime via new file src/date.c.

pm.h dependency and its inclusion is removed and comparable functionality is
produced by moving the monster definitions from monst.c into new header
file called monsters.h and altering them slightly. The former pm.h header
file #define PM_ values are now replaced with appropriate emitted enum
entries during the compiler preprocessing.

onames.h dependency and	its inclusion is removed and comparable functionality
is produced by moving the object definitions from objects.c into new header
file called objects.h and altering them slightly. The former onames.h header
file #define values are now replaced with appropriate emitted enum entries
during the compiler preprocessing.

artilist.h has been slightly altered, and the former onames.h artifact-related
header file #define ART_ values are now replaced with appropriate emitted enum
entries during the compiler preprocessing.

makedefs can still produce date.h (makedefs -v), pm.h (makedefs -p), and
onames.h (makedefs -o) for reference purposes. They won't be used during
the compiler.

The other uses for makedefs remain. They are used to prepare external
file content that the game utilizes, not prerequisite code for the
compile:
    makedefs -d    (database)
    makedefs -r    (rumors)
    makedefs -h    (oracles)
    makedefs -s    (epitaphs, engravings, bogusmons)

date.c

Pull the code for date/time stamping from mdlib.c into date.c.
Set date.o to be dependent on source files, header files, and .o files
so that date.o is rebuilt from date.c when any of those changes, thus
ensuring an accurate date/time stamp. It also includes git sha
functionality formerly done by makedefs writing #define directives
into include/date.h. For unix it passes the git info on
the compile line for date.c (via sys/unix/hints/linux.2020, macOS.2020)

nethack --dumpenums (optional, but on by default)

Allow developer to obtain some internal enum values from NetHack
without having to resort to an external utility such as
makedefs.

Uncomment #define NODUMPENUMS in config.h to disable this.

The updates to sys/windows/Makefile.gcc have not been tested yet.
2021-08-21 07:59:18 -04:00
nhmall
2baadd6a29 header files sym.h and defsym.h
There were multiple symbol-related lists that had to be kept
in sync in various places.

Consolidate some of that into a single new file
    defsym.h
with a set of morphing macros that can be custom-called from
the various places that use the sym info without maintaining
multiple occurrences. Most maintenance can be done there.

Rename monsym.h to sym.h since it looks after some
symbols not related to monsters now too.

The defsym.h header file is included in multiple places to
produce different code depending on its use and the controlling
macro definitions in place prior to including it.

Its purpose is to have a definitive source for
pchar, objclass and mon symbol maintenance.

The controlling macros used to morph the resulting code are
used in these places:
  - in include/sym.h for enums of some S_ symbol values
    (define PCHAR_ENUM, MONSYMS_ENUM prior to #include defsym.h)
  - in include/objclass.h for enums of some S_ symbol values
    (define OBJCLASS_ENUM prior to #include defsym.h)
  - in src/symbols.c for parsing S_ entries in config files
    (define PCHAR_PARSE, MONSYMS_PARSE, OBJCLASS_PARSE prior
    to #include defsym.h)
  - in src/drawing.c for initializing some data structures/arrays
    (define PCHAR_DRAWING, MONSYMS_DRAWING, OBJCLASS_DRAWING prior
    to #include defsym.h)
  - in win/share/tilemap.c for processing a tile file
    (define PCHAR_TILES prior to #include defsym.h).
2021-08-10 13:35:25 -04:00
nhmall
0a10bd632d change references from winnt to windows
rename sys/winnt to sys/windows
move vs (visual studio) folder out of win/win32 and into sys/windows
rename include/ntconf.h to include/windconf.h
rename winnt.c to windsys.c
place visual studio projects into individual subfolders.

This will hopefully resolve GitHub issue #484 as well.
2021-06-03 23:26:00 -04:00
nhmall
1d94e65e45 finish mapglyph() removal 2021-01-02 09:22:53 -05:00
PatR
99cc236d4a vis_tab removal for VMS
Get rid of vis_tab.{c,h}, also the commented out remnants of
{dgn_comp,lev_comp}.*, and put back sfstruct.* that erroneously
got removed along with some other stuff way back when.

Untested, and the lua stuff needs to be modularized.
2020-12-30 08:58:15 -08:00
nhmall
8c42d306f7 purge trampoli.h 2020-12-13 10:27:49 -05:00
nhmall
f965d187b8 support for build with current Lua version 5.4.1
This may require
	make spotless
	make fetch-lua
for some platforms.
2020-11-15 11:08:10 -05:00
nhmall
ac9ba38449 file header bump from "NetHack 3.6" to "NetHack 3.7" 2020-08-03 22:07:36 -04:00
nhmall
c95fe8c32b Merge branch 'NetHack-3.7' into header-order3.7 2020-07-07 20:10:25 -04:00
nhmall
b967f73b96 build with the current Lua version 5.4.0 by default if not overridden 2020-07-07 17:36:23 -04:00
nhmall
1443ceecc5 more patchlevel consolidation 2020-07-07 08:55:11 -04:00
nhmall
6c0d522b1a relocate some more outdated code 2020-07-05 09:27:59 -04:00
PatR
70611afc48 splitting cmd.c, phase I
Preparation for moving enlightenment and conduct into new source
file insight.c.  Right now it's a stub that shouldn't break anything
whether included or omitted.  Once makefiles and project files have
been updated to compile and link it, the actual code will be moved.

unix/Makefile.src has been updated;
vms/Makefile.src and vmsbuild.com have been updated but not tested.
2020-02-01 08:59:19 -08:00
nhmall
480c3eb6e0 include/lev.h is an empty header file so just get rid of it 2019-12-14 17:18:48 -05:00
nhmall
f4720edfbf include/qtext.h is an empty header so just get rid of it 2019-12-14 12:31:29 -05:00
nhmall
4f654b630e src and include are down 1 level in src subfolder of lua tree 2019-11-07 17:30:55 -05:00
nhmall
8d4ccf5111 attempt to add the additional include directory to vms build 2019-11-07 17:28:57 -05:00
nhmall
39972beb0d cut-and-paste error bit 2019-11-07 17:21:23 -05:00
nhmall
f2d8ff49d5 add vms lua build bits 2019-11-07 17:17:17 -05:00
PatR
f5a0e43e31 version number 3.7.0 for vms 2019-05-12 15:57:05 -07:00
PatR
98002b3166 vms/Makefile.src - curses
Add curses dependencies to VMS Makefile.  Not tested.
2019-02-22 14:56:42 -08:00
PatR
4a9a92a2e8 VMS curses
Add untested support for building the curses interface instead of or
in addtion to tty.

While in there, update Makefile.src's isaac64.obj dependency.
2019-02-16 15:34:23 -08:00
PatR
da1212077d isaac64 on vms
Not tested yet...
2019-02-10 13:54:16 -08:00
PatR
bb8ba53ed9 vms/Makefile.src
Catch up with recent changes to vmsbuild.com and unix/Makefile.src.
2018-11-29 18:45:37 -08:00
PatR
6ecf97f6e3 vms build/install update
New-ish files 'engrave', 'epitaph', and 'bogusmon' added for 3.6.0
were not handled by playground setup.  NetHack runs without them so
limited testing didn't notice.

Add 'makedefs -s' to build them and include them in installed files.

Also, remove 'makedefs -m' and obsolete monstr.c.
2018-11-16 09:16:48 -08:00
nhmall
2b66b5ecd1 bump version ID values 2018-05-16 23:06:44 -04:00
keni
0f58af6f37 add missing copyright info 2018-04-25 16:54:50 -04:00
PatR
9c6e5a0563 dat/keyhelp for vms
Update vms/install.com (rather than Makefile.top) to install the new
data file for the 'whatdoes' command.

Also, the 3.6.0 distribution puts version number 3.5.0 into vms
binaries (all the programs, not just nethack itself).  It's something
observable with native tools without running the program, nothing to
do with nethack's 'v' command which gets its version number from
patchlevel.h via makedefs.
2016-06-05 06:33:42 -07:00
PatR
ef2a6e6f1b make depend
dungeon.o depending on lev.h is the only change found by 'make depend'.
(I'm a bit suspicious about that.)

I haven't attempted to reconcile the vms Makefiles with the Unix ones,
just put in this one new dependency.  I know vms/Makefile.src lacks
handling for sys/share/*regex.c and vms/Makefile.top and install.com
both lack handling for 'sysconf'.
2015-11-11 23:46:19 -08:00
Sean Hunt
1c081b1647 Remove stale version control lines. 2015-05-25 09:21:31 +09:00
karnov
2a907f894e Version number increment 2015-05-06 22:04:27 -04:00
keni
03140969ee Bulk recovery of file CVS headers and addition of NHDT- headers. 2015-02-26 09:19:03 -05:00
keni
4e5e720334 display version and build info at startup (trunk only)
Tested on the unix port; I've updated as many other ports as I can figure
out but they're not tested.  See window.doc for info on the changed banner
lines.  Also adds the ability to override the generic "Unix" port - used now to get
"MacOSX" into the version line instead of "Unix" (so we don't scare people who don't
know what's going on).
2011-10-11 02:37:31 +00:00
nethack.rankin
2ba506b385 version feedback (trunk only)
Show the 'v' output (full version number plus build date-time) as
the first line of '#version' output (build time configuration settings).
It isn't simple to do that when generating dat/options (there's some
port-specific tweaking going), so do it at run-time by processing that
file one line at a time instead of passing it through a pager routine.

     This also inserts an "About NetHack" entry as the first choice in
the menu for '?', the way that most Windows programs have interactive
help organized.  Picking that gives the same output as using #version.

'make depend' manually updated for Unix and VMS (add dlb.h to version.*).
2011-09-23 07:33:18 +00:00
nethack.rankin
17ba5651fa PANICTRACE on VMS (trunk only)
The preliminary implementation of PANICTRACE on VMS had a "Fixme"
that this fixes, and a "TODO" that this makes moot, but the main reason
for this patch is that vmsmisc.c had been changed to call vms_define(),
which resides in vmsunix.c.  Since vmsmisc.obj is linked into progarms
in util/ and vmsunix.obj isn't, enabling PANICTRACE caused linking
problems for those.  This moves the code that wants to call vms_define()
into vmsunix.c (despite the fact that it's not even vaguely related to
Unix emulation), so that it only matters to nethack and doesn't impact
the utility programs anymore.

     This uses a VMS facility called LIB$INITIALIZE to call code before
main() starts.  It's rather messy--at least when written in something
other than assembler or Bliss--and shouldn't be needed for nethack,
but I couldn't figure out how to trap the condition signalled by
lib$signal(SS$_DEBUG) when the debugger isn't available to do so, so I
needed a way to make issuing that signal be conditional upon debugger
availability.  One of the arguments passed to LIB$INITIALIZE-invoked
routines contains information that makes if feasible to deduce whether
the debugger is available.

     Even when PANICTRACE is disabled, that's useful for handling abort
due to panic while in running in wizard mode.
2011-09-01 01:47:00 +00:00
nethack.rankin
3453bf9a4d vms update (trunk only)
I hadn't tried the build script vmsbuild.com in a long time....
vmsbuild.com wasn't compiling src/sys.c;
vmsbuild.com and Makefile.src+Makefile.utl had some linking discrepancies;
Makefile.top, Makefile.dat, Makefile.doc - replace old SCCS id/date/rev
  comment with current cvs one (done for .src & .utl a month or so back);
config1.h - running DEC C in VAX C compatability mode to test linking
  yielded a diagnostic about signed in the schar typedef for every file.
2011-05-23 03:27:10 +00:00
nethack.rankin
0b97c1be42 sort of/kind of support PANICTRACE on VMS (trunk only)
I don't think this is useful enough to recommend ordinary users
enable it, but it's close enough to being useful that I don't want
to leave it to become subject to bit rot like umpteen other unfinished
patches.  Anyone running in wizard mode who has a panic already gets
pushed into the debugger on VMS, although it doesn't work for what might
be considered the most important configuration (a secure playground, as
opposed to the wide-open one I've always been content to leave mine at).
2011-04-24 08:16:22 +00:00
keni
6f0e178368 more SYSCF and related bits - cleanup and features
infrastructure for "system options" - things currently specified at build
 time that should be changeable at install time or run time but not really
 under user control
generalize contact info so it can be localized and it doesn't have to be
 an email address
move recently introduced WIZARDS into sysopt
drop bogus OPTIONS=wizards possibility
new function build_english_list() to comma-ize and add 'or' from a whitespace separated list: A.  A or B.  A, B, or C.
syscf file now handles: WIZARDS SUPPORT RECOVER
 SUPPORT specifies local support information
 RECOVER will eventually supply port-specific and/or localized info on how
  to run recover (or get it run for you).
Note: in sys/msdos I changed sys.o (generated from pcsys.c) to pcsys.o
Note: sys/msdos/Makefile.GCC has 2 rules for sys.o (now pcsys.o)
2008-01-31 00:56:59 +00:00
nethack.rankin
a675cc6ed7 vms file access
Fix the problem From a bug report.  His system has a logical name "DATA" pointing at some disk, and
when the dlb utility tried to open "data" for inclusion in the library
being built at install time, it attempted to access the wrong thing and
failed.  He then attempted to fix it in a manner which let dlb finish, by
modifying dlb_main.c to append "." to file names that lack a dot, but
then nethack couldn't access "dungeon" in the library because string
comparison didn't match the altered dlb directory entry of "dungeon.".

     NetHack was working around this unintended interaction with the
environment issue in fopen_datafile(), and dlb was doing so for fopen()
but not open().  This moves nethack's fixup out of src/files.c and into
sys/vms/vmsfiles.c, adds another routine there so that both open() and
fopen() are covered, and updates the vms Makefiles so that the various
utility programs all link with vmsfiles.  (The build script vmsbuild.com
puts object files into a library and gets that last bit for free.)
2007-10-28 09:37:56 +00:00
nethack.allison
4169a3a308 Remove win32 mapi mail from distribution (trunk only) 2006-10-19 13:26:54 +00:00
nethack.allison
143790540b mextra follow up bit 3
More Makefile tweaks
2006-01-07 13:38:29 +00:00