Commit Graph

12288 Commits

Author SHA1 Message Date
PatR
583fb60835 fix github issue #587 - incompatible save files
Save files from before the 'disambiguate WHACK' patch were not
necessarily compatible with ones after it, leading to potential
restore problems.

Comments in objclass.h (from before the patch) suggested that
inappropriate assumptions were being made about field layout.
This deliberately introduces new incompatibility and increments
EDITLEVEL to caused earlier save and bones files to be thrown
away.

Fixes #587
2021-09-12 05:31:01 -07:00
PatR
d118ac52af fix github issue #589 - gremlin crash
when fleeing hero who was wearing gold dragon scales/mail and not
wielding any weapon.

When a gremlin was made to flee "artifact light", code originally
intended for Sunsword attempted to format 'uwep' as an artifact.  For
gold scales/mail instead of that, it gave a sane but inappropriate
value if wielding something or segfaulted if not wielding anything.

Fixes #589
2021-09-11 03:04:04 -07:00
PatR
dc3f1447c7 fix #K3440/github issue #586 - losing object info
when an unseen monster picks up an item that the hero knows some
things about.  That's intentional, but vision is turned off while
engulfed so throwing or dropping something while swallowed always
treated it as being handled by an unseen monster.

If hero is swallowed or held by a monster or poly'd and holding a
monster, behave as it the monster can 'seen' by touch when items are
added to its inventory.

Closes #586
2021-09-07 17:50:50 -07:00
PatR
56dfa5a749 obj->spe doc: scroll of scare monster 2021-09-06 17:36:52 -07:00
Pasi Kallinen
e7e7bca2a3 fixes entry 2021-09-06 21:02:48 +03:00
Guillaume Clemens
67295bc706 Non-metallic gloves protect worn rings from shock 2021-09-06 21:01:53 +03:00
Pasi Kallinen
9942b65df7 Resistances gained from worn or wielded items also protect inventory 2021-09-06 20:24:44 +03:00
PatR
9f230c3cd4 fix #K3436 - crash during restore
triggered by Grayswandir's hallucination resistance.  If the game
is saved while hero is hallucinating but having that be suppressed
by wielding Grayswandir, is riding, and the steed is on an object,
then during restore the hero's location will be updated because
of the presence of the object but the attempt to display the hero
there is made before u.usteed has been restored and fails.
2021-09-05 15:44:00 -07:00
Pasi Kallinen
e813cf5b05 Move sanity checking to start of main loop
... just after clearing the object bypasses, as some
of the monster movement code may use object bypass flags.
2021-09-05 10:14:16 +03:00
PatR
c97e3e1db7 Fixes entry for "Disambiguate blunt weapons"
and additional comments.  Pull request #584 expands the oc_dir field
of objects[] from 2 bits to 3 in order to hold the weapon strike-
type bit mask.

Closes #584
2021-09-04 14:46:24 -07:00
copperwater
52585b00ab Disambiguate blunt weapons
Currently weapons are set up as piercing, slashing, or whacking, using
their object's oc_dir field, with the intention that certain weapons
can classify as both. However, since oc_dir is only 2 bits and WHACK is
0, there's no way to unambiguously express some of these combinations.
Certain weapons such as the lucern hammer are defined as combination
piercing/blunt weapons, but the game just sees it as a piercing weapon.

This commit adds a third bit to oc_dir and promotes the WHACK constant
to its own bit. Nothing should be affected by this (wand directions and
the like should remain working as usual) other than the
blunt-and-something-else weapons being defined properly.
2021-09-04 14:46:11 -07:00
PatR
dd7b9f2a8a fixes entry for "Suddenly you cannot see it"
Pull request #585 fixes incorrect XOR logic caused by changes
accompanying introduction of gold dragons 5 or 6 weeks ago.

Closes #585
2021-09-04 14:29:15 -07:00
Michael Meyer
1b6dddc281 Fix: 'Suddenly you cannot see it'
Updates to m_dowear_type(worn.c) in 5a09a01a13 inadvertently reversed
the effect of an xor near the end of the function, causing it to go from
testing whether a monster's status as 'seen' or 'unseen' changed over
the course of the function to testing whether it remained the same.

As a result, whenever an unseen, invisible monster donned a piece of
armor anywhere on the map, the message 'suddenly you cannot see it'
would be printed.  Fix the xor so that it goes back to testing whether
visibility changed since the start of the function.
2021-09-04 14:21:41 -07:00
Pasi Kallinen
e61d149171 Fix eel hiding in dry land
When an eel was hiding in a pool and a rolling boulder trap
launched a boulder on top of the pool, and the boulder then
filled the pool, the eel ended up hiding on the dry land.

As a stopgap measure, kill off any monster that is in the
pool location when the boulder hits the pool. This should
probably be expanded to handle flying monsters differently.
2021-09-03 13:27:40 +03:00
copperwater
1bb686f744 Fix: replace_terrain used wrong y2 coordinate 2021-09-03 08:27:44 +03:00
Pasi Kallinen
c0dc72b3d2 Test for replace_terrain coordinates 2021-09-03 08:27:17 +03:00
PatR
3a99a5e388 fixes entry for pull request #565 - booze
Drinking booze has more impact on hero with an empty stomach.

Closes #565
2021-09-02 15:54:17 -07:00
Michael Meyer
e44de71499 Amplify booze effect if drinking on empty stomach
Drinking booze on an empty stomach will amplify its effects
(i.e. increase the duration of the resulting confusion); stuffing
yourself before drinking will have the opposite effect.
2021-09-02 15:52:39 -07:00
Pasi Kallinen
cf44cb3382 Handle buried zombifying corpses
When a zombifying corpse is buried, allow it to zombify and
dig itself out of the ground.

Also allow wishing for zombifying corpses.
2021-09-02 20:54:36 +03:00
PatR
43db84cd13 fixes entry for polyfodder patch
Add a fixes entry for the "Count all poly'ing tins as potential sliming
cures" commit.

Closes pull request #578
2021-08-29 15:40:05 -07:00
Michael Meyer
6596718acd Count all poly'ing tins as potential sliming cures
Popeye, used to check whether eating a particular tin is a potential
lifesaving action, considered tins of chameleon meat a cure for sliming
(since you can polymorph into a fiery monster), but didn't credit the
same possible curative power to other tins which can polymorph the hero.

Use the polyfodder macro (used elsewhere to check whether eating
something will polymorph a monster/pet) to determine whether a tin will
polymorph the hero.
2021-08-29 15:36:35 -07:00
nhmall
a772751745 build failure detected in CI
The build in the CI was failing after commits today due to this error:
prob error for class 4 (28%)

It was caused by running
	makedefs -o

Remove unnecessary invocation of makedefs with outdated options from
aftermakedefs.proj
2021-08-28 23:10:49 -04:00
PatR
c57abab020 delete obsolete variable 'monstermoves'
Fixes entry and EDITLEVEL increment for 'Remove g.monstermoves'
commit.  Invalidates old save file contents.

Closes pull request #579
2021-08-28 16:24:23 -07:00
copperwater
f855fb5e45 Remove g.monstermoves
It's redundant with g.moves, so there is no more need for it.

Way, way back, it looks like g.moves and g.monstermoves can and did
desync, where g.moves would track the amount of moves the player had
gotten (and would therefore increase faster if the player were hasted)
and g.monstermoves would track the amount of monster move cycles, aka
turns. But this has not been the case for a long time, and they both
increment together in the same location in allmain.c. There are no
longer any cases where they will not be the same value.

This is a save-breaking change because it changes struct
instance_globals, but I have not updated the editlevel in this commit.
2021-08-28 16:22:38 -07:00
Pasi Kallinen
b76a213caf Fixes entry 2021-08-28 17:07:56 +03:00
copperwater
0e05c94400 Remove requirement of object probs adding to 1000
When discussing the recent commit that removed makedefs -o from the
build process, nhmall pointed out that a sanity check ensuring all
objects within one class add up to 1000 probability had been removed as
well. This requirement was a perennial thorn in the side for anyone
doing anything that touches object probabilities, because allocating
probability to something meant deciding what to take it away from,
without a good way to evenly distribute that across all the other
members of the object class.

I had gotten around this in xNetHack by removing the sanity check and
making mkobj() total up the probability within an object class and then
using that instead of 1000. This commit takes a similar approach, but
instead of inefficiently recalculating the sum every time mkobj() is
called, it instead computes it at the start of the game or when
restoring the save file and stores it in a global variable.

This fixes a slight bias problem with rings - they are all supposed to
be of equal probability, but there are 28 of them and 1000 is not evenly
divisible by that, so the old formula made the later rings slightly more
likely. Now instead of a 35/1000 or 36/1000 chance, they are all
uniformly 1/28. (Internally they have a oc_prob of 1 now, not 0).

Gems are also weird, because their oc_prob values change every level.
This ought to have still worked without a change, because the arcane
formula for assigning the probabilities would still end up with them
adding to 1000. But I added in code to reset the total gem probability
anyway; this may help make the formula less arcane in the future.

There is still a sanity check against object classes having a nonzero
number of objects but zero total probability, in which case an
impossible will be thrown and every member of the class will be given
equal probability. I also downgraded the "probtype error" panic in
mkobj() to an impossible because it has a reasonable failure case -
return the first item in that class.
2021-08-28 17:03:39 +03:00
PatR
ecee4e8610 Guidebook tweaks for ^E, section 5 header
Describe #wizdetect as revealing hidden things rather than searching
for hidden things since the latter is described more than once as
possibly needing multiple tries.

For plain text output, the "Rooms and corridors" section header was
harder than necessary to notice because it seemed to run together
with the list of commands preceding it.
|
| u    #untrap
|
| 5.  Rooms and corridors
|
Inserting an extra blank line in between them is helpful.  That isn't
needed for Postscript/PDF output because the text of the section
title is rendered with bold font, but I didn't attempt to make the
extra line be conditional.  The 'roff directive is added as a comment
to the TeX source without knowing whether an extra blank line would
be useful there (doubtful).
2021-08-26 15:32:52 -07:00
Pasi Kallinen
2aaee76c5c Fix ball bypass sanity complaint
Be punished, get swallowed, drop the ball inside the monster
via the 'D' drop, kill the swallower - this issued a sanity
check complaint about the ball bypass flag.

In this case, the ball was "floating", not on any object chain,
when dropped inside the monster, so clear_bypasses didn't
clear the flag.
2021-08-26 18:46:25 +03:00
Pasi Kallinen
2f94ad489f Reindent main loop
No code change, just reindenting the main loop, as it wasn't
reindented when the inner part was split into separate function.
2021-08-26 14:19:39 +03:00
Pasi Kallinen
70b953db44 Clear bypasses at beginning of main loop
Object bypass flag is used to check if an object was already
handled in an iteration loop, in cases where the linked list order
may change during iteration. The flags should never stay set
past a turn, if any were used.

Reset the bypass flags at the beginning of the main loop, without
checking g.context.move -flag; that flag gets reset if hero lifesaved.
2021-08-26 14:12:00 +03:00
PatR
f37119f6c9 unclutter dlb's main() 2021-08-26 02:25:51 -07:00
PatR
573c4c0e63 reveal elapsed time during play
Have end of game disclosure and the ^X command display the amount
of time spent playing the current game instead of just putting that
in xlogfile.

This isn't an onscreen clock for speed runners as someone recently
asked about on reddit.  NetHack shouldn't attempt to handle that.
2021-08-25 15:02:26 -07:00
PatR
48252705b8 less elapsed time: ! and ^Z
Suppress any time spent in a sub-shell or in the background when
accumulating total elapsed play time.

This won't help for leaving the game idle instead of saving and
restoring.  That's a can of worms I'd prefer to leave sealed.
2021-08-25 14:49:58 -07:00
PatR
b1f3d1f864 elapsed time handling
The code has been assuming that time_t is some number of seconds.
That's valid for traditional Unix systems and for Posix compliant
systems but is not something guaranteed by the C standard.  (We ran
into a long time ago when trying out an alternate way to calculate
phase of moon.  That code made a similar assumption and broke one
of the ports.)

'ubirthday' also warrants being re-done but I've run out of energy.
2021-08-25 14:14:23 -07:00
PatR
52f5e79790 some restore.c reformatting
Some reformatting I did while investigating the mimic-as-strange-object
vs protection-from-shape-changers situation.  Not part of the fix for
that and no change in behavior.
2021-08-24 08:20:18 -07:00
PatR
e67f45fc5c fix #K3422 - mimic remains as 'strange object'
even when protection from shape changers is in effect.  I'm not sure
why mimicking other things doesn't trigger the same sanity check
warning.  This fix works for the strange object case and I assume
that it doesn't break the more general case.

When investigating, I noticed that save and restore (even leaving
the level and then returning) causes cancelled shape changers to be
uncancelled.  Treat being cancelled similarly to having to having
protection from shape changers in effect:  shape changer is forced
to revert to its innate form and not allowed to change shape.
2021-08-24 08:09:30 -07:00
Pasi Kallinen
a1b927a278 Use enum value, not hardcoded number 2021-08-24 11:34:28 +03:00
nhmall
6ffa912359 missed dependency 2021-08-23 22:18:55 -04:00
nhmall
81134cf8d1 Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2021-08-22 21:06:35 -04:00
nhmall
1c869ca12f curses port 2021-08-22 21:04:19 -04:00
nhmall
81cfb5c99c git hash wasn't being used on unix 2021-08-22 20:57:49 -04:00
nhmall
96d095d08d reword fixes37.0 entry 2021-08-22 19:34:12 -04:00
nhmall
61ed041c9e Windows VS build failure if DLB wasn't defined 2021-08-22 19:25:13 -04:00
nhmall
07fadd5e69 fix nhl_loadlua() failures on Windows
The [dlb_]fopen() requires an RDBMODE argument on Windows.
ftell(), fseek(), and fread() interactions can be problematic otherwise.
2021-08-22 19:25:13 -04:00
Pasi Kallinen
6dc99f69b7 Prevent impossible trying to find a door position
When random dungeon level generation looks for room walls
to place doors at (for joining corridors or creating niches),
it complained about impossible, if the shaped theme room
doesn't have a valid place for a door.

Make the position routine return FALSE and let the
caller deal with it...

Observed this with the small circular themeroom which had
all 4 valid positions already joined with corridors, and
the niche function tried to add a niche to the room.
2021-08-22 18:44:20 +03:00
nhmall
a869a018d6 ignore visual studio .user files 2021-08-22 08:12:50 -04:00
PatR
2e92b67296 tweak baby/gold dragon tile
Make the "eyebrows" yellow instead of gray for male and female baby
and adult gold dragons.
2021-08-21 23:13:26 -07:00
PatR
1c2706e083 fixes entry for gold dragon scales in bones
Closes pull request #577
2021-08-21 22:55:57 -07:00
copperwater
89835554d8 Fix: gold dragon scale mail remained lit in bones
This is caused by the bones-pile-making routine using artifact_light()
as a test for whether it needs to call end_burn. Gold dragon scale mail
uses artifact_light(), but only returns true when its owornmask is set.
But owornmask was getting zeroed right before artifact_light() is
called. Fix is to move it right after instead.

Tested that Sunsword is not affected by this (created bones while
wearing gold dragon scales and wielding Sunsword in a dark area; when
returning to them, no light was emitted from the gravesite) because it
always returns true in artifact_light() irrespective of owornmask.
2021-08-21 22:52:10 -07:00
nhmall
f785026006 remove test bit 2021-08-21 22:51:39 -04:00