Commit Graph

213 Commits

Author SHA1 Message Date
nhmall
0c3b9642e4 pmnames mons gender naming plus a window port interface change
add MALE, FEMALE, and gender-neutral names for individual monster species
to the mons array. The gender-neutral name (NEUTRAL) is mandatory, the
MALE and FEMALE versions are not.

replace code uses of the mname field of permonst with one of the three
potentially-available gender-specific names.

consolidate some separate mons entries that differed only by species into a
single mons entry (caveman, cavewoman and priest,priestess etc.)

consolidate several "* lord" and "* queen/* king" monst entries into
their single species, and allow both genders on some where it makes some
sense (there is probably more work and cleanup to come out of this at some
point, and the chosen gender-neutral name variations are not cast in stone
if someone has better suggestions).

related function or macro additions:
    pmname(pm, gender) to get the gender variation of the permonst name. It
    guards against monsters that haven't got anything except NEUTRAL naming
    and falls back to the NEUTRAL version if FEMALE and MALE versions are
    missing.

    Ugender to obtain the current hero gender.
    Mgender(mtmp) to obtain the gender of a monster

While the code can safely refer directly to pmnames[NEUTRAL] safely in the
code because it always exists, the other two (pmnames[MALE] and
pmnames[FEMALE] may not exist so use:
    pmname(ptr, gidx)
      where -ptr is a permonst *
            -gidx is an index into the pmnames array field of the
             permonst struct
pmname() checks for a valid index and checks for null-pointers for
pmnames[MALE] and pmnames[FEMALE], and will fall back to pmnames[NEUTRAL] if
the pointer requested if the requested variation is unavailable, or if the
gidx is out-of-range.

Allow code to specify makemon flags to request female or male (via MM_MALE
and MM_FEMALE flags respectively)to makedefs, since the species alone doesn't
distinguish male/female anymore. Specifying MM_MALE or MM_FEMALE won't
override the pm M2_MALE and M2_FEMALE flags on a mons[] entry.

male and female tiles have been added to win/share/monsters.txt.
The majority are duplicated placeholders except for those that were
separate mons entries before. Perhaps someone will contribute artwork in the
future to make the male and female variations visually distinguishable.

tilemapping via has the MALE tile indexes in the glyph2tile[]
array produced at build time. If a window port has information that the
FEMALE tile is required, it just has to increment the index returned
from the glyph2tile[] array by 1.

statues already preserved gender of the monster through STATUE_FEMALE
and STATUE_MALE, so ensure that pmnames takes that into consideration.

I expect some refinement will be required after broad play-testing puts it to
the test.

    consolidate caveman,cavewoman and priest,priestess monst.c entries etc

This commit will require a bump of editlevel in patchlevel.h because it alters
the index numbers of the monsters due to the consolidation of some. Those
index numbers are saved in some other structures, even though the mons[] array
itself is not part of the savefile.

Window Port Interface Change

Also add a parameter to print_glyph to convey additional information beyond
the glyph to the window ports. Every single window port was calling back to
mapglyph for the information anyway, so just included it in the interface and
produce the information right in the display core.

The mapglyph() function uses will be eliminated, although there are still some
in the code yet to be dealt with.

win32, tty, x11, Qt, msdos window ports have all had adjustments done to
utilize the new parameter instead of calling mapglyph, but some of those
window ports have not been thoroughly tested since the changes.

Interface change additional info:

    print_glyph(window, x, y, glyph, bkglyph, *glyphmod)
            -- Print the glyph at (x,y) on the given window.  Glyphs are
               integers at the interface, mapped to whatever the window-
               port wants (symbol, font, color, attributes, ...there's
               a 1-1 map between glyphs and distinct things on the map).
            -- bkglyph is a background glyph for potential use by some
               graphical or tiled environments to allow the depiction
               to fall against a background consistent with the grid
               around x,y. If bkglyph is NO_GLYPH, then the parameter
               should be ignored (do nothing with it).
                -- glyphmod provides extended information about the glyph
               that window ports can use to enhance the display in
               various ways.
                    unsigned int glyphmod[NUM_GLYPHMOD]
               where:
                    glyphmod[GM_TTYCHAR]  is the text characters associated
                                          with the original NetHack display.

                    glyphmod[GM_FLAGS]    are the special flags that denote
                                          additional information that window
                                          ports can use.

                    glyphmod[GM_COLOR] is the text character
                                       color associated with the original
                                       NetHack display.

Support for including the glyphmod info in the display glyph buffer
alongside the glyph itself was added and is the default operation.
That can be turned off by defining UNBUFFERED_GLYPHMOD at compile time.
With UNBUFFERED_GLYPHMOD operation, a call will be placed to map_glyphmod()
immediately prior to every print_glyph() call.
2020-12-26 11:23:23 -05:00
nhmall
8c42d306f7 purge trampoli.h 2020-12-13 10:27:49 -05:00
nhmall
affb60dd97 support for build with current Lua version 5.4.2
This may require
    	make spotless
    	make fetch-lua
for some platforms.
2020-12-11 09:20:26 -05:00
PatR
f8fcab3400 move 'g.restoring' to 'g.program_state.restoring'
Move the core's global restoring flag (not the same as main()'s
local resuming flag) to a more logical place.  Add a saving flag
in the process, but it isn't being set or cleared anywhere yet.
(Once in use it will probably fix the exception during save that
was just reported, but before that it would be useful to figure
out what specifically caused the event.)

The program_state struct really ought to be standalone rather
than part of struct g but I haven't made that change.

Removing an unused variable for wishing and some reformatting
that whent along with it got mixed in.  Removes some trailing
whitespace in sfstruct.c too.

Only lightly tested...
2020-11-30 11:40:21 -08:00
nhmall
cb5bda40e2 update an old msdos file 2020-11-25 07:53:24 -05:00
nhmall
9ea45d7a1f remove some trailing whitespace 2020-11-25 07:23:23 -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
945d10cfbc cross-compile update
Update the cross-compiling doc at the top.

Remove sys/msdos/Makefile1.cross, sys/msdos/Makefile2.cross, and
sys/msdos/msdos-cross-compile.sh as they are no longer required.

Remove occurrences of CROSSCOMPILE_HOST as the host-side of a
cross-compile can be determined from:
    defined(CROSSCOMPILE) && !defined(CROSSCOMPILE_TARGET)
without the additional macro.
2020-09-29 15:01:37 -04:00
nhmall
14b532bf10 add cross-compile recipe for msdos
- If you want to obtain the djgpp cross-compiler and tools/libs for MSDOS,
which is available for linux and macOS, you can use the following script
to obtain it:

       sh sys/msdos/fetch-cross-compiler.sh

That script won't install anything, it is just file fetches. It will
store the cross-compiler in subfolders of lib and the hints files are
configured to find it appropriately there.

Note: Both the fetch and the msdos cross-compile package target require
unzip and zip to be available on your host build system.

Cross-compiler bits:
       https://github.com/andrewwutw/build-djgpp
   and the pre-built binary for your platform from:
       https://github.com/andrewwutw/build-djgpp/releases/download/v3.0/
   and a DOS-extender (for including in msdos packaging) from
       http://sandmann.dotster.com/cwsdpmi/csdpmi7b.zip
   and pdcurses from:
       https://github.com/wmcbrine/PDCurses.git

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

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

You can explicitly include tty and curses support if desired, otherwise
you'll end up with a tty-only cross-compile build:
       make WANT_WIN_TTY=1 WANT_WIN_CURSES=1 CROSS_TO_MSDOS=1 all

Also note that building the msdos targets using the make command
above, does not preclude you from building local linux or macOS
targets as well. Just drop the CROSS_TO_MSDOS=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.
2020-09-28 16:28:15 -04:00
nhmall
14d55c5bdb make sys/msdos/msdos-cross-compile.sh build msdos NetHack entirely
- should work on linux or MacOS to build an msdos zipfile distribution
- no longer requires env variables be set ahead of it because it will set some
  defaults within
- you must have zip and unzip on your system though
- you have to "make fetch-lua" first if you haven't already done that
- script takes care of obtaining the djgpp-cross-compiler etc, then
  uses it to build msdos NetHack
- to clean and rebuild from scratch:
  make -f sys/msdos/Makefile1.cross clean
2020-08-14 18:23:31 -04:00
nhmall
83f8da2a17 msdos cross-compile djggp build now with gcc 10
Also updates the travis build to Ubuntu focal because of an
ar libfl.so.2 shared library load error on xenial that was
easier to just get away from by moving to focal.
2020-08-14 17:25:05 -04:00
nhmall
7a1952eadd more file header "NetHack 3.6" to "NetHack 3.7" 2020-08-03 22:41:35 -04:00
nhmall
ac9ba38449 file header bump from "NetHack 3.6" to "NetHack 3.7" 2020-08-03 22:07:36 -04:00
nhmall
a3bfb599ca more Makefile maintenance for Windows, msdos 2020-07-18 10:31:34 -04:00
nhmall
aa69f6be04 mirror the recent make depends update in some other Makefiles 2020-07-18 09:53:30 -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
nhmall
0fed5a06db Cross-compiling, msdos Makefile 2020-05-30 08:41:20 -04:00
nhmall
a6d84209bf msdos Makefile bit
still untested
2020-05-10 12:16:37 -04:00
nhmall
285fc69da0 Makefile updates for windows, msdos
The msdos Makefile changes are untested.
2020-05-10 12:11:17 -04:00
nhmall
390a531f16 relocate the real mode msdos code to outdated/sys/msdos 2020-05-10 11:46:07 -04:00
nhmall
cdf280628c split symbols bits from drawing.c; new file src/symbols.c 2020-05-06 10:55:54 -04:00
nhmall
f1d7676bfb more CROSSCOMPILE fixes 2020-05-05 14:04:29 -04:00
nhmall
aa5eb5a355 yet another host-side crosscompile fix
The host build portion using sys/msdos/Makefile1.cross) was failing because it
was attempting to compile the generated tile.o which is using hack.h.

gcc  -o../util/tilemap host_o/tilemap.o
A new ../src/tile.c has been created
gcc -c -O -I../include -I../sys/msdos -DDLB  -DUSE_TILES -DCROSSCOMPILE -DCROSSCOMPILE_HOST -ohost_o/tile.o ../src/tile.c
In file included from ../include/hack.h:201:0,
                 from ../src/tile.c:3:
../include/dungeon.h:70:5: error: unknown type name ‘lua_State’
     lua_State *themelua;   /* themerms compiled lua */
     ^
../sys/msdos/Makefile1.cross:286: recipe for target 'host_o/tile.o' failed
make: *** [host_o/tile.o] Error 1

I don't think think the tile.o is required on the host build build portion,
so it is probably an error in the Makefile. Try removing it.
2020-05-03 21:22:55 -04:00
nhmall
0f27a8e71d fix copy-and-paste error 2020-02-03 03:54:14 -05:00
nhmall
816e2285ea add recent file addition to msdos Makefile2.cross 2020-02-03 03:51:30 -05:00
Ray Chason
1fb1967e42 Enable statue glyphs for cross compile 2020-02-01 16:48:37 -05:00
nhmall
e39ec5ce3e rename new header file to fnamesiz.h
Changes to be committed:
renamed:    include/filesize.h -> include/fnamesiz.h
2020-01-29 09:56:43 -05:00
nhmall
209fab138b recover fix
recover had deviated somewhat from NetHack in its
file expectations:
1) A couple of 3.7 fields needed to be accommodated.
2) hard-coded file size values had deviated.

The file sizes are now in an added header file named "filesize.h",
which is included at the bottom of config.h.

There will likely be another commit to write the filename size ahead
of the file name so that the precise number of characters can be read,
but since that will break existing saves, it can go in along with another
save-breaking commit.

This commit doesn't not alter savefiles written by nethack so does not
require an editlevel bump. It does alter the read-in expectation in
recover to match the game and this get recover working again.
2020-01-29 09:15:55 -05:00
nhmall
f4d100ea5f Merge branch 'NetHack-3.7-Jan2020' into NetHack-3.7 2020-01-27 13:24:15 -05:00
Pasi Kallinen
0500f54742 Use nh_getenv just in case 2020-01-27 18:03:42 +02:00
nhmall
033894d784 Merge branch 'NetHack-3.7' into NetHack-3.7-Jan2020 2020-01-27 08:52:17 -05:00
Ray Chason
b52392a5bc Make background appear as a proper black 2020-01-27 09:54:59 +02:00
Ray Chason
b296196a4a Scale the font for large resolutions 2020-01-27 09:54:58 +02:00
Ray Chason
82a219c227 Lift restrictions on tilesets
Support full color tilesets with tiles of arbitrary size.
2020-01-27 09:54:58 +02:00
Ray Chason
aa3303cafc More bits for linear frame buffer 2020-01-27 09:54:58 +02:00
Ray Chason
8d9f31e91f Support the linear frame buffer if available
If the linear frame buffer is in use, the entire frame buffer is
visible all at once, and no calls to the window function are needed.
2020-01-27 09:54:58 +02:00
Ray Chason
ab6424b31c Call the window function directly if supported
Some BIOSes allow calling the window function directly, bypassing the
logic that distinguishes this call from other BIOS calls. Should be
faster on some systems.
2020-01-27 09:54:58 +02:00
Ray Chason
c0d1c4efb7 Use 8 bit mode if available
This was not previously done because the palette was not correctly set
up, and QEMU gave incorrect colors. The palette setup function now
falls back to the standard BIOS function if the VESA BIOS function
fails, which resolves the issue with QEMU. The mode selection logic now
favors 8 bit color if the tile set is compatible.

Using 8 bit mode means fewer writes to memory and fewer uses of the
BIOS window function.
2020-01-27 09:54:58 +02:00
nhmall
97b74e6f7b Merge branch 'NetHack-3.7' into NetHack-3.7-Jan2020 2020-01-24 17:27:48 -05:00
nhmall
57e0e30d10 travis-ci bits: try to avoid failure-flagging on transient connectivity issues
Attempt to test whether Lua fetch succeeded (and pdcurses for windows
and msdos as well)

If those prerequisite fetches and untars didn't work, just exit without
marking the travis-ci build as a failure so that the development team
isn't notified about something transient that they don't need to fix
in the code.
2020-01-20 11:10:16 -05:00
nhmall
d5174323eb Merge 'NetHack-3.6' updates into NetHack-3.7-Jan2020 2020-01-14 22:09:29 -05:00
nhmall
a6c46bbd85 housekeeping items for 3.6.5 - first pass 2020-01-14 11:35:06 -05:00
nhmall
4e904d01e8 msdos cross-compile bits 2019-12-27 12:13:41 -05:00
Ray Chason
6f9e7b6b97 Fixes to build NetHack 3.7.0 on FreeDOS 2019-12-23 18:03:26 -05:00
nhmall
17feb01d8f Merge branch 'NetHack-3.6' 2019-12-17 14:39:15 -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