]> granicus.if.org Git - nethack/log
nethack
2 years agoAdd some hallu monsters
Pasi Kallinen [Wed, 24 Aug 2022 15:40:27 +0000 (18:40 +0300)]
Add some hallu monsters

2 years agoPrevent getpos queueing mouse commands
Pasi Kallinen [Wed, 24 Aug 2022 11:21:24 +0000 (14:21 +0300)]
Prevent getpos queueing mouse commands

My change to allow binding the mouse buttons made getpos
push the mouse commands into a command queue, so when you
were asked for a map location, clicked on it with a mouse,
you'd first get the expected effect, and then (most likely)
immediately traveled there.

Change getpos to clear the commands bound to the mouse buttons,
and restore the binds afterwards.

2 years agoMake explosions give feedback message
Pasi Kallinen [Wed, 24 Aug 2022 10:26:41 +0000 (13:26 +0300)]
Make explosions give feedback message

... even when the explosion doesn't hit anything.

2 years agoAdd boulder pushing to therecmdmenu
Pasi Kallinen [Wed, 24 Aug 2022 09:53:04 +0000 (12:53 +0300)]
Add boulder pushing to therecmdmenu

2 years agoExplicitly list the random breath types
Pasi Kallinen [Wed, 24 Aug 2022 07:29:59 +0000 (10:29 +0300)]
Explicitly list the random breath types

2 years agofix mon digest mon conferring intrinsics
PatR [Wed, 24 Aug 2022 01:35:06 +0000 (18:35 -0700)]
fix mon digest mon conferring intrinsics

Pull request #846 from entrez:  pets got two chances to obtain
intrinsics if they hit for digestion damage (only possible with
engulf attacks).

Closes #846

2 years agoFix: engulf/digest intrinsic granting
Michael Meyer [Sat, 13 Aug 2022 01:55:21 +0000 (21:55 -0400)]
Fix: engulf/digest intrinsic granting

Engulfing pets were getting a double chance to get an intrinsic from a
digestion attack, because they got the mon_givit call in mhitm_ad_dgst
and then also the one in mdamagem.

There is a bit of inconsistency here, in that mhitm_ad_dgst requires
corpse creation to grant nutrition, but the non-nutrition effects of
eating a corpse like polymorph, extra health, etc, in mdamagem don't
have any such requirement.  As a result, one of the mon_givit calls
required a corpse to be "created" before granting an intrinsic, and the
other didn't.   In choosing which one to remove, I figured intrinsic
granting is probably closer to those special effects than providing
nutrition (and also putting it in mhitm_ad_dgst is not ideal w/r/t
message ordering: it causes the 'intrinsic granted' message to appear
before the monster kill message).

2 years agoblack and white ice, sink
PatR [Tue, 23 Aug 2022 23:01:35 +0000 (16:01 -0700)]
black and white ice, sink

When moat and lava use the same screen symbol and color is Off, lava
is rendered in inverse video.  It used to be similar for floor and
ice, but that got broken last year.  Fix inverse ice, and now that
fountain and sink might be same symbol (recent IBMgraphics change),
render sinks in inverse if they match fountains and color is Off.

I started to give sink its own mapglyph flag but then got lazy and
used the same value as ice.  That can be amended if some interface
wants to use some more elaborate distinction than inverse video.

2 years agoMake sink symbol match fountain in IBMgraphics
Pasi Kallinen [Tue, 23 Aug 2022 20:36:41 +0000 (23:36 +0300)]
Make sink symbol match fountain in IBMgraphics

2 years agoAllow binding mouse buttons
Pasi Kallinen [Tue, 23 Aug 2022 20:06:26 +0000 (23:06 +0300)]
Allow binding mouse buttons

Instead of hardcoding mouse button actions, allow the user to
bind mouse buttons to extended commands.  For example the new
defaults are:

BIND=mouse1:therecmdmenu
BIND=mouse2:clicklook

Currently a bit rudimentary; the defaults should be OK, but
documentation is bit lacking, and in-game binding and option
saving are missing.

Allowed commands to bind are "nothing", "therecmdmenu", "clicklook",
and "mouseaction". Clicklook replaces the "clicklook" boolean option,
and mouseaction does what mouse 1 button used to do - a context sensitive
action.

2 years agoSome lua selection userdata code cleanup
Pasi Kallinen [Tue, 23 Aug 2022 14:34:13 +0000 (17:34 +0300)]
Some lua selection userdata code cleanup

2 years agoRemove extra definitions
Pasi Kallinen [Tue, 23 Aug 2022 13:52:05 +0000 (16:52 +0300)]
Remove extra definitions

2 years agoClear or copy whole selectionvar
Pasi Kallinen [Tue, 23 Aug 2022 11:39:39 +0000 (14:39 +0300)]
Clear or copy whole selectionvar

2 years agodocrt()
PatR [Tue, 23 Aug 2022 07:45:30 +0000 (00:45 -0700)]
docrt()

Replace a few more instances of calling user command doredraw()
when docrt() is meant.

2 years agoFix some coordxy declarations that should be xint16
Patric Mueller [Tue, 23 Aug 2022 07:10:17 +0000 (09:10 +0200)]
Fix some coordxy declarations that should be xint16

By temporarily changing the type definition for each of xint16 and
coordxy to int32_t, the compiler was able to find several places where
the type definitions were wrong.

2 years agocurses: 'perm_invent' revisited
PatR [Tue, 23 Aug 2022 01:36:53 +0000 (18:36 -0700)]
curses: 'perm_invent' revisited

Redo the fix for using doset(#optionsfull) to toggle perm_invent
under curses.  Move it to curses code and let the core be unaware
of it.  It does the perm_invent update twice when creating the
window for that.

2 years agofix end-of-game DUMPLOG panic
PatR [Mon, 22 Aug 2022 21:03:28 +0000 (14:03 -0700)]
fix end-of-game DUMPLOG panic

dump_create_nhwindow() has been returning a bogus value.  In the past
that didn't make any difference but after some recent perm_invent
changes, it started triggering a panic when writing the inventory
portion of DUMPLOG.

The changes to invent.c just avoid attempting to create a window that
won't be used.

2 years agoMonsters can blind you with a camera
Pasi Kallinen [Mon, 22 Aug 2022 10:32:12 +0000 (13:32 +0300)]
Monsters can blind you with a camera

2 years agoupdate tested versions of Visual Studio
nhmall [Sun, 21 Aug 2022 15:51:15 +0000 (11:51 -0400)]
update tested versions of Visual Studio

2 years agoupdate Guidebook
nhmall [Sun, 21 Aug 2022 14:20:32 +0000 (10:20 -0400)]
update Guidebook

2 years agoRandom figurines are of harder monsters
Pasi Kallinen [Sun, 21 Aug 2022 10:23:16 +0000 (13:23 +0300)]
Random figurines are of harder monsters

2 years agoRename command to #debugfuzzer, add some z and doc
Pasi Kallinen [Sun, 21 Aug 2022 09:10:08 +0000 (12:10 +0300)]
Rename command to #debugfuzzer, add some z and doc

2 years agoMonsters see and remember when others trigger traps
Pasi Kallinen [Sun, 21 Aug 2022 08:46:49 +0000 (11:46 +0300)]
Monsters see and remember when others trigger traps

No longer will there be a conga line of hill orcs stepping into
the same arrow trap one after another.

2 years agoMonster known traps bit twiddling
Pasi Kallinen [Sun, 21 Aug 2022 08:36:39 +0000 (11:36 +0300)]
Monster known traps bit twiddling

2 years agoerror() doesn't return
PatR [Sat, 20 Aug 2022 22:42:04 +0000 (15:42 -0700)]
error() doesn't return

This will fix some complaints from static analysis.  Note that the
code it complained about wasn't incorrect and that's likely to be
the case of a lot of its complaints.

2 years agoMonsters try to escape from boulder forts
Pasi Kallinen [Sat, 20 Aug 2022 18:49:51 +0000 (21:49 +0300)]
Monsters try to escape from boulder forts

If a monster cannot move, for example because it's being
blocked off by boulders or walls, it will try to escape by some
method - such as a wand or scroll of teleportation.

2 years agoMake #wizgenesis ignore debug_mongen blocking
Pasi Kallinen [Sat, 20 Aug 2022 18:45:21 +0000 (21:45 +0300)]
Make #wizgenesis ignore debug_mongen blocking

Explicitly creating monsters in wizard-mode should go through
and not get blocked by the debug_mongen flag.

2 years agoSplit soldier-finding into separate function
Pasi Kallinen [Sat, 20 Aug 2022 16:33:53 +0000 (19:33 +0300)]
Split soldier-finding into separate function

2 years agoFix some #saveoptions issues
Pasi Kallinen [Sat, 20 Aug 2022 14:09:17 +0000 (17:09 +0300)]
Fix some #saveoptions issues

The #name default key was 'N', but that gets bound to #runsoutheast
when not using number_pad. Swap around the default #name key to M-n,
and bind the 'N' to it in commands_init instead.

The number_pad option wasn't getting saved because it has a separate
handler - mark the option as changed even if the value did not change
so it will be saved to the config.

2 years agoFix the corpse taste adjectives
Pasi Kallinen [Sat, 20 Aug 2022 13:33:35 +0000 (16:33 +0300)]
Fix the corpse taste adjectives

Use proper grammar, and just go with randomized, not fixed by corpse type.

2 years agoAdd #fuzzer wiz-mode command
Pasi Kallinen [Sat, 20 Aug 2022 05:34:48 +0000 (08:34 +0300)]
Add #fuzzer wiz-mode command

Move the debug_fuzzer boolean out of the full options menu
and turn it into #fuzzer extended command

2 years ago'color' in simple options menu
PatR [Fri, 19 Aug 2022 21:54:59 +0000 (14:54 -0700)]
'color' in simple options menu

'color' appears in the simplified O menu for curses, but was not
showing up for tty.  That's because it is hidden when tiles are in
use, and tty has had a bogus value for iflags.wc_tiled_map.

Presence of USE_TILES is not a reliable way to tell whether tiles
are available in a multi-interface binary.  Nor is the setting of
DEFAULT_WC_TILED_MAP from config.h.

2 years agogrammar
nhmall [Fri, 19 Aug 2022 14:47:52 +0000 (10:47 -0400)]
grammar

2 years ago\#wizkill fixes
PatR [Fri, 19 Aug 2022 14:35:58 +0000 (07:35 -0700)]
\#wizkill fixes

Remove 'I' for remembered, unseen monster if it is successfully killed
as well as when a kill attempt reveals that there is nothing there.

When killing engulfer, don't report it to be "unseen" since hero is
able to recognized it by touch.

2 years agocomment typo fix
nhmall [Fri, 19 Aug 2022 14:13:16 +0000 (10:13 -0400)]
comment typo fix

2 years agom #optionsfull
PatR [Fri, 19 Aug 2022 14:03:35 +0000 (07:03 -0700)]
m #optionsfull

Preceding #options or the key bound to that with m runs 'advanced'
options.  Implement the inverse:  preceding #optionsfull or the key
bound to that with m now runs 'simple' options.

2 years agofix comment
nhmall [Fri, 19 Aug 2022 14:00:47 +0000 (10:00 -0400)]
fix comment

2 years agodocument that dochugw() return value is ignored
PatR [Fri, 19 Aug 2022 13:26:13 +0000 (06:26 -0700)]
document that dochugw() return value is ignored

2 years agopull request #853 - remove useless 'if'
PatR [Fri, 19 Aug 2022 13:23:24 +0000 (06:23 -0700)]
pull request #853 - remove useless 'if'

Pull request from argrath:  offending code is
|  if (function())
|    return FALSE;
|  return FALSE;
so testing the function's return value is pointless.

Closes #863

2 years agoremove unnecessary `if`
SHIRAKATA Kentaro [Mon, 15 Aug 2022 06:08:24 +0000 (15:08 +0900)]
remove unnecessary `if`

2 years agopull request #854 - 'tname' comment in defsym.h
PatR [Fri, 19 Aug 2022 13:17:33 +0000 (06:17 -0700)]
pull request #854 - 'tname' comment in defsym.h

Pull request from copperwater:  remove duplicate description of
argument 'pname' for macro PCHAR2().

Closes #854

2 years agoFix: double documentation for 'tilenm' in PCHAR2
copperwater [Mon, 15 Aug 2022 22:20:53 +0000 (18:20 -0400)]
Fix: double documentation for 'tilenm' in PCHAR2

2 years agocomment typo
PatR [Fri, 19 Aug 2022 13:12:51 +0000 (06:12 -0700)]
comment typo

2 years agolocomotion when plucked from saddle
PatR [Fri, 19 Aug 2022 11:49:27 +0000 (04:49 -0700)]
locomotion when plucked from saddle

Reported by entrez.  Revise a recent change that made non-animals who
engulf mounted hero cause dismount first.

2 years agoextend TTYINV to other interfaces
PatR [Fri, 19 Aug 2022 02:12:27 +0000 (19:12 -0700)]
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.)

2 years ago'?' entry for 'O' help
PatR [Thu, 18 Aug 2022 21:38:45 +0000 (14:38 -0700)]
'?' 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?

2 years agofixes entry for PR #856 - sleep explosion
PatR [Thu, 18 Aug 2022 20:52:42 +0000 (13:52 -0700)]
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

2 years agoDon't describe sleep explosion as a "ray"
Michael Meyer [Thu, 18 Aug 2022 19:48:15 +0000 (15:48 -0400)]
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.

2 years agopets eating containers
PatR [Thu, 18 Aug 2022 08:09:52 +0000 (01:09 -0700)]
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.

2 years agoCI build failure following 694a7418
nhmall [Thu, 18 Aug 2022 01:32:24 +0000 (21:32 -0400)]
CI build failure following 694a7418

CI reported a problem with the documentation job.

2 years agoredundant code warning line 400 src/apply.c
nhmall [Thu, 18 Aug 2022 01:16:23 +0000 (21:16 -0400)]
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.

2 years agodocument pseudo-class 'P' slightly better
PatR [Thu, 18 Aug 2022 00:47:31 +0000 (17:47 -0700)]
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.

2 years agocorrect an rng mistake in 6e0d55df from Jan 2019
nhmall [Thu, 18 Aug 2022 00:32:07 +0000 (20:32 -0400)]
correct an rng mistake in 6e0d55df from Jan 2019

Reported by entrez

2 years agoExpose some debug flags in options
Pasi Kallinen [Wed, 17 Aug 2022 11:28:04 +0000 (14:28 +0300)]
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.

2 years agocurses: interactively toggling 'perm_invent' On
PatR [Tue, 16 Aug 2022 22:23:37 +0000 (15:23 -0700)]
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.

2 years agoReturn early from mon_has_friends
Pasi Kallinen [Tue, 16 Aug 2022 11:49:25 +0000 (14:49 +0300)]
Return early from mon_has_friends

2 years agoMonsters using wands of teleportation more
Pasi Kallinen [Tue, 16 Aug 2022 09:17:54 +0000 (12:17 +0300)]
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.

2 years agoinvent fixes, take II
PatR [Tue, 16 Aug 2022 01:00:10 +0000 (18:00 -0700)]
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.

2 years agoinvent fixes
PatR [Mon, 15 Aug 2022 18:41:28 +0000 (11:41 -0700)]
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.)

2 years agou.uswallow
PatR [Mon, 15 Aug 2022 17:53:50 +0000 (10:53 -0700)]
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.

2 years agoattack/damage by trapper and lurker above
PatR [Mon, 15 Aug 2022 11:14:36 +0000 (04:14 -0700)]
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.

2 years agoChange poison instakill to damage with attrib and maxhp loss
Pasi Kallinen [Mon, 15 Aug 2022 07:46:58 +0000 (10:46 +0300)]
Change poison instakill to damage with attrib and maxhp loss

2 years agoFix a couple latent bugs with initial rings/other charged items
copperwater [Sun, 14 Aug 2022 11:09:35 +0000 (07:09 -0400)]
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.

2 years agoTurn statushilites on automatically if any are defined
Pasi Kallinen [Sun, 14 Aug 2022 19:32:09 +0000 (22:32 +0300)]
Turn statushilites on automatically if any are defined

2 years agoRemove obsolete find_skates function
copperwater [Sun, 14 Aug 2022 01:09:48 +0000 (21:09 -0400)]
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[].

2 years agofix github issue #842 - lamp/lantern feedback
PatR [Sat, 13 Aug 2022 22:55:10 +0000 (15:55 -0700)]
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

2 years agoCI warning caused by deprecation of ubuntu-18.04 there
nhmall [Sat, 13 Aug 2022 14:08:39 +0000 (10:08 -0400)]
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

2 years agoa couple of warnings
nhmall [Sat, 13 Aug 2022 13:09:10 +0000 (09:09 -0400)]
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,
      |     ^~~~~~

2 years agoMacros for checking is object artifact
Pasi Kallinen [Fri, 12 Aug 2022 16:37:34 +0000 (19:37 +0300)]
Macros for checking is object artifact

2 years agoBetter feedback for monster falling into a hole
Pasi Kallinen [Fri, 12 Aug 2022 15:17:27 +0000 (18:17 +0300)]
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.

2 years agoTurn on menucolors automatically if any are defined
Pasi Kallinen [Fri, 12 Aug 2022 14:34:21 +0000 (17:34 +0300)]
Turn on menucolors automatically if any are defined

2 years agoFix repeating untrapping
Pasi Kallinen [Fri, 12 Aug 2022 09:02:48 +0000 (12:02 +0300)]
Fix repeating untrapping

... or any that use getdir to ask direction.

2 years agoFix Windows compilation
Pasi Kallinen [Thu, 11 Aug 2022 14:07:43 +0000 (17:07 +0300)]
Fix Windows compilation

2 years agominor code cleanup
PatR [Thu, 11 Aug 2022 10:55:17 +0000 (03:55 -0700)]
minor code cleanup

Mostly removing several trailing spaces.

2 years agoRemove comment
Pasi Kallinen [Thu, 11 Aug 2022 05:46:20 +0000 (08:46 +0300)]
Remove comment

2 years agoMonsters "remember" noteleport levels
Pasi Kallinen [Thu, 11 Aug 2022 05:43:37 +0000 (08:43 +0300)]
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.

2 years agoFixes entries
Pasi Kallinen [Thu, 11 Aug 2022 05:28:15 +0000 (08:28 +0300)]
Fixes entries

2 years agoDocument monmove.c and name temp variables.
Kestrel Gregorich-Trevor [Fri, 21 Jan 2022 21:05:36 +0000 (15:05 -0600)]
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.

2 years agoPull mind flayer blasts into their own function.
Kestrel Gregorich-Trevor [Fri, 21 Jan 2022 19:48:08 +0000 (13:48 -0600)]
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.

2 years agoPiranhas devour corpses.
Kestrel Gregorich-Trevor [Thu, 20 Jan 2022 19:24:37 +0000 (13:24 -0600)]
Piranhas devour corpses.

2 years agoClean up set_apparxy()
Kestrel Gregorich-Trevor [Thu, 20 Jan 2022 18:31:10 +0000 (12:31 -0600)]
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.

2 years agoAllow monsters to zap wands of teleportation at the player.
Kestrel Gregorich-Trevor [Thu, 20 Jan 2022 17:05:35 +0000 (11:05 -0600)]
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.

2 years agolook_here() arguments
PatR [Thu, 11 Aug 2022 01:02:57 +0000 (18:02 -0700)]
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.

2 years agoShopkeepers hold a grudge against past thieves
Michael Meyer [Tue, 26 Jul 2022 18:31:34 +0000 (14:31 -0400)]
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.

2 years agoFix: lookaround trap detection
Michael Meyer [Thu, 28 Jul 2022 16:04:34 +0000 (12:04 -0400)]
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.

2 years agoRestore old behavior for running onto trap
Michael Meyer [Thu, 28 Jul 2022 15:48:05 +0000 (11:48 -0400)]
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).

2 years agoUpdate lit corridor display if dark_room toggled
Michael Meyer [Fri, 29 Jul 2022 16:52:16 +0000 (12:52 -0400)]
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.

2 years agoDon't show corridors as lit in #terrain
Michael Meyer [Fri, 29 Jul 2022 16:17:47 +0000 (12:17 -0400)]
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).

2 years agoRefer to non-damaging gas cloud as "steam"
copperwater [Mon, 8 Aug 2022 22:08:38 +0000 (18:08 -0400)]
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.

2 years agoImprove feedback for trying to bribe the watch
Michael Meyer [Wed, 10 Aug 2022 00:57:28 +0000 (20:57 -0400)]
Improve feedback for trying to bribe the watch

Members of the watch can never be bribed, no matter how much gold is
thrown at them, but when a bribe was attempted they would say "that's
not enough" (implying incorrectly some higher amount would be enough to
pacify them).  Also, an already-peaceful mercenary would take on an
unusually aggressive tone when given any amount of gold, giving the
player the same message to "beat it" as when a bribe succeeds in
pacifying them.

Adjust the mercenary bribery code a bit so that a more friendly message
is given if the monster is already peaceful, and so that unbribeable
monsters don't imply they are just not being given enough gold.  I think
the actual effects of bribery shouldn't be affected by this commit, just
the messages/feedback.

2 years agoDescribe engulf attack by animal as "swallowing"
Michael Meyer [Wed, 10 Aug 2022 13:09:02 +0000 (09:09 -0400)]
Describe engulf attack by animal as "swallowing"

Suggested by aosdict: instead of describing all gulp attacks as
"engulfing you", say "The <monster> swallows you whole" for purple worms
(or any other animal engulfer) to visibly differentiate between
engulfing and swallowing.

2 years agoFix: m-prefix looting a container
Michael Meyer [Wed, 10 Aug 2022 13:02:57 +0000 (09:02 -0400)]
Fix: m-prefix looting a container

Using #loot with the 'm' prefix would claim there was nothing to loot
even if the hero was standing on a box, as long as there was no adjacent
monster.  'm' prefix is an explicit request to select a direction so
make it work regardless of whether a monster is there.  Once I did that
I noticed that it was providing no feedback for using '.' or '>' as the
direction if no container was available, so adjust that to give the
"there is nothing here to loot" feedback.

2 years agoRandom item artifact chances
Pasi Kallinen [Wed, 10 Aug 2022 15:18:15 +0000 (18:18 +0300)]
Random item artifact chances

The chance that randomly generated item is an artifact will
now depend on the number of already existing artifacts.

2 years agoMigration-safe monster movement iteration
Pasi Kallinen [Wed, 10 Aug 2022 07:53:43 +0000 (10:53 +0300)]
Migration-safe monster movement iteration

The monster knockback could mess with the monster linked list while
the code was going through it for monster movements. (For example,
a monster knocked back another into a level teleport trap)

Add iter_mons_safe, which first grabs all the monster pointers in
the list into an array, and goes over that array instead of relying
on the "next monster" pointer. This is possible because dead monsters
are not removed from the linked list until after all the monsters
have moved.

Testing is very minimal, and I'm not sure the vault guard check
for migration is correct - it should probably check for more states?

Also the iterator could be improved by not continually allocating
and freeing the monster pointer array.

2 years agofix issue #836 - engulfing mounter hero
PatR [Tue, 9 Aug 2022 23:22:50 +0000 (16:22 -0700)]
fix issue #836 - engulfing mounter hero

Reported by copperwater:  if an engulfer swallowed a mounted hero,
odd things could happen if the hero dismounted.  The steed would be
silently expelled and float-down flooreffects were attempted.

It turns out that if the engulfer is classified as an animal (so
purple worm, lurker above, trapper), the hero got "plucked from
<steed>'s saddle" and was forcibly dismounted prior to completing
the engulf operation, but non-animals (vortices, air elemental,
ocher jelly, Juiblex) swallowed the hero+steed intact.  The most
straightforward fix to dismounting-while-engulfed issues is to change
engulfing to always pluck the hero from the saddle even when the
engulfer isn't an animal.

If there's no room on the level to place the former steed, it gets
killed off.  I looked at changing that to put the steed into limbo,
waiting to migrate back to the current level if hero leaves and
subsequently returns, but that breaks movemon()'s assumption that
when monsters are in the process of moving, only the currently moving
one can be taken off the fmon list to be placed on migrating_mons.

[The recently added monster knockback code violates that assumption
too when knocking the victim into a level changer trap.  It needs to
be fixed in one fashion or another.]

2 years agoCommand repeating by using cmd queues
Pasi Kallinen [Mon, 8 Aug 2022 11:02:59 +0000 (14:02 +0300)]
Command repeating by using cmd queues

This replaces the old pushq/saveq arrays (which were used to save
the keys pressed by the user for repeating a previous command)
with a new command queue.  This means there's no hard-coded limit
to the saved keys, and it can repeat extended commands which are
not bound to any key.

2 years agofix #K3656 - chest in pit
PatR [Sun, 7 Aug 2022 23:02:44 +0000 (16:02 -0700)]
fix #K3656 - chest in pit

Using #loot while in a pit allows looting containers in that pit.
Using open and specifying the hero's spot when not in a pit allows
looting containers at hero's spot.  But using open while in a pit
complained about not being able to reach out of the pit before player
had a chance to give hero's spot at the place of interest, so did not
allow looting any container there.

Get a target spot before rejecting use of 'open' while in a pit.
The alternate prompt might be tty-centric.

2 years agoMinor ranged attack tweak
Pasi Kallinen [Sun, 7 Aug 2022 19:31:41 +0000 (22:31 +0300)]
Minor ranged attack tweak

Make monsters with magic and gaze attacks avoid hero,
just like spitters and breathers already did.
Some small code cleanup related to the ranged attacks.

2 years agoFix: command counts greater than 2
Michael Meyer [Thu, 4 Aug 2022 17:53:12 +0000 (13:53 -0400)]
Fix: command counts greater than 2

Entering a count to repeat an action stopped working for counts greater
than 2 after 93db2a8: the unconditional call to reset_cmd_vars at the
top of rhack was resetting many more variables than had previously been
cleared at that point, including g.multi (which in this context tracks
how many more times the requested action should be repeated).  As a
result any count would perform the requested action twice at most.
Reduce the list of variables zeroed out at the start of rhack back to
what it was before 93db2a8.

2 years agoFix: get_count and altmeta
Michael Meyer [Thu, 4 Aug 2022 17:34:06 +0000 (13:34 -0400)]
Fix: get_count and altmeta

M-<key> shortcuts with altmeta enabled weren't working when preceded by
a count (e.g. 2 M-j for "jump twice"): g.program_state.getting_a_command
determined whether <esc> should be read as staring a potential meta key
combination, and was being reset by readchar on the first digit entered
without being reactivated for subsequent input.  As a result, by the
time the player entered the actual command to be modified by the count,
readchar wasn't bothering to look for M-<key> sequences.