Commit Graph

11622 Commits

Author SHA1 Message Date
PatR
d625fca828 obj.h - expand documentation of obj->spe uses
Started out adding spe==2 for eggs but ended up changing other
things too.

FIXME?  The line "special for uball and amulet" baffles me:

    uball->spe is set to 1 during punishment (with an ambiguous
comment "special ball (see save)"), and back to 0 afterwards, but
otherwise seems to be unused.

    "and amulet" is ambiguous; it should either be "and the Amulet"
or "and amulets".  I assume it probably referred to the former but
it doesn't seem to be used for either kind as far as I can tell.
2021-01-07 14:02:52 -08:00
nhmall
bcf49b85c3 fix another regression in pager.c 2021-01-07 15:52:38 -05:00
Pasi Kallinen
de5da621ac Fix glyph lookup
Seems to have been a mistake in c9673b3d9e
2021-01-07 21:53:56 +02:00
Michael Meyer
a29b76e1bf Add Sokoban penalty for dismounting onto a boulder
Because landing_spot will select a square containing a boulder as a
last-resort option, provided no other squares are accessible, it is
possible for the player to maneuver into a place where this could be
exploited when completing Sokoban (e.g. to get into a corner that would
normally be inaccessible, from which position an otherwise-blocked
boulder can be pushed away). This behavior should incur the same penalty
as exploitation of other Sokoban 'loopholes'.
2021-01-07 18:55:46 +02:00
Michael Meyer
e7e418c1ec Prevent inappropriate diagonal dismounts
Dismounting a steed checked whether the target spot was accessible and
whether there was a monster on it, but not whether it could actually be
accessed by the hero through normal movement. As a result, dismounting
allowed the hero to pass between diagonal gaps that would normally cause
a "you are carrying too much to get through" pline; this could leave
them in a position where they are effectively stuck, unable to remount
their steed or move away without dropping their inventory.

This also could be abused by dismounting in Sokoban to squeeze between
boulders in a way that would normally be impossible.

Using a successful result test_move as one of the requirements for a
spot to be valid prevents this and limits valid dismount targets to
squares that would normally be accessible through standard movement.
2021-01-07 18:55:46 +02:00
copperwater
0b638592a4 Refactor getobj() to use callbacks on candidate objects
This replaces the arcane system previously used by getobj where the
caller would pass in a "string" whose characters were object class
numbers, with the first up to four characters being special constants
that effectively acted as flags and had to be in a certain order.
Because there are many places where getobj must behave more granularly
than just object class filtering, this was supplemented by over a
hundred lines enumerating all these special cases and "ugly checks", as
well as other ugly code spread around in getobj callers that formatted
the "string".

Now, getobj callers pass in a callback which will return one of five
possible values for any given object in the player's inventory. The
logic of determining the eligibility of a given object is handled in the
caller, which greatly simplifies the code and makes it clearer to read.
Particularly since there's no real need to cram everything into one if
statement.

This is related to pull request #77 by FIQ; it's largely a
reimplementation of its callbacks system, without doing a bigger than
necessary refactor of getobj or adding the ability to select a
floor/trap/dungeon feature with getobj. Differences in implementation
are mostly minor:
- using enum constants for returns instead of magic numbers
- 5 possible return values for callbacks instead of 3, due to trying to
  make it behave exactly as it did previously. PR #77 would sometimes
  outright exclude objects because it lacked semantics for invalid
  objects that should be selectable anyway, or give slightly different
  messages.
- passing a bitmask of flags to getobj rather than booleans (easier to
  add more flags later - such as FIQ's "allow floor features" flag, if
  that becomes desirable)
- renaming some of getobj's variables to clearer versions
- naming all callbacks consistently with "_ok"
- generally more comments explaining things

The callbacks use the same logic from getobj_obj_exclude,
getobj_obj_exclude_too and getobj_obj_acceptable_unlisted (and in a few
cases, from special cases still within getobj). In a number of them, I
added comments suggesting possible further refinements to what is and
isn't eligible (e.g. should a bullwhip really be presented as a
candidate for readying a thrown weapon?)

This also removed ALLOW_COUNT and ALLOW_NONE, relics of the old system,
and moved ALLOW_ALL's definition into detect.c which is the only place
it's used now (unrelated to getobj). The ALLOW_ALL functionality still
exists as the GETOBJ_PROMPT flag, because its main use is to force
getobj to prompt for input even if nothing is valid.

I did not refactor ggetobj() as part of this change.
2021-01-07 11:06:58 -05:00
PatR
39fbf083a2 Guidebook update
Document m\ and m`.

Several years ago there was a suggestion--aka complaint--that
"menustyle:Traditional was the only alternative for early versions"
was too vague and requested that the version be included.  It was
probably accurate at the time it was included, but I've changed it
from "early versions" to "very early versions" now.  :-}
2021-01-06 18:54:42 -08:00
PatR
7ba7873a41 curses line-of-input prompting
Redo the fake ESC handling for curses' wgetnstr() so that it
applies to all popup prompts rather than just to "Who are you?",
in case the player sets the 'popup_dialog' option.
2021-01-06 15:59:55 -08:00
Michael Meyer
2df4f08c0b Add liquid flow to land mine explosions
Land mine explosions did not call liquid_flow(dig.c), and as a result
the pit created by an exploding land mine would never fill with adjacent
water or lava, as pits created by other sources -- digging, breaking a
wand, and earthquake -- can do.

This commit adds the appropriate calls to liquid_flow and fillholetyp to
blow_up_landmine so that land mine explosions may fill with water like
other pits do.

The call to losehp in dotrap had to be moved from after to before
blow_up_landmine, since waiting to call losehp when the pit can fill
with water could lead to silly messages (``That was a close one. You
die...''). After this change, a land mine that killed a character would
be retained unexploded in a bones file, because death would occur before
the call to blow_up_landmine. To avoid this issue, the land mine is
converted to a pit before calling losehp; blow_up_landmine does not
check whether the target trap is in fact a landmine so works as usual
even if the trap is converted to a pit, and will delete the pit in cases
where it should not exist.
2021-01-06 20:46:51 +02:00
Pasi Kallinen
bc8dd92621 Monster ranged attacks and staying away from hero
Move the check for monsters that want to stay away from hero
due to having a ranged attack into a separate function.

Add monsters with polearms and breath attacks to it.
Monsters with breath attacks stay away only if they haven't
used their breath recently, or if they are injured.
2021-01-06 14:38:39 +02:00
nhmall
c6306e1117 adjust some disabled code in curses window port 2021-01-05 16:06:58 -05:00
nhmall
b0a366d0ae a couple of display.c follow-up bits 2021-01-05 16:06:04 -05:00
nhmall
2d1cf9591f place a reminder in glyph_info comment 2021-01-05 11:00:07 -05:00
nhmall
a444c765b9 field order in initializer after earlier change 2021-01-05 10:55:12 -05:00
Pasi Kallinen
0a60a80f50 Fix zero-damage attacks
Disenchanters dealt 0 damage with their disenchanting attack,
as did monsters with sleeping and slowing attacks.

Fixes #439
2021-01-05 17:51:04 +02:00
nhmall
4cbf95b350 typo in comments 2021-01-05 10:44:19 -05:00
nhmall
3efc3c0bc8 MSDOS and TTY_TILES_ESCCODES bit 2021-01-05 10:28:43 -05:00
nhmall
c9673b3d9e more window port interface adjustments
further adjustments to the window port interface to pass a pointer
to a glyph_info struct which describes not just the glyph number
itself, but also the ttychar, the color, the glyphflags, and the
symset index.

This affects two existing window port calls that get passed glyphs
and does the parameter consistently for both of them using the
glyph_info struct pointer:
	print_glyph()
	add_menu().

The recently added glyphmod parameter is now unnecessary and has been
removed.
2021-01-05 10:09:37 -05:00
PatR
2a9a18fa2f curses askname()
Noticed when implementing restore-via-menu for curses a couple
of days ago:  The "Who are you?" prompt wouldn't let me cancel
out via <escape>.  I created a character named '\033' which was
displayed as "^[" during play and produced a save file shown by
'ls' as "501?.Z".

To fix this properly, we will need to replace use of wgetnstr()
with something of our own.  That's more work than I feel like
tackling.  This fakes ESC handling if the player is willing to
type <escape><return> rather than just <escape> when terminating
the prompt.
2021-01-04 18:01:49 -08:00
nhw_cron
eb91a031f9 This is cron-daily v1-Jan-20-2020. manpages updated: makedefs.txt 2021-01-04 12:52:42 -05:00
nhw_cron
89916a5ae1 This is cron-daily v1-Jan-20-2020. files updated: Files 2021-01-04 12:52:23 -05:00
Dean Luick
3ffd330c31 Remove vision tables from makedefs
Update makdefs source and its man page.

Remove all mentions of the vision table files from:
o .gitattributes
o .gitignore
o Files
o Cross-compiling

Add a brief note in the fixes file.
2021-01-03 13:37:25 -06:00
PatR
62ba302851 Unix 'make clean' and 'make spotless'
Provide a reasonably straightforward way to leave lua alone when
changing git branches (which I precede with 'make spotless').
 make clean-keep-lib
and
 make spotless-keep-lib
are new alternate forms of top level 'make clean' and 'make spotless'
that won't touch lib/lua/.
2021-01-03 11:27:17 -08:00
nhmall
dd15a1c46d cron doc/Guidebook.txt update 2021-01-02 22:57:14 -05:00
nhmall
e93eeb25fd Windows SELECTSAVED follow-up
set_savefile_name() was misbehaving on Windows if the regularize argument
was false.
2021-01-02 22:28:54 -05:00
PatR
46460255ef curses: restoring via menu
Clone the tty SELECTSAVED code in curses.  If you would be getting
the "who are you?" prompt (perhaps via 'nethack -u player') and
you have at least one save file, you'll get a menu of save files
(plus entries for 'new game' and 'quit') to choose from.  Requires
'#define SELECTDSAVED' at build time (only ntconf.h does that by
default) and when present, can be disabled by setting 'selectsaved'
to False in NETHACKOPTIONS or .nethackrc.
2021-01-02 18:50:04 -08:00
PatR
c71dd6696d pickup_types documentation
Another one from several years ago.  Document 'pickup_types:.'
as a way to set pickup_types to a value that won't ever cause
anything to be picked up, in order to leave all autopickup
decisions to player's autopickup exceptions.

Actually implementing pickup_types:none would require just as
much documentation plus extra code.
2021-01-02 17:07:46 -08:00
PatR
b1d0943d6d quickmimic fixes
Reported by a beta tester four years ago:  if you telepathically
observed a pet eat a mimic corpse and temporarily change shape,
you were told that you sensed it happening but the map continued
to show its true form (because telepathy overrides mimicking).
Attempting to force the map to show the alternate shape in that
situation was hopeless, so give an alternate message instead.

While trying to fix this, I noticed my dog mimicking a throne
several times.  The list of alternate shapes for quickmimic
included SINK which happens to have the same value as S_throne.
Change that to S_sink.
2021-01-02 11:59:40 -08:00
PatR
b815c470ec remove mapglyph() remnants from win/curses/
Remove a couple of leftover references to mapglyph() from the
curses code (present inside '#if 0' blocks).  I've tried to
substitute code which should work but have no idea whether it
actually will.
2021-01-02 10:46:17 -08:00
nhw_cron
9bd992f4a5 This is cron-daily v1-Jan-20-2020. files updated: Files 2021-01-02 10:50:55 -05:00
nhmall
1f78be370d fixes37.0 update 2021-01-02 10:49:48 -05:00
nhmall
10dfceac7b another unused variable 2021-01-02 09:44:09 -05:00
nhmall
5910f86c19 unused variables 2021-01-02 09:35:56 -05:00
nhmall
1d94e65e45 finish mapglyph() removal 2021-01-02 09:22:53 -05:00
nhmall
18116d4a7b update for 2021 2021-01-01 22:07:54 -05:00
nhmall
44b4b1f3d1 Merge branch 'actual-nh-patch-1' into NetHack-3.7 2020-12-31 22:57:52 -05:00
nhmall
985cffbfed Merge branch 'patch-1' of https://github.com/actual-nh/NetHack into actual-nh-patch-1 2020-12-31 22:57:33 -05:00
nhmall
eb14a7ddf2 Check bones data directly for deja vu messages PR #374
Closes #374
Closes #322
2020-12-31 21:31:13 -05:00
nhmall
cdfbae5529 Merge branch 'entrez-fix322' into NetHack-3.7 2020-12-31 21:25:16 -05:00
nhmall
02e465e643 Merge branch 'fix322' of https://github.com/entrez/NetHack into entrez-fix322 2020-12-31 21:18:51 -05:00
actual-nh
c3e94596f8 Missing quote mark
Again, checked vs my copy.
2020-12-31 19:54:39 -05:00
actual-nh
0a5852291e Typo (Hogfather)
One typo in a quotation from Hogfather; I have checked (Corgi edition (13th printing?), 1997, page 310) and corrected it to match the original.
2020-12-31 19:51:04 -05:00
PatR
db673ab791 termcap followup
A little more testing for ANSI_DEFAULT forced on has revealed
that hilites[Black] has also been left Null, a problem that
MS-DOS hid.
2020-12-31 16:09:46 -08:00
nhmall
862c4064ab gender-specific names can be used in .lua files with the gender upheld
Revert "monster name references in .lua files"
This reverts commit 0e0aa7bdf6.
2020-12-31 18:51:00 -05:00
PatR
e7e07cb067 pull request #411 - freeing termcap hilite entries
(strings to switch color) for ANSI_DEFAULT.  Instead of lumping
more conditional code into tty_shutdown() I put the new code
into a separate routine and also pulled the existing setup code
out of tty_startup() into a separate routine too.

It will be a miracle if this doesn't break anything due to the
crazy amount of convoluted conditionals present in termcap.c.

On the other hand, I found and fixed a bug while trying to test.
The ANSI_DEFAULT hilites for Gray and No_Color were null instead
of an empty string.  MS-DOS stdio apparently fixes that up, but
on OSX (after #undef UNIX and TERMLIB and TERMINFO and #define
ANSI_DEFAULT in termcap.c) I started seeing instances of "(null)"
on the map (OSX stdio does a different fix up for Null pointers)
as soon as I enabled 'color'.  It was an attempt to set No_Color.

Closes #411
2020-12-31 14:49:21 -08:00
PatR
4c8a8bcfee fix github issue #431 - failed displacing
Being able to swap places with peaceful monsters instead of just
with pets made it possible to cause them to flee. Shopkeepers
wouldn't abandon the shop door but temple priests would attack
if hero tried to chat while they were fleeing.
2020-12-31 11:23:29 -08:00
Michael Meyer
6ae7818346 Refactor bones search loop
Using a for loop instead of an if and a do/while makes the code much
more clear and concise, so that it's easier to understand what the
function does at a glance.  The actual approach to iterating through the
current level's bones files and searching for a match is more or less
unchanged.
2020-12-30 22:42:48 -05:00
PatR
565cdf3cba tribute typo: Lords and Ladies #5
Add a missing opening quote mark near the end of passage 5 of
Lords and Ladies.
2020-12-30 17:55:30 -08:00
nhmall
0e0aa7bdf6 monster name references in .lua files
Closes #434
2020-12-30 19:18:25 -05:00
nhmall
1cf9d0323a pmnames follow-up
replace references to "aligned priest" in several lua files with "aligned cleric"

also accept "aligned priest" during ^G parsing
2020-12-30 18:57:24 -05:00