Commit Graph

299 Commits

Author SHA1 Message Date
Michael Meyer
4e008bb52f Reword feedback for repeated confuse monster use
I didn't like "your hands begin to glow red even more" very much (the
hero's hands aren't really 'beginning' to glow if they already have an
active confuse monster effect, and "glow red even more" was an awkward
turn of phrase on top of that).  Rephrase it to "The red glow of your
hands intensifies."
2023-11-29 12:11:43 -08:00
PatR
b03e5c1ad7 ^G of unseen monster
I used ^G to create a monster and specified "invisible owlbear".  I
then got "An owlbear appears next to you."  Except it didn't; it was
invisible and I lacked see-invisible.  I imagine that newsym() was
called for the new-yet-invisible monster, but that remained buffered
and was gone overridden by the time pending map update got flushed
at some point after the monster was made invisible.

Add a new makemon() flag to turn a newly created monster invisible
during its creation, before "monster appears" message is delivered.
Since that message will now be suppressed in this situation, use the
cursor-flash hack that indicates where the new, unseen monster got
placed.  Creating "1000 invisible <mon>" is something you probably
won't do twice.
2023-11-10 15:43:02 -08:00
nhmall
6cbefc7c2d Revert "granular verbose message suppression mechanics"
This reverts commit be76727265.
2023-10-29 20:39:07 -04:00
Pasi Kallinen
13ad9561f3 Buff scroll of confuse monster 2023-10-11 20:22:56 +03:00
PatR
0a7cdeae3c viewing geno'd monsters at "genocide what?" prompt
At either of the genocide prompts,
|What type of monster do you want to genocide?
or
|What class of monsters do you want to genocide?
answering "?<return>" will show the list of monster types that have
already been genocided, then re-prompt.
2023-09-09 16:56:24 -07:00
Michael Meyer
8fa53d6ac5 Adjust seenres when observed attack succeeds
If a monster sees an elemental attack succeed from some other creature
or environmental danger, it will be willing to try those attacks again.
2023-08-29 12:05:48 +03:00
PatR
450f060132 github issue #1060 - crystal helmet
Issue reported by vultur-cadens:  changing helm of brilliance to
crystal made it stop being classified as "hard helmet" so it gave
less protection against things falling onto the hero's head.

Change the is_metallic() tests used on helmets to new hard_helmet().
Unlike when thrown, crystal helmets don't break when objects fall
on them.

Fixes #1060
2023-06-14 06:13:11 -07:00
PatR
85a002c157 hearing an unseen monster read a scroll
Heroes recognized unseen same-race monsters by voice, but it yielded
an unexpected result if the monster was unique.  Change it so that
hero will recognize any type of monster by its voice if that monster
has been seen and limit unseen same-race ones to non-unique monsters.
Treats shopkeepers as unique since they have distinct names.

This adds a new flag to struct monst in order to track whether each
specific monster has ever been seen or sensed.
2023-04-22 02:00:04 -07:00
nhmall
2855f71764 ceiling and surface relocations and adjustments
relocate surface(), ceiling(), and avoid_ceiling() to dungeon.c
adjacent to has_ceiling() etc.

astral and fire, like airlevel and waterlevel return FALSE
for has_ceiling()

if a caller does happen to call ceiling() on fire level,
return "flames above"

if a caller does happen to call ceiling() on quest level,
return a more-generic "expanse above", instead of the
word "ceiling"

add "stairs" return to surface()

remove recent update to engrave.c to special-case "stairs"
since surface() will return that now
2023-03-27 18:09:58 -04:00
nhmall
de79240dea some comment spelling fixes 2023-03-16 22:27:01 -04:00
nhmall
f0e88bbc68 one more follow-up for #954 2023-03-06 16:06:43 -05:00
nhmall
a58a2df119 follow-up for #954 2023-03-06 15:49:28 -05:00
nhmall
436e2617c7 replace tab 2023-03-06 15:39:43 -05:00
nhmall
a66954a2f5 Use suggestion from issue #954
As suggested by lynn.

Closes #954
2023-03-06 15:11:11 -05:00
nhmall
da92b9b173 paste error in read.c 2023-02-21 11:52:36 -05:00
nhmall
fbd9a7bae8 another update to the soundlib interface
sound_verbal(char *text, int32_t gender, int32_t tone, int32_t vol,
             int32_t moreinfo);
    -- NetHack will call this function when it wants to pass text of
       spoken language by a character or creature within the game.
    -- text is a transcript of what has been spoken.
    -- gender indicates MALE or FEMALE sounding voice.
    -- tone indicates the tone of the voice.
    -- vol is the volume (1% - 100%) for the sound.
    -- moreinfo is used to provide additional information to the soundlib.
    -- there may be some accessibility uses for this function.

It may be useful for accessibility purposes too.

A preliminary implementation has been attempted for macsound to test
the interface on macOS. No tinkering of the voices has been done.

Use of the test implementation requires the following at build time with make.
    WANT_SPEECH=1
That needs to be included on the make command line to enable the test code,
otherwise just the interface update is compiled in.

I don't know for certain when AVSpeechSynthesizer went into macOS, but older versions
likely don't support it, and would just leave off the WANT_SPEECH=1.

If built with WANT_SPEECH=1, the 'voices' NetHack option needs to be enabled.

It was a bit strange, when I first started up the test, to hear Asidonhopo,
the shopkeeper, talking to me as I entered his shop and interacted with him.
2023-02-07 00:44:36 -05:00
Pasi Kallinen
cae29f1dfd Comment typofix 2023-02-02 19:07:56 +02:00
nhmall
28cd188259 resolve 5 analyzer warnings if no SND_LIB_* define 2023-01-20 17:32:55 -05:00
nhmall
8bbe9282aa add soundeffects hooks to core
Insert the calls to trigger a number of potential soundeffects
into the core.

If no additional soundlib support is integrated into the
build, then the Soundeffect macro (sndprocs.h) expands to nothing:

[#define Soundeffect(seid, vol)
]

If, however, at least one additional soundlib support is integrated
into the build, then the Soundeffect macro gets defined as this
in sndprocs.h:

[#define Soundeffect(seid, vol) \
    do {                                                              \
        if (!Deaf && soundprocs.sound_soundeffect                     \
            && ((soundprocs.sndcap & SNDCAP_SOUNDEFFECTS) != 0))      \
            (*soundprocs.sound_soundeffect)(emptystr, (seid), (vol)); \
    } while(0)
]

That macro definition checks for the hero not being Deaf; it checks
to ensure that the active soundlib interface has a non-null
sound_soundeffect() function pointer; and it checks to ensure
that the active soundlib interface has declared that it supports
soundeffects by setting the SNDCAP_SOUNDEFFECTS bit in its sndcap
entry. That just means that the interface routines are prepared to
accept and deal with the calls from the core, whether or not it
actually produces the desired soundeffect.
2023-01-20 14:20:08 -05:00
nhmall
ba5356603a yn()
A number of C compiler suites have a math.h library that includes a yn()
function name that conflicts with NetHack's yn() macro:
"The y0(), y1(), and yn() functions are Bessel functions of the second kind,
for orders 0, 1, and n, respectively. The argument x must be positive. The
argument n should be greater than or equal to zero. If n is less than zero,
there will be a negative exponent in the result."

At one point, isaac64.h included math.h, although that has since been removed.

Some libraries used in NetHack (Qt for one) do include math.h and that required
build work-arounds to avoid the conflict.

Rename the NetHack macro from yn() to y_n() and avoid the math.h conflict
altogether, eliminating the need for that particular work-around.
2023-01-12 16:04:40 -05:00
nhmall
02a48aa8cf split g into multiple structures
The consolidation of global variables from scattered source
files into decl.c and declared in decl.h was begun in 3.7.0.
Their placement in common files was done for centralized
initialization and potential re-initialization during a
"play again" scenario.

It wasn't really necessary for all of them to be housed in a
single huge structure to meet the "play again" requirement,
and the single huge structure has been a little unwieldy when
it comes to maintenance.

Following this commit, instead of one single extremely large structure
named 'g' to house all of the relocated global variables, they
are distributed into several ga through gz.

To make things easy for the developer, each variable is placed
into the struct corresponding to the starting letter of the variable.
That way, no lookup is required in order to know which struct houses
a particular variable, it is a simple match to the starting letter
for all the centralized global variables.

A global variable named 'amulets', would be found in ga.
    ga.amulets
     ^ ^
A global varable named 'move', would be found in gm.
    gm.moves
     ^ ^
A global variable named 'val_for_n_or_more' would be found in gv.
    gv.val_for_n_or_more
     ^ ^
A global variable named 'youmonst' would be found in gy.
    gy.youmonst
     ^ ^
2022-11-29 21:53:21 -05:00
Michael Meyer
db4785b27f Don't leak ID of magic tools in charging prompt
The getobj prompt for charging was presenting any chargeable tool in the
hero's inventory as a suggested charging target, even tools which were
unidentified and undistinguishable from their mundane counterparts
(e.g. bag of tricks, magic harp, horn of plenty...).  This leaked
information about the identity of these items and made it possible to
determine whether a generic 'harp' was magic or not.

When suggesting chargeable tools, include only those which are actually
known to be chargeable (unidentified or unseen chargeable tools can
still be selected, they just won't be suggested targets).  Basically the
same as what's done for a potion of oil in the apply prompt.
2022-11-19 00:41:52 -08:00
nhmall
99a93fe50b some C99 changes
Instead of using index() macro defined to strchr, use C99 strchr.
Instead of using rindex() macro defined to strrchr, use C99 strrchr.

If you want to try building on a platform that doesn't offer those
two functions, these are available:
    define NOT_C99       /* to make some non-C99 code available */
    define NEED_INDEX    /* to define a macro for index()  */
    define NEED_RINDX    /* to define a macro for rindex() */
2022-10-29 10:54:25 -04:00
PatR
1c24f9f143 refine genocide prompting
More PR #882; give a different message for empty input than "such
creatures do not exist".

The new message mentions 'none' (with single quotes) as a potential
choice so recognize "'none'" as well as "none" to decline.
2022-10-25 03:44:07 -07:00
PatR
769e154546 couple of reformatting bits
Some formatting stuff left out of recent commits.  No change in
behavior.
2022-10-08 15:56:12 -07:00
PatR
064ee2021b more genocide prompts
Make the prompt for single genocide be more precise
 from:  What monster do you want to genocide?
 _to_:  What type of monster do you want to genocide?
and the re-prompt for it be slightly more verbose
 from:  What... [type the name of a monster]
 _to_:  What... [enter the name of a type of monster]

Also, make the already verbose re-prompt for class genocide even
more verbose
 from: What class... [type the symbol representing a class]
 _to_: What class... [type the symbol or name representing a class]

Possibly should have changed 'type' to 'enter' on the last one to
keep them consistent but I left that as-is.
2022-09-28 15:19:41 -07:00
Michael Meyer
365d728be7 Show genocide prompt help iff 'cmdassist' enabled
The "[type the name]" prompt seems appropriate for handling via
cmdassist, so experienced players who don't need the help can hide it.
I also added a corresponding help note for the class genocide prompt.
2022-09-28 14:47:56 -07:00
Michael Meyer
fc7a2a9869 Don't screen out empty input in class genocide
So that a blank line wouldn't use up one of the player's "tries" for
class genocide, the game would continue to prompt until the input was
non-blank (or the user hit <esc>), with a tight loop around the getlin
call that only exited when it got some non-empty input.  This apparently
risked leaving the game endlessly looping under some worst-case-scenario
hangup conditions.  It was also inconsistent with normal genocide, which
doesn't have special handling of blank lines.  Make the class genocide
prompt behave like the normal genocide prompt by removing the "blank
input" loop (and consequently treating a blank line the same way as any
other attempt to write a name).
2022-09-28 14:47:56 -07:00
nhmall
c548fff9e4 some spelling corrections
The pull request included some changes that were neither accidental nor
unintentional, so only a subset of the changes from pull request #869
submitted by klorpa were manually applied.

behaviour  -> behavior
speach     -> speech
knowlege   -> knowledge
incrments  -> increments
stethscope -> stethoscope
staiway    -> stairway
arifact    -> artifact
extracing  -> extracting

The uses of "iff" were left alone.

Close #869
2022-09-08 10:54:11 -04: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
9be2e581b7 Macros for checking is object artifact 2022-08-12 19:37:34 +03:00
PatR
a9fec4e0ae github issue #828 - confuse monster effect when \
hero is invisible without being able to see invisible

Issue reported by EndHack:  you could see your hands glow red when
reading a scroll of confuse monster or casting the spell of confuse
monster even if you were unable to see yourself.

Switch to the blind feedback (tingling instead of glowing red) if
invisible without see invisible.

Also, have uncursed scroll or low skilled spell confer 1..2 turns
of glowing hands instead of always just 1.  (Blessed/highly skilled
stays at 2..9 turns.)

Fixes #828
2022-07-28 13:42:35 -07:00
PatR
231bd75b7f github issue #819 - magic harp vs shopkeeper
Issue reported by youkan700:  for shopkeepers, taming via magic harp
behaved differently than taming via scroll or spell.

Make magic harp's taming be the same as [non-cursed] scroll of taming
and spell of charm monster:  angry shopkeepers will be pacified (even
though they can't be tamed).

Also, add something I've been sitting on for ages:  when taming magic
hits an already tame monster, give that monster a chance to become
tamer.  Not significant for monsters that eat (unless being starved
for some reason) but matters for ones who don't eat.  For tameness N
(which has a maximum of 20), if N is less than 10, have any taming
yield a 10-N out of 10 chance to increase the tameness by 1.  So the
closer a pet is to becoming feral, the more likely for it to improve
tameness a little.

Closes #819
2022-07-16 05:08:26 -07:00
Pasi Kallinen
486ed29077 Blessed potion of polymorph asks user for monster to poly into
... unless there's some other form that would override the choice,
such as a worn dragon armor, lycanthropy, or vampirism.

The polymorph will be in effect for 10-24 turns.
2022-07-14 14:04:27 +03:00
PatR
6249fa7e54 rephrase some livelog messages
From entrez:  rephrase the terse livelog messages so that they form
complete sentences.
2022-07-08 18:24:36 -07:00
nhmall
3004cf2d34 be more consistent with coordinates 2022-07-02 09:10:03 -04:00
PatR
7c732e64a0 simplify unpunish()
unpunish() duplicated much of delobj() in order to use dealloc_obj().
Switch to delobj().  That required a fix to feel_location() when it
was called by savebones() after vision is turned disabled.
2022-06-11 00:11:48 -07:00
nhmall
be76727265 granular verbose message suppression mechanics
Switch to using a macro invocation Verbos(n, s) in place of the
flags.verbose checks.

Provide the mechanics for individual suppression of any of the
existing messages that were considered verbose.

Mechanics only - this code update does not provide any means of
setting the suppression bits.

iflags.verbose = 0
is still a master suppression of all the verbose messages.

iflags.verbose = 1
turns on the verbose messages only for those whose suppression
bit is 0 (not set).
2022-06-09 13:53:20 -04:00
vultur-cadens
53f782dcd6 Livelog declined wishes and (non-cursed) genocides 2022-06-02 06:57:53 -07:00
nhmall
9e6ac144b4 switch to using a flag parameter on newcham() 2022-05-28 19:35:48 -04:00
PatR
ef9d874c22 more PR #771 - blast vs spell
Add the patch from entrez to describe the tower of flame effect from
a scroll of fire as "the blast" rather than "your spell" if it reveals
a secret door.
2022-05-28 14:09:31 -07:00
PatR
9c2a5cbcb8 fix github issue #731 - accessing freed memory \
after charging causes a ring to explode

Reported by gebulmer:  if charging exploded a ring, the ring's memory
got freed but the stale pointer was passed to cap_spe() which accessed
it again.  Fix by setting the object pointer to Null after using up
the ring.  This was a post-3.6 bug.

Fixes #731
2022-04-13 13:34:14 -07:00
PatR
56c2e63492 "just picked up" tweaks
For menustyles traditional and combination, allow 'IP' to request
inventory listing of just picked up items even if not carrying any
items flagged as just picked up.  The not carrying any such items
feedback was already present but couldn't be triggered.

For menustyles partial and full, the special menu entry for 'P'
when only one item applies shows the item instead of the category
"Items you just picked up".  [That sort of thing probably ought to
be done for every menu entry rather than just for 'P'.]  Rephrase
it from
| P - <item>
to
| P - Just picked up: <item>
in case it is player's first time seeing that category be listed.

Clear the just picked up flag for any item that is dipped or read.
Lots of other actions besides drop or put-into-container probably
ought to do that too.  [Maybe even just picking an item with getobj()
could be sufficient so that it wouldn't have to be replicated all
over the place.]
2022-03-22 11:33:17 -07:00
nhkeni
fc5e991b06 Add typedef mmflags_t to assure enough bits for all MM_* flags. 2022-03-17 17:14:12 -04:00
nhkeni
a64a666f78 Various type and cast bits. 2022-03-16 18:18:52 -04:00
nhkeni
e51026aee1 LIMIT_TO_RANGE_INT macro and various casts. 2022-03-16 17:59:23 -04:00
copperwater
a61a97856b Externify trycall() and replace many docall() calls with it
trycall() is a short docall() wrapper that is a no-op if the item is
already identified or the player has called the object type already. For
some reason, many calls to docall() did those same exact checks
beforehand.

This commit eliminates that redundancy by converting those calls into
trycall(), which is now made extern rather than local to do.c. No
behavior should be changed by this commit; I've checked that none of the
affected places could take a different code path now that the
oc_name_known and oc_uname checks are removed.
2022-03-14 09:48:19 -04:00
Pasi Kallinen
e83917bbf3 Unhide monster hiding under chain when unpunished 2022-03-01 16:14:07 +02:00
Pasi Kallinen
8e91320d2f Use u_at macro 2022-02-23 20:28:55 +02:00
Pasi Kallinen
26ea5824c1 Reading a magic marker shows the specific red ink color 2022-02-19 13:11:24 +02:00