Commit Graph

1702 Commits

Author SHA1 Message Date
PatR
524f9dd82b Qt map's "ttychar"
Change the glyphttychar[ROWNO][COLNO] array from uchar to
unsighed short.  DrawWalls() has handling for values in over 2000.

This also reformats pretty much all of the NetHackQtMapViewport
portion of qt_map.cpp.
2020-12-28 10:01:43 -08:00
nhmall
c31047984b typo in tilemap.c update 2020-12-28 09:19:07 -05:00
nhmall
30fe65b5e0 fix tilemap.c compile when STATUES_LOOK_LIKE_MONSTERS wasn't defined 2020-12-28 09:14:39 -05:00
nhmall
19583adca9 another extraneous file 2020-12-27 21:31:31 -05:00
nhmall
51e5e9c998 extraneous file 2020-12-27 21:28:50 -05:00
nhmall
aad56ab5d8 Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2020-12-27 21:22:48 -05:00
nhmall
881eccca9e some tile processing fix-ups.
Some of the new colors added to some monster tiles did not
have gray scale mappings. This fixes the processing by
mapping them to *something*, but optimal gray scale mappings
for the new colors will require follow-up evaluation at some
point.
2020-12-27 21:20:44 -05:00
PatR
953f0652c4 reformat Qt/qt_clust.cpp 2020-12-27 17:01:33 -08:00
nhmall
86141b3196 Merge branch 'feature/gendered-tiles' of https://github.com/NullCGT/NetHack into NullCGT-feature/gendered-tiles 2020-12-27 17:50:29 -05:00
PatR
6499fc4dd9 some code cleanup, mostly Qt map
The Qt routine NetHackQtMapViewport::Clear() was broken, but
fixing it hasn't changed the glyph display issue.  None of the
other changes here would be expected to affect that but they
are in/among the sections of code under investigation.
2020-12-27 12:33:03 -08:00
Kestrel
5d0c1a94f4 More monster gender tiles additions. 2020-12-27 13:01:27 -06:00
nhmall
ea1ffe5112 tty unused parameter under some configs 2020-12-27 12:51:40 -05:00
Kestrel
f83b3e038a Differentiate male and female ant tiles.
Female ants are larger than male ants. I could have added wings to the male ants, but I felt that doing so would lead to a loss in visual clarity.
2020-12-27 10:56:30 -06:00
nhmall
fd13f2a2f2 monster gender-related follow-ups
remove unintentionally left M2_MALE flag on dwarf lord/lady/leader

provide a way to verify gender information relayed from the core
in debug mode on tty via #wizmgender debugging extended command
2020-12-27 10:45:13 -05:00
PatR
8ccb5985d4 curses comment bit
Don't require c99, even in code that's suppressed via #if 0.
2020-12-27 05:09:44 -08:00
nhmall
ec889df4d3 another follow-up bit - punctuation consistency
an uppercase entry was left in the monsters.txt tile file, but
changed elsewhere
2020-12-26 19:21:37 -05:00
nhmall
772e876e44 incorporate some pmnames feedback
Also an update to a fixes37.0 entry
2020-12-26 19:07:19 -05:00
nhmall
a7c63f8abc switch curses port to use the new tty_print_glyph argument 2020-12-26 18:35:09 -05:00
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
PatR
0ec355bdb4 fix github issue #426 - binding special commands
Binding 'repeat' (DOAGAIN, or redo) to a different key than ^A
didn't work as intended because the code that used it was
checking for DOAGAIN (a key value from config.h) instead of
g.Cmd.spkeys[NHKF_DOAGAIN] (the key currently bound to repeat).

Contrary to the github issue, re-bound prefix keys worked ok for
me if followed by a direction.  However, they behaved strangely
if followed by anything else.  If the keystroke was stolen from
some other command and that command hadn't been bound to another
key, following the prefix with a non-direction could end up
executing the command that used to own the key.  For example,
 BIND=d:nopickup
to use 'd' to move without auto-pickup would work if you used
d<direction> but if you used d<something-else> if would execute
the drop command.

The NHKF_REQMENU prefix could be bound to some key other than
'm' but it only worked as intended if the new key was a movement
prefix.

This also makes DOAGAIN be unconditional.  If it is deleted or
commented out in config.h, the default binding will be '\000' so
unusable (freeing up ^A for something), but still be available
to be bound to some key (perhaps even ^A).

This also includes an unrelated change to mdlib.c.  The comments
added to config.h will force a full rebuild.  Changing mdlib.c
now rather than separately will avoid forcing that twice.

Fixes #426
2020-12-25 13:57:05 -08:00
PatR
1a2afd21d4 tty: winch_handler vs NO_SIGNAL
While testing something unrelated, I built with NO_SIGNAL
defined and winch_handler() caused an unused function warning.
2020-12-24 17:53:57 -08:00
nhmall
fe3eb92411 win32: avoid game exit dialog lacking any explanation 2020-12-23 20:31:54 -05:00
PatR
3922bbf666 remove a solved item from Qt-issues.txt 2020-12-23 08:26:54 -08:00
PatR
934808be0e Qt support for changing 'statuslines' dynamically
Turns out it was nearly as simple as I originally thought.
I just missed one significant detail the first time around.
This leaves DYNAMIC_STATUSLINES as conditionl but now enables
it by default.  Using 'O' to change 'statuslines' from 2 to 3
or vice versa now works for Qt as well as for curses and tty.
2020-12-22 11:10:32 -08:00
PatR
ee9fa9ebe3 Qt text window search
Fix the strangeness where typing ':' in a menu window initiated
the menu search operation but typing ':' in a text window saw
the shift key be pressed but not the ';' that went with it, even
though they both called the same key decoding routine.  That made
typing ':' to initiate text search be impossible.  Menu windows
did more input focus manipulation in their constructor.  Mimicking
that in text windows fixes the problem with keys not being seen by
the text window's keystroke handler.
2020-12-17 13:55:10 -08:00
PatR
496777384b Qt paper doll bit
Override the 'implicit_uncursed' option when formatting an item
of equipment for its paper doll tool tip.  Each tile is outlined
in yellow if known to be uncursed; force "uncursed" in the tool
tip text for the same situation.

Also add or revise some comments.
2020-12-14 12:32:43 -08:00
PatR
d4313ff828 Qt 'game' menu tweak for OSX
Change "_Quit-without-saving" in the Game dropdown menu to be
"\177Quit-without-saving".  That makes the prefix used on OSX to
prevent matching "^[&]?[Qq][Uu][Ii][Tt].*" be invisible.

Also change the order of the choices for the command+Q and
application dropdown menu entry "quit nethack" so that "cancel
and return to game" is the default for arbitrary response to the
confirmation prompt.  <return> and <space> select "quit without
saving".  Note that the nethack dropdown menu is OSX-specific
(a Qt feature to emulate other OSX applications) and its
nethack->Quit action is separate-from/in-addition-to Game->Quit
menu action mentioned above (which runs nethack's #quit command).
2020-12-14 02:11:53 -08:00
PatR
04724fc5a0 Qt: remove "Search [______]" from Help menu
Prevent Qt from inserting an extra entry in the Help dropdown
menu displayed in the menu bar across the top of the screen
when nethack has focus.  "Search [______]" lets the user enter
a string to search for but doesn't give nethack any control
over that so we can't have it.

I haven't found a sane way to get rid of it.  The insane way
of not naming any menu "Help" works.  This uses "\177Help" so
that it still looks like "Help" but won't match that string.
2020-12-13 13:45:04 -08:00
nhmall
8c42d306f7 purge trampoli.h 2020-12-13 10:27:49 -05:00
nhmall
d008d6c995 use .Substring to limit maintenance to major Lua version releases only 2020-12-11 22:35:37 -05:00
Bart House
fe874db0b3 Fix Windows build break caused by bump to lua 5.4.2.
Modified Windows build to use submodules/lua for lua source.
2020-12-11 18:45:44 -08:00
PatR
5b709fcb55 Qt text search crash fix
About 5 weeks ago, commit e4106bb161
changed Qt's searching in text windows to be able to find a match
on the very first line.  It assumed that the first line would be
the current line except when repeating the same search after a
match.  But after a failed search the current line index is -1 and
starting a new search would crash trying to look that line up.
2020-12-11 18:11:27 -08:00
nhmall
cb84c555d7 more Lua 5.4.2 bits 2020-12-11 09:25:01 -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
123b6c38a6 Qt extended commands: menu teardown and rebuild
Change qt_get_ext_cmd() to handle calling the extended command
selection menu again after player clicks on Filter/Layout/Reset
instead of relying on the core to do that.  (In order to change
the menu, instead of attempting to reconfigure that on the fly
it returns to caller and then puts up a new menu with different
settings when called back.  Initial checkin relied on the core
for the call back; this maintains full control for that within
the Qt interface code.)
2020-12-07 01:05:37 -08:00
PatR
197d8130d0 Qt extended commands enhancement
For Qt's pick-an-exetended-command dialog, allow a player to
toggle the grid layout from column-oriented to row-oriented
and vice versa and when in wizard mode to cycle the set of
shown (and typable) commands from 'all' to 'normal mode-only'
to 'wizard mode-only' back to 'all'.  The most recent values
are saved by Qt along with tile size, font size, and some other
stuff.  The extended command dialog has a Reset button to force
them (the two extended command values) back to their defaults.

The dialog layout has a slight change to conserve screen space
as well as three additional control buttons:
Was                                  Now
| [             Cancel            ]  | [Cancel] [Filter][Layout][Reset ]
|#                                   |#            Grid Title
|             Grid title             | [cmd 1] [cmd R+1] [cmd 2*R+1] ...
| [cmd 1] [cmd R+1] [cmd 2*R+1] ...  | [cmd 2] [cmd R+2]
| [cmd 2] [cmd R+2]                  |...
|...                                 | [cmd R] [cmd 2*R]
| [cmd R] [cmd 2*R]
'#' is the prompt where typed text gets echoed and 'R' is the
number of rows in the grid and varies by the set of commands
from the current filter.  Grid dimensions have been adjusted:
'all' is 13x9, 'normal' is 13x7, and 'wizard' is 7x4 or 4x7
depending on layout orientation.

The wizard mode-only filter setting probably isn't very useful
because you can only type--or click on--commands which are
visible.  So when set to wizard mode-only, you can't #quit for
instance.  (Via extended command; there are still menu choices
for that particular action.  And it's trivial to change filter.)
2020-12-06 02:58:05 -08:00
PatR
6bfd1c7e62 Qt's window menus
Qt on OSX is inserting "Search [_____]" as the first entry in
the Help dropdown menu (the one in the toolbar at the top of the
desttop).  While trying--and failing--to figure out how to get
rid of that, I cleaned up a little bit of the old menu hackery
(that tries to workaround the fact that Qt on OSX insists that
some menu actions--based solely on their names--should go into
the appication menu rather than whichever menu the program is
trying to insert them into).  The only observeable difference
is that 'About NetHack-Qt' will be at the top (actually second
because of that Search one) of the Help dropdown, where it is on
non-OSX builds, rather than last.

This tries to make the program name consistent too, changing
several instances of "Qt NetHack" to be "NetHack-Qt".  The latter
is the name being set up as ApplicationName in qt_bind.cpp that
gets used when Qt stashes the Qt-specific settings wherever it
stashes them.

It also makes another tweak in formatting of 'About NetHack-Qt',
inserting one explicit line break to avoid some poor looking line
wrapping.  I still haven't figured out how to control that popup's
size.
2020-12-05 19:37:03 -08:00
PatR
3e7283e8fd Qt fix for typing "#version"
The #version command is a leading substring of the #versionshort
command and for Qt, it couldn't be executed by typing, only via
mouse click or one of the Qt-specific menus.  #version<return>
or #version<space> now works for that.

The #versionshort command ought to be renamed to something else.
2020-12-02 16:11:53 -08:00
Bart House
1360e63644 Fix build issue when building project for the first time. 2020-12-01 21:32:52 -08:00
PatR
de8337f402 Qt extended commands
When responding to '#', the Qt interface puts up a grid of buttons
labelled with the names of commands.  Then if the user types
instead of clicking on a button, buttons which can no longer match
are removed rather than grayed out.  The remaining ones keep their
same relative positions.  Once whole rows or whole columns were
gone, it looked awful.  With rows gone, the size of the grid
shrank but the popup stayed the same size, so the one-line prompt
area expanded to fill up the vacated vertical space.  That caused
the prompt and partial response to move as they stayed centered in
their growing area.  With columns gone, the width of the buttons
in remaining columns expanded and they spread out to take up
vacated horizontal space.  Once the candidate commands were all
in one column, the buttons spanned the width of the grid.  (That's
mostly my fault due to changing the grid from being row-oriented
[a b c]
[d e  ]
to column oriented
[a d]
[b e]
[c  ]
which resulted in columns going away a lot faster and possibly down
to one when the old layout always had at least two.  But old layout
could drop to one row; the current layout always has at least two.)

Also, accept ^[ as ESC.  Typing ESC when partial input is present
kills that input but keeps prompting.  Typing ESC when no input
is present (none entered yet or a second of two consecutive ESCs)
cancels the operation.

Allow ^U to kill partial input.  If used when no input is present,
nothing happens, similar to backspace.  Unlike tty and curses, it's
hardcoded here.  That shouldn't be a problem because ESC can be
used as a substitute if ^U isn't what the player normally uses.
2020-11-30 03:18:45 -08:00
PatR
69dd0485fb Qt message window: horizontal scrolling
Multiple stints of flailing about without a clue finally led to
a breakthrough.  When writing a new message to the multi-line
message window, force the view back to showing the starts of
lines if player has scrolled it to the side and left it that way.
Put another way, if it has been scrolled to the right, scroll it
as far as possible back to the left.
2020-11-29 16:58:56 -08:00
nhmall
0d6481ad8c spelling correction tidbit
Closes #415
2020-11-28 08:59:03 -05:00
PatR
018d838eb9 today's Qt status update: non-standard conditions
Qt's status highlighting was treating any change to hunger or
to encumbrance as "worse" (shown in red).  That's wrong if you
go from weak to just hungry or from stressed to encumbered.

Comparing satiated with other hunger states is tricky.  I've
ranked it between hungry and weak but that's fairly arbitrary.

Also, change the highlighting when Lev, Fly, and Ride are new
conditions from red to blue.
2020-11-24 09:45:55 -08:00
PatR
43379bffcc Qt status: highlights when toggling 'showexp'
During status update at the time the 'showexp' option gets toggled
on or off, prevent comparing Xp (level) against Exp (points) when
deciding whether the value has gone up or down.  Xp/Exp (when
toggling on) or just Xp (when toggling off) will be highligthed in
blue (changed, neither better nor worse) rather than green or red.
2020-11-23 17:45:44 -08:00
PatR
0c56c06316 Qt font selection dropdown menu
In "Qt settings" (or "Preferences" for OSX), the current font size
would show "Medium" if that was the current setting.  So far, so
good.  However, if you clicked on the up/down arrows to get the
dropdown menu, it was truncated to "Mediu" there regardless of
current setting.  Force the menu to be wide enough to show "Medium".
2020-11-23 17:39:00 -08:00
PatR
479bb87766 Qt status again: unhighlight disabled fields
If 'showscore' has been On and gets toggled Off while Score is
highlighted, remove that highlight immediately instead of letting
it stick around a few turns until it times out.
2020-11-23 01:29:53 -08:00
PatR
3339d0247f Qt paperdoll bit
For the tool tips shown if you let the mouse pointer hover over
any of the cells in the paperdoll (inventory subset showing
worn and wielded items), remove the trailing period and add a
leading space and a trailing space.  Improves readability.
2020-11-22 02:36:10 -08:00
PatR
6d4fd933b2 Qt status bit
When Qt highlights a field that has gotten better, use the same
shade of green as is used for the green range of hitpoint bar.
The old value was too dull, like olive green seen in shadow.
2020-11-22 01:10:52 -08:00
PatR
efea46a93d tty: selecting gold in menus
Requested by a beta tester nearly four years ago: '$' is both an
inventory "letter" and a group accelator.  The letter only works
if gold is on the current menu page and was taking precedence
over the group accelator.  Allow '$' to toggle selection of gold
regardless of the page.

curses already behaves this way.  X11 and Qt menus aren't
paginated so also pick gold even if the '$' entry in the menu
isn't visible at the time.  No idea about Windows GUI...
2020-11-21 18:21:16 -08:00
PatR
f7a3e7884c daily Qt status window update...
Highlight changes to dungeon location or alignment in blue instead
of green or red since neither the old value nor the new can be
classified as better than the other.  Likewise when changing
between regular Hp and Xp (or Xp/Exp) to or from you-as-mon Hp and
HD when polymorph or rehumanization takes place.

When toggling Score On, start out highlighted in blue instead of
green.  When toggling it Off, don't highlight the blank space
where it had been in red.  At the moment there's a quirk here;
if it is highlighted in green (from recent change) or blue (from
having just been toggled on) at the time it gets toggled off, the
space stays green or blue until that highlight times out.  (It has
occurred to me that the bogus red highlight might have been added
to deliberately overwrite stale green highlights.  If so, a better
fix should be achievable.)

For the title (plname and rank or plname and monster-species),
capitalize the player name since core's botl() and at least some
other interfaces do that.

TODO:  toggling Exp needs work.  The field used for deciding
up/down changes gets swapped and the update in progress compares
apples and oranges.  [This wasn't an issue in the original Qt
implementation where Xp and Exp were two separate fields.]
2020-11-19 04:48:15 -08:00