Commit Graph

13978 Commits

Author SHA1 Message Date
SHIRAKATA Kentaro
4e3fc4dcb0 remove unnecessary if 2022-08-19 06:22:01 -07:00
PatR
2acdf4333a pull request #854 - 'tname' comment in defsym.h
Pull request from copperwater:  remove duplicate description of
argument 'pname' for macro PCHAR2().

Closes #854
2022-08-19 06:17:33 -07:00
copperwater
df3fc20ed0 Fix: double documentation for 'tilenm' in PCHAR2 2022-08-19 06:16:47 -07:00
PatR
8b40ae6bdd comment typo 2022-08-19 06:12:51 -07:00
PatR
51c367ada3 locomotion when plucked from saddle
Reported by entrez.  Revise a recent change that made non-animals who
engulf mounted hero cause dismount first.
2022-08-19 04:49:27 -07:00
PatR
07a0d2a3a1 extend TTYINV to other interfaces
Make the experimental perm_invent control via TTYINV in player's
environment work for any interface that supports persisntent inventory
(only tested with curses), not just for tty+TTY_PERM_INVENT.  The
value is a bitmap but the only combination value that makes any sense
is 3 for tty.

0 - normal
1 - show gold
2 - 'sparse' (list all 52 letters; ones not is use show blank item)
4 - only items in use (approximation of '*' command)

Note that the bits were set up for tty use, and 'normal' for tty is
to hide gold instead of show it.  When there's no value for TTYINV in
the environment, the default value is 0 for tty and 1 for others to
retain existing behavior.

Sparse has no effect for non-tty.  In-use will display gold even if
the show-gold bit is clear if gold happens to be quivered or wielded.
(That fixes current tty misbehavior.)
2022-08-18 19:12:27 -07:00
PatR
8038f7108d '?' entry for 'O' help
Update the menu for the help command to change
  "i - using the 'O' command to set options"
to
  "i - using the '#optionsfull' or 'm O' command to set options"
(examples assume default key bindings but the actual help menu shows
currently bound keys; the "or 'foo'" part is omitted if #optionsfull
is bound to a key).

dat/opthelp should probably be updated to describe how doset_simple
works since that is different from normal menus and explicitly
contradicts the existing description for boolean settings being
deferred until the menu gets dismissed.  Any changes need to make
sense if displayed in the context of picking '?' in #optionsfull.
Maybe a separate help file and separate entry for it in '?' menu?
2022-08-18 14:38:45 -07:00
PatR
76c000ec11 fixes entry for PR #856 - sleep explosion
Pull request from entrez:  when the hero breaks a non-empty wand of
sleep and gets hit by the resulting explosion, don't describe it as
"the sleep /ray/ hits you."

Closes #856
2022-08-18 13:52:42 -07:00
Michael Meyer
66e98e1344 Don't describe sleep explosion as a "ray"
When breaking a wand of sleep, don't print the message "the sleep ray
hits you!" since it produces an area effect/explosion rather than a ray.
For a couple other wands, !ordinary (wand breakage) effects don't
produce a message (I assume because the do_break_wand feedback is
considered sufficient), but I put in an alternative message for the
explosion since I think it's important to inform the player the hero has
fallen asleep.
2022-08-18 15:57:53 -04:00
PatR
2108abd30d pets eating containers
Apply the patch from entrez that makes pet gelatinous cubes who eat
containers engulf rather than digest the contents, like non-tame
g.cubes.  Unlike the latter, tame ones will immediately drop the
stuff they just engulfed and might subsequently eat it all anyway.
2022-08-18 01:09:52 -07:00
nhmall
10101cf1da CI build failure following 694a7418
CI reported a problem with the documentation job.
2022-08-17 21:32:24 -04:00
nhmall
ef6fde88ea redundant code warning line 400 src/apply.c
if (odummy->otyp == SLIME_MOLD
400 ->                    && has_mcorpsenm(mtmp) && MCORPSENM(mtmp) != NON_PM)

The definition of has_mcorpsenm macro is:
include/mextra.h:#define has_mcorpsenm(mon) ((mon)->mextra && MCORPSENM(mon) != NON_PM)

Remove the redundant code.
2022-08-17 21:16:23 -04:00
PatR
694a7418df document pseudo-class 'P' slightly better
Inspired by the diff from entrez.  I didn't care for 'time'.  I don't
like 'novelty' much either, but it is a little more accurate since
there is no time factor involved with just-picked-up.
2022-08-17 17:47:31 -07:00
nhmall
d3208fa1c3 correct an rng mistake in 6e0d55df from Jan 2019
Reported by entrez
2022-08-17 20:32:07 -04:00
Pasi Kallinen
c05a6f3199 Expose some debug flags in options
Show and allow changing the debugging flags in options:

debug_fuzzer: turn on the fuzzer
debug_hunger: prevent hunger
debug_mongen: prevent monster generation
debug_overwrite_stairs: allow level generation overwrite stairs

These are wizard-mode only, cannot be set via config file,
and the fuzzer cannot change these either.
2022-08-17 20:17:30 +03:00
PatR
5c7f2945da curses: interactively toggling 'perm_invent' On
Enabling perm_invent with 'O' ('m O' these days) with curses used to
work but stopped at some point.  Analysis by entrez has attributed
the change to the g.program_state.in_docrt flag in docrt().  When
curses creates the perm_invent window for update_inventory(), it
calls docrt() to have nethack redraw the screen.

 docrt() -> update_inventory() -> curses_update_inventory() -> ...
  -> curs_reset_windows() -> doredraw() -> docrt() [early return]

resulted in room for the persistent inventory window but it was
blank.

This also replaces a couple of doredraw() calls with direct calls to
docrt() (one in code that isn't used).  doredraw() implements a user
command; docrt() does the actual redrawing.
2022-08-16 15:23:37 -07:00
Pasi Kallinen
1900a30323 Return early from mon_has_friends 2022-08-16 14:49:25 +03:00
Pasi Kallinen
d7d4ed3dfe Monsters using wands of teleportation more
Previously monsters used wands of teleportation at hero, if hero was
standing on top of stairs, or on a scary thing (eg. Elbereth or
scroll of scare monster).

Allow monsters to recognize when hero is behind a chokepoint and
monster has friends with them, hopefully teleporting the hero
out of the chokepoint.
2022-08-16 12:17:58 +03:00
PatR
44fc8576ed invent fixes, take II
Make sure that inventory listing when carrying only gold works when
build without TTY_PERM_INVENT as well as with that.
2022-08-15 18:00:10 -07:00
PatR
e9f59090c2 invent fixes
Fix the reported problem of a crash when using the curses interface
when examining inventory while carrying only gold, and a blank menu
for tty in the same circumstance.  Triggered by changes made for
TTY_PERM_INVENT but doesn't require that to be enabled.

Not fixed: with curses, starting with perm_invent Off and toggling it
On (with sufficient screen real estate to show it) doesn't display it.
Doing something to update it like pickup or drop causes it to appear.
(^R isn't enough.)
2022-08-15 11:41:28 -07:00
PatR
be0def37c1 u.uswallow
Make sure u.uswallow is cleared when u.ustuck gets set to Null so
that they won't be out of sync with each other.  Having u.uswallow
be non-zero does imply that u.ustuck is non-Null.

Running #panic while swallowed didn't produce any anomalies for me,
either before or after this change.
2022-08-15 10:53:50 -07:00
PatR
b07fe59b3c attack/damage by trapper and lurker above
Change trappers and lurkers above to remove digestion damage.  They
fold themselves around rather than swallow the victim.  There were
are lot of places that assumed that an engulfer which is an animal
would swallow and digest the victim.  In hindsight, it might have
been simpler to take the M1_ANIMAL flag off of trappers and lurkers
above.

This adds a new digests() predicate for creatures with AT_ENGL+AD_DGST
(purple worm) and also enfolds() for AT_ENGL+AD_WRAP (both 't'-class
critters).

There are several minor fixes mixed in with this.  I didn't record
them as I went along but the two I remember are
1) if poly'd into a holder and holding on to a monster, the '<' and
   '>' commands refursed to work; release the held creature first
   and then treat those commands as normal;
2) throwing a non-weapon while engulfed by an ochre jelly reported
   "the <item> vanishes into the ochre jelly's /currents/".

This needs a lot more testing.  I found and fixed multiple minor
details before my own testing burned out.
2022-08-15 04:14:36 -07:00
Pasi Kallinen
d0b11fd2c0 Change poison instakill to damage with attrib and maxhp loss 2022-08-15 10:51:17 +03:00
copperwater
7d27dca47f Fix a couple latent bugs with initial rings/other charged items
These bugs are currently latent only because no role's starting
inventory happens to satisfy the conditions under which it would show
up. This commit contains the xNetHack fixes for them.

Bug 1: if a role received a specific charged ring (versus a random
ring), it would be possible for that ring's charge to be <= 0, since the
code currently only caught this case for random rings. Move that clause
outside the if (UNDEF_TYP) clause.

Bug 2: non-ring oc_charged items of UNDEF_TYP that randomly rolled a
starting charge/enchantment <= 0 would always be enchanted, sometimes
very highly, because their enchantment was getting set to rne(3) by
hitting this case, which is only intended for rings as a comment
indicates. In particular, Archeologists' starting pick-axe would hit
this case after moving it out of the UNDEF_TYP block, but it would also
apply to any role receiving a random tool or weapon-tool at the start
of the game.
2022-08-15 09:00:18 +03:00
Pasi Kallinen
f156b0f660 Turn statushilites on automatically if any are defined 2022-08-14 22:32:09 +03:00
copperwater
549dfb92ea Remove obsolete find_skates function
find_skates was still in use for its one intended case, but objdescr_is
has been around for a few years now and can do just as good a job
without having to hardcode the first and last boots in objects[].
2022-08-14 10:12:54 +03:00
PatR
1a6456ad82 fix github issue #842 - lamp/lantern feedback
Issue reported by GorillaSapiens:  you get notified if a lamp burns
out even if you're blind at the time.

That is intended behavior; you can feel the heat or lack of heat
from a lamp or candle.  But the comment from copperwater pointed out
that you shouldn't be able to feel that for a brass lantern.

This suppresses the "power has run out" feedback if blind at the
time.  However, applying a lantern to turn it on or off still gives
the on/off feedback on the assumption that there's a switch and you
can feel its position.  When hero is blind and lantern is out of
power, trying to turn it on yields "nothing seems to happen".  It's
not completely consistent since you would feel the switch in its On
position but claiming that the lantern is on would be a lie.

The basic on and off messages referred to "lamp" even when using a
brass lantern.  I thought that that had been fixed a long time ago.

Fixes #842
2022-08-13 15:55:10 -07:00
nhmall
607774367a CI warning caused by deprecation of ubuntu-18.04 there
[warning]The ubuntu-18.04 environment is deprecated, consider switching to ubuntu-20.04(ubuntu-latest), or ubuntu-22.04 instead. For more details see https://github.com/actions/virtual-environments/issues/6002
2022-08-13 10:08:39 -04:00
nhmall
c0d636fe32 a couple of warnings
invent.c: In function 'getobj':
invent.c:1579:29: warning: 'cnt' may be used uninitialized [-Wmaybe-uninitialized]
 1579 |                 if (cnt < 1 || otmp->quan <= cnt)
      |                     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~
invent.c:1529:10: note: 'cnt' was declared here
 1529 |     long cnt;
      |          ^~~

../win/X11/winstat.c: In function 'update_fancy_status_field':
../win/X11/winstat.c:1920:28: warning: declaration of 'active' shadows a global declaration [-Wshadow]
 1920 |             static boolean active = FALSE;
      |                            ^~~~~~
In file included from ../include/hack.h:196,
                 from ../win/X11/winstat.c:36:
../include/wintype.h:180:5: note: shadowed declaration is here
  180 |     active           = 0x001,
      |     ^~~~~~
2022-08-13 09:09:10 -04:00
Pasi Kallinen
9be2e581b7 Macros for checking is object artifact 2022-08-12 19:37:34 +03:00
Pasi Kallinen
fc3729d249 Better feedback for monster falling into a hole
... or a trap door. The trap is immediately identified anyway,
so just name the trap in the message.
2022-08-12 18:17:31 +03:00
Pasi Kallinen
1a5cd08b32 Turn on menucolors automatically if any are defined 2022-08-12 17:34:21 +03:00
Pasi Kallinen
d062f4c4d8 Fix repeating untrapping
... or any that use getdir to ask direction.
2022-08-12 12:02:52 +03:00
Pasi Kallinen
db1ef8172e Fix Windows compilation 2022-08-11 17:07:43 +03:00
PatR
dee099968e minor code cleanup
Mostly removing several trailing spaces.
2022-08-11 03:55:17 -07:00
Pasi Kallinen
1952050fae Remove comment 2022-08-11 08:46:20 +03:00
Pasi Kallinen
649fc7f9b3 Monsters "remember" noteleport levels
... using the same hack when zapping themselves: If the level is
no-teleport, the monster will learn of teleport traps, and if
it knows about them, won't try using teleportation again.
2022-08-11 08:43:40 +03:00
Pasi Kallinen
c855b04a57 Fixes entries 2022-08-11 08:28:15 +03:00
Kestrel Gregorich-Trevor
5c313389a1 Document monmove.c and name temp variables.
This commit expands on comments in dochug() and defines names for
the integer passed between it and m_move(). Hopefully increases readability.
2022-08-11 08:26:23 +03:00
Kestrel Gregorich-Trevor
ecc275a450 Pull mind flayer blasts into their own function.
The mind blast code was previously a part of dochug().
This commit pulls that code into its own function, and also
happens to eliminate a goto and label with no change in functionality.
2022-08-11 08:26:09 +03:00
Kestrel Gregorich-Trevor
50adaff549 Piranhas devour corpses. 2022-08-11 08:26:06 +03:00
Kestrel Gregorich-Trevor
a2a79a1250 Clean up set_apparxy()
This commit removes the gotos from set_apparxy, making it easier to read.
It also cuts out at 1-2 variable assignments on certain calls,
so technically it is an efficiency win as well.
2022-08-11 08:25:56 +03:00
Kestrel Gregorich-Trevor
f83eaade32 Allow monsters to zap wands of teleportation at the player.
According to comments in the code, this feature was disabled
because it never triggered, making it useless. I enabled the code
again, and monsters demonstrated a willingness to zap the player
with wands of teleportation. I am not sure of what exactly changed,
but I think this feature could trigger some interesting situations,
and absolutely deserves to make a comeback.
2022-08-11 08:25:33 +03:00
PatR
3dac38eb0f look_here() arguments
Add LOOKHERE_NOFLAGS to use instead of 0 for look_here()'s 2nd arg.
Fix the call to look_here() that passed FALSE.
2022-08-10 18:02:57 -07:00
Michael Meyer
8a549b0a60 Shopkeepers hold a grudge against past thieves
When you steal from a shop, its shopkeeper will remember you as a thief
and charge you higher prices in the future (as well as be more curt and
less polite in interactions with you, though not outright hostile) even
if you pacify them, or die on the level and revisit it later as a bones
file.  This was an idea aosdict had, and I think it makes sense that a
shopkeeper doesn't forgive and forget, immediately returning to treating
you exactly like anyone else, just because you were terrorized into
paying her back.  Paying a shopkeeper off may cause her to stop actively
attacking you, but it feels like she'd have her eye on you as a known
thief going forward (and maybe would hang up a sign with your picture,
saying something like "DO NOT ACCEPT CHECKS FROM THIS HERO").

This surchage already existed, but since it was tied to active anger
(which typically causes a shopkeeper to quickly abandon their shop to
follow you) it was somewhat rare to see it in action.

I did not implement it here, but one possible further tweak might be to
clear the surcharge if the shopkeeper is pacified via taming magic
(which more-or-less magically brainwashes the target to feel positively
towards the hero) but not if you simply pay your debts.
2022-08-10 20:02:33 +03:00
Michael Meyer
94e8141c01 Fix: lookaround trap detection
Whether a trap exists is independent on the underlying terrain type, so
putting a check for traps in a block structured like

| if (IS_ROCK(levl[x][y].typ) || levl[x][y].typ == ROOM)
|     ; /* do nothing */
| else if (levl[x][y].typ == CORR)
|     do_corridor();
| else if ((trap = t_at(x, y)))
|     avoid_trap(trap);

would mean that the check for traps only happens on terrain other than
normal room and corridor spots.  As a result, it wasn't being evaluated
in most places where traps might actually occur.

Move the test for traps outside of the terrain type evaluation if/else
series, so that it happens independent of terrain (and remove the
'continue' so it doesn't preclue evaluation of the terrain).

Once the rule actually started coming into play, it became clear the
avoid_moving_on_trap message was being printed in cases where the hero
didn't actually stop (i.e. shift-dir runmode, the "if you must" case),
so I also modified the value for that parameter so it will match the
situations where the hero stops running.
2022-08-10 20:01:22 +03:00
Michael Meyer
ce0107aff9 Restore old behavior for running onto trap
The refactor of domove made it impossible to run onto a trap (or water,
if blind), even in the shift-dir mode where the hero is meant to stop
only upon "hitting a wall or running into something".  I use this
runmode to sprint large distances across the map, and the change to this
behavior meant that it was no longer possible to press shift-dir again
to continue past the trap.  This restores the old behavior of allowing
shift-dir running to carry you onto a trap (though the hero will still
stop before hitting a trap in less breakneck runmodes).
2022-08-10 20:01:22 +03:00
Michael Meyer
9d28a8dc76 Update lit corridor display if dark_room toggled
The dark_room option determines whether remembered but unseen waslit
corridor spaces are displayed with S_litcorr or not.  When it is
disabled, a remembered permanently-lit corridor spot will be shown
as "lit corridor" when out of sight.  When it is enabled,
corridors are only shown as lit if they are currently in view.

Toggling this option was not immediately refreshing how corridors on the
map were displayed: an unseen spot shown as a lit corridor because
dark_room was disabled would continue to be shown as a lit corridor
when it was toggled on, until the hero's memory was refreshed by
visiting the spot and then leaving.

Slightly extend the existing function for updating how room spaces are
displayed when dark_room is toggled so that it will update the glyph
used for unseen lit corridors in a similar way.
2022-08-10 19:59:44 +03:00
Michael Meyer
c2393344b7 Don't show corridors as lit in #terrain
Because back_to_glyph assumes the hero can directly see the spot, when
used for #terrain (e.g. when a spot was covered by a remembered object)
it would display corridors as lit if lit_corridor was enabled.  Instead
of trying to suppress back_to_glyph's S_litcorr result only under
circumstances where it would be unusual, just show all corridor spots
with S_corr, so that none of them appear as "lit corridor".  This
is consistent with what is already done for room spots for #terrain
(S_darkroom is forced to the basic S_room across the board).
2022-08-10 19:59:44 +03:00
copperwater
e0d26c7163 Refer to non-damaging gas cloud as "steam"
You can create steam clouds that are gray and deal 0 damage when zapping
fire at or over water sources. If you happen to be in the cloud, it
produced the "You are enveloped in a cloud of noxious gas!" line, and
steam isn't noxious.

Other uses of "gas cloud" could have potentially been changed, but I
left them alone.
2022-08-10 19:58:43 +03:00