Commit Graph

15450 Commits

Author SHA1 Message Date
PatR
7f635ad25b fix github issue #1082 - Prot from shape changers
vs lycanthropes

Issue reported by Umbire:  when hero had Protection_from_shape_changers
extrinsic, a lycanthrope in human form that attacked could change into
critter form.  It would change back to human on its next move.

Prevent werecreatures from transforming from human form to critter form
if hero has Protection_from_shape_changers.  That attribute does not
prevent a human werecreature from summoning animal companions.

Fixes #1082
2023-07-15 12:20:47 -07:00
PatR
4eadab380a Guidebook.tex bit
Backslash doesn't need to be escaped by backslash inside a verbatim
block (presumably the first character is an exception).  The doubled
backslashes in SOUNDDIR example were producing doubled backslashes in
the output.

There didn't seem to be any other instances of this.
2023-07-14 14:15:11 -07:00
PatR
2ff91032e0 Guidebook update
Have Guidebook.tex catch up with Guidebook.mn for hilite 'criticalhp'.

Tweak a couple of things in Guidebook.mn.
2023-07-13 23:49:07 -07:00
PatR
bcf739e8e8 documentation for PR #1071 - highlight criticalhp
Pull request from vultur-cadens:  add a new status highlight pattern
OPTIONS=hilite:hitpoints/criticalhp/color&attribute
to highlight hit points when they drop to the point where prayer
classifies them as a major problem.  The threshold for that varies
depending on max HP and experience level.

It affects hitpointbar as well as the status field for hit points.

Right now a highlight rule for HP down or HP changed or HP up takes
precedence over criticalhp until the temporary highlight times out.
I'm not sure how best to deal with that.  With regeneration and an
up or changed rule for HP, the criticalhp highlight probably won't be
seen even with a very short statushilites timeout.

I've added a fixes entry and updated Guidebook.mn but Guidebook.tex
is lagging.

Closes #1071
2023-07-13 14:57:10 -07:00
vultur-cadens
df2799faff add a statushilite option for critically low HP
This allows players to specify a highlight for critically low HP in
the config file, for example:

OPTIONS=hilite_status:hitpoints/criticalhp/purple&inverse

This will cause the hitpoints field to be highlighted when HP is low
enough to be considered a major trouble.  The new "criticalhp" setting
only applies to the hitpoints field.

Since the critical HP threshold changes with level (and most of the
fractions are not integer percents) it was impossible to set
highlights to match the critical HP threshold using percentage
settings.
2023-07-13 13:58:26 -07:00
PatR
c4de0826f4 github PR 1080 - unintended Qt debugging printf
Pull request from entrez:  a temporary printf call snuck into the
Qt window resize code 5 or so weeks ago.  Remove it.

Fixes #1080
2023-07-13 02:03:35 -07:00
Michael Meyer
cd2648c74c Qt: remove window size debug print statement
A printf call was introduced in 20fb008012 that caused the terminal
window to be filled with repeated debugging messages as the window
containing the Qt windowport was resized.  I removed it because I
assumed it was meant to be temporary and was left in the commit by
mistake, considering it isn't mentioned in the commit message; if it was
meant to be permanent it'd probably be good to block it out with #ifdef
DEBUG or something at least, because it produces a real deluge of
terminal output if the player spends any time resizing the window by
hand.
2023-07-13 02:03:05 -07:00
nhmall
9dce424145 Merge branch 'cmap_confusion_planes' of https://github.com/entrez/NetHack into NetHack-3.7 2023-07-12 15:29:16 -04:00
Michael Meyer
93e578bf6f Fix: wrong glyphs for clouds and water on Planes
ff727e9 introduced an issue where unseen water and cloud on the
respective planes were shown with open and closed drawbridge glyphs
instead of the appropriate glyphs.  This is because they fall into cmap
section B, but the translation from symbols/cmap index to glyphs was
being done as though they were in cmap section A (ff727e9 manually used
that particular cmap section macro instead of the general cmap_to_glyph
to work around some compiler warning).
2023-07-12 15:21:00 -04:00
PatR
dbd39f2cd5 prevent weightless statues
From a reddit thread:  statue weight is one and half times corpse
weight and some monsters that don't leave a corpse are defined as
having mons[].cwt==0 so statues of those weighed nothing.

Rather than assigning a non-zero corpse weight to every type of
creature, statues that weigh less than an arbitrary value based on
monster size have their weight increased to that value.  The weight
of a statue of a killer bee jumps from 1 to 100, that of a leprechaun
increases from 90 to 100, that of a yellow light is changed from 0
to 300, wraith from 0 to 500, and air elemental from 0 to 900.  That
last one is actually too low but making the formula more complex
doesn't seem worth it.
2023-07-12 09:48:24 -07:00
PatR
4fc96b0218 another paranoid_confirmation revision
Add support for
 |OPTIONS=paranoid_confirm:+foo !bar
to enable confirmation for foo and disable it for bar while leaving
other settings intact.  Drop support for
 |OPTIONS=!paranoid_confirm:bar
since paranoid_confirm:-bar and paranoid_confirm:+!bar accomplish the
same thing.  !paranoid_confirm still works as paranoid_confirm:none.

Update the documentation for paranoid_confirmation.  It doesn't spell
out all the ins and outs but should cover enough for actual use.

The revised Guidebook.tex is untested.
2023-07-10 23:38:18 -07:00
PatR
5d1f3e9957 github PR #1075 - same RC file for Windows
Pull request from erwinton:  the template run-time configuration file
had a MENUCOLOR pattern for cursed worn armor that didn't work.

The regular epxression containing "(being worn)" needed to quote its
parentheses.

The same fix was needed for sys/share/NetHack.cnf.

Closes #1075
2023-07-09 15:31:24 -07:00
Erwin Dondorp
024d3158cc fixed menu color for 'cursed being worn' 2023-07-09 15:12:55 -07:00
PatR
1b79f00a39 more PR #1077 - #sit on floor trap while Flying
Sitting on a squeaky board wasn't triggering it even after the
handler for that type of trap allowed VIASITTING to override Flying.
The check_in_air() test for floor traps didn't have the same override,
so the squeaky board handler didn't get called.

This fixes that, which led to inconsistency with some other trap
types, and additional fixes for pits and bear traps.  There might be
others that still behave oddly.  For example, if flying over a hole,
using #sit yields
 |You land.  There's a gaping hole under you!  You don't fall in.
I think that's a message phrasing issue rather than a falling trap
issue; if you want to go down, use '>' instead of #sit.  On the other
hand, you do now fall into pit traps for #sit while flying over them.
2023-07-09 14:51:30 -07:00
PatR
a0c481c2f9 fixes entry for PR #1077 - #sit while flying
Pull request from Ardub23:  trigger a squeaky board trap if flying hero
uses #sit while over it.

Supersedes #1067
Closes #1077
2023-07-09 13:40:28 -07:00
Ardub23
6406c9d055 Sit to trigger squeaky board even if flying
If the hero deliberately sits on the floor while flying over a squeaky
board, then either they're trying to squeak it on purpose or they haven't
noticed it. Either way, sitting should trigger it.
2023-07-09 09:28:09 -06:00
PatR
7b32ce02ea fix github issue #1072 - pets pick up cursed items
Issue reported by vultur-cadens:  tame monsters capable of using items
would pick up cursed ones and even wear cursed armor.

The report cites commit 6c9700ab25 but
I don't see any reason why it would be the cause.  However, I was able
to reproduce the misbehavior and this commit seems to fix it.

Fixes #1072
2023-07-08 15:24:40 -07:00
PatR
8948ad0327 fixes entry for PR #1069
Pull request from vultur-cadens:  writing an unknown spellbook will
succeed if corresponding spell is well known (feasible via divine gift
in 3.7 or object amnesia in earlier versions).  When nearing the point
of fading from memory, Luck is still required but non-wizards only
need the much lower wizard amount.  If already forgotten, the chance
to write the book remains the same as if the spell wasn't known.

Closes #1069
2023-07-07 12:20:04 -07:00
vultur-cadens
72213bf48f writing an unknown spellbook when the spell is known
Allow hero to write an unknown spellbook if the spell is freshly known
(from divine knowledge).  If the spell is going stale, the chance of
successfully writing the spellbook depends on Luck, but only rnl(5)
(like a Wizard) instead of rnl(15).  Forgotten spells do not help when
writing unknown spellbooks.
2023-07-07 12:13:52 -07:00
PatR
78a2260830 fixes entry for PR #1057 - altars vs pits
Pull request from entrez:  pits created by breaking a wand of digging
or applying a drum of earthquake used to be able to destroy altars
but a change to prevent placing traps on 'furniture' unintentionally
caused that to stop working.

Closes #1057
2023-07-07 10:45:13 -07:00
Michael Meyer
ab37888b36 Restore altar destruction from magical digging
Especially powerful magic is meant to be able to destroy altars
(breaking a wand of digging or using a drum of earthquake), but it was
being blocked by a check added to maketrap() in a7f6460 designed to
prevent wizard-mode trap wishing from overwriting stairs.  The check was
refined in 6a3d82c to add an exception for digging up graves, but
continued to prevent the destruction of other types of
previously-destructible terrain.

Since this block was a side effect of an attempt to add some guard rails
to wizmode terrain wishes, and the code to explicitly permit the
destruction of other furniture with especially powerful magic is still
present, it doesn't seem like it was actually intended.  Open up terrain
destruction by digging magic a bit more by excluding only
non-destructible terrain, not all furniture other than graves, from
being overwritten by pits and holes.

Also, use AM_SANCTUM to more precisely identify non-destructible high
altars in dig_check() rather than checking whether the hero is on the
Astral or Sanctum levels.
2023-07-07 10:41:18 -07:00
PatR
b914f79c2f fixed entry for PR #1051 - water-vault escape item
Pull request from entrez:  when creating a detached theme room of type
"water-surrounded vault", make sure that one of the chests contains an
item that could be used to escape from the room in case hero arrives
via trap door or [level] teleportation.

Closes #1051
2023-07-07 09:50:57 -07:00
Michael Meyer
95b410ee94 Provide escape item in water-surrounded vaults
Water vaults are one of the few places that can/will generate completely
sealed off in a normal level.  Other such spots are designed to provide
a guaranteed means of escape (vault guard, scrolls of teleportation in
niches, etc) -- water vaults were an exception that didn't do this, so a
hero who fell into one from above could have ended up in a position
where she had no choice but to wait to starve to death or #quit. Provide
an escape item in one of the vault's chests to give a hero more options
in that position.

Also fix a minor mistake (I'm pretty sure, though I'm not a Lua expert
enough to be certain) in an nhlib.c comment describing how to use
obj.addcontent() -- when called as box.addcontent(contents) as the
comment suggested it produces an error, but works OK when called as
box:addcontent(contents) or obj.addcontent(box, contents).
2023-07-07 09:42:43 -07:00
PatR
60a3263a85 fix github issue #1070 - Minetown achievement
Issue reported by vultur-cadens:  arriving on the Mine Town level
via falling or level teleport won't register the "entered Minetown"
achievement if hero doesn't arrive inside a room.

Reorder some code in check_special_room() so that town entry will be
tested before the early return if no room entry has occurred.  This
adds 'level.flags.has_town' to make the town test be cheaper when
the hero hasn't attained the achievement yet and is wandering around
the mines.

Fixes #1070
2023-07-06 13:18:19 -07:00
nhmall
2bba306348 default fetch-lua to https
Also add an alternative fetch-lua-http target to use http (via port 80)

Resolves #1074
2023-07-05 19:18:48 -04:00
nhmall
7c26410daf adjust hints/{linux,macOS}.370 for absence of pkg-config 2023-07-05 09:07:13 -04:00
PatR
c360822c89 github PR #1052 - levltyp[] re-synchronization
Pull request from entrez:  the legend for wizard mode #terrain wasn't
updated to include terrain type "lava wall", so the entries for it
and everything that followed were inaccurate.

I've expanded the comment about level type codes in rm.h.

Closes #1052
2023-07-04 23:17:30 -07:00
Michael Meyer
3064228ca7 Fix: levltyp[] desynchronization
The "temporary?" levltyp[] array became desynchronized from the level
types enum with the addition of lava walls.  This caused all level types
past that to be given the wrong description when it was used.

Add an explicit length to the array so that future additions to the enum
should produce a compiler warning if it's not updated at the same time.
2023-07-04 22:56:52 -07:00
PatR
d119a91799 github PR #1050 - plural of Cyclops
Pull request from entrez:  plural of Cyclops should be Cyclopes
but nethack was constructing Cyclopses.

Closes #1050
2023-07-04 22:38:13 -07:00
Michael Meyer
d57a359bba Add correct Cyclops pluralization
The correct plural of "Cyclops" is "Cyclopes", not "Cyclopses".  I don't
know if anyone would actually use that as a fruitname, but it wouldn't
hurt to add it -- especially since a Cyclops does appear in the game.
2023-07-04 22:37:38 -07:00
PatR
12ca114e96 github PR #1036 - split dosacrifice()
Pull request from argrath:  split #offer of fake Amulet of Yendor
out of dosacrifice() into a separate routine.

Closes #1036
2023-07-04 22:20:39 -07:00
SHIRAKATA Kentaro
97edd4b845 split offering fake amulet into separate function 2023-07-04 22:19:04 -07:00
PatR
060398abec github PR #1023 - extrinsics vs intrinsics rumor
Pull request from Kufat:  add a true rumor hinting about extrinsics
sometimes being 'better' than intrinsics.

Closes #1023
2023-07-04 22:15:18 -07:00
Kufat
66d0c47951 Add true rumor re. intrinsics/extrinsics
Some extrinsics (telepathy, speed) are more powerful than their intrinsic versions.
2023-07-04 22:09:20 -07:00
nhmall
1c8a5d62bc suppress four new warnings
src/sp_lev.c(5348) : warning C4702: unreachable code
src/sp_lev.c(5608) : warning C4702: unreachable code
src/sp_lev.c(6281) : warning C4702: unreachable code
src/sp_lev.c(6334) : warning C4702: unreachable code
2023-07-04 23:44:36 -04:00
PatR
8a3a5c0c9f fix PR #1034 - special level bullet proofing
Pull request from copperwater:  if a special level's lua file
specified invalid coordinates for some things, the code in sp_lev.c
might use them instead of rejecting them.  This could lead to severe
problems.  Presumeably the existing special levels aren't affected
by this.

Closes #1034
2023-07-04 16:23:53 -07:00
copperwater
0e01828ed8 Fix: when a themeroom failed, xstart/ystart weren't reset
Revealed this bug when testing the previous commit:

Themed room generation with a randomly placed map involves picking a
single random point on the map at which to plop it down, and then
declaring the themed room failed and exiting if it would go beyond the
map bounds or overlaps with an existing room. In the process,
xstart/ystart/xsize/ysize have been modified, but weren't getting reset.
(They would get reset if the map successfully got placed and it had a
contents function, as of commit 4af086b, but there wasn't handling for
the failure to place it.)
2023-07-04 16:19:28 -07:00
copperwater
2ae5ce8ab3 Fix and guard against out-of-bounds writes in splev code
I traced a memory corruption bug in xNetHack to a themed room that
looked something like this:

    function()
       des.room({ type="themed", contents = function()
          des.feature({ type='sink' })
          ...
       end })
    end

Placing a feature at a random spot within a room or region is a
reasonable thing for the parser to handle, but the code was not equipped
to handle it, and so the unspecified x and y set as -1 got passed
directly to SP_COORD_PACK, ending up as coordinates way off the map.
Since sel_set_feature does not do an isok() check, this ended up writing
data to unrelated memory.

This commit does the following things:

- Enables des.feature() with no coordinates specified, both via a table
  with 'type' set, and as the single string argument. When no
  coordinates are specified, it will pick a random normal-floor spot
  within the enclosing room or region if there is one, or anywhere
  on the level if there isn't.
- Prevents sel_set_feature from corrupting memory outside
  g.level.locations. Additionally, if EXTRA_SANITY_CHECKS is defined and
  this gets attempted, it causes an impossible.
- Guards the existing "door coord not ok" Lua error with an immediate
  return from lspo_door.
- Adds similar "coord not ok" errors to all the other locations in
  sp_lev.c which did not already check for a unspecified/invalid
  coordinate and for which a random coordinate is nonsensical:
  des.terrain(), des.drawbridge(), and des.mazewalk().
2023-07-04 16:19:27 -07:00
PatR
c016f70a0d pull request #1033 - builds_up()
Pull request from copperwater:  address a 'FIXME' in the code that
didn't have any affect on nethack but did affect xnethack.

Closes #1033
2023-07-04 16:07:24 -07:00
copperwater
9e291234f5 Implement builds_up correctly, resolving its FIXME
The FIXME comment noted that builds_up would return an incorrect false
value for a dungeon branch that builds upwards but is only 1 level, but
that this is a latent problem because no such branch exists in NetHack.
Such a branch does exist in xNetHack, and it causes the debug fuzzer to
crash ("mon_arrive: no corresponding portal" because it can't find the
correct-direction stairs), so I figured I might as well fix it upstream.
2023-07-04 16:05:52 -07:00
PatR
bd9ff5cda6 fixes entry for PR #1032 - des boolean 'trapped'
Pull request from copperwater: accept 'true' or 'false' (also 'yes'
or 'no') in des.object specification for 'trapped'.

After resolving a merge conflict one diff band of this went away, but
the settings of otmp->otrapped from o->trapped and otmp->greased from
o->greased without it look ok to me.

Closes #1032
2023-07-04 15:46:58 -07:00
copperwater
cba85d2314 Allow des.object "trapped" field to be a boolean
I thought there were more object fields that currently only accept ints
but ought to accept booleans, but when I checked I found that most of
them do already, and the ones that take ints are the ones that the
number carries meaning (spe, recharged, etc).

Except for trapped. In struct obj, otrapped is a 1-bit flag, so there's no
good reason for the level parser to treat it as a type error if someone
intuitively makes a des.object call with trapped=true or trapped=false.
Change it to an optional boolean argument, like the other boolean flags
(locked, greased, etc).

Note that get_table_boolean_opt still accepts ints, so existing uses of
trapped=0 or trapped=1 won't be affected.
2023-07-04 15:38:26 -07:00
PatR
34f91484fb fixes entry for PR #1031 - lua: subtract and xor
Pull request from copperwater:  selection subtract and selection xor
didn't work as intended.

Closes #1031
2023-07-04 14:55:45 -07:00
copperwater
c6fa9c3099 Fix chained selection xor and subtraction operations
Something that's reasonable to expect to see in Lua files is something
like:

    local sel4 = sel1 - sel2 - sel3

or more generally, producing a selection from subtraction that will then
be used in subsequent selection math.

I discovered this wasn't actually working correctly, and that it also
applied to the xor operation. The reason behind this is that
l_selection_sub and l_selection_xor create a new selection from nothing,
which by default has "lower" bounds of COLNO, ROWNO and "upper" bounds
of 0,0. Iterating across the intersecting rectangle of both selections
does not reliably set the bounds of the resulting selection properly,
since the first selection_setpoint with a value of 0 will cause the
selection's bounds_dirty flag to be set, at which point they will cease
to change as more points are added.

Then this selection with its incorrect boundaries is pushed back onto
the Lua stack, and becomes the first operand of the next subtraction
(i.e. selr in the first l_selection_sub becomes sela in the second
l_selection_sub). Depending on how broken the bounding box is, results
may vary, but if the bounding box is still (COLNO,ROWNO,0,0), the
resulting selection will have no points selected at all.

This fixes this problem by forcibly recalculating the bounds of the
result selection, so any subsequent operations on it will be valid.
2023-07-04 14:53:16 -07:00
nhmall
6e3ccaa8a5 notes about some header files
The gist of this appeared previously in the commit message for
b722cf99.
2023-07-04 09:53:51 -04:00
PatR
0e97f8901a glyph_to_cmap() usage
I was looking to see what the impact of converting glyph_to_cmap() to
a function might have and noticed a couple of places where the macro
edition is passed a non-trivial argument.  Since it evaluates that
argument many times, there is hidden overhead.  Fetch the glyph once
and pass that to glyph_to_cmap().

This will no longer be very useful--but won't need to be reverted--if
PR #1022 gets incorporated.

do_positionbar() has bugs (only matters for MS-DOS).
2023-07-03 13:24:56 -07:00
nhw_cron
47acc3da39 This is cron-daily v1-May-8-2022. 000files updated: Files 2023-07-03 13:07:35 -04:00
nhmall
1db6bb0438 update submodules/pdcursesmod 2023-07-03 13:05:28 -04:00
nhmall
be1be16458 outdated file 2023-07-03 11:51:06 -04:00
nhmall
e75535497b add support for mips cross-compile to *.370 hints
Also close #1041
2023-07-03 11:44:50 -04:00