Commit Graph

191 Commits

Author SHA1 Message Date
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
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
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
ba5356603a yn()
A number of C compiler suites have a math.h library that includes a yn()
function name that conflicts with NetHack's yn() macro:
"The y0(), y1(), and yn() functions are Bessel functions of the second kind,
for orders 0, 1, and n, respectively. The argument x must be positive. The
argument n should be greater than or equal to zero. If n is less than zero,
there will be a negative exponent in the result."

At one point, isaac64.h included math.h, although that has since been removed.

Some libraries used in NetHack (Qt for one) do include math.h and that required
build work-arounds to avoid the conflict.

Rename the NetHack macro from yn() to y_n() and avoid the math.h conflict
altogether, eliminating the need for that particular work-around.
2023-01-12 16:04:40 -05:00
Pasi Kallinen
030fc0036a Remove NO_VSNPRINTF
Affects only ancient VMS where vsnprintf wasn't available.
2023-01-06 15:53:06 +02:00
nhmall
02a48aa8cf split g into multiple structures
The consolidation of global variables from scattered source
files into decl.c and declared in decl.h was begun in 3.7.0.
Their placement in common files was done for centralized
initialization and potential re-initialization during a
"play again" scenario.

It wasn't really necessary for all of them to be housed in a
single huge structure to meet the "play again" requirement,
and the single huge structure has been a little unwieldy when
it comes to maintenance.

Following this commit, instead of one single extremely large structure
named 'g' to house all of the relocated global variables, they
are distributed into several ga through gz.

To make things easy for the developer, each variable is placed
into the struct corresponding to the starting letter of the variable.
That way, no lookup is required in order to know which struct houses
a particular variable, it is a simple match to the starting letter
for all the centralized global variables.

A global variable named 'amulets', would be found in ga.
    ga.amulets
     ^ ^
A global varable named 'move', would be found in gm.
    gm.moves
     ^ ^
A global variable named 'val_for_n_or_more' would be found in gv.
    gv.val_for_n_or_more
     ^ ^
A global variable named 'youmonst' would be found in gy.
    gy.youmonst
     ^ ^
2022-11-29 21:53:21 -05:00
nhmall
4b04b1e6ac expand support for noreturn declarations
Although gcc specifies support for declaring a function as
noreturn after the function name and parameters, other compilers
do so via an attribute at the start of the declaration. Add some
macro support for the attribute-at-the-beginning method:
  o MS Visual Studio compiler
  o Upcoming C23 standard (untested at this point)
2022-11-24 00:51:42 -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
8df41a6ba2 Revert "NEED_VARARGS followup"
This reverts commit 4d34e153e0.
2022-09-17 15:57:52 -04:00
nhmall
4d34e153e0 NEED_VARARGS followup 2022-09-17 14:22:20 -04:00
nhmall
cb0c21e91d ENHANCED_SYMBOLS
A new feature, enabled by default to maximize testing, but one which can
be disabled by commenting it out in config.h

With this, some additional information is added to the glyphmap entries
in a new optional substructure called u with these fields:
    ucolor          RGB color for use with truecolor terminals/platforms.
                    A ucolor value of zero means "not set." The actual
                    rgb value of 0 has the 0x1000000 bit set.
    u256coloridx    256 color index value for use with 256 color
                    terminals, the closest color match to ucolor.
    utf8str         Custom representation via utf-8 string (can be null).

There is a new symset included in the symbols file, called enhanced1.

Some initial code has been added to parse individual
OPTIONS=glyph:glyphid/R-G-B entries in the config file.

The glyphid can, in theory, either be an individual glyph (G_* glyphid)
for a single glyph, or it can be an existing symbol S_ value
(monster, object, or cmap symbol) to store the custom representation for
all the glyphs that match that symbol.

Examples:
   OPTIONS=glyph:G_fountain/U+03A8/0-150-255

(Your platform/terminal font needs to be able to include/display the
character, of course.)

The NetHack core code does parsing and storing the customized
entries, and adding them to the glyphmap data structure.

Any window port can utilize the additional information in the glyphinfo
that is passed to them, once code is added to do so.

Also, consolidate some symbol-related code into symbols.c, and remove it from
files.c and options.c
2022-05-07 10:25:13 -04:00
nhmall
c2cb89cae9 vms bits to c99 2022-02-07 15:15:14 -05: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
b851b28cbe FDECL and NDECL in sys/vms 2021-01-31 12:49:22 -05: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
PatR
5c291bc540 honor sysconf SHELLERS on VMS
I was looking into adding a confirmation prompt for '!' and it
isn't very promising due to sequencing issues.  (The check for
whether '!' is allowed should happen before the prompt about
running it but the latter should take place in the core rather
than in the port code.)  In the mean time, I noticed that VMS was
ignoring the SHELLERS value from SYSCF.

Untested implementation of a SHELLERS check on VMS.  Even if it
works, it should not be using $USER as the user name to verify.

Tweaks the Unix implementation of check_user_string() but doesn't
switch the testing loop to the simpler version used by VMS which
is derived from the generic users test used by Qt.
2020-11-15 18:28:20 -08: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
efd0911f89 Merge recent changes into NetHack-3.7 2020-01-27 16:49:31 -05:00
PatR
5146827307 Another VMS tweak
One of the new paragraphs inadvertently duplicated an existing one.
2020-01-27 12:14:19 -08:00
nhmall
bd83b6e194 one more missed inconsistency and README updates 2020-01-27 15:05:45 -05:00
PatR
858bd2f376 Readme tweaks
Replace a few tabs, remove a few trailing spaces, and shorten a few
long lines.

Readme still needs another fix:  if falsely claims to contain all bug
fixes since 3.6.4.  I wasn't sure how to reword that so didn't try.

Also, fix a couple of old typos in Install.vms.
2020-01-27 11:53:18 -08:00
nhmall
86b045f80c Merge updates from 'NetHack-3.6' into NetHack-3.7-Jan2020 2020-01-27 09:02:05 -05:00
PatR
eb61690f34 Install.vms update 2020-01-27 02:20:47 -08:00
nhmall
a6c46bbd85 housekeeping items for 3.6.5 - first pass 2020-01-14 11:35:06 -05:00
nhmall
74a5339a5e housekeeping updates for 3.6.4
typos

README update
2019-12-17 14:11:52 -05: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
bc8c1f8f56 remove field-level savefile code 2019-12-08 07:27:01 -05:00
nhmall
a9c946a05f Merge branch 'NetHack-3.6' 2019-12-01 19:30:09 -05:00
nhmall
d2d40289e6 update and/or clarify some version references 2019-12-01 19:07:28 -05:00
nhmall
48852b0857 missed a part of vmsbuild.com 2019-11-27 13:48:25 -05:00
nhmall
c1dad9bb25 more lib subfolder updates 2019-11-27 13:19:45 -05:00
nhmall
392ddb2fef updates to vmsbuild.com to include lua and new 3.7 files 2019-11-12 23:41:01 -05:00
nhmall
bc0d78138f some, but not all, vms issues fixed 2019-11-12 19:58:48 -05:00
nhmall
9b0090aad9 Merge branch 'NetHack-3.7' into paxed-lua-v2-merged 2019-11-08 12:28:36 -05:00
nhmall
50d04bbd61 Merge branch 'NetHack-3.6' 2019-11-07 23:10:47 -05:00
nhmall
0c5b1674ef restore use of wildcards in sys/vms/install.com (untested) 2019-11-07 19:39:11 -05:00
PatR
2058ad10f9 missing data file on vms
vms's install.com was processing bigrm-%.lev (which corresponds to
bigrm-?.lev on unix) so missed two-digit bigrm-10.lev.
2019-11-07 16:21:52 -08:00