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.
Mostly the warnings were about QString::sprintf and QFontMetrics::width.
sprintf replacement is asprintf, which annoyingly behaves differently
from sprintf - it seems to append to the string.
Not thoroughly tested, but seems to work.
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).
Terminals supporting more than 8 colors can directly display the bright
colors (upper 8 colors of the 16 color palette).
The tty port now only uses bold for displaying bright colors as a fallback to
previous behavior for terminals with 8 colors.
Different color for stairs that go to another dungeon branch.
Adds four new glyphs, S_br{up,dn}{stair,ladder}, which use the
same character as normal stairs/ladders, but yellow color.
In tiles, the up/down arrow is yellow-green instead of while-blue.
This feature has been around a lot and is in several different
variants, but this is implemented from scratch so tiles work too.
Add two new monsters and two new objects:
gold dragon
baby gold dragon
gold dragon scale mail
set of gold dragon scales
A couple of variants seem to have added these already, but this came
off my ancient list of monsters to add and was done from scratch.
It's a clone of silver dragon, but instead of having reflection and
breathing cold, a gold dragon emits light and breathes fire; because
of the latter it can be seen with infravision like a red dragon.
Adult gold dragons are lawful as in the AD&D Monster Manual rather
than chaotic as the wiki pages show for the variant versions.
Worn gold dragon scales operate similar to wielded Sunsword: when
blessed, radius is 3 (same as a lamp), if uncursed, radius is 2, and
if cursed, radius is 1 (but functions as 2 when worn by the hero,
otherwise there would be no tangible effect). Gold dragon scale mail
gets an extra +1, making blessed gold DSM have a bigger radius than
lamps. Embedded scales have radius 1 regardless of BUC state; light
for that case comes from the gold dragon monster form the hero is in.
When not worn, gold scales and scale-mail don't emit any light.
The tiles use a mix of yellow (for gold) and red. The two object
tiles seem reasonable variations of the corresponding silver dragon
ones. The two monster tiles definitely need work since the silver
ones were mostly cyan and changing that to red did not produce very
good result; subsequent attempt at a mixture was haphazard at best.
This didn't crash since xputs is defensive and checks if it got a NULL
string, but it also didn't display black entries (dragons, unicorns,
orcish arrows, ...) as black or otherwise different from gray entries.
The earlier warning is architecture-dependent.
The warning showed up under an x64 build, but not an x86 build.
The __unaligned keyword is not supported under an x86 build.
Refine the preprocessor conditional.
Have curses call the core get_count() routine instead rolling its
own so that backspace and delete are supported. That part was
trivial to accomplish. Unfortunately it brought the disappearing
menu phenomenon back so it became more complicated overall.
This fixes the disappearing menu, but not curses menu count entry
failing to honor backspace/delete. Entering two or more digits
to get a "Count:12" message, followed by non-digit which removes
that, resulted in the menu for apply/loot in-out container operation
vanishing while it was still waiting for a choice. (Typing a choice
blindly did work.)
The code intended to handle this. I don't understand why refresh()
wasn't working. Reordering stuff didn't help until I changed that
from refresh() to wrefresh(win).
The original Count:123 display was limited to 25 characters and
menus to half the main window, so they didn't overlap. I made the
count display wider--because it is now also used for 'autodescribe'
feedback when moving the cursor around the map--so made something
that originally was impossible become possible. One line of the
menu does get erased while "Count:" is displayed, but then gets put
back by the wrefresh().
On terminals with at least 16 colors there should be no need for special
handling dark gray.
The curses code uses COLORS < 16, COLORS <= 16, COLORS > 16, or COLORS >= 16
at several places although I'm not sure if they are correct or which could
possibly be off-by-one errors.
But realistically in this case, we only need to distinguish between 8 color
terminals and terminals supporting more than 8 colors as this will mean the
terminal supports at least 256 colors.
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.
On some platforms this may require:
make spotless
make fetch-lua
I did attempt to force a reminder message about the latter to
Makefile.top this time, and hope that works correctly for everyone.
Implementation of '|'/#perminv command for scrolling perm_invent
deliberately disabled menu_headings (video attribute for object
class separator lines) on the persistent inventory window under
curses. I don't recall why (possibly because it isn't actually
a menu) but there's no compelling need to do that, so reinstate
heading attributes.
Fixes#499
When Qt's extended command selection dialog is set for all commands
or all normal mode commands, it displays the "#wait" command as
"wait (rest)". Picking by mouse is straightforward; the extra text
on the button has no effect. Picking by typing "#wa" will choose it;
there aren't any other choices matching that so the player never gets
as far as typing 'i'. This change allows the player to type "#rest"
as an alternate way to choose it. "#re" matches some other stuff
and the choice is left pending, adding 's' makes it unique but not
explicitly chosen (so still possible to back up), then adding 't'
chooses it. The core never knows the difference.
Simplify extended command selection under Qt by allowing the
autocomplete subset be one of the choices for its [filter]. That's
the same subset as X11 uses, where #q is unambiguous for #quit
instead of competing with #quaff and #quiver.
Unlike under X11, the player can use [filter] to switch to the full
command set and get access to a few commands which have no useable
key and aren't flagged to autocomplete. (Mostly obscure wizard mode
commands but #exploremode is in that situation.)
In normal and explore modes, the [filter] button just toggles between
two sets of commands (all normal mode commands vs autocomplete normal
mode commands). In wizard mode there are four choices and you might
need to click on [filter] up to three times to step through to the
target one among four sets (all commands, all normal mode commands,
autocomplete commands for both normal and wizard, full subset of just
the wizard mode commands).
For Qt, always render text windows with fixed width font instead
of switching from proportional to fixed when the text contains
any line(s) with four consecutive spaces. That was really meant
for menu lines without selector letters which want to be lined
up under or over ones with such, and wasn't a very good heuristic
for text windows.
Most of the text files for the '?' command happen to have such
lines so are already being shown with fixed-width font. data.base
entries were hit or miss; most have attribution lines indented by
four or more spaces but some don't, so display was inconsistent:
some were shown with fixed-width font and some with proportional.
Change the '|'/#perminv final positioning for X11 to be the same
as for curses: finishing with <escape> leaves the current view,
with <return> resets to unscrolled.
Actually getting ESC and RET to the right place wasn't trivial;
down the rabbit hole and out the other side. Using yn_function()
to get the #perminv keystrokes is less than ideal. (curses also
started that way but switched to raw character input for this.)
Stripping article ("a ", "an ", "the ") off inventory items to
squeeze a little more info into truncated persistent inventory
was initially case insensitve. That was removed because it isn't
needed but the comment still reflected it.
Add new '|' command, aka #perminv, which allows the player to
send menu scrolling keystrokes to the persistent inventory window.
Implemented for X11, where its usefulness is limited, and for
curses, where it is more needed and also more fully functional.
The interface can either prompt for one keystroke, act upon it,
and return to normal play, or it can loop for multiple keystrokes
until player types <return> or <escape>. X11 does the former if
the 'slow' application resource is False so that prompting uses
popups, and the latter when 'slow' is True where prompting is in
a fixed spot and doesn't end up causing the persistent inventory
window to be stacked behind the map window. curses always does
the loop-until-done approach. It also accepts up and down arrow
keys to scroll one line at a time.
Also adds two new menu scrolling commands, menu_shift_right (key
'}' by default) and menu_shift_left ('{') if wincap2 flags contain
WC2_MENU_SHIFT. Shifting allows different substrings of too-long
lines to be seen.
For X11, neither works because their handling requires a horizontal
scrollbar and for some reason that escapes me our menus don't have
one of those. If they did, shifts could work for all menus but a
shifted window would hide the selection letters. So shifting would
be most usefully done as: pan right, read more of any long lines,
immediately pan back to the left.
For curses, they only apply to the persistent inventory window.
Shift right redraws it with class headers and inventory letters
shown normally but the item descriptions omit their leftmost
portion, showing more text towards the end. Shift left reverses
that and does nothing if the beginning is already in view. Forward
and backward scrolling while shifted leave the shift in place.
Give the window-port side of *_update_inventory() an argument.
Calls in the core still omit that; invent.c's update_inventory()
is the only place that cares.
Looking up scrollbars did not work as intended. The code wanted an
ancestor widget that had both horizontal and vertical scrollbars,
but menus either have none or just vertical. The lookup code found
some top level widget and returned bad data.
When panictrace feedback occurs due to catching a signal rather
than controlled panic, the backtrace is useless when running the
curses interface unless the terminal gets reset first. Let's
just hope that the signal triggering a panictrace doesn't occur
while resetting the terminal.
In a couple of places, call menu_popdown instead of duplicating
its contents. I'm fairly sure that executing the is_active bit
that the duplications omitted is safe.
Several minor formatting bits are mixed in.
Widget widths should have type 'Dimension' rather than plain 'int'.
Perform a couple of things once during popup widget creation rather
than every time it gets popped up.
When X11_yn_function() re-uses a popup widget to issue a prompt
and get the player's response, make it resize properly. I'm not
sure why the old hack for that apparently worked for some folks
and not for me, or why this does work for me. At least it does.
Also, make the minimum popup width be 25 characters so that
really short prompts don't result in tiny popups. Since the
popup appears at whatever spot the pointer happens to be sitting,
it isn't always immediately noticeable when the player is using
the keyboard rather than the pointer.
X11_getlin() echoing its prompt and response to message window
truncates combined value to maximum allowed pline (rather than
having pline truncate it). But it was truncating the response
as if the prompt was maximum allowed length instead of its actual
length, so possibly hiding some of the user's text unnecessarily.
After player has responded to a getline prompt, echo the prompt
and the line of text response to the message window. Uses pline()
so also gets put into core's message history for dumplog.
More issues. The incorrectly rendered map after panning is one
I haven't seen before. Normally I only have a clipped map if I
force double size tiles rather and hadn't noticed this behavior
for that case, so manually resizing--and/or the scrollbars which
get added when that occurs--may be what triggers it.
X11_yn_function() issues a pline() to put the prompt and player's
response into the message window. Change it to use visctrl() to
make sure that the response character is ledgible when something
like the '&' command allows an arbitrary answer.
This patch adds a leading space and two extra trailing spaces
to the prompt when it's being issued via popup, but that hasn't
affected the issue mentioned next....
The popup prompting when the 'slow' resource is False doesn't
always resize properly. I saw both too wide and too narrow
[What do you want to throw? [abc] ]b
[ In what direction? ]
and
[Really quit? [yn] (n) ]y
[Dump core? [ynq] (q) ]n (size seemed right, but hard to tell)
[Do you want your posses] (might have shown one more letter;
resize doodad in window's bottom right
corner on OSX oscures the rightmost
column--which is ordinarily a space)
The truncated one did accept responses. If I answered 'n' then
the next question was truncated too, but for 'y' (plus ensuing
feedback) it would be sized correctly for the question after that.
To be clear: the popup width issue was present before this change
and is still present after it. The code already has a hack that's
intended to deal with this but it doesn't do the job for me.
If 'perm_invent' is preset in player's options, have X11 show the
persistent inventory window from the start instead of waiting for
an 'i' command. moveloop() prolog needed a tweak do deal with it
cleanly.
Require WC_PERM_INVENT in order to honor the perm_invent option.
X11 and curses already set that, tty and curses don't support it,
so only Windows GUI needed to be updated for it.