Commit Graph

1376 Commits

Author SHA1 Message Date
nhmall
a0b53ee391 merge 2018-11-11 10:29:52 -05:00
PatR
91f973306b build and bug fixes for USE_OLDARGS
New:  call to panic() in impossible() used arbitrary string as a
format so was vulnerable to percent signs in that string.  (This
potentially serious problem is not limited to USE_OLDARGS.)

Old:  revised message string for impossible ("save/restore might fix
this" instead of "perhaps you'd better quit") passed wrong number of
arguments to pline() when using the clumsy VA_PASSx() mechanism (was
missing arg 0 for the fixed-arg format argument).

Old:  varargs config_error_add() in files.c wouldn't compile for
USE_OLDARGS.  Evidently no one has been impacted by that but this
fixes it anyway.  (Two problems:  prototype used FDECL() when it
should have been using VDECL(), and calls to config_error_add() in
the same file would need the VA_PASSx() stuff to force presence of
all optional args.  I moved it instead of adding the latter.)
2018-11-08 15:33:03 -08:00
Pasi Kallinen
0bb6754998 Fuzz testing debug tool
Add code to run a fuzz tester, simulating (more-or-less) random
keyboard mashing. There's no option to turn it on, you need to
set iflags.debug_fuzzer on via a debugger or something along
those lines.
2018-11-08 15:55:49 +02:00
PatR
89a3f4a3fd ^X again
Add a new line for one last missing status field:  gold.
Also add one for proficiency with current weapon.

Move a few lines from 'characteristics' to 'background' and a few
more from 'characteristics' to new 'basics', leaving characteristics
with the six original characteristics:  Str, Con, Dec, &c.
2018-11-02 00:59:01 -07:00
Pasi Kallinen
6d70997869 X11: Reuse menu code to display files
Previously the code used the ASCII Text Athena widgets for displaying
file contents. Unfortunately, the widget made it impossible to control
scrolling or pretty much anything else.

Use the menu code instead, making the file display window behave properly.
2018-10-27 13:58:59 +03:00
PatR
1273d6817e provide dungeon location in ^X feedback
Dungeon level wasn't included in ^X output, so it wasn't actually
giving all status fields and attempting to rely on it when turning
off 'status_updates' was leaving a gap in feedback for the player.
Add an extra line to the first section where character's name and
patron deity are reported, giving current location.
|You are in the Dungeons of Doom, on level 5.
or
|You are in the endgame, on the Elemental Plane of Fire.

The information is more explicit than the basic status field, but
you can already get similar information via #overview so it isn't
giving away extra info.
2018-10-27 03:45:18 -07:00
Pasi Kallinen
45ecbb84d6 X11: Move color and font structs
... so that other window types can also use them.
2018-10-23 20:30:48 +03:00
Pasi Kallinen
0470065b47 X11: TTY-style status lines
Set X resource NetHack*fancy_status: False to enable the TTY-style
status lines. Default is the fancy status.

This patch is somewhat unfinished - even though the TTY-style status
allow for status hilites, the colors don't work correctly yet.
Also changes the fancy status to use the windowport notification code.
2018-10-22 21:26:56 +03:00
Pasi Kallinen
d648f4c371 X11: save and load message history 2018-10-21 17:26:24 +03:00
keni
f222023bd8 Deprecate "makedefs -m".
mons[].difficulty takes over for monstr[]
Invoking "makedefs -m" gives a deprecation message; it is also included
in the (now mostly empty) monstr.c.
Ports should now remove "makedefs -m" from their build procedures but this
commit does not include that change.
2018-10-20 23:14:33 -04:00
Pasi Kallinen
fa5e5ac4b4 X11: Obey menu movement keys 2018-10-18 18:39:27 +03:00
Pasi Kallinen
9f2f232d99 X11: Allow bold attribute for menucolors 2018-10-12 20:46:19 +03:00
Pasi Kallinen
62234b871f X11: Remember perm_invent window geometry 2018-10-11 20:18:07 +03:00
Pasi Kallinen
e48c61c06f X11: Menucolors
Replace the XawList with our own lists of labels and command widgets
to allow for menucolors. Supports only inverse line attribute for now.

Allow key translations to work with menus on Linux.
2018-10-10 21:50:23 +03:00
PatR
053880c149 untrap downwards while over trap
Force trap to activate during failed untrap attempt if done while
already at the trap's location, to match the recent change in
behavior when failed attempt occurs while adjacent to the trap.

Most noticeable while flying over bear traps, but affects all
failed untrap attempts.
2018-09-30 16:37:32 -07:00
PatR
3e19858edd fix #H6925 - being trapped vs Levitation/Flying
Make being trapped in/on/over floor block Levitation and Flying, the
way that being inside solid rock already does, and the way levitating
blocks flight.

Blocked levitation still provides enhanced carrying capacity since
magic is attempting to make the hero's body be bouyant.  I think that
that is appropriate but am not completely convinced.

One thing that almost certainly needs fixing is digging a hole when
trapped in the floor or tethered to a buried iron ball, where the
first part of digactualhole() releases the hero from being trapped.
If being released re-enables blocked levitation, the further stages
of digging might not make sense in some circumstances.

I recently realized that being held by a grabbing monster is similar
to being trapped so should also interfere with levitation and flying.
Nothing here attempts to address that.

Save files change, but in a compatible fashion unless trapped at the
time of saving.  If someone saves while trapped prior to this patch,
then applies it and restores, the game will behave as if the patch
wasn't in place--until escape from trap is achieved.  (Not verified.)
2018-09-30 01:06:59 -07:00
nhmall
ef199f3763 one more update for the right of the status line
This tracks the last character written on each row and clears
the previous content from the end independently of which field
is actually involved.
2018-09-29 23:21:11 -04:00
nhmall
d1c5649890 revisit display artifact appearing to the right of status line
The prior fix for this was a bit flawed. It was only considering
the length of the last field, but what it really needed to do was
consider the placement of the last character of the last field
on the row relative to the placement of the last character of
the last field on the row previously.

If the new placement of that last character of the last field
is left of the previous placement, some clearing must be done.
2018-09-29 22:28:10 -04:00
nhmall
394c72d366 display cleanup only targets the right-most field where it's needed 2018-09-28 12:55:30 -04:00
nhmall
b14d495ce4 Merge branch 'NetHack-3.6.2-beta01' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.6.2-beta01 2018-09-28 02:09:30 -04:00
nhmall
5639539568 tty: fix leftover display artifact when last field on the row got smaller 2018-09-28 02:09:07 -04:00
PatR
21db5a3ae6 alternate bear trap fix
Fix the situation of Flying hero failing to untrap a bear trap that
was resulting in the trap becoming hidden.  Previous fix prevented
hero from moving onto the trap's location so that the reason for
hiding it didn't occur.  This moves the hero and forces the trap,
so it will become unhidden again before there's any chance to notice
that it had been hidden.

Status 'Flying' conflicts with being trapped at floor level, but that
is a separate, known issue.  I'll have to resurrect my unfinished fix
for that sooner rather than later.
2018-09-27 18:42:12 -07:00
PatR
e0b7d2f5a9 monpolycontrol, wizdebug_*
Demote #monpolycontrol and #wizdebug_traveldisplay from commands to
simple boolean options.  The former has the same name, the latter
is called travel_debug.  Rename #wizdebug_bury to #wizbury; it
shouldn't matter that it goes away when compiled without DEBUG.

There are now five wizard-mode boolean options:  monpolycontrol,
sanity_check, and wizweight are documented in the Guidebook;
menu_tab_sep and travel_debug are commented out there.

Guidebook.mn has been tested; Guidebook.tex has not.
2018-09-26 18:40:13 -07:00
nhmall
039ad51660 don't impact player stats with wizard mode ^T 2018-09-25 23:08:09 -04:00
PatR
3a62075070 fix #H7136 - iron bars vs non-diggable walls
Iron bars can be destroyed in some circumstances (hit by yellow
dragon breath or thrown potion of acid, being eaten by rust monser
or black pudding, or by poly'd hero in those forms) and should act
like walls for diggable/non-diggable purposes.  But they aren't
walls, so the non-diggable flag was not being set for them by the
special level loader.  Even once that was changed, they weren't
being handled consistently.  Some places checked for non-diggable
directly (zap_over_floor of acid breath, potion of acid hitting bars)
and started working as intended, others used may_dig() to check
non-diggable (poly'd hero attempting to eat iron bars) but it doesn't
handle iron bars, and still others didn't check at all (bars-eating
monster who moved onto bars location in expectation of eating those
next).
2018-09-25 16:43:06 -07:00
PatR
8ce81a27ef fix #H7397 - pronoun for unseen shopkeeper
Most shop messages accurately identify the shopkeeper even when he
or she can't be seen, but some also include a pronoun reference that
ended up as "it" or "its" when not seen.  Extend pronoun selection
so that visibility can be ignored:  noit_mhe(mon), noit_mhim(mon),
and noit_mhis(mon).  Note that despite being called noit_foo(),
those will still return "it" if mon is neuter.

"Accurately identify shopkeeper" is misleading if the hero is
hallucinating; a random shopkeeper name is used then.  noit_foo()
yields the pronoun applicable to the actual shopkeeper and might
not match the gender of a hallucinatory name.  That could be fixed
in a couple of ways (add shk_mhe()/shk_mhim()/shk_mhis() and either
pass them the randomly chosen name so that they can figure out the
appropriate gender, or just have them use a random gender whenever
hallucinating) but I don't think that's worth bothering with.

A bunch of shop messages needed noit_foo(); only a couple of those
have actually been tested.  A bunch more were using shkname() at
the beginning of a sentence where Shknam() should be used instead.
(All the existing shk names are already capitalized so there's no
noticeable difference.)

The three places outside shk.c and vault.c which directly use
pronoun_gender() have been successfully tested.
2018-09-24 15:15:04 -07:00
nhmall
21a81d0294 BL_RESET usage for window port status line updating
Like BL_FLUSH, only send BL_RESET if the window port has
indicated it wants them via setting the appropriate WC2
bits in its window_procs structure. Update documentation.
2018-09-22 22:41:02 -04:00
nhmall
bbb81700f5 sunsword vs gremlin
The original report complained that gremlins seemed impervious to
Sunsword's light yet a flash from a camera caused them to cry out in pain
despite "The long sword named Sunsword begins to shine brilliantly!"

This commit does two things:
1. A dmg bonus is applied against gremlins using a lit Sunsword.
2. Gremlins will generally avoid the light emitted by Sunsword.
There's a few minor flavor bits thrown in also.

It is understood that this effectively makes Sunsword provide
"gremlin-proofing", but the gremlin myth and Sunsword's characteristic
feature pretty much demand it.

bug 42
2018-09-22 14:08:28 -04:00
nhmall
a18ae517f8 some orctown follow-up bits, fix Bad fruit #0 and some minor tuning 2018-09-21 11:31:01 -04:00
nhmall
9eb7830819 Gnomish Mines changes involving "Orctown" level variant
Changes to be committed:
	modified:   include/decl.h
	modified:   include/dungeon.h
	modified:   include/extern.h
	modified:   include/hack.h
	modified:   src/decl.c
	modified:   src/do_name.c
	modified:   src/dog.c
	modified:   src/dokick.c
	modified:   src/makemon.c
	modified:   src/mkmaze.c
	modified:   src/mkobj.c
	modified:   src/pager.c

This commit is an attempt to address the complaints about
the orc town variation taking away lots of stuff that is
normally available in mine town. The statement in the level
description says "A tragic accident has occurred in Frontier
Town...It has been overrun by orcs."

The changes in this commit attempt to uphold that premise,
while making things a bit more interesting and perhaps
more palatable for the player.

This update does the following in keeping with the mythos:
- While many of the orcs still remain to wander about the
  level, many of the orcs took off deeper into the mines with
  some of the stuff that they plundered. You may now be
  able to hunt some of it down.

- Adds some appearance of this particular horde of marauding
  orcs working as part of a larger collective.

- This evolves the Orc Town mine town variation into a
  a feature over multiple levels of The Gnomish Mines,
  rather than just the single-level "feature" that it was
  previously.

- You may have to work longer and a bit harder for some
  things than other mine town variations, but at least with
  these changes, there is hope that some of it may be found
  elsewhere.

Game mechanics notes (maybe spoily?)

- Add mechanism to place objects into limbo (okay, really
  place them onto the migrating_objs list for transferring
  between levels etc.) and destine them
  to become part of the monster inventory of a particular
  species. In this particular usage case, it's using the
  M2_ORC flag setting to identify the recipients.

- At present, there is no mechanism in the level compiler
  for placing objects onto the migrating objects, nor
  with more sophisticated landing logic, so a somewhat
  kludgy hard-coded fixup and supporting routines were used.
  Some day the need for that might change if additional
  capabilities move to the level compiler.

This is a NetHack-3.6.2-beta01 update. Please give it a workout.

Fixes #127
2018-09-18 18:35:13 -04:00
Pasi Kallinen
e031800880 Use is_hole macro to check for trapdoors and holes 2018-09-15 17:57:57 +03:00
Pasi Kallinen
adf070eb04 Use is_pit macro to check for (spiked) pit 2018-09-15 17:19:26 +03:00
PatR
3eded06669 fix #H7156 - perm_invent
Bug report #H7156 listed three items, all relating to perm_invent:
1) it shouldn't persist across save/restore since restore might be
   on a system which doesn't have enough room to display it (report
   actually complained that config file setting was ignored when
   restoring old games, which is an expected side-effect for options
   that persist across save/restore);
2) permanent inventory wasn't updated when using scroll of charging;
3) attempts to update permanent inventory during restore could lead
   to crash if it tries to access shop cost for unpaid items.
Items (2) and (3) have already been fixed.  This fixes (1).

Replace 'flags.perm_invent' with a dummy flag, preserving save files
while removing it from flags.  Add 'iflags.perm_invent' to hold the
value of the perm_invent option.

The win32 files that are updated here haven't been tested.  Whichever
branch contains the curses interface needs to be updated; ditto for
any other pending/potential interfaces which support perm_invent.
2018-09-14 17:34:33 -07:00
Ray Chason
41fdc79b7b Qt on Win32: resolve conflict over boolean type 2018-09-10 21:13:14 +03:00
Ray Chason
8dbaafbb7b Ignore Win32 build products 2018-09-10 21:13:10 +03:00
nhmall
a417d67572 status_update distinguish new BL_RESET from BL_FLUSH
This adds BL_RESET to status_update to send a flag to a window
port that every field should be updated because something has
happened in the core to make current values shown to be
untrustworthy or potentially obliterated.

That is now distinguished from BL_FLUSH, which now has no
bearing on whether every field needs to be redone, and instead
can be used by a window port indicator that it is time to render
any buffered status field changes to the display.

tty port now sets WC2_FLUSH_STATUS indicator for BL_FLUSH support
and now does one rendering per bot() call, instead of up to 22.

Side note: The tty hitpoint bar code was relying on the old
behavior of redrawing everything upon BL_FLUSH apparently, so it
initially had some color change lag issues, corrected by marking
BL_STATUS as dirty (in need of updating) in tty_status_update()
whenever BL_HP was marked as dirty.
2018-09-03 08:18:18 -04:00
nhmall
5a44a34420 wizidentify suppress unnecessary prompt; allow individual items for perm ID
Don't display the selection to identify all items if there are none.

Complete an item marked ToDo in cmd.c: allow selection of one or more
particular items to permanently identify rather than just all or nothing.
2018-09-01 10:43:26 -04:00
PatR
335e868865 fix github issue #111 - stone-to-flesh of statues
Fixes #111

Casting stone-to-flesh at a random statue animates it as a monster
(created via direct call to makemon()) at an adjacent or nearby spot
if there is already a monster at the statue's spot, but doing so on
a statue of a petrified monster (create attempt via montraits() which
called makemon() without the ADJACENTOK flag) turned it into a corpse
instead.  Pass an extra argument to montraits() so that it behaves
the same normal statue animation for stone-to-flesh without changing
how it behaves when reviving corpses for undead-turning.
2018-07-03 14:59:34 -07:00
PatR
4bce58f665 fix github issue #106 - polymorph panic
Fixes #106

If dipping a worn amulet into a potion of polymorph turns it into an
amulet of change, the game panics while trying to use up that amulet
when the new one hasn't replaced the old one in inventory yet.  Simply
reordering the relevant code isn't sufficient to fix things:  once it
is in inventory and can be successfully used up, later code would end
up deferencing a stale pointer because it was unaware of the deletion.
2018-06-17 16:59:58 -07:00
nhmall
78fca9bef0 build fix, avoid use of 'class'
Build fix, avoid use of 'class'

include\hack.h(199): error C2236: unexpected token 'class'. Did you forget a ';'?
include\hack.h(199): error C2332: 'class': missing tag name
include\hack.h(199): error C2027: use of undefined type 'sortloot_item::<unnamed-tag>'
2018-06-15 22:35:32 -04:00
PatR
0b93d26269 sortloot - enhanced sorting [re-revamp anyone?]
When objects are in the same class, sortloot orders them by their
formatted name.  It was reformatting each object every time it got
compared to another object.  Change that to remember the formatted
name so that any given object is formatted at most once (during the
current sort; future sorts will need to format it again).

Armor and weapon classes are subdivided into smaller subclasses
and the formatting plus alpha compare is only done for items in
the same subclass, so helms come out before cloaks and don't get
their names compared, for instance.  [That was from my 'revamp'
rather than the original implementation.]  This adds a couple more
subclass sets:  food (named fruit, 'other' food, tins, eggs, corpses,
globs) and tools (containers, pseudo-containers [bag of tricks and
horn of plenty once those have become discovered; prior to discovery,
bag of tricks is classified as a container and horn of plenty as an
instrument], instruments, 'other' tools).

The main difference, aside from the formatting efficiency improvement,
is to change the previous sort order
| pink potion
| potion of enlightenment
| purple-red potion
to be
| pink potion
| purple-red potion
| potion of enlightenment
by grouping undiscovered items before discovered items when class and
subclass match.  So discovery state is essentially a sub-subclass and
formatting plus string comparison is only done for members of the
same sub-subclass.  There are actually four state values:  unseen
(which applies to particular objects rather than to their type),
unknown (not discovered and not named), named (not discovered but has
player-assigned type name), and discovered (either fully discovered
or considered not interesting to discover [no alternate description,
not nameable]).

My testing was primarily done with pickup ('m,' with menustyle:T)
and sortloot:Loot (the default) plus !sortpack (not the default and
not a setting I ordinarily use, but less verbose without the class
separators).  It won't astonish me if oddities crop up with other
usage combinations.
2018-06-12 16:33:35 -07:00
PatR
595ad9a5e9 more sortloot - picking up cockatrice corpses
Yesterday's sortloot() overhaul didn't include some cockatrice corpse
handling for pickup.  If there's an object class filter in place and
pickup has been told to care about cockatrice corpses, have sortloot()
include them in the loot array even if food class isn't accepted by
the filter.  In the pre-sortloot days, and in 3.6.[01] which didn't
attempt to deliver a filtered subset of loot, the check for such
corpses was done before pickup checks the filter.  They need to be in
the loot array to retain the same behavior.
2018-06-11 16:32:34 -04:00
PatR
77d478c939 fix #H7205, #H7120, #H5216 - sortloot
H7205 - full-pack identify might skip items if perm_invent is on
        because updating the inventory window might reorder 'invent'
        while the identify code is in the midst of traversing it;
H7120 - pickup that doesn't pick anything up can change the glyph
        shown on the map because the pile might be reordered such
        that a different item is on top;
H5216 - performing a sortloot operation on a pile and then switching
        back to sortloot:none doesn't restore pile's original order.

The 'revamp' that changed the contributed sortloot feature to switch
to simpler usage (object list itself was sorted rather than having a
parallel array that needed to be constructed, sorted, traversed, and
discarded) turns out to have too many problems.  This reverts to a
hybrid solution that constructs an array for traversal, leaving the
linked list in its original order, but hides most of the details of
that from sortloot() callers.  The 'revamp' benefit of being able to
use normal list traversal is lost, as is the potential to skip
sorting when the list turns out to already be in the desired order.

This could stand to have a lot more testing than it's had so far.
2018-06-11 16:31:58 -04:00
nhmall
2b52b093e7 expand on patch 2 so far in patchlevel.h 2018-05-27 21:39:20 -04:00
PatR
dc00df935b hilite_status support for <=, >=, explicit =
Add threshold relationships <= and >= so that the change to make <
and > perform their expected comparison can be resolved.  "Point
release shouldn't force players to update their config files" does
not carry sufficient weight given that they already had to do that
to turn on status highlighting when going from 3.6.0 to 3.6.1.  The
3.6.2 release notes can warn them about the need to update their
status highlight options if they're currently using '<' and/or '>'.

Entering new hilite rules via the 'O' command accepted '=' prefix
for numbers, but rules from config files did not.  Now they do.
The '=' prefix is optional in both situations.

With 'O', percent rules and absolute rules had separate menu entries
so picking one was already choosing the rule type, but entering a
numeric value without percent sign (for percent) or with one (for
absolute) would change the type on the fly.  If someone has already
picked percentage they shouldn't be required to append '%' to the
digits, so that is now optional.  If explicitly included with the
number after having picked absolute, the value is rejected.  It is
trivial to back up in those menus and choose the alternate type if
someone changes his/her mind part way through.

If a status field has both persistent (percent, absolute, always)
and temporary highlights (up, down, changed), give the temporary one
precedence when the value has changed.  To do that with 3.6.1, the
rules for temporary had to follow the ones for persistent highlights
since whichever matched last was the one used.  Now their order
relative to each other doesn't matter.  If a value increases and
there is both an 'up' rule and a 'changed' rule, the more specific
'up' takes precedence, regardless of their relative order; likewise
for decreases and 'down' vs 'changed'.

There were a couple more tweaks needed to support negative values;
I overlooked the 'O' menu handling before.  >-1% and <101% now work
for both the config file and interactive adding via 'O' methods of
defining highlight rules, although new >=0% and <=100% will be
clearer to anyone examining a rule set.

'enum relationship' was forcing LT_VALUE to be -1 but that fact was
never utilized anywhere, and the code was using magic number -2 to
mean "no relationship yet".  This adds NO_LTEQGT to replace the
latter and gives it value -1.  EQ_VALUE is still 0 so effectively
the default if a highlight hasn't been fully set up yet.  LT_VALUE
is now just another positive value along with GT_VALUE, LE_VALUE, &c.

The Guidebook hasn't caught up with the code yet.

The rule choosing code used when deciding how to highlight something
only supports 'int' fields and relies on 'long' having the same bits.
It needs to be extended to support 'long' properly.  Fixing should
be straightforward (except maybe for the initialization of min/max
best fit handling) but this doesn't address that.  Also, data type
for encumbrance/carrying-capacity should be changed from unsigned to
plain int so that no extra handling for just one field will be needed.
2018-05-21 05:58:01 -07:00
nhmall
2b66b5ecd1 bump version ID values 2018-05-16 23:06:44 -04:00
nhmall
cc1d43fad4 integrate aklys feature introduced in 3.6.1 into display
(cherry picked from commit 3fe8325f14)
2018-05-15 06:29:40 -04:00
Bart House
039687cf5f Fix for bug 324 (aka H4216). We now will use nhraykey by default if the
players keyboard layout is non-english.  nhraykey properly handles
non-english input.  We also now support changing altkeyhandler in game.
2018-05-12 18:06:23 -07:00
Bart House
1d31a49661 Some nttty.c clean-up. 2018-05-12 15:58:44 -07:00
Bart House
3467b9f087 Added ntassert() mechanism for Windows based port use. 2018-05-12 13:59:06 -07:00