Commit Graph

11844 Commits

Author SHA1 Message Date
nhmall
49c008fcee Windows nmake build - recognize VS 16.8.5 2021-02-20 11:53:17 -05:00
PatR
a32002eb88 X11 getline: log prompt and response
After player has responded to a getline prompt, echo the prompt
and the line of text response to the message window.  Uses pline()
so also gets put into core's message history for dumplog.
2021-02-19 15:38:31 -08:00
PatR
2cedfc9696 X11 update
More issues.  The incorrectly rendered map after panning is one
I haven't seen before.  Normally I only have a clipped map if I
force double size tiles rather and hadn't noticed this behavior
for that case, so manually resizing--and/or the scrollbars which
get added when that occurs--may be what triggers it.
2021-02-19 14:11:32 -08:00
Pasi Kallinen
f9aff476c4 Increment editlevel
Just in case, even though changing joined to boolean shouldn't cause problems.
2021-02-19 17:28:43 +02:00
copperwater
18dc88505d Convert room 'joined' and 'needjoining' into booleans
des.region() accepted booleans for the joined field, whereas des.room
accepted xchars. These were only being used as truth values, so this
converts the room ones into booleans for consistency. I don't think
accidentally using an int or a boolean wrongly would actually crash the
level generator, but consistency is good.

This converts an schar field in struct mkroom into a boolean; on most
systems these are probably 1-byte types and save files won't be broken,
but it might be best to treat this as a save breaker anyway.
2021-02-19 17:09:41 +02:00
copperwater
fa3041c9f9 Make g.coder->lvl_is_joined a boolean
Its value is only used as a boolean, so there's no real need to keep it
as a confusing int.

Shouldn't be a save-breaking change; it doesn't look like g.coder is
saved.
2021-02-19 17:09:41 +02:00
nhmall
7bc8d98ea3 Merge branch 'copperwater-pr464' into NetHack-3.7 2021-02-19 07:50:34 -05:00
nhmall
fb0b535cde fixes37.0 entry for pr#464 2021-02-19 07:49:10 -05:00
nhmall
f716dd8211 Merge branch 'fix-engraving-impossible' of https://github.com/copperwater/NetHack into copperwater-pr464 2021-02-19 07:46:45 -05:00
Patric Mueller
bea69f39f3 Output message when changing fastmove mode while cursor targetting 2021-02-19 10:40:41 +01:00
PatR
bb57bf16f1 'O' feedback for booleans
Give a message for each boolean option toggled via 'O'.  It may
help catch mistakes sooner if/when player types wrong menu letter.

Only applies to 'O', not booleans manipulated during config file
or NETHACKOPTIONS processing.
2021-02-19 00:24:45 -08:00
PatR
f480803970 'wizmgender' flag
"Demote" wizmgender from an obscure wizard mode extended command
to an obscure wizard mode boolean option.  Behaves the same except
that no message is given when the value gets toggled.
2021-02-18 23:54:30 -08:00
copperwater
3219ed1aa8 Fix: engraving with non-blade dulled the weapon anyway
Due to a logic bug introduced when engraving became an occupation - the
code that tests to see whether the player is writing with a weapon that
will get dulled wasn't correctly checking that they were actually
carving an engraving.
2021-02-19 00:25:45 -05:00
PatR
a646764cc7 fix github issue #462 - line not displayed
Fix a latent bug in unreachable code.  As the comment preceding
the cited code states, hero polymorphed into an eel isn't offered
a chance to use #monster to hide, so program execution won't ever
get to the bad code.  Using formatting routine The() where message
delivery routine pline_The() is intended is certainly a bug though.

Fixes #462
2021-02-17 14:27:00 -08:00
PatR
31b0847bd7 X11's yn_function() echoing its response
X11_yn_function() issues a pline() to put the prompt and player's
response into the message window.  Change it to use visctrl() to
make sure that the response character is ledgible when something
like the '&' command allows an arbitrary answer.

This patch adds a leading space and two extra trailing spaces
to the prompt when it's being issued via popup, but that hasn't
affected the issue mentioned next....

The popup prompting when the 'slow' resource is False doesn't
always resize properly.  I saw both too wide and too narrow
[What do you want to throw? [abc] ]b
[       In what direction?        ]
and
[Really quit? [yn] (n) ]y
[Dump core? [ynq] (q) ]n   (size seemed right, but hard to tell)
[Do you want your posses]  (might have shown one more letter;
                            resize doodad in window's bottom right
                            corner on OSX oscures the rightmost
                            column--which is ordinarily a space)
The truncated one did accept responses.  If I answered 'n' then
the next question was truncated too, but for 'y' (plus ensuing
feedback) it would be sized correctly for the question after that.

To be clear:  the popup width issue was present before this change
and is still present after it.  The code already has a hack that's
intended to deal with this but it doesn't do the job for me.
2021-02-15 19:09:00 -08:00
PatR
8fff588ab3 X11 persistent inventory again: initial display
If 'perm_invent' is preset in player's options, have X11 show the
persistent inventory window from the start instead of waiting for
an 'i' command.  moveloop() prolog needed a tweak do deal with it
cleanly.

Require WC_PERM_INVENT in order to honor the perm_invent option.
X11 and curses already set that, tty and curses don't support it,
so only Windows GUI needed to be updated for it.
2021-02-14 00:57:34 -08:00
PatR
36179da82f X11 perm_invent: handle 'O' toggling off perm_invent
When persistent inventory window is up, remove it if 'perm_invent'
option gets set to False.  This has a side-effect of fixing the
end-of-game prompting problem it caused.
2021-02-13 19:17:20 -08:00
PatR
8c0e3b2a8d monster missiles vs sinks
Missiles shot or thrown by monsters already stop at sinks; give
a message if they haven't exhausted their range and hero sees.
2021-02-13 15:16:15 -08:00
PatR
5a8c978b1e scatter() vs sinks
Objects shot, thrown, or kicked by the hero or by monsters stop
short if they try to pass over a sink; make objects launched by
an explosion behave similarly.
2021-02-13 15:15:21 -08:00
Pasi Kallinen
1b7faaf661 Add couple more config tests 2021-02-13 11:51:25 +02:00
nhw_cron
80b82c687b This is cron-daily v1-Jan-20-2020. files updated: Files 2021-02-12 18:36:00 -05:00
PatR
be9a2c2907 X11: persistent inventory issues and hack for OSX
This hack prevents the perm_invent window for X11 on OSX from
creeping every time it gets updated.  It is far from perfect and
at the very least ought be handled via user settable X resources
rather than hardcoded values, but it's as much effort as I'm likely
to spend.

Add a new file containing a list of issues that ought to be fixed.
The initial entries are things I noticed while experimenting with
perm_invent; there is lots of older stuff that could/should be
there too.  I'm not sure whether the first one is OSX-specific; the
others aren't.
2021-02-12 15:07:51 -08:00
Pasi Kallinen
b1097df86d Make runmode option complain, add some tests for it 2021-02-12 19:41:46 +02:00
PatR
2e69789e6d mkroom.c oddity
Replace a strange pline() with impossible().

Remove some ancient MAC special handling for getenv("SHOPTYPE").
2021-02-11 15:38:26 -08:00
PatR
79ca1dc422 mklev.c's mkroom qsort
Get rid of some obsolete qsort hackery.  Use of prototypes makes
it unnecessary.  Even before that it was the only one of a dozen
instances of qsort() usage that cared about pre-ANSI implementation.

Also, reformat a couple of comments.
2021-02-11 15:18:12 -08:00
Pasi Kallinen
7f51e59770 Don't complain about unknown option if param is wrong
When a compound option was given an erroneous parameter,
for example "OPTIONS=runmode:foo",
you first got "Unknown runmode parameter 'foo", and
then "Unknown option 'runmode:foo'".

Prevent the Unknown option complaint, if we actually did
find a match.
2021-02-11 18:22:18 +02:00
nhw_cron
918bfca387 This is cron-daily v1-Jan-20-2020. files updated: Files 2021-02-11 10:48:05 -05:00
nhmall
7a8be551e9 Guidebook date was behind on recent updates so give it a bump 2021-02-11 10:38:43 -05:00
PatR
73ad32abc9 recent X11 bit: X11_bail() doesn't return 2021-02-10 18:52:22 -08:00
PatR
fedc2d5abe nroff Guidebook fix
Options which show lists of possible values using '.CC' were
unintentionally being rendered with bold font.  I tracked it
down to "figure 3" which has been in place for quite a while.
The font setting and resetting wasn't working as I expected.
This change yields the intended results.
2021-02-10 18:48:21 -08:00
nhmall
046ff4129b bump editlevel 2021-02-10 19:54:10 -05:00
nhmall
e512e98966 Merge branch 'copperwater-pr460' into NetHack-3.7 2021-02-10 19:53:07 -05:00
Pasi Kallinen
da92e0349b Fix lua doc copypaste error 2021-02-10 22:06:36 +02:00
Pasi Kallinen
cc25f40d69 Add lua tests for config file parsing
Bare-bones for now, more tests needed.
2021-02-10 19:22:16 +02:00
Pasi Kallinen
9576154690 Add in_lua flag
In preparation of making config errors available to lua scripts,
instead outputting them via pline.
2021-02-10 17:06:12 +02:00
PatR
33ee596d68 curses comment
Add a TODO item for curses status display that will probably
never get done.  Could apply to tty too.
2021-02-09 15:50:03 -08:00
PatR
3aaa565eb6 wiz_identify vs perm_invent
Using ^I to identify inventory and picking '_' (or '^I' or full
menu) would update persistent inventory window after identifying
everything, but picking specific items (even everything as long
as '_' was excluded) to identify wasn't doing that.

I moved some fixes37.0 entries around to group the persistent
inventory ones together.  One involved hold_another_object so I
group those too.  I didn't look very hard to try to find others
that could fit with these.
2021-02-09 15:07:16 -08:00
nhw_cron
0639fd619d This is cron-daily v1-Jan-20-2020. guidebook updated: doc/Guidebook.txt 2021-02-08 21:17:44 -05:00
PatR
71bb01c328 curses persistent inventory window tweak
Under curses interface, provide a way to get a little more space
for perm_invent without turning off windowborders entirely.

Possible 'windowborders' values:
 0 = no borders, max screen space available for useful info
 1 = full borders, two lines and two columns wasted for each window
 2 = contingent borders, show if screen is big enough, else hide
New:
 3 = as 1 except no borders for perm_invent window
 4 = as 2 except never borders for perm_invent window

3 and 4 let the map, message, and status windows have borders while
providing two extra lines and two extra columns on each line for
persistent inventory.  It's not much but better than nothing when
borders are enabled.
2021-02-08 16:34:29 -08:00
PatR
e411dce04f plug config file parsing memory leak
The new options processing had a memory leak:  'parser.inbuf'.

Also, reorder some routines to fit in the corresponding comment
sections (with new sections for wizkit and symset) and reorder
some prototypes to match their order in the file.
2021-02-08 13:16:54 -08:00
nhmall
afc16f116e make engraving an occupation pr#460
copperwater commented 8 hours ago:
Instead of inexplicably paralyzing the player for the duration of their
engraving. Many a character has died by trying to engrave something and
then sitting there diligently writing it while monsters surround and
attack them. (This was especially prominent back in the 3.4.3 era when
repeated Elbereths were viable, but it still occurs today with e.g.
using a hard stone to engrave Elbereth). There were also some other
oddities - for instance, if something teleported the player away while
they were engraving, they would continue to "engrave" (be paralyzed) on
their new location, but would not produce any text there; the full
engraving would be placed on their initial position.

In this commit, I have converted engraving to use the occupation
framework, which treats it as an interruptible activity. This
necessitated some logical restructuring, mostly involving the engraving
being written out in chunks as the player spends more uninterrupted time
on it.

I've tried to keep this free of regressions except for those inherent to
the occupation system.

What has NOT changed:

o The rate of engraving is still 10 characters per turn, or 1 character
using slow methods.

o The formulas for determining how much a bladed weapon or marker can
engrave before getting exhausted are kept. Though this is a bit
convoluted, and if it's not considered important to preserve the
existing behavior, I would recommend simplifying it by decreasing the
maximum engraving length for weapons by 1 so that each point of
enchantment simply gets you 2 characters' worth of engraving (e.g. a
-2 weapon will only engrave 1 or 2 characters before dulling to -3,
rather than giving it a third "grace character".

o The input buffer is still modified based on confusion/blindness/etc
only at the time when the player inputs it (if they gain a
debilitating status while engraving, it will not affect the text). My
personal preference is to make the text affected in scenarios like
that, but it's not strictly necessary to do here, so I didn't.

o Wand messages such as "The floor is riddled by bullet holes", and
blinding from engraving lightning, still appear before the hero starts
to take any time engraving. As noted above, getting blinded by the
wand still has no effect on accurately engraving the text, unless the
hero was already blind or impaired.

What has changed:

o Moving off the engraving or losing the object being engraved with
causes the player to stop engraving.

o Wands can still engrave an arbitrary amount of text using a single
charge, but if the hero is interrupted and decides to start engraving
again, they will consume a second charge.

As it adds a new field to g.context, this is a save-breaking change.
2021-02-08 08:41:23 -05:00
nhmall
449786dd93 Merge branch 'engraving-occupation' of https://github.com/copperwater/NetHack into copperwater-pr460 2021-02-08 08:39:50 -05:00
copperwater
9c6a5fc423 Make engraving an occupation
Instead of inexplicably paralyzing the player for the duration of their
engraving. Many a character has died by trying to engrave something and
then sitting there diligently writing it while monsters surround and
attack them. (This was especially prominent back in the 3.4.3 era when
repeated Elbereths were viable, but it still occurs today with e.g.
using a hard stone to engrave Elbereth). There were also some other
oddities - for instance, if something teleported the player away while
they were engraving, they would continue to "engrave" (be paralyzed) on
their new location, but would not produce any text there; the full
engraving would be placed on their initial position.

In this commit, I have converted engraving to use the occupation
framework, which treats it as an interruptible activity. This
necessitated some logical restructuring, mostly involving the engraving
being written out in chunks as the player spends more uninterrupted time
on it.

I've tried to keep this free of regressions except for those inherent to
the occupation system.

What has NOT changed:
- The rate of engraving is still 10 characters per turn, or 1 character
  using slow methods.
- The formulas for determining how much a bladed weapon or marker can
  engrave before getting exhausted are kept. Though this is a bit
  convoluted, and if it's not considered important to preserve the
  existing behavior, I would recommend simplifying it by decreasing the
  maximum engraving length for weapons by 1 so that each point of
  enchantment simply gets you 2 characters' worth of engraving (e.g. a
  -2 weapon will only engrave 1 or 2 characters before dulling to -3,
  rather than giving it a third "grace character".
- The input buffer is still modified based on confusion/blindness/etc
  only at the time when the player inputs it (if they gain a
  debilitating status while engraving, it will not affect the text). My
  personal preference is to make the text affected in scenarios like
  that, but it's not strictly necessary to do here, so I didn't.
- Wand messages such as "The floor is riddled by bullet holes", and
  blinding from engraving lightning, still appear before the hero starts
  to take any time engraving. As noted above, getting blinded by the
  wand still has no effect on accurately engraving the text, unless the
  hero was already blind or impaired.

What has changed:
- Moving off the engraving or losing the object being engraved with
  causes the player to stop engraving.
- Wands can still engrave an arbitrary amount of text using a single
  charge, but if the hero is interrupted and decides to start engraving
  again, they will consume a second charge.

As it adds a new field to g.context, this is a save-breaking change.
2021-02-08 00:11:07 -05:00
Dean Luick
5eaf028c0f Re-fix altar compiler warning
Implement a better fix for commit 2f4f7d22d ("Fix align type
mixup wth align mask") which was reverted in commit 4e35e8b5a
("Revert "Fix align type mixup wth align mask"").

In the present code, the field align in both struct altar and
struct monster is not an aligntyp, but an align mask with extra flags.
Change the type to match its actual use and improve the naming.

Consolidate duplicated code into a single routine.

Change the return type of induced_align() to be unsigned to match
amask usage.

Change the special level align mask values to be separate from
the normal align mask values.
2021-02-07 22:25:25 -06:00
PatR
ebc2dfdcf2 display_pickinv
A formatting bit that grew a little.  An end of line comment that
spans on two or more lines
  foo(); /* call
            foo() */
will confuse clang-format if the continuation lines don't begin
with an asterisk
  foo(); /* call
          * foo() */
Instead of just doing that, I changed display_pickinv() to add a
comment for each of its arguments.
2021-02-07 14:58:08 -08:00
PatR
eb0588583f potion dipping tweak
Update some code from four weeks ago.  One of two hold_potion()
calls was followed by update_inventory() but the other wasn't.
Have hold_potion() do that itself.  I'm not sure that this is
needed and haven't convinced myself that it's not.
2021-02-06 16:34:41 -08:00
PatR
67d94d2930 partial fix for #K3262 - X11 perm_invent panic
Prevent the "X Error (bad Atom)" situation that causes an
"X Error" panic.

The issue isn't fixed.  This fails to implement the intended
functionality of having the X server remember the persistent
inventory window's location across games (until the next time
that the X server restarts).  Worse, on OSX the window creeps
each time it is updated (visually it seems to be moving down by
the height of the window's title bar).

That's not as bad as having it move to the pointer's location as
it did in 3.6.1, but prior to the commit which introduced this
code that had been fixed and it stayed put during the current
game, so more work is definitely needed.
2021-02-06 16:04:44 -08:00
nhmall
4e0a1e0462 during engraving, spaces were counted instead of non-spaces
2015 commit 27d8b631cd incorrectly altered a test

	/* Chop engraving down to size if necessary */
	if (len > maxelen) {
	    for (sp = ebuf; (maxelen && *sp); sp++)
->		if (!isspace(*sp)) maxelen--;
	    if (!maxelen && *sp) {
		*sp = (char)0;
		if (multi) nomovemsg = "You cannot write any more.";

was changed to:

	/* Chop engraving down to size if necessary */
        if (len > maxelen) {
	    for (sp = ebuf; (maxelen && *sp); sp++)
->		if (*sp == ' ') maxelen--;
	    if (!maxelen && *sp) {
		*sp = (char)0;
		if (multi) nomovemsg = "You cannot write any more.";

Fixes #457
2021-02-06 18:49:16 -05:00
nhmall
4e35e8b5a6 Revert "Fix align type mixup wth align mask"
This reverts commit 2f4f7d22d3
for now while the matter is investigated further.

Also closes #459
2021-02-06 14:54:54 -05:00
Pasi Kallinen
d817564a6a Lua: set and get config options
Still needs more work, especially the error handling.
2021-02-06 19:02:25 +02:00