Commit Graph

14336 Commits

Author SHA1 Message Date
PatR
027cf3bf4d map documentation refinement
Add minor detail to recently added map description in doc/window.txt:
origin is in upper left and positive y goes downward, so not typical
Cartesian x,y coordinate plane.
2022-10-23 15:31:12 -07:00
nhmall
b40ef88e1e nmake warning
NMAKE : warning U4004: too many rules for target 'o\x86\cppregex.o'
2022-10-23 12:38:22 -04:00
nhmall
6f20939db9 support Unicode on Win32 pr #903 2022-10-23 12:34:16 -04:00
nhmall
6fd0bd3169 Merge branch 'unicode-win32' of https://github.com/chasonr/NetHack into NetHack-3.7 2022-10-23 12:32:04 -04:00
PatR
39560aac49 fix github issue #907 - bad shade logic
Issue reported by vultur-cadens:  one of the checks for whether a
shade would be harmed by an attack was erroneously inside a block
of code that only executed when you could see the attack.  Basic
physical damage wasn't affected but some monster (or poly'd hero)
damage types that shouldn't affect shades didn't when seen but did
when unseen.

Could also get "attack passes harmlessly through the shade" when
an unseen attack for physical damage hit and failed to deal damage.

fixes #907
2022-10-23 01:11:14 -07:00
PatR
11aaa70209 build fix for mummy wrapping changes
Not sure how I overlooked this earlier, but the warning about wrong
pointer type is showing up plainly now.  Fix that.
2022-10-23 00:30:23 -07:00
PatR
9a21d7d7b0 pull request #908 - rename update_mon_intrinsics
Pull request from entrez:  rename update_mon_intrinsics() to
update_mon_extrinsics() since it deals with properties conferred
by equipment in use rather than internal capabilities.

fixes #908
2022-10-23 00:22:18 -07:00
Michael Meyer
05f004403e Rename update_mon_intrinsics to ...extrinsics
There was a TODO about this; not exactly a great challenge but it feels
like a worthwhile change since the name was misleading.  I also updated
the name of the do_intrinsics parameter of extract_from_minvent(worn.c),
since it was in a similar situation (and directly related, since it
controls whether to call update_mon_{in/ex}trinsics).
2022-10-23 00:21:44 -07:00
PatR
4e85ad85cc fixes entry for PR #904 - duplicate invlet
Pull request from entrez:  explicitly throwing 1 out of stack of more
than 1 and then having the throw be rejected by tageting yourself did
not recombine the split, resulting in stacks of 1 and N-1 that both
had the same inventory letter.  Undo the split if throwing fails.

A similar fix was made for gold a year and a half ago by commit
c3ccd93a88.

fixes #904
2022-10-23 00:18:42 -07:00
Michael Meyer
47076c3625 Fix: duplicate invlet from throwing obj with count
Specifying a count of 1 when throwing an object could leave you with two
stacks sharing one inventory letter.  The second stack gets split off
when the player specifies a count (e.g. 't1o'), but keeps its original
invlet.  Some early returns, like trying to throw at yourself with '.',
could fail to unsplit the stack.  Theoretically, specifying multiple
items to multishot and then failing to throw them all could also leave a
partial stack; I don't think this is actually possible right now with
't' but I tried to make sure it won't become a problem if greater counts
than 1 are ever allowed.

The fix doesn't affect 'f', which can be a combined "create a quiver
stack and throw" action and doesn't have the issue with duping invlets.
Specifying a count to split off a new quiver stack with 'f' shouldn't be
reverted if the throwing fails or only part of the stack is thrown,
because the newly created stack may be intended for continued use as the
quiver in future turns.  This slightly changes the behavior of the
existing unsplit when cancelling the throw (which previously unsplit the
newly created quiver and quivered the entire parent stack), but I think
this actually makes more sense -- the player only declined to throw the
new stack, not to create it (as if they canceled earlier in the action).

I routed a couple early returns through the stack unsplitting that
shouldn't actually need it (like Mjollnir and welded items) for
consistency's sake; I don't think it hurts anything.
2022-10-23 00:01:54 -07:00
PatR
86cbf9366a PR #906 - loadstone confers 'steadfastness'
Pull request by Theyflower:  carrying a loadstone prevents big
monsters from hitting their target for knockback effect, same as
wielding Giantslayer.

The PR code needed fixing (unintended switch from 'otmp' to 'obj')
so I didn't use the commeit.  The PR code also required that the
loadstone be blessed which sounds nethackish but would mean that
nobody would ever notice.  Allow carrying any loadstone to prevent
being knocked back.  It will still be a rare accident or uncommon
tactical decision.  (It doesn't happen if the target is flying or
levitating because those checks deliberately come first.)

supersedes #906
closes #906
2022-10-22 23:57:05 -07:00
PatR
84fabf764a allow big humanoids to wear mummy wrappings
A giant mummy starts out with a mummy wrapping but couldn't wear it.
Allow humanoids who are bigger than human size (including poly'd hero
when applicable) to wear such cloaks.  They won't do so if they are
invisible and the cloak would let hero start seeing them.
2022-10-22 17:14:22 -07:00
PatR
f1e2c393f2 cansee() and couldsee()
cansee(), couldsee(), and templit() are macros which are described
as boolean and used as if boolean, but they've been using bit
masking to return integer values greater than 1.  That works since
C treats any non-zero as True but doesn't match boolean intent.
2022-10-22 15:47:48 -07:00
PatR
b1f7a68636 document map column 0
Something that FIQ once pointed out:  the fact that map column 0 is
not shown wasn't explicitly described anywhere.  Add a paragraph for
NHW_MAP to doc/window.txt and describe it there.
2022-10-21 15:16:25 -07:00
PatR
2caf2423c5 menu_drop() vs ECMD_TIME
Some routines return ECMD_TIME|ECMD_CANCEL (for instance when 'a'pply
wields an item and player cancels the attempt to use it) so change
drop_menu() to test that properly.  I don't think drop() ever returns
that combined mask value but be prepared to handle time passage if it
ever does.
2022-10-21 14:31:33 -07:00
PatR
7b62b2def9 PR #896 tweak - ^X shows known container gold
When not carrying any contained gold, or the only contained gold is
inside container(s) whose contents aren't known, ^X writes one line
about the hero's "wallet".  When known contained gold is present, it
writes two lines for gold, first one about wallet with the second
one about contained gold being a continuation of the first.  Move
the conjunction that combines them from the start of the second line
to the end of the first.

So change
|Your wallet contains M zorkmids,
|and you have N more contained in your pack.
to
|Your wallet contains M zorkmids, and
|you have N more contained in your pack.

and
|Your wallet is empty,
|but you have N zorkmids contained in your pack.
to
|Your wallet is empty, but
|you have N zorkmids contained in your pack.

It evens out the line lengths a little bit and starting the second
line with uncapitalized "you" seems slightly less jarring than with
"and" or "but".
2022-10-20 16:49:25 -07:00
PatR
418fcd8764 comment typo 2022-10-20 10:39:11 -07:00
PatR
fc0f05398e getpos() reformatting
Some miscellaneous reformatting done while looking over getpos() usage
rather than reformatting of getpos() itself.
2022-10-20 10:33:38 -07:00
PatR
5226c9633d fix github issue #905 - ^A vs getpos()
Reported by entrez:  using ^A instead of #retravel after interrupted
travel can pick wrong location if cursor was previously positioned
with movement commands rather than feature targeting because it
won't be starting from the original spot.  Also, ^A after ';' will
just redescribe whatever was examined previously instead of having
the player pick a new spot.

This suppresses cursor positioning from the do-again queue so that
repeating travel or quick-look or other command that needs player
to choose a position will repeat the command but then need to have
a position chosen.  For interrupted #travel, the cursor will already
be placed on the previous destination so that's relatively painless,
but also allows a different destination to be chosen.

It adds iflags.remember_getpos that callers of getpos() could set to
be able to restore the old behavior but none do so far.

Fixes #905
2022-10-20 10:27:21 -07:00
Ray Chason
c801f3ce00 Write Unicode to text save file 2022-10-16 22:57:28 -04:00
Ray Chason
f7aa79f939 Copy Unicode to the clipboard 2022-10-16 22:32:11 -04:00
Ray Chason
c5674fd10c Fix crashes when copying to clipboard 2022-10-16 21:42:42 -04:00
Ray Chason
426ef4d8d2 Add Unicode support to the map 2022-10-16 21:42:18 -04:00
nhw_cron
f5111a7fb7 This is cron-daily v1-May-8-2022. 000files updated: Files 2022-10-15 13:26:28 -04:00
nhmall
f3079ff274 Merge branch 'pr901' into NetHack-3.7 2022-10-15 12:54:31 -04:00
nhmall
f70ad6598d pull request #901
Also, makes some Makefile lines a little bit shorter
2022-10-15 12:53:01 -04:00
PatR
e4d83d71ce missing EDITLEVEL update
The Elbereth fix changed 'struct engr' and should have included an
increment to EDITLEVEL to invalidate old save and bones files.
2022-10-15 12:28:54 -04:00
PatR
659f16070c fix github issue #900 - "Elbereth" engravings
Issue reported by vultur-cadens:  Elbereth used to be effective in
inhibiting monster movement when an object was present on the same
spot, but since 3.6.0 it isn't.  It only functions that way when the
hero--or hero's displaced image--is present these days.  So special
levels that have been using engraved Elbereth to try to protect
objects from monsters haven't been providing any useful protection.

This makes Elbereth that's engraved during level creation work like
it used to in 3.4.3 and earlier:  when there's at least one object
on the engraving's spot, monsters who are affected by Elbereth will
be affected.  [I'm fairly sure that that behavior started out
unintentionally, as a side-effect of an optimization to only check
for scroll of scare monster when there was at least one item present
which is a necessary condition for such a scroll.]

Old-style Elbereth includes Elbereth chosen as a random engraving
during level creation in addition to engravings specified in special
level definitions.  Engravings by the player don't have the required
attribute and player-engraved Elbereth behaves in the 3.6 way.

This ought to be replaced by something more general.  Perhaps a new
engraving type not usable by the player?

Fixes #900
2022-10-15 12:28:54 -04:00
PatR
e135046497 fix several monster difficulty ratings
Fix most of the things pointed out by #wizmondiff.

Weakening of placeholder 'elf' is due to recent removal of M2_STRONG
for it as part of the "orc strongmonst" changes.

I assume that the discrepancies for multiple quest leaders came about
as part of the change that allows killing the leader as an alternate
way to gain access to the lower levels of the quest, but didn't check.

I don't know what's up with 'piranha' but just changed it to match
generated value.

'{freezing,flaming,shocking} sphere' still show up as discrepancies
with hardcoded (mons[].difficulty) value higher than generated value.
They got harder when their explosion was beefed up, so the formula to
calculate difficulty ought to be updated to account for that.
2022-10-15 12:28:54 -04:00
PatR
b7d46980ce rename #wizcheckmdifficulty to #wizmondiff
Shorten the name of the recently added debug command that validates
monster difficulty values.  'wizcheckmdifficulty' was 19 characters
long, the next longest is 14 ('wiztelekinesis').  The extra width
messed up the Qt interface's extended command selection dialog when
wizard mode commands are included.  It sizes the button for every
command to fit the longest name; the increase in size from 14 to 19
made the button grid become too big for the screen.

Add monsters' base difficulty level to the #wizmondiff output.

Add #wizmondiff and #wizdispmacros to 'wizhelp'.
2022-10-15 12:28:54 -04:00
PatR
0848ae7d83 more #saveoptions
Force windowtype to be the first option written to new RC file since
its value can affect how other options are processed.  (Only saved if
comes from existing RC file, not command line.)  doset() lists a few
compound options before the rest too.  Combine the two sets of want-
to-be-first and move the handling for that to optlist.h where the only
cost is that the options are no longer in alphabetical order.
2022-10-15 12:28:54 -04:00
PatR
cb33b9ecc8 \#saveoptions fix
I hadn't ever used #saveoptions before and when I checked to see
whether the autounlock:none changes were being handled properly, I
discovered that options set via 'm O' weren't being handled at all.

This includes some miscellaneous reformatting of things noticed
while tracking down the problem.
2022-10-15 12:28:53 -04:00
PatR
de2c9a42af more PR #897 - autounlock
For the 'autounlock option', "none" is gone from the set of choices
so case 'n' can't happen anymore.
2022-10-15 12:28:53 -04:00
Michael Meyer
7b9cfe0283 Fix: error handling for invalid autounlock value
Because the existing error was the default case in a switch/case
statement only reachable if the option matched one of the expected ones
in the list, it wasn't actually reachable: something totally out of
left-field wouldn't match one of the expected options so never hit the
switch, and something that did match one of the expected options would
by definition have a first character handled by one of the cases in the
switch/case.

Do it a slightly different way that should successfully raise an
unexpected value error for 'OPTIONS=autounlock:foobar'.  I didn't remove
the default case entirely, because it could still catch an error if
some new value is added to unlocktypes[] without a corresponding case
being added to the switch statement.
2022-10-15 12:28:53 -04:00
Michael Meyer
4c98ba493b Remove explicit 'none' opt from autounlock handler
The autounlock handler included an explicit 'none' option, a choice that
gave it a different UX from similar existing compound option handlers
(e.g. paranoid_confirm or pickup_types), which set 'none' simply by
deselecting all options.  It didn't make the menu any easier to use (at
least in my experience), since in order to go from some combination of
options to 'none', you'd have to deselect everything anyway (which on
its own was enough to set 'none', so there was no reason to explicitly
select it after doing so).

Make the autounlock handler work like other compound option handlers,
such that deselecting all options is the way to set 'none', and there is
no explicit 'none' option included in the list.
2022-10-15 12:28:53 -04:00
Michael Meyer
555196d334 Move stashed gold in #attributes to its own line
The line got a lot longer than most other #attributes lines when the
hero had gold both in open inventory and in stashed containers, so break
it up into two lines (using the same approach as the pantheon info in
the first section).  Maybe this isn't necessary but it does make it
stand out less.
2022-10-15 12:28:53 -04:00
Michael Meyer
69ed033258 Make #attributes gold line match #showgold
The #showgold command now mentions (known) gold socked away in
containers in your inventory as of 706b1a9.  Since the gold info in the
attributes display and dumplog matches the output of #showgold
otherwise, update it to do the same thing.  Also refactored doprgold a
bit to be a little more compact, as opposed to enumerating all the
different combinations of gold/no gold in open inventory/containers.
This eliminated some string constants that were broken up into multiple
constants/lines (like "line 1 " "line 2"), which NetHack code style
seems to prefer to avoid.
2022-10-15 12:28:53 -04:00
PatR
05f8ed0649 monk strength
Add a stack of 2 tins of spinach near the leader on the monk quest
start level and another stack of 2 blessed tins of spinach at a
random spot on the monk quest locate level, to compensate for the
inability to gain strength from giant corpses if they adhere to
vegan or vegetarian conduct.  paxed supplied the 'tinplace' magic.

4 tins of spinach aren't nearly enough to get to 18/100, but by
uncursing the first pair, if necessary, and waiting until strength
is at least 18, they can be eaten to add 4..40 (average 22) points
of exceptional strength.  (Players choosing either of those conducts
for other roles or foodless for any role are on their own as far as
boosting Str goes, same as before.)

The special level loader needed to be modified to handle tins of
spinach.  It now accepts "spinach" as a fake monster type for an
object of type "tin".  Also added support for empty tins since it
involved the same code, and use of fake monster type "empty" with
object type "egg" to be able to create generic (unhatchable) eggs.
(Wishing for "egg" produces those by default but it also accepts
explicit "empty egg" by coincidence.)
2022-10-15 12:28:53 -04:00
nhmall
433d991335 MinGW build update 2022-10-15 12:28:53 -04:00
PatR
fc0c1e121a couple of reformatting bits
Some reformatting done while working on ATTRMAX().
2022-10-15 12:28:53 -04:00
PatR
82476afdd6 more github issue #679 - orc strength
Handle alternate values for hero poly'd into a 'strongmonst' form
more thoroughly by propagating max values other than 18/100 to the
attribute manipulation routines.

ATTRMAX(A_STR), which used to be a relatively simple expression, now
contains a function call.

Along the way, change the races[] terminator's value for 'mnum' from
0 (giant ant) to NON_PM.
2022-10-15 12:28:53 -04:00
PatR
96e933f974 PR #862 - try XLII
When strength loss is so big as to cause HP damage, but reduce
strength if the damage causes hero to revert to normal form.  There's
no point in adjusting strength before rehumanization and not fair to
do so afterward.

Also, validate strength and its intended adjustment before doing
anything else.  (Just paranoia; there's no reason to suspect that any
bad data ever gets passed in.)
2022-10-15 12:28:53 -04:00
PatR
d0ad02b616 PR #892 - one more try...
Try again to make losestr() do what's intended.  If it would take
strength below 3, it takes away HP and max HP instead.  If hero is
poly'd, those come from the hero-as-monst values.  If hero was
poly'd but isn't any more, hero-as-monst died and rehumanized as
previous self; leave max HP alone.  If hero wasn't poly'd, take
HP and max HP from their usual values, but don't take max HP below
the threshold of minimum max HP (experience level times 1).  The old
check for max HP going below minimum can't happen anymore, unless
hero was below that threshold already (which shouldn't happen; if it
does somehow, don't punish hero further).

If this still isn't right, I'll throw up my hands and my lunch.
2022-10-15 12:28:53 -04:00
PatR
fd8c9c3978 more PR #892 - strength lose due to poison
Refine pull request #802 by entrez.  Applying damage within a loop
could potentially damage the hero multiple times, maybe using up
an amulet of life saving and then killing hero anyway, or causing
rehumanization and taking further HP from normal form, or both,
causing rehumanization and then using up amulet of life saving.

Accumulate the damage in the loop and then apply it as a unit.
2022-10-15 12:28:53 -04:00
nhw_cron
2f00f8d55f This is cron-daily v1-May-8-2022. 000files updated: Files 2022-10-15 12:28:53 -04:00
nhmall
d4bb4758aa transcribe dependencies from sys/unix/Makefile.src
Transcribe the dependencies from sys/unix/Makefile.src
to sys/msdos/Makefile.GCC and sys/windows/Makefile.nmake
to bring them up to date.
2022-10-15 12:28:53 -04:00
PatR
46f2903d43 missing EDITLEVEL update
The Elbereth fix changed 'struct engr' and should have included an
increment to EDITLEVEL to invalidate old save and bones files.
2022-10-15 06:22:18 -07:00
Ray Chason
333fc71b86 Provide characters missing from Terminus fonts 2022-10-15 09:05:58 -04:00
PatR
064c9fb52e fix github issue #900 - "Elbereth" engravings
Issue reported by vultur-cadens:  Elbereth used to be effective in
inhibiting monster movement when an object was present on the same
spot, but since 3.6.0 it isn't.  It only functions that way when the
hero--or hero's displaced image--is present these days.  So special
levels that have been using engraved Elbereth to try to protect
objects from monsters haven't been providing any useful protection.

This makes Elbereth that's engraved during level creation work like
it used to in 3.4.3 and earlier:  when there's at least one object
on the engraving's spot, monsters who are affected by Elbereth will
be affected.  [I'm fairly sure that that behavior started out
unintentionally, as a side-effect of an optimization to only check
for scroll of scare monster when there was at least one item present
which is a necessary condition for such a scroll.]

Old-style Elbereth includes Elbereth chosen as a random engraving
during level creation in addition to engravings specified in special
level definitions.  Engravings by the player don't have the required
attribute and player-engraved Elbereth behaves in the 3.6 way.

This ought to be replaced by something more general.  Perhaps a new
engraving type not usable by the player?

Fixes #900
2022-10-15 02:13:39 -07:00
PatR
2e981966d0 fix several monster difficulty ratings
Fix most of the things pointed out by #wizmondiff.

Weakening of placeholder 'elf' is due to recent removal of M2_STRONG
for it as part of the "orc strongmonst" changes.

I assume that the discrepancies for multiple quest leaders came about
as part of the change that allows killing the leader as an alternate
way to gain access to the lower levels of the quest, but didn't check.

I don't know what's up with 'piranha' but just changed it to match
generated value.

'{freezing,flaming,shocking} sphere' still show up as discrepancies
with hardcoded (mons[].difficulty) value higher than generated value.
They got harder when their explosion was beefed up, so the formula to
calculate difficulty ought to be updated to account for that.
2022-10-14 14:42:54 -07:00