Pasi Kallinen [Thu, 24 Feb 2022 16:55:11 +0000 (18:55 +0200)]
Most traps now require touching the floor to trigger
It was silly how some clearly mechanical traps didn't consider
flight or levitation when to trigger. Do those checks in dotrap/mintrap
making hero and monster trap triggering match more closely.
Pasi Kallinen [Thu, 24 Feb 2022 14:23:56 +0000 (16:23 +0200)]
Make trap return values more consistent
Instead of returning monster's mtrapped-state, return specific
trap return values.
Add one extra trap return value, for when a monster was
moved by the trap.
Michael Meyer [Wed, 23 Feb 2022 17:58:43 +0000 (12:58 -0500)]
Fix: monster hurtling and liquid
A monster hurtling over liquid would drown immediately the instant it
touched the first square of water, even if normally it would have kept
moving (e.g. hurtling over a short moat). Additionally, its placement
on liquid would not take into consideration other monsters, so it could
overwrite an existing monster on that spot and lead to an impossible,
and/or two monsters occupying a single position.
Fix these issues, so that liquid effects like drowning only happen if
the monster ends up in liquid at the end of the hurtle, and so that
other monsters in the way will stop it early even if they're floating
over or swimming on a pool/water/lava square.
Also use canspotmon instead of canseemon for the wiztelekinesis debug
command.
PatR [Wed, 23 Feb 2022 17:50:25 +0000 (09:50 -0800)]
fix #K3529 - perm_invent not IDing blank scroll
Report was for curses but issue is in the core so any interface
that supports persistent inventory is affected. Reading a not-yet-
discovered scroll of blank paper wasn't always updating perm_invent
to show change in formatted description when it became discovered.
Would only happen on turn #1 (so the scroll needed to be acquired
via autopickup at starting location or via wizard mode wish so that
it could be read before any game time elapsed) when the object
discovery routine deliberately avoided updating perm_invent. Fix
by using a different way than moves==1 to decide whether an object
is being discovered because it is part of hero's initial inventory.
PatR [Tue, 22 Feb 2022 20:12:13 +0000 (12:12 -0800)]
more sleeping monster
Extend the PR#660 change that shows whether a monster is asleep when
examined by farlook/quicklook/autodescribe to monsters that aren't
moving due to timed sleep as well as those that are asleep for an
unspecified amount of time. Unfortunately 'mfrozen' isn't specific
about why a monster can't move so the phrasing is less than ideal.
Pasi Kallinen [Tue, 22 Feb 2022 10:26:03 +0000 (12:26 +0200)]
Start with a level 1 spell and enough power
Ensure the first spell - if any - given to the hero in initial
inventory is level 1 - otherwise you can end up with a situation
where the hero knows level 3 spells, but won't have enough power
to cast them.
If the hero starts out with a spell, ensure enough power (5)
to cast that level 1 spell.
Pasi Kallinen [Tue, 22 Feb 2022 07:13:28 +0000 (09:13 +0200)]
Adjust sleep spell, and monk starting spell
Tone down sleep level to 3 (hitting a monster does tend to wake
it up), and replace the random monk starting sleep spell with
confuse monster, which fits nicely with monk's bare-handed
fighting style.
PatR [Mon, 21 Feb 2022 18:59:42 +0000 (10:59 -0800)]
Unix command line bit
For the !SYSCF configuration, the command line processing still checks
for a value for maximum number of simultaneous players. The recent
revisions would have accepted a negative value. I don't know whether
anything interesting would have happened if someone did that.
Pasi Kallinen [Mon, 21 Feb 2022 17:30:52 +0000 (19:30 +0200)]
Adjust enchantment spell levels
The enchantment spells were skewed towards lower spell levels,
and didn't seem to correspond with the spell effectiveness or
power. Adjust the spell levels:
- Confuse monster is probably the least powerful enchantment, and
also requires touch to work, so make it the new level 1 spell.
- Sleep is quite powerful, and ray, bump it to level 4.
- Charm monster is even more powerful so make it level 5.
(Considering that create familiar is level 6)
old new
sleep 1 4
confuse monster 2 1
slow monster 2 2
cause fear 3 3
charm monster 3 5
Also swap sleep and confuse monster generation probability.
PatR [Sun, 20 Feb 2022 22:46:59 +0000 (14:46 -0800)]
fixes entry for pull request #683 - just picked
Pull request from argrath: the code that decides whether to add 'B'
for blessed items, 'X' for unknown bless/curse state and so forth
when setting up prompting for the 'I' command was counting up the
recently introduced "just picked up" category using an uninitialized
variable. So it might erroneously include 'P' as a choice when no
such items were present.
PatR [Sun, 20 Feb 2022 21:52:18 +0000 (13:52 -0800)]
makedefs exit control
Have makedefs do through a common point when exiting, in case it ever
needs extra memory or scratch file cleanup.
While testing, I discovered that the reference use of 'makedefs -o' to
build obsolete onames.h didn't work anymore because of the change to
not require object probabilities to add up to 1000 within classes.
I think fixing that is the only change besides new 'makedefs_exit()'.
PatR [Sun, 20 Feb 2022 21:47:31 +0000 (13:47 -0800)]
memory management for 'nomakedefs'
The nomakedefs struct starts out with static values, then if/when
populate_nomakedefs() is called, the fields are given dynamic values.
free_nomakedefs() needs to know what state it's in.
A big chunk of this if just formatting for indentation.
Pasi Kallinen [Sun, 20 Feb 2022 16:27:23 +0000 (18:27 +0200)]
Make looting less tedious
I've seen complaints how looting containers is tedious, and
since multiple containers in the same location are now (and have
been for a while) handled with a menu, the yes-no-quit prompt
for a single container doesn't really mean anything.
Remove that prompt, and remove the "open carefully" message too,
so when you're looting a location with a single container, the
command will drop straight into the loot-in-out -menu. Also
adjust one looting message to explicitly mention the container
if there are other objects on top of it.
Removing the prompt means you can't loot a saddle from a tame
monster with plain loot when standing on a container - you need
to prefix the loot command with 'm' prefix in that case.
PatR [Sat, 19 Feb 2022 19:24:28 +0000 (11:24 -0800)]
gamelog: hit with wielded weapon for first time
Reordering "killed for the first time" and "hit with a wielded weapon
for the first time" was done by moving the latter to hmon(). Hitting
with an applied polearm also gave the first-hit message since it
bypassed the routine that had been doing so. But the throwing code
that handles applied polearms calls hmon() for damage, so after that
reordering, the first-hit log message became duplicated if triggered
by polearm usage.
Also, fix a quibble with the wizard mode conduct message given after
never-hit-with-wielded-weapon conduct has been broken. The message
said "used a wielded weapon N times" when it meant "hit with a wielded
weapon N times". "Used" is misleading if that wielded weapon happens
to be a pick-axe, so change the message to say "hit with".
PatR [Fri, 18 Feb 2022 22:38:24 +0000 (14:38 -0800)]
Unix command line parsing
Move a bunch of stuff out of main() into new early_options(): '-dpath'
playground directory handling, '-s ...' show scores instead of playing,
and the 'argcheck()' options: --version, --showpaths, --dumpenums,
and --debug (not to be confused with -D). Also introduce
| --nethackrc=filename
| --no-nethackrc
to control RC file without using NETHACKOPTIONS so that that is still
available for setting other options. They can start with either one
or two dashes. --no-nethackrc is just --nethackrc=/dev/null under the
hood. '-dpath' can now be '--directory=path' or '--directory path'
but the old syntax should still work. '-s ...' can be '--scores ...'.
Basic call sequence in unixmain relating to options is now
|main() {
| early_options(argc, argv[]);
| initoptions(); /* process sysconf, .nethackrc, NETHACKOPTIONS */
| process_options(possibly_modified_argc, possibly_modified_argv[]);
|}
Options processed by early_options() that don't terminate the program
are moved to the end of argv[], with argc reduced accordingly. Then
process_options() only sees the ones that early_options() declines to
handle.
Most early options were using plain exit() instead of nh_terminate()
so not performing any nethack-specific cleanup. However, since they
run before the game starts, there wasn't much cleanup being overlooked.
chdirx() takes a boolean as second argument but all its callers were
passing int (with value of 1 or 0, so it still worked after being
implicitly fixed by prototype). Change them to pass TRUE or FALSE.
argcheck() was refusing (argc,argv[]) with count of 1 but then it was
checking 0..N-1 rather than 1..N-1, so it tested whether argv[0] was
an argument instead of skipping that as the program name. Change to
allow count of 1 with modified argv that has an option name in argv[0].
That happens to fit well with how early_options() wanted to use it.
Martial arts users never deal no damage with a clumsy kick
From EvilHack, under the basis that anyone trained in martial arts (or
is in a powerful kicking polyform or wearing kicking boots) should be
immune from landing such a poor kick. This bypass used to happen only
50% of the time; now it happens all the time.
Note that this only averts the "Your clumsy kick does no damage" case:
it remains possible for a powerfully kicking player to kick clumsily and
have the monster evade or block, for example if they are fumbling or
wearing bulky armor.
Also, documentation: I added a comment explaining what the incredibly
dense and confusing logic is with i and j happening here, for the next
poor soul that has to read that code.
Pasi Kallinen [Thu, 17 Feb 2022 07:12:03 +0000 (09:12 +0200)]
Fix fire auto-swapweaponing to polearm
When you have a polearm as secondary weapon, have a fireassist on,
and press 'f' to fire, the code tries to swapweapon to the polearm.
This failed badly and got stuck in a loop if you were also wearing
a shield - as polearms are two-handed and shield prevents wielding
those.
Add a new "command failed" result, and clear the command queue
in that case. Also make swapweapon and wield actually return
the ECMD flags back to the rhack loop.
PatR [Wed, 16 Feb 2022 08:36:26 +0000 (00:36 -0800)]
groundwork for nethackrc name on command line
I've implemented 'nethack -nethackrc=filename' as an alternative to
'NETHACKOPTIONS='@filename' nethack' but at the moment it doesn't
work because the command line parsing comes after the run-time config
file has already been processed. But this part should work, or maybe
have problems spotted and fixed if it doesn't. The RC file part of
initoptions_finish() has been rewritten so that it won't need extra
replication of
| set_error_handling()
| process_file()
| reset_error_handling()
| if (NETHACKOPTIONS) {
| set_error_handling()
| process_options()
| reset_error_handling()
| }
I've tried to test all the combinations mentioned in the comment but
am not sure that I covered everything, particulary for repeating
earlier tests after making incremental changes.
PatR [Mon, 14 Feb 2022 19:18:08 +0000 (11:18 -0800)]
Unix argcheck() usage
The checking for command line flags --version, --showpath, and one
or two others was inside #if CHDIR. I don't know whether anyone
ever disables that configuration option, but it shouldn't control
whether those flags are handled.
PatR [Mon, 14 Feb 2022 18:57:49 +0000 (10:57 -0800)]
man page update
For nethack.6, include the recently added 'optmenu' help file among
the list of files.
I didn't do anything about '-windowtype=xyzzy' though; there are some
other command line changes in the pipeline. The existing '-w' that
the new longer form enhances isn't in there either.
I took my name out for the claim of copyright. I've barely ever
touched this file. We see if that breaks the automated processing.
PatR [Sat, 12 Feb 2022 19:42:17 +0000 (11:42 -0800)]
unix command line
I wanted to be able to specify -windowtype:foo on the command line so
that I didn't have to use "NETHACKOPTIONS='windowtype:foo' nethack"
and it turned out that such an option already exists, as "-wfoo".
I either never knew about that or had completely forgotten it. Anyway,
this makes specifying windowtype be more versatile.
"-wX11" still works; now "-w X11", "-windowtype=X11", "-windowtype:X11"
work too, with "--" variations of the latter too also supported. The
long name can be truncated to any leading substring of "windowtype",
although it has to be at least "wi" for "--"; "--w" is rejected.
Also, any errors reported while processing the command line are
treated like config file processing errors rather than just delivered
with raw_printf(). On tty at least, they used to vanish when the
screen cleared to start the game, with no chance to read them. Here's
an example from after this change. It sets windowtype to tty and then
overrides that with X11.
|% ./nethack --w:Qt --win tty -wX11 -windowtype
|
|
| * Unknown option: --w:Qt.
| * Window type [nothing] not recognized. Choices are: tty, curses, X11, Qt.
|
|2 errors on command line.
|
|
|Hit return to continue:
This should probably be better integrated with argcheck() or vice
versa but the only change to that was a couple of formatting bits.
Anything that already worked should continue to work just the same,
aside from the improvement to the error feedback.
PatR [Sat, 12 Feb 2022 15:56:14 +0000 (07:56 -0800)]
fixes entry for pull request #677 - com_pager
From argrath, have com_pager_core() check for null return from
nhl_init() to pacify some code checker. If nhl_init() ever fails,
the program will never get far enough to try to use com_pager().
Pasi Kallinen [Sat, 12 Feb 2022 14:30:39 +0000 (16:30 +0200)]
Add paranoid:swim to prevent typoing into water or lava
In the name of accessibility: Prevent moving into dangerous liquids.
Now with themed rooms, water and lava are more common, and it's
unreasonable to expect blind players to check every step for those.
With paranoid:swim, just prevent normal walking into those liquids,
unless you prefix the movement with 'm', or if the liquid would not
harm you.
Doesn't completely prevent an accidental dunking - for example
if the hero is impaired or couldn't see the liquid.
This comes from xNetHack by copperwater <aosdict@gmail.com>
with some changes to the code.
PatR [Sat, 12 Feb 2022 15:28:40 +0000 (07:28 -0800)]
tty PICK_NONE menus
When testing the menu/incomplete map situation I noticed that <return>
didn't work to dismiss the "list autopickup exceptions" menu. <space>
or <escape> was required. That was clearly intentional but doesn't
seem reasonable. Make <return> behave the same for PICK_NONE as it
does for other menu modes in tty and as it does for other interfaces.
PatR [Sat, 12 Feb 2022 14:48:42 +0000 (06:48 -0800)]
fixes entry for pull request #673 - incomplete map
Sometimes tty left part of the screen blank after covering the entire
screen with a menu and then switching to a smaller menu that should
have redrawn the map as background. To reproduce:
| O - puts up a big menu
| : - enter a search string: "autopickup exception"
| <return> - dismiss the menu after the search makes one match
The autopickup exceptions sub-menu will be shown, with a small border
of map around it but most of the screen blank. (This behavior was
present before 3.6.0 but may not have been noticed because when the
discovered map doesn't extend to the corner menu's area, the blank
map probably seemed to be intentional. But if a fringe of map gets
drawn around the menu, that clearly isn't intended.) The incomplete
map is temporary; once menu is dismissed, it gets redrawn properly.
This adds a flush_screen() call after one particular docrt() call.
Perhaps docrt() should end with its own flush_screen() instead, but
that would require a lot more testing.
Michael Meyer [Tue, 8 Feb 2022 22:45:12 +0000 (17:45 -0500)]
Fix: tty map weirdness after 'full-screen' menu
When a 'full-screen' (cw->offx and cw->offy both 0) menu was immediately
followed by an offset menu -- as in the case of selecting certain
options from the options menu, or using loot to take out/put in items
after using ':' to describe the contents of a very full container --
there were some odd interactions with the map.
Only certain parts of the map near/under the menu window would be
redrawn if the first offset menu was followed by another one, while
a getlin prompt would cause the entire map to be redrawn, with parts
intersecting the window being drawn on top of it and obscuring it.
Flushing the display immediately after the docrt call when closing a
full-screen menu seems to fix both these issues.
PatR [Sat, 12 Feb 2022 00:17:17 +0000 (16:17 -0800)]
fix gamelog 1st kill vs 1st weapon hit sequencing
If the first monster the hero kills is killed by the hero's first hit
with a wielded weapon, report the hit first and kill second instead of
the other way around. Not as hard to manage as I feared, but bound to
be more fragile than the simpler handling that produced the odd order.
Also while testing it I knocked something into a polymorph trap and it
changed form without any feedback. Give foo-changes-into-bar message
if the hero is moving and can see it happening. It isn't needed with
a monster moves deliberately into a polymorph trap but probably would
be useful when that's is unintentional.
The "<hero> enters the dungeon" log message had a trailing period but
other log messages don't have sentence punctuation, so take that off.
PatR [Fri, 11 Feb 2022 22:43:01 +0000 (14:43 -0800)]
apple pasteboard
Turning on -Wformat-noliteral for Mac triggered a new warning.
Blindly suppressing the warning would have silenced it but would
also have left a real bug in place. The former format was passing
a string argument to %d format.
This converts the format to a literal with an additional argument
for the non-literal part. It compiles cleanly but I don't know how
to test it, let alone force an error for it to report.