Commit Graph

3682 Commits

Author SHA1 Message Date
Pasi Kallinen
4d594f77c2 Split direction key showing into separate function 2016-06-03 21:08:43 +03:00
Pasi Kallinen
cc839a56c6 Clear leashmon when leash is generated, even without obj init 2016-06-03 19:33:51 +03:00
PatR
358552a587 comment formatting bit 2016-06-02 18:01:28 -07:00
PatR
94a4f57d53 farlook bullet-proofing
When examining a buried object (after detection has revealed it),
suppress setting of its dknown bit when hero is adjacent.  [That
couldn't actually happen, because the glyph on the map that we're
trying to examine would be replaced by one for whatever is on the
surface when sighted hero moved next to it, and an earlier clause
in the same test prevents blinded hero from getting to this point.]
2016-06-02 17:11:13 -07:00
Pasi Kallinen
984785b13c Give a hint that containers are looted instead of opened 2016-06-02 18:11:41 +03:00
Pasi Kallinen
8240db3445 Show in inventory which monster a leash is attached to 2016-06-02 16:35:21 +03:00
PatR
894d6c6859 detection revamp
Change most instances of detection to offer the player a chance to
move the cursor around on the map so that the getpos() autodescribe
feature can explain things that might go away as soon as the
current detection completes.  The few instances that don't offer
such a chance are the ones where everything which has been revealed
will still be there once the action finishes (such as regular magic
mapping and blessed/persistent monster detection).

There were quite a lot of inconsistencies in things like handling
for detection while swallowed or underwater.  I didn't keep track
of them to distinguish between 3.6.0, current dev code, or my patch
in progess.  They should be much more consistent now but without a
comprehensive fixes36.1 entry.

Blessed clairvoyance (divination spells at skilled or expert) now
shows monsters as well as terrain.  I first had it like that for
any clairvoyance, but having getpos/autodescribe kick in every 15
or 30 turns once you have the amulet--or pay the appropriate amount
to a temple preist--was nearly unplayable.  When it only follows an
explicit spell cast it is not intrusive.
2016-06-02 01:08:34 -07:00
PatR
a5d57430be obscure polyself message
Hero was poly'd into a hider monster and was swallowed by something.
Attempting to hide via '#monster' gave "You can't hide while you're
being held."  It correctly blocked hiding due to u.ustuck but the
feedback ignored the possibility of u.ustuck+u.uswallow.
2016-06-01 18:45:52 -07:00
Pasi Kallinen
a5d3d0fdb8 Make coyote names deterministic 2016-06-01 18:38:21 +03:00
Pasi Kallinen
5503c5e1e4 Disable object pile display when hallucinating
Hallucination shows object piles under boulders
2016-06-01 18:29:05 +03:00
PatR
4ce52dc07f iflags.save_uswallow
Some groundwork for detection enhancements.

you.h  - just formatting
flag.h - add iflags.save_uswallow so that u.uswallow manipulation ...
save.c - ... can be undone if a hangup save occurs
2016-06-01 05:58:22 -07:00
Pasi Kallinen
e138a4b069 Fix travel occasionally walking you into pools
This was a bug introduced post-3.6.0 in commit 9a2eb370e7
2016-05-31 20:41:39 +03:00
PatR
d41e097ea8 more door/chest trap detection
Make the '^' command catch up with far-look as far as identifying
trapped doors and trapped chests revealed by confused gold detect.
You need to be blinded when approaching the '^', otherwise as soon
as you can see a door or chest or whatever else is there the fake
bear trap will be removed from the map.
2016-05-31 06:37:14 -07:00
PatR
c68dfe8f52 wishing fix
rnd_otyp_by_namedesc() had an off by one error when choosing which
matching item to return, making it impossible to successfully wish
for the Amulet of Yendor, always yielding the plastic imitation.
  n == 2, maxprob == 2
  prob = rn2(maxprob); => 0 or 1
  i = 0; while (i < n - 1 && (prob -= ... + 1) > 0) i++;
always exited the loop on the first test of the condition because
subtracting 1 from 0 or 1 never yielded a result greater than 0.

It's still suboptimal:  "amulet of yendor" should find an exact match
and should never return "cheap plastic imitation of amulet of yendor"
from the partial match.

I think biasing the choice among multiple candidates based on their
generation probabilities only makes sense when all the candidates are
within the same class.  If scroll of light occurred in 5% of scrolls
and spellbook of light occurred in 10% of spellbooks (both percentages
pulled out of thin air), having "light" get a 2 out 3 chance to be a
spellbook doesn't seem right because scrolls are four times more
likely than spellbooks (in most of the dungeon; books aren't randomly
generated at all on the rogue level or in Gehennom).
2016-05-31 05:35:56 -07:00
PatR
30855febad fix #H4353 - monster gets angry after being killed
...by thrown potion.  The reported case was a shopkeeper killed by
system shock from thrown potion of polymorph, but any death (acid,
burning oil explosion, water against iron golem, holy water against
undead, demon, or werecritter) to any peaceful monster could cause
similar result.
2016-05-31 04:44:21 -07:00
PatR
71113a6971 detecting chest and door traps
When confused gold detection finds a door trap or a chest trap, it
puts a bear trap glyph/tile on the map at that location.  (They
disappear once they're within sight.)  Those should be given their
own glyphs so that they can have their own tiles, but this doesn't
do that.  What it does do is describe such fake bear traps as
"trapped door" or "trapped chest" when examined with far-look.
The '^' command--if used while blind so that '^' hasn't disappeared
yet--needs to catch up: it says "I can't see a trap there" when the
adjacent '^' is a fake bear trap.
2016-05-31 00:08:17 -07:00
PatR
7404597ac5 getpos moving to 'cmap' characters
While testing something I noticed that moving the cursor to visible '^'
by typing '^' while getpos was asking me to pick a location, it didn't
always cycle through all visible traps.  The most straightforward
culprit was after trap detection (via confused gold detection, not ^F)
had found a trap door or level teleporter in a closet that itself was
a secret corridor spot.  But it turned out to be any location that
hadn't been seen yet.  This is a substantial overhaul of the relevant
code and so far works for all the cases I've tried, but there are
bound to be cases I haven't tried yet and those may or may not work
correctly.

There's also a bunch of formatting cleanup, and some simplification of
the m/M/o/O/d/D/x/X handling.
2016-05-30 17:56:47 -07:00
Pasi Kallinen
d45d475468 Gremlin wailing in agony should wake up nearby monsters
Also allow wizmode ^G create sleeping monsters
2016-05-29 09:35:55 +03:00
PatR
0c70b1bd06 reset travel cache when changing levels
When travel fails to reach its destination, it remembers the target
spot to use as default next time.  But that spot is only meaningful
on the current level.  Discard last travel destination when moving
to a different level.

Also, discard unlocking context when changing level unless the
context is for a container being brought along (after having been
picked up since you can't unlock a carried box).  Previously, a
door pointer on the new level could happen to match the last one
being unlocked on the old level.

Discard trap setting context when changing level even if the trap
object is brought along.

Somehow the code for applying a touchstone got inserted in between
two sections of code for applying a trap (ages ago; probably since
touchstone was first introduced however many versions back), so
clean that up.
2016-05-28 19:54:19 -07:00
PatR
ea9a95d463 travel comment formatting 2016-05-28 18:39:11 -07:00
PatR
a102ee9a1a ctype tweaks
None of these explains the Windows assertion failure.
 end.c - post-3.6.0
 options.c - in #else block of #if win32
 winmenu.c - X11
2016-05-28 17:18:51 -07:00
Pasi Kallinen
bbe02dca2b Add rudimentary autoexplore to getloc
Pressing 'x' or 'X' will move the cursor to a possibly unexplored location.
2016-05-28 14:55:02 +03:00
Pasi Kallinen
ac8bde0f70 Some code reorg for the getloc nearest/farthest locs 2016-05-28 14:27:07 +03:00
Pasi Kallinen
3bbf12d8b5 Minor code reorg in gather locs 2016-05-28 13:52:53 +03:00
PatR
6459b5d301 black&white lava
Add MG_BW_LAVA to mapglyph() instead of hijacking MG_DETECT.  Used
to display lava in inverse video if color is disabled and lava is
using the same display character as water (which is the default).
(The use_inverse option must be enabled for tty to honor it.  X11's
text mode doesn't care.  Win32 does care but probably shouldn't--it's
not a case like tty where the hardware might not support it.)

This implements both MG_DETECT and MG_BW_LAVA for X11, but only if
the program is built with TEXTCOLOR enabled.  Those should work even
when color is not supported, but I suspect that configuration is
unlikely to ever be used so didn't want to spend the time to figure
out how to do it.  (The relevant data is overloaded on the color
data, so not available when TEXTCOLOR is disabled.)

The win32 revision is untested.
2016-05-28 00:51:54 -07:00
Pasi Kallinen
332780763e Merge branch 'infinite-travel-fix' of https://github.com/tung/NetHack into tung-infinite-travel-fix 2016-05-28 09:50:20 +03:00
PatR
cb14aa332d number_pad:-1 qwertz keyboard
Reported almost exactly one year ago by a beta tester proofreading
the Guidebook, the number_pad setting to support the German keyboard
which swaps the Y and Z keys is for a keyboard that is used in other
places too.  The report mentioned France and Belgium; Wikipedia's
"keyboard layout" entry mentions "Germany, Austria, Switzerland and
other parts of Central Europe".  This changes references to "German
keyboard" (there were only a couple) into "QWERTZ keyboard".
2016-05-27 18:39:17 -07:00
PatR
5987c62468 getpos of doors
Using 'd' to cycle through door locations is worthwhile when #terrain
is executing as well as when picking a location.
2016-05-27 16:10:03 -07:00
Pasi Kallinen
d51db5a992 Make getpos for doors also target drawbridges 2016-05-27 18:47:56 +03:00
PatR
49da8b87d8 '^O' command documentation and '^' command help
While looking for things in core which might conceivably trigger the
Windows ctype assertion failure (haven't found any yet), I noticed
that help_dir() was still treating ^O as a wizard mode-only command.
Also, documentation about that command was never brought up to date.

I wish this change to ^O hadn't been done.  #overview already has
a meta/alt M-O shortcut and overloading wizard mode commands makes
documentation more complicated since wizard mode stuff traditionally
has been left unmentioned.
2016-05-26 18:35:27 -07:00
Pasi Kallinen
962610f365 Reset dooridx too 2016-05-26 17:58:17 +03:00
PatR
5b85a16436 level_difficulty comment: Wizard's Tower
Add a comment addressing something I recently mentioned in the
newsgroup.
2016-05-25 17:31:57 -07:00
PatR
b8d1f44272 unix mail cleanup bulletproofing
If the recently added release routine ever gets called twice for
some reason, don't free already freed memory, or worse, was freed
here and then allocated for something else which is still in use.
2016-05-25 17:25:47 -07:00
PatR
656476e409 more #H4347 - corpse revival
When a stack of N corpses is hit by wand or spell of undead turning,
1 revives and N-1 remain corpses.  If owned by a shop, a fee for
using up all N corpses was charged and if carried at the time, the
extra N-1 became owned by the player but if on the floor, they
remained owned by the shop.  Feedback was schitzophrenic as to
whether the whole stack was involved:
 One of the <foo> corpses glows irridescently.
 You owe <shk> X zormids for them.

Split the stack so that revival explicitly operates on only 1 corpse.
It's done after the revival side of things has already succeeded or
given up, so the split will never need to be undone.
2016-05-25 01:09:45 -07:00
PatR
955c53eba5 fix #H4347 - revival of carried corpse in shop
Zapping wand of undead turning at self while inside a shop and
carrying a corpse caused the shopkeeper to claim a use-up fee for
the corpse regardless of whether it was owned by the shop.

Not mentioned in the report:  casting stone-to-flesh as self while
carrying a figurine or statue behaved similarly.
2016-05-24 18:00:57 -07:00
Pasi Kallinen
caafec1bc7 Separate permonst valid location humidity function 2016-05-23 22:19:43 +03:00
Pasi Kallinen
fdc1889d0d Allow quick pick doors and doorways in getloc 2016-05-23 21:03:10 +03:00
Pasi Kallinen
3b38c75517 Free mailbox at exit 2016-05-23 17:18:24 +03:00
Pasi Kallinen
e37da61b30 Fix valgrind complaints of uninitialized memory 2016-05-23 16:21:36 +03:00
PatR
bc91a01fdd potential ctype.h issues
A few things which might conceivably pass negative values to ctype
routines.  Some are post-3.6.0.  None of them explain the sporadic
Windows assertion failure.

Using tolower() without verifying the argument isupper() should be
completely safe when tolower() is a function but might not be when
it's a macro.  (Likewise for toupper() without islower().)  NetHack's
lowc() function is always safe, at least for ASCII.
2016-05-22 17:29:59 -07:00
PatR
c1bfa1360f mon->mhp manipulation
I've hunted for other instances where monster hit points were set
to zero or less without calling the routine that kills off the
monster (see recent mon_unslime() vs zhitm()) and didn't find any
for mhp subtraction.  I haven't checked for direct assignment yet.

For a while I thought I'd found several cases where a monster was
intended to be killed but got left with positive hit points, but
it turned out that lifesaved_monster(), of all places, was setting
them to zero.  I've moved that to its callers so that it isn't so
well hidden.  And changed several ''if ((mon->mhp -= dmg) <= 0)''
into separate subtraction and 'if' just so the mhp manipulation is
a bit more visible.

I think the only actual change here is the message for monster
being killed by lava, where glass golems now melt instead of burn.
2016-05-21 18:25:16 -07:00
PatR
4e31180933 far-look which swallowed
Change description of area outside of the swallow animation from
"interior of a monster" to "unreconnoitered".  For the animation
characters themselves, don't suppress the list of other screen
features which use the same character ('/' for wand and so on).
Add a data.base entry for "unreconnoitered" in case someone tries
to use it to look up an unfamiliar term.
2016-05-20 17:24:18 -07:00
PatR
1a47273ad5 formatting: tab removal 2016-05-20 17:01:40 -07:00
Pasi Kallinen
d9fabb9642 Unify monster use healing potions checks 2016-05-20 20:35:02 +03:00
PatR
6a11dace8e zap beam symbol descriptions
They aren't walls.

Noticed while working on a potential change for far-look while
swallowed, zap beams have a bogus description of "wall" that
showed up when looking at '/' and '\\'.  I'm guessing that vbeam
and hbeam were cloned from actual wall symbols and then lslant
and rslant got cloned from them.  There doesn't seem to be any
other reason for the description, which is both wrong and applies
to symbols which aren't on the screen at a time when the player
can use far-look to examine them.  It's been this way since the
creation of the second cvs repository used to start the current
git one; I didn't attempt to go back any farther than that.
2016-05-19 18:12:45 -07:00
PatR
6c0489cb1b mon digging lint 2016-05-19 17:34:00 -07:00
Pasi Kallinen
2ea8666583 Interrupt a multi turn action if hp or pw is restored to maximum
via UnNetHack by Patric Mueller
2016-05-19 22:04:10 +03:00
Pasi Kallinen
0db1e1ca38 Unify pet and monster digging item checks 2016-05-19 18:46:29 +03:00
Pasi Kallinen
de716ec533 Unify shop location stocking test 2016-05-19 18:05:54 +03:00
PatR
23f5526c35 shop_keeper bit
This started as formatting cleanup but ended up adding a bit more
useful information if the impossible ever gets triggered.
2016-05-18 18:13:01 -07:00