Commit Graph

3236 Commits

Author SHA1 Message Date
Michael Meyer
ca56b1d161 Make c_vision_clears const char *const
Everything else in c_commmon_strings had this qualifier, but
c_vision_clears was just const char *.  There doesn't seem to be any
reason for that so change it to be consistent with the others.
2023-11-09 16:41:06 -08:00
Michael Meyer
674b8c6b07 Add additional sink potion #dipping effects
Also put "Nothing seems to happen." into c_common_strings, since it's
used all over several files.
2023-11-09 16:41:05 -08:00
Michael Meyer
3fac63749a Add basic sink #dipping effects
This is largely taken from xNetHack with a few minor changes.  Dipping a
potion into a sink can help with item identification by producing the
potionbreathe effect (or a sink-specific effect, for a couple potions).
Dipping other items will just run water over them.  I also added the
capability to wash your hands at a sink.
2023-11-09 16:41:05 -08:00
Michael Meyer
5af1fad398 Enable hero to wash hands in fountains and pools
Dipping hands (with '-') or currently-worn gloves in a fountain or pool
will cause the hero to wash her hands, washing away any oil and clearing
the Glib intrinsic timeout.  This does mean bare hands can be used to
fish for fountain effects, without having to pick up a stray arrow and
carry it around as a dipping item, but having your hands be the only
thing that does not activate those effects felt weird.  If that would be
too unbalancing this could be scrapped.
2023-11-09 16:41:04 -08:00
Michael Meyer
a69ff06e85 Make mstate flag checks more mutually consistent
Various places checking for whether a monster was on the map based on
mstate flags were inconsistent about which ones they checked (and then
place_monster() was additionally inconsistent with all of them about
which bits were cleared when placing a monster onto the map).  I think
some places were also more convoluted than is now necessary because they
date back to mstate being an alias for mspare1, which it shared with
migflags before those became two separate dedicated fields (MSTATE_MASK
also dates back to this and is no longer used, so I removed it).

I tried to go through all the MON_foo mstate bits, understand when/why
they are set, and make the various functions I noticed more consistent
(with each other, and with my understanding of how the bits work) about
how they are treated.  I don't know for a fact that I understood
everything right -- some diagnostic bits that aren't used for much of
anything, like MON_OBLITERATE, had me mystified until I read the 5ee78c5
commit message -- but this patch hasn't caused any new problems (sanity
check or otherwise) with the fuzzer in my testing so far.  All the same,
it could probably use review by someone who has a good sense of what the
mstate bits mean.
2023-11-08 10:41:40 -08:00
Michael Meyer
a1b1f3b250 Try to unify "back on solid ground" messaging
Put everything through a single function that can handle all the
complicated parts of using the correct proposition for different terrain
types, and will not just call things "solid ground" indiscriminately.
This got complicated but I'm not sure if it's possible to do it much
simpler while still using the distinct names for each type of terrain
(unless you are OK with the sentences sounding sort of wonky).
2023-11-07 16:13:55 -08:00
Michael Meyer
b993edca74 Follow-ups on EXPLORERS authorization
I realized that failed explore-mode authorization on a special-mode
saved game cannot downgrade the game mode further down to a normal game,
because this would dump the player back into a state where she has
completed some part of the game in explore mode but is eligible for the
topten list.  This is even more true when the game was formerly a
wizard-mode game.  Unforunately, that was the state my previous commits
left the game in.

Instead, if restoring an explore-mode or wizard-mode savegame, and the
player is authorized via sysconf for neither of those modes, fail
restoration entirely and start a new game instead.  That's sort of
clunky and there could probably be more explanation provided, but it
should be an exceedingly rare occurance and I'm not sure what
alternative exists that would still honor the EXPLORERS and WIZARDS
restrictions.  This shouldn't affect the way they default 'down a mode'
in other circumstances, i.e. the overwhelming majority of situations in
which EXPLORERS authorization is needed/checked.

For the same reason, I realized that the player can't be prompted
whether or not to enter explore mode, if being downgraded from a
no-longer-authorized wizmode save while explore mode is authorized.  The
change from wizard mode to explore mode must be mandatory.  I have also
switched that up so that it will force the change -- unfortunately, this
has the side effect of allowing the preservation of the save, but it's
more important to make sure a wizard mode game doesn't get reverted to
normal mode.  They won't be able to load the save into wizard mode
anyway.
2023-11-07 15:38:10 -08:00
Michael Meyer
85b727c92c Apply sysconf EXPLORERS restriction on startup
The sysconf EXPLORERS list restricting access to explore mode was being
evaluated and used when a player used the #exploremode command in-game,
or when specifying -X or OPTIONS=playmode:explore on the command line
when resuming a normal game, but not when starting an entirely new game.
When SYSCF is avilable, check for authorization early, similar to debug
mode authorization, to restrict access to explore mode to EXPLORERS
under (hopefully) all circumstances.
2023-11-07 15:38:08 -08:00
Michael Meyer
98d2b0ecb3 Follow up on disturbing buried zombies
Change 852f8e4 by requiring a minimum impact before a buried zombie
nearby will be disturbed: light, but still excluding things like
scrolls, if it's a violent impact (dropped while levitating, thrown, or
kicked), and fairly heavy if the hero is just placing the item on the
ground normally.

Moving the call out of flooreffects meant it no longer applied to
pushing boulders around, so have moverock disturb nearby zombies.  I
additionally had wake_nearby do the same thing.

Finally, I renamed check_buried_zombies (which doesn't really reflect
what it does) to disturb_buried_zombies.
2023-11-05 21:51:45 -08:00
PatR
2ee7509945 replace getenv("TTYINV") with perminv_mode option
Add a new option 'perminv_mode' to augment perm_invent.  It handles
the same choices as the temporary TTYINV method:  show all items other
than gold, show full inventory including gold, or only show in-use
items (similar to the '*' command).

For tty, both the all-except-gold and full-inventory modes can add
the poorly named 'sparse' variation which populates unused slots in
its fixed grid with the inventory letter that would go in each.

For others, the default has been changed from full-inventory to
all-except-gold.  Note that gold is treated as part of 'all' or of
'in-use' if it is quivered because having the amount be shown on the
status line doesn't make that redundant.

Changing the default may mess up WinGUI if it assumes that perm_invent
is full inventory with gold.

Initially I was going to change perm_invent into a compound but this
leaves it as an on/off toggle and adds perminv_mode as a separate
option for how to show the inventory when the toggle is on.  It may
make sense to combine them since dual controls is a little confusing,
but right now setting perm_invent On when perminv_mode is 'none'
changes that to 'all' and changing perminv_mode away from 'none' when
perm_invent is Off toggles it to On.

Guidebook.mn has been updated but as usual Guidebook.tex is lagging.
2023-11-05 02:31:26 -08:00
Pasi Kallinen
a6051dae81 Simplify adding menu headings 2023-11-03 19:07:15 +02:00
Bernhard E. Reiter
733b41347a Doc: fix xpm scaling example in config.h
* Add conversion back to xpm in the example command, otherwise the error message is `Failed to load x11tiles: XpmFileInvalid`
2023-11-03 02:44:08 -07:00
Pasi Kallinen
852f8e4996 Dropping items disturbs buried zombies 2023-11-02 20:31:51 +02:00
PatR
c8a84acfa5 handle C++ vs enum arithmatic differently
The cast to (int) was much simpler but this seems better overall.
2023-10-31 15:04:14 -07:00
PatR
4ecc798d20 fix #4024 - C++ complaint about enum arithmatic
Not tested with a compiler that cares.  Still builds with Qt4 and an
older one.
2023-10-31 01:49:09 -07:00
PatR
6303141f1d fix #K4025 - #saveoptions vs cond_ options
Confusion between 'o_status_cond' and 'pfx_cond_'.  Still confusing
but I think now working as intended and expected.

If any cond_xyz option has been loaded from the RC file or changed via
'm O', #saveoptions still saves the full set rather than just the ones
that are different from their default value.
2023-10-31 01:19:20 -07:00
nhmall
a3f452bbe0 Verbose reversion follow-up 2023-10-29 21:02:47 -04:00
nhmall
6cbefc7c2d Revert "granular verbose message suppression mechanics"
This reverts commit be76727265.
2023-10-29 20:39:07 -04:00
nhmall
9bd9bbc57c Revert "granular verbose message suppression mechanics updated"
This reverts commit 95a39d0b71.
2023-10-29 20:29:11 -04:00
nhmall
67a695ac56 Revert "more Verbose"
This reverts commit 377be376fe.
2023-10-29 20:28:19 -04:00
Pasi Kallinen
16ed7e49c3 Separate level flags for premapped and sokoban 2023-10-29 12:35:32 +02:00
PatR
d7799279e4 reverse accidental config.h change
I thought these had been stashed so that I could use 'git commit -a'
but evidently I got careless.
2023-10-26 03:15:10 -07:00
PatR
4dc8429d9e thawing ice followup
Modifying an() [actually just_an()] to treat "<thickness> ice" and
"frozen <hallucinatory liquid>" as special cases which shouldn't be
prefixed with "a" or "an" affected using something like "shaved ice"
or "frozen yogurt" as named fruit.
 |a) shaved ice
 |b) frozen yogurt (weapon in hand)
now have article "a" preceding them:
 |a) a shaved ice
 |b) a frozen yogurt (weapon in hand)
However, the existing cases
 |c) iron bars
 |d) an iron bars (weapon in hand)
still get item 'c' wrong.  'd' is slightly odd but that's because the
fruit name is ambiguous as to whether it's singular or plural.
2023-10-26 01:28:56 -07:00
PatR
04d6789c98 report ice's thaw state
Classify nearby ice as "solid" (no melt timer), "sturdy" (more than
1000 turns left), "steady" (101 to 1000 turns left), "unsteady" (51
to 100 turns left), "thin" (15 to 50 turns left), or "slushy" (1 to
14 turns left, matching walking on ice with the Warning attribute).
[I'm not thrilled with "steady" and particularly "unsteady".]

I was originally going to do this just for probing downward, but ended
up also doing it for look-here and getpos's autodescribe.  It nearly
got out of hand and touched more files than anticipated.

'mention_decor' ought to treat moving from ice firmer than thin to
thin or slushy, from thin to slushy, from slushy to any other, and
from thin to firmer as if moving onto different terrain but I haven't
attempted to tackle that.

The melt timer could work more like a candle's burn timer, triggering
at intermediate stages and resetting itself, so that ice which changes
to a weaker state under the hero could be reported to the player.  But
this doesn't implement that.
2023-10-25 13:26:03 -07:00
Pasi Kallinen
7bf3888118 Shopkeepers consider monster type for some items
Tins, eggs, and corpses will now cost different amounts
based on what intrinsics the monster type could give
2023-10-25 18:45:16 +03:00
nhmall
42348ac299 recent sound addition bit 2023-10-16 09:11:05 -04:00
PatR
9e65cd7d80 more not PR #1102 - reveal_terrain() args
From a comment w/ diff in the pull request by entrez, combine the
show-full-map flag (available in wizard mode and explore mode) with
the bitmask for map-only, map-and-traps, map-and-traps-and-objects
flags for #terrain mode (and getpos() help) instead of passing that
as a separate argument.  No change in behavior unless I messed up.
2023-10-13 18:17:08 -07:00
PatR
80b153638b refine #1106 - invent action: item lookup
Only show the '/' menu choice for context-sensitive inventory item
action if data.base look up for the item will find something.  Lack
of '/' is as informative as "you don't know anything about that".

Harder to implement than expected but seems to be working ok.

This also changes the menu for the '/' command, replacing cryptic /^
and /" with /t and /T so that listing near traps or all traps is more
like listing near|all objects|monsters.  I put caret and double-quote
in as group accelerators; double-quote works on tty, caret gets
intercepted as "menu first page" so doesn't.  I didn't check other
interfaces since supporting that doesn't seem to be worth the bother.

Also a little bit of reformatting.
2023-10-13 01:08:21 -07:00
PatR
284452796c redo tty resizing
Rest of 'not PR #1102'.  Resizing the terminal while getpos was in
operation recalculated the map from scratch instead of redrawing what
the core considers to already be shown.  And it was always operating
while an asynchronous signal was excuting which could potentially
clobber whatever was running at the time the signal arrived.

This uses same redrawing as the prior '^R during getpos()' fix.  It
also only performs the resize while tty_nhgetch() is waiting for
input.  If that is the situation at the time that the signal arrives
then it will resize immediately (while in the asynchronous signal
handler); if not, it will set a flag and tty_nhgetch() will do the
resize the next time it gets called.

This builds with TTY_PERM_INVENT enabled and doesn't seem to be any
worse than before, but there are bugs with that.  The only way I could
get perminv to appear was to save and restore, then perm_invent was
honored for both RC file and mO command.  And once I managed to get it
to display, moving an item from a lower case slot to slot 'A', made
that item vanish; nothing appeared in the invent's right hand panel.

Both of those misbehaviors already happen prior to this commit.  I
also saw an abort+panictrace if I resized while at the "Dump core?"
prompt when running the pre-commit code and didn't see that with the
post-commit code (although the prompt wasn't shown so I couldn't tell
that it was waiting for an answer).  The abort probably sounds scarier
than it warrants; I suspect that the pre-commit code just treated the
resize as answering 'y' for some reason, possibly a stale value in the
variable it uses.
2023-10-12 18:45:14 -07:00
PatR
f70f84aee7 not PR #1102 - map refresh during #terrain
This fixes the part of pull request #1102 by entrez dealing with the
map refresh side of things.  It was pulled out of a much larger patch
that also deals with terminal window resize for tty.

Using ^R when getpos() is in operation, whether actually picking a
position for something or browsing the map during #terrain or post
detection magic, it was reconstructing the known map and positioning
the cursor on the hero instead redrawing the selected terrain subset
or detected objects/monsters/whatever.  There's already a routine to
redraw the current view of the map without recalculating it, but it
wasn't being used for ^R during getpos operation.
2023-10-12 01:18:55 -07:00
Pasi Kallinen
90ec36bcd6 Reduce land mine weight
They were simply too heavy to lug around; now they weigh
the same beartraps.
2023-10-04 21:43:28 +03:00
Pasi Kallinen
76de4f6ee9 Ice devils get a slowing touch 2023-10-04 20:06:12 +03:00
Pasi Kallinen
3946c5a01d Give barbed devils a sticking attack 2023-10-04 11:09:25 +03:00
Pasi Kallinen
6e09c980d2 Use #monster to make dragon steed breathe 2023-09-30 22:44:46 +03:00
Michael Meyer
fa1f1134c8 Disambiguate b_trapped null bodypart value
b_trapped was treating 0 as a null value for its bodypart parameter, but
0 is actually the value of ARM, so b_trapped(..., ARM) would be treated
as intending no A_CON abuse.  Add NO_PART = -1 to the bodypart_types
enum, and use that instead of 0 as the "no body part" value in
b_trapped, so that ARM can be passed to it without any ambiguity.

aosdict identified this issue in xNetHack and handled it differently; he
added NO_PART with a value of 0, incremented the existing bodypart_types
values, and padded the body part arrays so the actual body parts would
start at index 1.  I think using NO_PART = -1 is simpler, but that's an
alternative approach that can be used instead -- it is advantageous in
that it automatically fixes any other places where 0 is assumed to be a
non-body-part value that I may have overlooked.
2023-09-27 10:40:27 +03:00
nhmall
0b472d15f5 relocate mixed_to_glyphinfo to windows.c 2023-09-24 11:13:15 -04:00
nhmall
44ecbb2a1b some work on conditional components in vs build 2023-09-23 15:26:09 -04:00
nhmall
14faa682c4 improve selectsave handling for Windows
If there were outdated savefiles encountered during
startup, each individual one was getting a wait_synch
that required a <return> even though a message window
wasn't being used at that point.

Allow suppression of the individual per-file wait_synch()
calls on Windows, so that a single one can be done once
the selectsave processing is overwith.

This was a little messy because an indicator had to flow
down through validate(), uptodate(), etc.

There shouldn't be any change in how things behave on
any non-Windows platforms.
2023-09-22 15:14:53 -04:00
PatR
dd05f5183e addinv_nomerge()
Replace several instances of
 obj->nomerge = 1;
 addinv(obj);
 obj->nomerge = 0;
with new
 addinv_nomerge(obj);
and add various related comments.
2023-09-19 14:40:33 -07:00
Pasi Kallinen
44a649b0b4 Wand of probing reveals map locations in ray path 2023-09-18 19:20:01 +03:00
PatR
4f2c913925 another paranoid_confirm:Autoall revision
For Autoselect-all confirmation, accept yes|n|q (or yes|no|quit)
rather than just yes|n (or yes|no).  An extra query routine is needed
to support it, but the existing paranoid_query() can just call the
new paranoid_ynq() with an extra argument, keeping things painless.

For menustyle:full plus paranoid_confirmation:Autoall, if you include
'A' in the class filtering choices then you're prompted for whether
you really meant it.  (Same behavior as in the past few weeks.)  Yes
auto-selects items matching all other chosen classes, or from all
classes if 'A' is the only choice.  (Again, same behavior.)  n|no
moves on to menu:full's second menu.  If anything else was chosen
along with 'A', that's what the second menu will offer.  (Same as
past few weeks but revised from initial implementation.)  If 'A' was
the only choice, it will now use 'a' and offer a choice of everything
in the second menu.  (That's a change; it used to cancel if declining
to honor 'A' and nothing else was present.)  Now <return> without
answering or q|quit or ESC skips the second menu, whether or not the
rejected 'A' was the only choice made in the first menu.  (New.)

Other paranoid confirmations still just accept yes and n|no responses,
treating ESC as n|no.
2023-09-18 00:17:33 -07:00
nhmall
ca7ca6393a add a reminder to comment 2023-09-16 20:16:51 -04:00
PatR
2a5f03a3b4 status hilites: Hp and Pw percentages
The hitpoints and power/energy status values (and corresponding
maxima) shown on the screen are capped at 9999 to control status line
width.  The actual values can be bigger than that.  Highlights based
on percentages were doing their calculations on the potentially
truncated values rather than on the actual ones.

Add another field to the blstat[] structure, populate it for BL_HP,
BL_HPMAX, BL_ENE, and BL_EXEMAX and switch to it for their percentage
calculations.

Doesn't seem to break highlighting of 'normal' range values but hasn't
been tested for extreme ones.
2023-09-16 12:42:26 -07:00
PatR
e451966266 botl.c cleanup
Mainly miscellaneous source formatting, plus some expanded comments
and #undef of macros when done with them.
2023-09-16 10:15:05 -07:00
PatR
6636db94e7 corridor engravings in black and white
The default engraving-in-corridor character is the same as the default
corridor symbol (and also default lit corridor one), distinguished by
color.  Show it differently (in inverse vidoe, like lava vs water and
sink vs fountain) if color is Off.

It might be better to change the engraving-in-room symbol to be the
same as the room one so that they'll be more consistent with corridors;
color is probably sufficient without resorting to back-tick.  But this
update hasn't done that.
2023-09-12 01:34:47 -07:00
Pasi Kallinen
ef296e7ad9 Change wall of water color to bright blue
Differentiates it from a pool of water, with the same logic as
wall of lava is different from pool of lava.
2023-09-10 20:48:41 +03:00
PatR
1a64ee1c28 github PR #259 - paranoid_confirmation:trap
Fairly old pull request from copperwater:  add new paranoid_confirm
setting 'trap'.

The old commit suffered from bit rot and merging needed too much
fixing up despite there not being many bands of change in the commit's
diffs.  I ultimately redid it from scratch, although the two biggest
chunks of code started with copy+paste of the pull request's commit.

It operates like paranoid:pray.  Setting paranoid:trap adds a new
"Really step into <trap>?" y/n prompt when attempting to move
into/onto a known trap, even if an object covers it on the map.
Setting both 'paranoid:Confirm trap' turns that into a yes/no prompt.
(Adding 'Confirm' affects other paranoid confirmations; in addition
to requiring yes<return> rather than just y to accept, it also forces
no<return> to reject.)

However, moving into a known trap that is considered to be harmless
behaves as if no trap was present.  Some of the trap classification
might be out of date; several types of traps have undergone changes
since implementation of the original pull request, notably anti-magic
field.  When the hero is hallucinating, all known traps are considered
harmful since the map no longer reliably describes them.

Preceding a movement command with the 'm' prefix also behaves as if
no trap was present, bypassing confirmation for that move, similar to
how paranoid:swim currently behaves.  Being stunned or confused also
behaves as if no trap was present, taking priority over hallucination.

This updates the documentation.

Supersedes #259
Closes #259
2023-09-08 15:55:31 -07:00
Michael Meyer
9d7378ec57 Fix: undoing monsters' permablindness by accident
Monsters can become permanently blind (in very narrow circumstances -- I
think limited only to a very short-range camera flash), in which case
they have both mon->mblinded and mon->mcansee set to 0.  Such
permanently blinded monsters can counterintuitively regain their sight
by being blinded a second time from a different source: for example, by
being hit with a cream pie.  That second blinding will increase
mon->mblinded (which functions as a blindness timeout) by some amount,
and when it runs out the monster will regain its sight.  Try to make
sure that doesn't happen by skipping any blinding attacks if the monster
has already been permanently blinded.
2023-09-07 05:59:50 -07:00
nhkeni
385d860bef Merge branch 'keni-crashweb3' into NetHack-3.7 2023-09-06 12:39:17 -04:00
nhkeni
8c095b009a Add CRASHREPORT, show contact form on panic/impossible
When calling panic() or impossible(), create the option
of opening a browser window with most of the fields
already populated.  Code for MacOS and linux is included;
other ports are affected by argument change to early_init
which are done but not tested.

To enable, define CRASHREPORT in config.h and set
CRASHREPORTURL in sysconf to (for the moment at least)
http[s]://www.nethack.org/common/contactcr.html

Adds --grep-defined option to makedefs for Makefiles.

Adds "bid" (binary identifier), an MD4 of the main nethack
binary.  This is ONLY for helping (in the future) contact.html
to set the "NetHack from" field automatically for our own
binaries.  This can be faked, but the user can lie so nothing
lost.  There's nothing magic about MD4; other ports can use
anything that prodcues a long apparently random string we can
match against.

- new option --bidshow for us to get the MD4 of a
  released binary so I can add it to the website.
  Only available in wizard mode and not in nethack.6.
- typo macos -> macosx in hints file

No support for packaging builds as I'm not sure what that
would look like.

Adds a javascript helper for MacOS.
Adds a lua helper for linux (and builds and installs
 nhlua).
2023-09-06 12:27:13 -04:00