Commit Graph

8032 Commits

Author SHA1 Message Date
Patric Mueller
4aeb3875e2 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.
2022-08-23 09:10:17 +02:00
PatR
8d29733fc4 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.
2022-08-22 18:36:53 -07:00
PatR
9541f17126 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.
2022-08-22 14:03:28 -07:00
Pasi Kallinen
4a84fb5b9d Monsters can blind you with a camera 2022-08-22 13:32:12 +03:00
Pasi Kallinen
a9ca23e8f9 Random figurines are of harder monsters 2022-08-21 13:23:16 +03:00
Pasi Kallinen
2b163d89b0 Rename command to #debugfuzzer, add some z and doc 2022-08-21 12:10:08 +03:00
Pasi Kallinen
fcf5c1ea50 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.
2022-08-21 11:51:19 +03:00
Pasi Kallinen
953d43f5ac Monster known traps bit twiddling 2022-08-21 11:36:39 +03:00
Pasi Kallinen
b0f3371147 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.
2022-08-20 21:49:55 +03:00
Pasi Kallinen
54bff58598 Make #wizgenesis ignore debug_mongen blocking
Explicitly creating monsters in wizard-mode should go through
and not get blocked by the debug_mongen flag.
2022-08-20 21:45:26 +03:00
Pasi Kallinen
7ab1ac0a19 Split soldier-finding into separate function 2022-08-20 19:33:53 +03:00
Pasi Kallinen
caaa527d45 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.
2022-08-20 17:09:23 +03:00
Pasi Kallinen
535eb9327a Fix the corpse taste adjectives
Use proper grammar, and just go with randomized, not fixed by corpse type.
2022-08-20 16:35:31 +03:00
Pasi Kallinen
ac5aadf0e3 Add #fuzzer wiz-mode command
Move the debug_fuzzer boolean out of the full options menu
and turn it into #fuzzer extended command
2022-08-20 08:34:52 +03:00
PatR
c1337773f5 '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.
2022-08-19 14:54:59 -07:00
nhmall
017ad88d13 grammar 2022-08-19 10:47:52 -04:00
PatR
091c3333e9 \#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.
2022-08-19 07:35:58 -07:00
nhmall
d5eaee6c2e comment typo fix 2022-08-19 10:13:16 -04:00
PatR
50665d10f2 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.
2022-08-19 07:03:35 -07:00
PatR
e4753f619f document that dochugw() return value is ignored 2022-08-19 06:26:13 -07:00
SHIRAKATA Kentaro
4e3fc4dcb0 remove unnecessary if 2022-08-19 06:22:01 -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
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
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
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