Commit Graph

2868 Commits

Author SHA1 Message Date
nhmall
76dadab568 whitespace bit 2019-10-29 13:19:41 -04:00
nhmall
a399151d01 some symbol tweaks
A few symbol-related modifications:

- fulfill a request from a blind player to allow them to
  specify a unique/recognizable character for all pets and/or
  the player in the config file for use when using a screen
  reader (S_player_override, S_pet_override). Requires sysconf
  setting ACCESSIBILITY to be set to have an effect, although
  they can still be specified in the config file.

- Config file SYMBOLS entries were not working properly on
  the rogue level. Allow ROGUESYMBOLS as well as SYMBOLS to be
  specified in the config file independently.

- When values are moved into showsyms[], the overriding SYMBOLS
  or ROGUESYMBOLS entry from the config file is used if there is
  one; if there is no overriding value for a particular symbol,
  the loaded symset value is used; if there is no symset entry
  loaded for the symbol then a default symbol is used.
2019-10-27 23:12:11 -04:00
PatR
d834ebb0ec paranoid_query bulletproofing
Make paranoid_query() (yn question requiring explicit "yes" answer)
protect itself from overly long prompt strings.  I'm not aware of
any specific overflowing queries so I temporary reduced QBUFSZ within
paranoid_query() in order to test.

For EDIT_GETLIN, don't use previous response as default if we loop
after neither "yes" nor "no" was given for paranoid confirm.
2019-10-26 19:01:49 -07:00
Pasi Kallinen
d201d302b7 Fix wizmakemap leaving genocided monsters on map
If a genocided monster was in "limbo" (migrating to the same level),
wizmakemap put it back on map.
2019-10-26 19:58:02 +03:00
PatR
757eca7fd9 fix github issue #238 - 'scores' option
Fixes #238

For the three fields in the 'scores' option's argument: top, around,
and own, if any was separated from preceding one by space(s) rather
than slash and lacked a count prefix, the argument parsing skipped
over it.  So "10t/3a/o" and "10t 3a 1o" worked but "10t 3a o" ignored
the 'o'.  The issue report was about 'own' but there's nothing special
about 'own' itself; just that it doesn't warrant a count prefix and is
usually last (in other words, normally preceded by one or both of the
other two) so more likely to trip over this.

[I thought there was another report about 'scores' misbehaving (from
quite a while ago) but couldn't find one.  If it exists, it might have
been about the same thing.]
2019-10-25 23:11:06 -07:00
nhmall
b8effef5e4 fix H9344: remove_object: obj not on floor (heavy iron ball & chain) 2019-10-22 10:02:53 -04:00
PatR
bf7e955645 mimicking slime molds
Mimic-as-slime_mold needs to keep track of the fruit index the same
way that mimic-as-corpse keeps track of corpse's monster type.  The
mimic description was changing (for '/' and ';' feedback) whenever
the player assiged a new fruit name.

That wasn't noticeable when applying a stethoscope because
mimic-as-slime_mold always yielded "that fruit is really a mimic".
Change it to report the fruit's type instead of generic "fruit".
2019-10-19 17:38:27 -07:00
nhmall
c099e0a1ff grammar fix for "That walking shoes is really a small mimic" 2019-10-19 12:05:33 -04:00
PatR
46225955bc symset and roguesymset options
For 'O's menu, make the current symbol set be pre-selected so that
the set in use is clearly marked while contemplating changing it.
Using Return or Enter will pick it again; Escape is now needed to
deliberately not make any selection.

Also, change several symbol set initializations to use the new method
of deciding whether the default symbols are still in place.
2019-10-18 18:23:47 -07:00
PatR
f114675739 containers in shops
Fix a couple of bugs I stumbled across while testing something else.
The sell prompt for a container dropped in a shop had phrasing issues.
This fixes a couple but there are more.  The message composition
assumes that contents fall into two categories:  those already owned
by the shop and those the shopkeeper is offering to buy from the hero.
But there is a third:  stuff the shopkeeper doesn't care about so
won't buy.  The count_contents() routine can supply total contents or
shop-owned contents.  Subtracting one from the other yields combined
hero-owned without any way to separate out shk-cares and don't-care.
2019-10-18 15:00:16 -07:00
PatR
4b87e858aa fix #H9312 - partly eaten food in bones shop
Dying in a shop while carrying partly eaten food would place that food
on the floor without marking it no_charge.  But marking it that way
wouldn't have helped because as bones data gets saved, every object on
the level has its no_charge flag cleared.  So 'no_charge' needs to be
explicitly set for partly eaten food in tended shops as a bones level
gets loaded.

Most of the shk.c diff is reformatting, but it does change the
get_pricing_units() routine to lie that the quantity is zero for
partly eaten food so that when multiplying with price it won't matter
whether the price has been forced to zero or been left non-zero.
2019-10-17 18:45:56 -07:00
PatR
389c496055 zap colors
One of the comments for pull request #234 mentions that the colors
for sleep and poison are backwards.  Yellow dragons had green breath.
Green dragons would have had yellow breath if they used the normal
zap symbols, but they use the poison cloud one which is green so
they had green breath.  I rarely have color enabled and had never
noticed.  (At the moment I can't find where the switch from zap to
cloud is being done.)

Pull request #234 is based on #231, about control of the shield
effect animation when resisting.  But it changes struct flags so
would break 3.6.x save file compatibility.
2019-10-17 15:50:33 -07:00
PatR
3e368b9a51 symbol set reorganization
Change the way symbol sets are loaded to make them have the same order
as they appear in the symbols file rather than being reversed.

Revise dat/symbols so that the new ordering yields a result similar
to the old ordering, more or less.  I've added a few set descriptions.
The only substantive change is marking DECgraphics as primary-only
(not available on rogue level) and adding new set DECgraphics_2 which
is commented out near the end.

Define symbol handling H_MAC since one of the sets specifies
'handling: MAC'.  All H_MAC is used for now is to avoid showing
MACgraphics as a symset when compiled without MAC_GRAPHICS_ENV (which
was used for pre-OSX Mac by the old code in sys/mac/), so it will be
hidden for everyone.

I left handling H_CURS even though curses doesn't implement anything
for it.  It could do something when rendering the map or assign a
function to 'cursesgraphics_mode_callback' for special init or both
but hasn't needed to.  Since curses is now supporting DECgraphics,
define 'decgraphics_mode_callback' for it.  No value is being
assigned so that doesn't do anything; curses seems to be setting up
the primary character set as text and secondary one as line-drawing
without the need for that hook.

With the added set descriptions, 'O's symset menu looked horrible for
curses due to the way curses decides to set the width of menus and
the resulting line wrapping which took place because of a too-narrow
menu.  I've added a chunk of code to the options handling code which
shouldn't really be there but makes the menu much easier to read.

Lastly, do some formatting cleanup in files.c.
2019-10-17 05:00:58 -07:00
PatR
33d33fcf19 fix curses build warning and update fixes36.3
Move a declaration that became mid-block when a preceding 'if () {'
got removed to top of block suppress warning about C99 feature.

Add new entry for the curses symset change to fixes36.3.
2019-10-16 16:19:51 -07:00
PatR
32e2d7cfc5 fix use_inverse (aka wc_inverse) for curses
Highlighting for monsters shown due to extended monster detection and
for lava shown in black and white didn't work because that keys off
of 'iflags.use_inverse' (actually a macro for 'iflags.wc_inverse') and
curses wasn't enabling that window-capability option.  To be fair, it
was probably unconditional at the time the curses interface was first
developed.  It checked for whether a monster was supposed to be drawn
with inverse highlighting but wouldn't draw it that way because the
flag was always false.  Inverse b&w lava is relatively new and curses
hadn't been taught about it.

Various other things such as pets (if hilite_pet is on) and object
piles (if hilite_pile is on) get highlighted with inverse video when
use_color is off, regardless of whether use_inverse is on or off.
That's probably a bug.
2019-10-14 02:28:27 -07:00
Pasi Kallinen
f200397689 Fix monster triggering land mine accessing deleted trap
mintrap -> thitm -> mondied -> relobj -> mdrop_obj ->
flooreffects -> deltrap

after calling thitm, the mintrap code was trying to access the trap.
2019-10-13 20:52:38 +03:00
Pasi Kallinen
346ebbce10 Fix launched object accessing a deleted trap
In launch_obj, the code first got the trap, then called ohitmon
(which can delete the trap by doing mondied -> fill_pit ->
flooreffects -> deltrap), then after that used the trap variable.
2019-10-13 20:40:58 +03:00
Pasi Kallinen
1f7095e226 Fix addressing deleted trap when helping monster out of a pit
Move reward_untrap before fill_pit, as the trap may get deleted.
2019-10-13 19:58:27 +03:00
Pasi Kallinen
9e9ee59ca7 Fix hero hiding under a statue shattered by land mine
Trigger a land mine while being polymorphed into a monster that
automatically hides (eg. scorpion). Have the statue on the land mine
shatter and all items on that square scatter away. Avoid falling
into the pit left by the land mine.
2019-10-13 19:30:32 +03:00
PatR
1fc8d7528c fix #H9298 - corpse mismatch
Corpses for dying monsters were being created with the wrong type,
caused by incorrect block nesting for 'if (ptr)' from commit
ad302fb8a9 (Oct 10).
2019-10-12 02:31:47 -07:00
Pasi Kallinen
46adb312e7 Fix priests and shopkeepers moving on other monsters 2019-10-11 20:24:17 +03:00
Pasi Kallinen
ab30c3d79d Fix vault guard impossible
... when the guard is angry, and he's in the vault or in his corridor,
you're not in the vault nor in his corridor, and the level is full
so the guard cannot relocate.
2019-10-11 20:11:28 +03:00
Pasi Kallinen
02b9368dba Fix fired iron ball sanity error
When hero was punished and swallowed, and fired the attached
iron ball from a quiver, thrownobj was not cleared.
2019-10-11 20:02:06 +03:00
PatR
e4f3559acc curses on unix - terminal reset needed after abort
Noticed while investigating the message loop.  If I had level files
from an interrupted game and was asked "Destroy old game?" when
starting a new one, answering 'n' left the terminal in an unusable
state.  Executing 'stty sane' (invisibly since input echo was off)
repaired things but the user shouldn't have to do that.

Change unixtty.c's error() to shut down windowing if that has been
initialized.  This might need some tweaking for tty, which will now
clear the screen before showing the startup error message.  Other
systems besides unix use unixtty.c so are affected, but I think the
change doesn't introduce anything that should cause trouble (aside
from the potential screen erasure).
2019-10-09 13:18:34 -07:00
Pasi Kallinen
e92445810f Fix ball and chain sanity
Scatter did not consider the ball or chain, and moved them around, causing
ball and chain sanity error.

One way to trigger was being punished, with chain on a land mine and having
a monster trigger the mine. Now the chain will shatter, unpunishing the hero.
2019-10-08 19:47:51 +03:00
PatR
80d3abcf00 fix github pull request #26 - validating #explore
Fixes #26

Report stated that the attempt to look up the player's username
(on Unix) failed (reason unknown) and nethack refused to allow the
player to execute the #explore command even though sysconf was set
to use character names (CHECK_PLNAME=1) instead of user names.
Setting EXPLORERS to "*" overcomes this glitch, but the fix moves
a bit of code around to honor CHECK_PLNAME before fetching username
so that that isn't necessary.

I ended up doing some formattng clean up (replace tabs with spaces,
whitespace cleanup in 'port_insert_pastebuf()').  The actual change
to fix #26 is only a few lines.
2019-10-06 17:30:18 -07:00
PatR
f7bf56555e fix pull request #227 - running over engravings
Fixes #227

Travel, <ctrl><direction>, <g|G><direction> all stop on engravings,
but <shift><direction> told the player what the engraving said and
kept going.  The message output is buffered until map update or
another message, so player couldn't tell where hero was at the time
the engraving got shown.  Make <shift> running stop on engravings.
2019-10-05 16:42:13 -07:00
PatR
f11f4de057 sortloot of tools
Fix the first part of github issue 229.  sortloot_classify() tries to
group musical instruments separately from other tools, but missing
'break' in a 'switch' prevented that from happening--they were mixed
together.

Since that grouping isn't documented anywhere, only source divers
would ever notice that it wasn't working as intended.
2019-10-04 16:37:14 -07:00
PatR
f3bc5e5c78 fix #H9272 - "object lost" panic
when polymorph causes loss of levitation boots or water walking boots
while over water.  If discarding stuff while trying to crawl out got
rid of the taken-off boots, they wouldn't be in inventory any more
when break_armor() tried to drop them after taking them off.
2019-10-04 16:12:08 -07:00
PatR
8fa38ec8fb fix 'b&c distance' sanity check warning
when attempting to crawl out of water fails and hero is life-saved
or wizard-/explore-mode player declines to die.  If the hero is saved
by positioning him/her one step further away from ball and chain,
teleds() tries to drag them, but if 'emergency disrobe' left the hero
stressed or worse, dragging fails.  Ball and chain were being left
where they were, with chain no longer being adjacent to hero.

If drag_ball() fails, have teleds() teleport ball and chain to hero's
new spot, same as when that isn't within range of a one step drag.
2019-10-04 15:16:51 -07:00
PatR
d9a1bbb203 fix #H9269 - potential panic due to window slots
A couple of early returns could result in temporary windows getting
left around instead of being released for re-use, which in turn might
lead to a panic due to lack of available window slots.  The first
one is accompanied by an 'impossible' warning which no one has ever
reported and the second one could only happen if data file 'keyhelp'
was missing, so panic due to either of these is hypothetical as far
as released versions go.  Somebody making modifications could run
afoul of either of them though.

query_category() - switch from early return to 'goto' so that the
  temporary window used for a menu will always be destroyed;
whatdoes_help() - defer creating the display window until after the
  data file has been successfully opened so that early return won't
  need any window cleanup.
2019-10-03 15:45:43 -07:00
nhmall
acf45be503 Guidebook.txt update 2019-10-02 10:56:39 -04:00
nhmall
59effabd73 Revert "Guidebook.txt update"
This reverts commit df7e6a0f2a.

stamped with incorrect version
2019-10-02 10:50:04 -04:00
nhmall
df7e6a0f2a Guidebook.txt update 2019-10-02 10:47:47 -04:00
nhmall
38b529c3e7 fix a Guidebook.tex bit just noticed 2019-10-02 09:46:30 -04:00
nhmall
1df652683e allow orctown booty items to be initialized in mksobj 2019-10-01 21:06:07 -04:00
nhmall
e520071f52 update guidebook 2019-10-01 19:57:04 -04:00
nhmall
29946b551b autopickup exception priority in pull request 226
The pull request #226 commentary follows:

One major limitation of the autopickup exception system is that you can't
define an exception from an exception, despite both menucolors and msgtypes
prioritizing rules based on the order they are defined in .nethackrc. This
is because the "always pickup" and "never pickup" exceptions are tracked in
different lists, and at runtime, when the player steps over an object, the
game checks these lists seperately, with "never pickup" taking precedence.
This means that if you want to pick up some but not all items matching a
given expression, you may need to write a long and kludgy list of regexes
to get the behavior you want.

I've edited the autopickup exception code to remove this necessity: now
the exceptions are stored in one list, and conflicts between them are
resolved based on their relative position in that list. Whether an
exception was inclusive or exclusive was already tracked individually;
I don't know why they were stored separately in the first place. This
edit makes the system both more convenient and more consistent with the
semantics of menucolors and msgtypes.

With these changes, the 33 autopickup exception rules in the wiki article
linked above may be replaced with the following 7 much simpler rules for
the exact same effect:

AUTOPICKUP_EXCEPTION=">.* corpse.*"
AUTOPICKUP_EXCEPTION="<.* newt corpse.*"
AUTOPICKUP_EXCEPTION="<.* lichen corpse.*"
AUTOPICKUP_EXCEPTION="<.* lizard corpse.*"
AUTOPICKUP_EXCEPTION="<.* floating eye corpse.*"
AUTOPICKUP_EXCEPTION="<.* wraith corpse.*
AUTOPICKUP_EXCEPTION=">.*\>.*"

closes #226
2019-09-30 10:54:03 -04:00
nhmall
da6c393e43 fix errant verb tense in some messages if pet or mon name ends in 's'
Report stated:
"Poes deliberately slither onto a polymorph trap!" ... it's only one cat, er,
black naga. Why does the parser treat the name as plural? There are lots of
singular words and names that end in -s or -es!

H9249 1780
2019-09-26 11:49:15 -04:00
nhmall
9361e872b2 fix uarmh null pointer dereference
uarmh null pointer dereference if a helm of opposite alignment came off due
to being polymorphed

fixes #225
2019-09-24 12:32:58 -04:00
PatR
348f968132 fix add_to_minv panic when aklys kills enfulger
Reported directly to devteam rather than via the web contact form:
throwing wielded aklys while swallowed would hit the engulfer and
return to the hero's hand but leave a stale 'thrownobj' pointer if
the monster survived.  Under usual circumstances, throwing anything
else or throwing the aklys again when not engulfed would clear that
pointer, putting things back to normal.  However, killing any engulfer
with the same weapon would try to add it to engulfer's inventory to
be dropped as it died.  If the killing blow was via melee rather than
another throw, the object in question would still be in hero's
inventory instead of free, hence panic.

The initial returning-aklys implementation shared Mjollnir's code
which doesn't have this issue.  This reverts from having attached
aklys always returning successfully when thrown while swallowed to
Mjollnir's 99% chance of return and 99% to be caught when it does
come back.  (That was already the case if the engulfer was killed by
the throw, where hero wasn't swallowed anymore after the damage was
inflicted.)
2019-09-23 15:16:39 -07:00
PatR
0434437e99 fix #H9232 - message phrasing for openholdingtrap
Zapping wand of opening or spell of knock at self while trapped:
"You are released from pit."
ought to be
"You are released from the pit."
Likewise for most of the other held-in-place situations.

Also, when released like that vision wasn't being recalculated right
away to update line of sight to reach beyond the edge of the pit.
2019-09-22 15:03:52 -07:00
PatR
b1154399f1 fix github issue 223 - rubbing ring on touchstone
Fixes #223

The touchstone code treated all rings as if they had gemstones, but
quite a few don't and feedback could be unexpected.  Cited case was
an iron ring yielding a cyan (hi_metal) streak instead of the normal
iron result ("scritch, scritch").  A gold ring yielded a yellow
streak rather than a golden scratch.  I didn't test silver ring but
suspect it yielded a silver streak rather than a silvery scratch.

This changes touchstones to treat non-gemstone rings like other
classes of objects instead of like gems.  I made mineral rings keep
acting like gemstone rings--I'm not sure whether that's right.
2019-09-19 12:48:41 -07:00
PatR
6569631180 fix github issue 221 - unfixable troubles
Fixes #221

Routine unfixeable_trouble_count() is used for both applying a unicorn
horn (possibly internally via #monster if poly'd into a unicorn) and
drinking a blessed potion of restore ability.  For the latter case, it
always gave the wrong answer (unless the hero happened to be all of
Sick and Stunned and Confused and Hallucinating and Vomiting and Deaf).
Since the actual count wasn't used to decide whether hero felt "great"
or just "good", having any of those conditions would hide the problem.
2019-09-18 11:37:11 -07:00
PatR
fd03a1b310 github pull request - man page typo
Fixes #205

"at last" should be "at least".  doc/nethack.txt is now out of date.
2019-09-14 18:04:33 -07:00
PatR
5589a16d74 github pull request - "You are <a foo>[.]"
Fixes #215

A post-3.6.2 change added a message for life-saving which lack its end
of sentence punctuation.
2019-09-14 18:00:39 -07:00
nhmall
2a66ce54ad use faster method to write characters to VGA in msdos port
chasonr's comments in github pull request #220:
It was necessary, when updating the MS-DOS port for 3.6, to revise the
screen-clearing and character-drawing functions, because the background
color is no longer zero. But the 3.6.1 method is rather slow, using
write mode 2 and a lot more calls to outportb.

outportb is expensive when running under a virtual machine, the typical
use case for the MS-DOS port these days, because it traps to the
hypervisor rather than actually writing to hardware.

This change restores the speed of the 3.4.3 version. The adapter is left
in write mode 0. Clearing is accomplished by writing zero to planes where
the background color has a zero bit, and 0xFF where the background color
has a one bit. Characters are drawn by writing 0x00, 0xFF, the font data,
or the inverse of the font data, as appropriate, to each plane.

When testing, be sure to use OPTIONS=videomode:vga, because autodetect
will go to VESA mode if it can.

closes #220
2019-09-13 00:38:04 -04:00
PatR
1a97dce727 fix github issue 218 = hallu vs passive gaze
Fixes #218

Hallucinating hero has 75% to be unaffected by a gaze counterattack
that paralyzes.  Check for that before checking free action (100%
chance to be unaffected).  The only change is that player might get
different feedback when both forms of protection against the gaze.
2019-09-06 14:39:25 -07:00
Pasi Kallinen
6426e61860 Prevent a possible impossible when guard relocated a monster 2019-09-06 22:09:03 +03:00
PatR
8cf70f7771 fix github issue 217 - monster spellcasting feedback
Fixes #217

Feedback when spellcasting monster aimed at the wrong spot due to not
being able to see an invisible hero only gave the intended message if
hero couldn't see self.  The code was using 'if (Invisible)' which
checks whether the hero is invisible and can't see invisible, when it
should have been using 'if (Invis)' which just tests whether the hero
is invisible.

It wouldn't surprise if the same problem occurs elsewhere.  Those
macros are rather error prone.

The issue report mentions that one of the affected messages might be
unreachable.  I didn't investigate that.
2019-09-02 02:59:09 -07:00