Commit Graph

12507 Commits

Author SHA1 Message Date
PatR
d0197bd3e7 document obj->owornmask
ship_object() and obj_delivery() use obj->owornmask for something
other than tracking what slot(s) an object is worn in.
2021-12-14 05:49:31 -08:00
PatR
78c84a1e5d insufficient spell power feedback
If attempting to cast a spell without having enough power, you get
 |You don't have enough energy to cast that spell.
Recently that was augmented to
 |You don't have enough energy to cast that spell yet.
if your current power is at maximum and not enough.  Augment again to
 |You don't have enough energy to cast that spell anymore.
if current power is at maximum and that maximum is less than the peak
value it once had and that peak value would have been enough.
2021-12-14 02:38:17 -08:00
PatR
1fd379a980 glob update
Initialize glob weight sooner in mksobj() and have weight() skip the
fix up it had been doing when it was passed a glob with weight 0.
This allows shrink_glob() to be simplified slightly in the situation
where a glob inside a container shrinks away to nothing.

weight(glob) with glob->owt==0 now yields 0 instead of 20.  That was
only needed for 'obj->owt=weight(obj)' during object creation and
the new earlier weight init makes the 0 to 20 fixup obsolete.  In
turn, that allows a glob which has shrunk to 0 while in a container
to not have to be removed before updating the container's weight.
2021-12-13 07:04:30 -08:00
PatR
9b150b0249 pickup.c bits
This started out as just some minor reformatting but ended up including
a couple of new comments and a revision in how the use_container()
decides whether it is feasible to put something into the container.
Behavior isn't changing.
2021-12-13 05:07:30 -08:00
PatR
f10ef7aba8 attrcurse() on 'see invisible'
If hero has intrinsic see-invisible and a gremlin steals that, the
map wasn't being updated to hide invisible monsters (until the next
iteration of moveloop() after other monsters finished current turn).
2021-12-12 11:32:09 -08:00
Pasi Kallinen
f6b7be49f4 Accessibility: give a message when teleporting a monster
Teleporting a monster only updated the map. Give a message
so blind players can get the same information.
Making a monster invisible gives the same message, if you
cannot detect invisible.
Several other places where monsters teleported themselves
now also give the same message.
2021-12-12 16:50:49 +02:00
PatR
e25f8ec6e3 endless shrink_glob...
A shrink_glob timer keeps running for a glob on the migrating objects
list so shink_glob() needs to be aware of that.
2021-12-11 18:39:36 -08:00
PatR
ba255875cd shrink_glob bug when when glob is totally gone
When a wielded glob shrank away to nothing, an impossible warning:
"obfree: deleting worn obj" would be issued.

If a glob is quivered or wielded or set up as swap weapon when it
shrinks away to nothing, clear the relevant weapon slot before
destroying the glob.

Won't happen for monsters since they never wield globs.  Also won't
happen for migrating objects (which overload obj->owornmask) because
they have to have arrived somewhere in order to have their shrink
timer execute.
2021-12-10 20:16:30 -08:00
PatR
8aa90bdbac formatting bit 2021-12-08 16:24:48 -08:00
PatR
a80969f280 wizard mode polyself to "priest"
When polymorphing while already polymorphed, picking your own role
will rehumanize (wizard mode only; restores old characteristics and
experience level, unlike becoming a new man which can change those
and even be fatal if level drops below 1).  But it didn't work if
you were a priest or priestess because name_to_mon() yields aligned
cleric monster rather than cleric role.
2021-12-08 16:08:57 -08:00
PatR
5ce53f4d17 shape change while strangling
Polymorphing into a vulnerable form while wearing an amulet of
strangulation says "your amulet still constricts your neck" if your
previous form was also vulnerable or "your amulet beings constricting
your neck" if previous form wasn't vulnerable.  But a change nearly
6 years ago to have the status line be updated to say "Strangling"
during the message--instead of next status update after it--caused
the "still constricts" variation to always be given even when the
"begins constricting" was appropriate.
2021-12-08 15:31:06 -08:00
PatR
49f21769da long worm growth again
The previous change could have resulted in a long worm losing HP when
gaining a segment (if it had gained levels while at the peak amount
for the previous number of segments).  I think this is finally right.
2021-12-07 15:54:46 -08:00
PatR
47243ba860 long worm growth
I think this is what was originally intended.
2021-12-07 03:10:57 -08:00
PatR
ec58e917f3 misuse of hero_glyph
It isn't just the hero's normal glyph, it gets adjusted when poly'd.
So the way I tried to use it didn't work as intended.  Explicitly
check Upolyd separately so that hero_glyph won't be affected by tat
and only returns the player monster or race monster value.
2021-12-05 15:09:08 -08:00
PatR
8682cfd544 showrace again...
I'm fairly sure that the 'showrace' and PC rogue cases are covered
correctly now despite the approximation in deciding whether the
specified glyph represents the hero.  However, I'm not sure how the
accessibility handling ought to work when the hero is not in normal
form.  Right now it kicks in if the glyph is any monster, so the
hero is visible as a monster (whether normal or poly'd or on steed).
It does not kick it when mimicking an object (after eating a mimic
corpse or being poly'd into a mimic and then hiding) or furniture
(only if poly'd into mimic) because execution won't make it into the
is_you block in that situation.  Same situation applies to setting
the MG_HERO flag bit, but that doesn't seem to be used anywhere.
2021-12-04 17:18:00 -08:00
nhmall
d1f11c788f remove a couple of tabs 2021-12-04 16:07:49 -05:00
nhmall
2926e52d1f rogue symset issues following expanded glyphs
Contributed by entrez

Also, remove the iflags.use_color test from the many if-statements
in reset_glyphmap(), and test and/or override it once before
the assignment to gmap->color.
2021-12-04 15:59:30 -05:00
PatR
936be565d9 tracking peak maximum HP and energy
Keep track of the highest value that u.uhpmax and u.uenmax have
attained, in new u.uhppeak and u.uenpeak.  They aren't used for
anything yet.  u.mhmax (max HP while polymorphed) isn't interesting
enough to track.

Not save and bones compatible so increments EDITLEVEL.
2021-12-04 05:19:45 -08:00
PatR
657e205ae8 showrace followup
Previous patch made sure that the color tweaks were really at the
hero's location, but not whether it was actually drawing the hero
there.

I'm taking the suggestion about fixing pet_override on faith....
2021-12-04 04:58:35 -08:00
PatR
c3dc95f926 commit ccb10489aee5f2af752177b0f8451790140292e2
Author: PatR <rankin@nethack.org>
Date:   Fri Dec 3 18:35:12 2021 -0800

    showrace when hero can't see self

    This supersedes pull request #644 by entrez, "Fix: expanded-glyphs
    hero color regression".  The code to change color for the hero in
    special circumstances (for 'showrace' and for some PC rogue stuff)
    was relying on the hero's map coordinates rather than verifying
    that the hero was shown at that spot.  When the hero is invisible
    and lacks see invisible, he isn't shown.  But the color of whatever
    could be seen beneath him was incorrectly having its color changed
    (to HI_DOMESTIC for showrace or to YELLOW for PC rogue).

    Closes #644
2021-12-03 18:45:53 -08:00
nhmall
3bb9f91a1e get Xcode build working 2021-12-03 15:01:22 -05:00
nhmall
359f4dfc65 tested with visual studio 17.0.2 2021-12-03 10:19:18 -05:00
PatR
dbc8a70271 bullwhip inconsistencies
Reported by entrez:  applying a bullwhip towards a medium or small
peaceful monster used to be an attack but that stopped working when
'safepet' was extended to peacefuls in order for the hero to be able
to swap places which those.  Also, side-effects were different when
hero applied the whip from within a pit compared to when not in one.

This allows the hero trapped in a pit to try to snag furniture or a
boulder even when a small or medium is present, and escaping that
pit if successful.  (It still snags big monsters in preference to
furniture/boulder at their location.)  When no such non-monster
target is available, it attacks the monster if hostile or peaceful
but not when tame.  When revealing a previously unseen monster it
prevents snagging that monster's wielded weapon because hero couldn't
possibly target the weapon in that situation.

This makes other changes, mostly dealing with finding and exposing
concealed monsters, which may introduce some new bugs.

Since I was already in the right place, implement snagging an item
off the floor while flying.  It isn't necessary since a flyer can
pick things up off the floor directly, but there isn't any pressing
reason to disallow it.  Supersedes the commit in pull request #632
by RojjaCebolla.

Closes #632
2021-12-03 04:34:08 -08:00
PatR
8a6a58367a feedback for spell cast failure due to energy
If the hero is at full energy but still lacks enough to cast a chosen
spell, say "you don't have enough energy yet" instead of just "you
don't have enough energy."
2021-12-02 18:53:34 -08:00
PatR
c8c69b0cc5 fixes entry for pull request #642 - shk name vs it
3.6.1 changed a bunch of messages in shk.c to give the actual shk
name even when a the shopkeeper couldn't be seen, to avoid things
like "You owe It <N zorkmids> for <item>."  But there are various
messages issued outside of shk.c which were overlooked.  Fix those.

Closes #642
2021-12-01 18:49:48 -08:00
Michael Meyer
a606f83e7a Fix: 'you owe It for goods lost'
Some messages about owing a shopkeeper money would use 'it' when blind,
with weird results such as "You owe It 267 zorkmids for goods lost."  It
seems maybe like these were missed in 6591f8b since they were outside of
shk.c/shknam.c.  Bring those messages into alignment with most other
shopkeeper-related messages, which use the shopkeeper's name even if the
hero is blind or can't see them at the moment.

Some of the 'it gets angry' ones don't seem so bad, but similar 'gets
angry' messages in shk.c use Shknam so I changed those as well for
consistency's sake.
2021-12-01 18:34:20 -08:00
PatR
59aedc3b37 yet another shrink_glob fix...
When catching up for lost time spent on another level, globs inside
containers that shrank away to nothing didn't need to have those
containers' weight explicitly adjusted because obj_extract_self()
does that, so yesterday I removed the unneeded container_weight()
call.  However, ones that shrank only partially did need to have
their containers' weights adjusted and that wasn't being done.
The weight would be brought up to date within 25 or so turns when
the contained glob's next shrink_glob event took place.  Until then
attempting to pick up the container by hero or monster, or to pick
up something else by a monster already carrying it, could have been
impacted by the weight discrepancy.
2021-12-01 17:05:27 -08:00
PatR
35ac9a09e2 miscellaneous tweaks
Simplify a glob handling bit in a recent shrink_glob change used when
catching for lost time upon returning to a level.

Revise a clumsily worded fixes entry.

Fix a comment typo in makedefs that's been there for a bunch of years
now.  It's been within the diff context for several recent patches
and I still hadn't noticed it until just now.
2021-11-30 14:04:00 -08:00
PatR
0c69fd9afc fixes entry for pull request #640 - zoo monsters
Populating some of the types of special rooms can pick monsters that
sometimes come in groups, and getting a group could have some members
spill out of the room (or inhibit other random choices by filling some
spots that haven't been populated yet, preventing subsequent monster
creation there).

The misbehavior isn't new so it seems surprising that no one has ever
previously reported this.

Closes #640
2021-11-30 13:01:17 -08:00
Michael Meyer
ce2615a316 Fix: zoo monsters spawning in hallways
If a random G_[SL]GROUP monster was generated in a zoo, the resulting
group of monsters could spill out into nearby hallways and other
surrounding areas.  Disregard G_GROUP flags when filling a zoo with
monsters to avoid this problem.
2021-11-30 12:51:11 -08:00
PatR
7d84ea0605 CapMons[] entries for hallucinatory monster names
Simplify the handling of capitalized hallucinatory monster names
which should be described as "the Bogon" rather than just "Bogon".
Instead of inserting an ESC character to indicate "this entry
should be freed when done", keep track of how many of the entries
come from mons[] (which always come first and shouldn't be freed)
and just free the rest.  So one instance of inserting an ESC and a
couple of skipping it when present and one of testing for it when
freeing are removed.

Also, the check for bogusmons classification code was testing
whether the name started with a letter (or with '@', an obscure
special case for letter()) rather than for the actual type codes
used in dat/bogusmons.txt.  If '@' becomes used as a classification
code (so far it isn't one) any entries using it could have been
misclassified and would be misspelled because it would stay as the
first character.  And existing entry "/r/tard" was also subject to
misclassification, but since it doesn't start with a capital letter
either with or without leading '/' that had no noticeable effect.
If the leading slash was followed by a capital letter there would
have been a different sort of misspelling with that slash missing
in the copy kept in CapMons[].  I knew all that when I first used
letter() but have decided that it is better to extract 'bogon_types'
from bogusmon() in order for the handling to be more consistent.
2021-11-30 03:28:10 -08:00
PatR
a2df8ee587 rumors again...
The code to provide even distribution for rumors was being successfully
used for engravings, epitaphs, and hallucinatory monster names but not
actually for rumors themselves.  Move it into its own routine and have
both the three miscellaneous things and rumors use that.

My testing has verified that asking for a true rumor can produce the
first and last true rumors and not either of the first or last false
rumors, and vice versa when asking for a false rumor.  Asking for
unspecified true/false can produce all four of those.  Aside from that
verification of correctness (I hope...), I haven't checked that the
distribution when selecting is actually even.
2021-11-29 06:04:44 -08:00
PatR
ec5f7bce16 tribute update: Monstrous Regiment and A Hat Full
of Sky

Add a page citation for Monstrous Regiment passage 1 and add four new
passages, bringing its total to 12.

Add two new passages to A Hat Full of Sky, bringing its total to 13.
2021-11-27 17:40:48 -08:00
PatR
03476a7c78 get_rnd_text() for rumors and other stuff
Solve the uneven distribution situation that has been present for
picking random rumors for a long time and for random engravings,
epitaphs, and hallucinatory monster names since 3.6.0.  This relies
on the previous partial solution where short lines have been padded
to a longer length.  When that length is N and random seek lands in
a long line of length L, retry if the position is in the first L-N
characters.  Put differently, it if takes more than N characters to
reach the next newline, reject that random seek and try again.  This
effectively makes long lines behave as if they had the same length
of N as the short lines have been padded to and when all lines are
the same length, all entries have the same chance to be chosen.
2021-11-27 12:23:01 -08:00
PatR
629c2c4094 SOUND=foo vs !defined(USER_SOUNDS)
Give a better message than "Unknown config statement" if SOUNDDIR or
SOUND directives are found in the configuration file being loaded by
an executable built without support for USER_SOUNDS.  And just give
it for the first occurrence since when present there will likely be
multiple SOUND instances.

It doesn't attempt to deal with the case where the current interface
does not support sound but USER_SOUNDS is enabled because another
interface in the same executable does.
2021-11-26 21:56:58 -08:00
PatR
e88126cf6f format issues
Fix a couple of things that prototyping pline() with FORMAT_F(1,2)
pointed out.  The mkobj.c one looks familiar; I thought it had
already been fixed.  Maybe it matches a pull request that hasn't
been incorporated yet.
2021-11-26 21:52:38 -08:00
PatR
5224d85ad3 compile-time format checking
We've had a few pull requests fixing format/argument mismatches
lately.  I did't notice when PRINTF_F(format_index,first_arg_index)
attribute use and the checking gcc and clang do with it got removed,
but that was very useful.  Putting it back triggers a whole bunch
of "format string is not literal" warnings, but that's because
'-Wformat-nonliteral' was explicitly added to the *.2020 hints.
Checking pline/You/&c arguments in the cases where the format is a
literal is more valuable than the complaints for sprintf being fed
a generated format, so reinstate PRINTF_F usage and turn off the
check for non-literal format strings.
2021-11-26 21:50:44 -08:00
PatR
2a7c2f25d7 nhassert() for vms
Update nhassrt_failure() to handle VMS file names.  Still builds on
OSX but not actually tested for VMS>
2021-11-26 19:04:04 -08:00
PatR
a30c789e30 unpadding capitalized hallucinatory monster names
Two semi-related patches within the span of less than three days and
I overlooked the overlap.  When the() deals with a capitalized string,
it calls CapitalMon() to check whether the string matches a monster
and if so whether usage should be "the Monster" (Oracle or Olog-hai
for example) or just "Monster" (Medusa).  The first time that gets
called, it collects all capitalized non-the Monsters from both mons[]
and the bogusmon file.  The latter just got changed to pad short
lines, and that works fine for selecting hallucinatory monsters at
random via get_rnd_text(), but non-the Monster collection processes
the bogusmon file directly and wasn't updated to strip the padding.
2021-11-25 23:50:11 -08:00
PatR
59beebcbcc get_rnd_text() selection distribution
While testing 'the("Capitalized Hallucinatory Monster")' I noticed that
some hallucinatory monsters showed up more often than others.  When
the random engravings, epitaphs, and bogus monsters were converted from
hard-coded arrays to data files accessed by random seek (3.6.0), they
became subject to the same distribution irregularites that rumors suffer
from.  The chance that an entry will be chosen depends upon the chance
that a random seek will hit somewhere in the line which precedes it, so
entries that follow long lines are more likely to be chosen and entries
that follow short lines are less likely.  We improved that for rumors
by having makedefs pad the shortest lines.  Distribution still isn't
uniform but is much better than it was (and could be further improved
with a longer padding length at the cost of making data files bigger so
possibly slower to access; both overall size and access speed mattered
back when floppy discs were supported but are probably irrelevant now).

Start doing the same thing for the newer files:  pad the shortest lines
to increase the chance that seek will find them.  The tradeoff is that
the data files become bigger.  Rumors, engravings, and epitaphs lines
are all at least 60 characters now; bogus monsters are at least 20.
These are the data file sizes I see (in bytes:  old, new; padding for
rumors was already in use so its size hasn't changed):
  bogusmon    4449    7211
  engrave     1326    2894
  epitaph    14159   24075
  rumors     49173   49173

The only place that padding is noticeable in-game is #wizrumorcheck.
2021-11-25 17:57:37 -08:00
PatR
3f3d1ad85c suppress warning
The compiler which suggested that 'aname' might be used without
being initialized is wrong, but this should pacify it.
2021-11-25 13:17:03 -08:00
PatR
c0228d1a74 shrinking globs vs shop bill
A shop-owned glob picked up by the hero was added to shop's bill
and if that shrank to nothing it moved from the unpaid portion to
used-up portion as intended.  But once there it retained obj->owt
of 0 and if 'sanity_check' was enabled, that triggered a warning
every move until finally paid for.  Both the 'Ix' list of used-up
items and itemized shop billing revealed a weight of 0 aum if
'wizweight' was enabled.

Keep track of the weight a glob had when it becomes unpaid, then
reset from 0 to that amount if it becomes used-up.  This overloads
the obj->oextra->omid field which is an unsigned int previously
only used for corpses.  Now for globs it is pre-bill obj->owt which
is also unsigned int.  I didn't add new oextra access functions for
it; it is only used in two places and existing omid ones suffice.
2021-11-25 00:47:45 -08:00
PatR
01b2bcff75 artifact fruit
Reported by entrez:  when fruit name is given the name of an artifact
that doesn't use "the" at the start of its name, messages about the
artifact could be altered.  Example was fruit=Excalibur causing usual
 |You are blased by Excalibur's power!
to unintentionally change to
 |You are blased by the Excalibur's power!
because of a false match during special handling for named fruit in
function the().

This fixes that, and also changes basic inventory formatting.  Former
 |f - an Excalibur
will now be
 |f - Excalibur
for a fruit that has been assigned that name.  When sort pack in On,
as it is by default, that will be listed under Comestibles rather than
under Weapons so really shouldn't fool anyone.  And
 |f - 2 Excaliburs
also breaks the illusion.

This formatting change only affects named fruits.  User assigned names
for object types or for individual objects behave the same as before.
2021-11-24 17:17:40 -08:00
PatR
341d1dff13 add a Harry Potter reference
Add three new hallucinatory monsters:  dementor, flying monkey, and
plaid unicorn.
2021-11-24 01:14:08 -08:00
PatR
f0f9701a37 attempting to polymorph into a unique monster
Noticed while testing revised "the" handling and trying to trigger
"you can't polymorph into [the] Oracle", if the character was human
it would turn into a new man or woman instead of having the unique
form be rejected.
2021-11-24 00:46:44 -08:00
PatR
b2d4b77d3a fix pull request #636 - the("Capitalized Monster")
Function the() wasn't supposed to be used for monsters because many
of the ones with capitalized names confuse it, but over time multiple
instances of the(mon_nam()) have crept into the code.  Instead of
ripping those out, modify the() to handle that situation better.

Pull request #636 by entrez dealt with this with one extra line of
code, but could end up scanning all the names in mons[] repeatedly
if the("Capitalized string") gets called a lot.  This uses a similar
one line fix but calls a whole new routine that scans through mons[]
once collecting all the relevant special case names.  As a bonus,
it does the same for hallucinatory monster names which name_to_mon()
couldn't handle.

Fixes #626
2021-11-24 00:24:56 -08:00
nhmall
dc4b98ebdc more windows keyhandling follow-up 2021-11-23 17:14:10 -05:00
nhmall
f9c66c9889 Merge branch 'pr637' into NetHack-3.7 2021-11-23 16:45:44 -05:00
nhmall
583969284f Merge branch 'fix-format-char' of https://github.com/argrath/NetHack into pr637 2021-11-23 16:45:17 -05:00
nhmall
93a4d8394b avoid zero for the windows key handling values 2021-11-23 16:43:42 -05:00