Commit Graph

8173 Commits

Author SHA1 Message Date
nhmall
83f64ee2b6 a couple of warnings 2022-09-30 08:59:57 -04:00
PatR
064ee2021b more genocide prompts
Make the prompt for single genocide be more precise
 from:  What monster do you want to genocide?
 _to_:  What type of monster do you want to genocide?
and the re-prompt for it be slightly more verbose
 from:  What... [type the name of a monster]
 _to_:  What... [enter the name of a type of monster]

Also, make the already verbose re-prompt for class genocide even
more verbose
 from: What class... [type the symbol representing a class]
 _to_: What class... [type the symbol or name representing a class]

Possibly should have changed 'type' to 'enter' on the last one to
keep them consistent but I left that as-is.
2022-09-28 15:19:41 -07:00
Michael Meyer
365d728be7 Show genocide prompt help iff 'cmdassist' enabled
The "[type the name]" prompt seems appropriate for handling via
cmdassist, so experienced players who don't need the help can hide it.
I also added a corresponding help note for the class genocide prompt.
2022-09-28 14:47:56 -07:00
Michael Meyer
fc7a2a9869 Don't screen out empty input in class genocide
So that a blank line wouldn't use up one of the player's "tries" for
class genocide, the game would continue to prompt until the input was
non-blank (or the user hit <esc>), with a tight loop around the getlin
call that only exited when it got some non-empty input.  This apparently
risked leaving the game endlessly looping under some worst-case-scenario
hangup conditions.  It was also inconsistent with normal genocide, which
doesn't have special handling of blank lines.  Make the class genocide
prompt behave like the normal genocide prompt by removing the "blank
input" loop (and consequently treating a blank line the same way as any
other attempt to write a name).
2022-09-28 14:47:56 -07:00
Michael Meyer
d1f4e7df85 Fix: IS_SUBROOM_INDEX range
The macro (currently unused, I think) for checking whether a particular
index designates a subroom was off by one on the maximum allowable
value.

Because of the dedicated extra space for the g.rooms array terminator
flag (hx == -1), subroom indices in g.rooms are set out in the range
[MAXNROFROOMS+1, MAXNROFROOMS*2], inclusive.

Also some minor formatting tweaks.
2022-09-28 14:11:05 -07:00
vultur-cadens
ae37a1197a Unidentified gem selling prices
Make the token selling prices for unidentified gems not depend on how
many items were defined before FIRST_GEM.  Now the unidentified gem
selling prices will depend only on the number and defined order of the
types of gems, and won't inexplicably change when objects are added,
or depend on compile-time options such as MAIL.

Also don't do the regular item price reduction for unidentified gems,
since they are already not based on the actual value.  This restores
the pre-3.6 behavior, allowing players to gain a bit more information
from the nominal selling prices of unidentified gems.

Whoever first introduced this special handling for gems probably
intended for players to be able to gain information from gem prices
this way, but probably nobody has been doing it since 3.6.
2022-09-28 13:42:18 -07:00
PatR
8509951291 rename "huge chunk of meat" to "enormous meatball"
Pull request #607 by Vivit-R proposed renaming "huge chunk of meat"
to "giant meatball" to better reflect the similarity to meatball.
But an object name that contains a monster name prefix requires extra
work in the wishing code.  I considered "huge meatball" which retains
more of the original name but decided to go with "enormous meatball"
becaues it seems more evocative.

Supersedes #607
Closes #607
2022-09-27 13:32:51 -07:00
PatR
fdd7b0c0b9 windowborders menu bit
The menu to interactively set the windowborders option for curses
uses 'a'..'e' for choosing 0..4.  Accept '0'..'4' (via unseen group
accellerator) too.
2022-09-26 15:05:22 -07:00
PatR
2b7e82728b more TTYINV=4 - lamps/leashes
When persistent inventory is set to only show items-in-use, include
leashes attached to pets and lit lamps and candles, same as the '*'
command.
2022-09-26 14:50:10 -07:00
PatR
effc29c000 TTYINV vs end-of-game disclosure
If environment had TTYINV=4 (perm_invent shows worn/wielded only),
disclosing inventory at end of game only showed worn and wielded
items instead of full inventory.  Didn't matter whether perm_invent
is On or which interface is in use or whether game was built with
TTY_PERM_INVENT enabled.
2022-09-26 14:34:23 -07:00
PatR
0735b790f9 object name assignment vs persistent inventory
This is an alternate way to deal with pull request #876, where
splitting a stack that has a name assigned updated perm_invent when
cloning the name and ran into trouble with shop billing when trying
to format for persistent inventory display.

The PR#876 fix has been left in place but wouldn't have been needed
if this had gone in first.
2022-09-26 14:25:06 -07:00
PatR
caf1eeebf9 fix #H5459 - explosions and steeds
Reported nearly five and half years ago:  mounted hero and steed
shared resistances if they got hit by an explosion.
2022-09-25 01:21:07 -07:00
PatR
f4e87e8744 fix "unique monster doppelganger and bones bug"
Reported by paxed 8 years ago:  if a bones file contains a
doppelganger imitating a unique monster, when it gets loaded
that monster ends up being marked as having been created.  The
doppelganger itself will shapechange to other forms, but the
unique monster won't be created when it should be because it has
become extinct.

Report involved creating a statue of a unique monster which
yields a doppelganger in that monster's shape, then using stone
to flesh to animate the statue, dying before it changes to some
other shape, and having bones be saved.
2022-09-24 18:49:48 -07:00
PatR
65b8cf7981 pull request #850 - level teleporter feedback
Pull request from copperwater:  don't give "flash of light" feedback
when activating a level teleporter because it's too much like one of
the outcomes of a magic trap.

This doesn't use the suggested commit.  Getting the "you feel
disoriented" feedback before being asked for destination level (when
having teleport control) seemed contradictory.  This gives different
feedback and does so after the actual teleport.

Supersedes #850
and since nhcopier doesn't seem to understand "supersede"
Closes #850
2022-09-24 15:27:13 -07:00
PatR
4885653014 alloc() never returns Null
Mark alloc()--also dupstr() and re_alloc()--for gcc and clang as
always returning non-Null.  This should silence some of the static
analysis complaints.

Almost all the monster and object naming functions (anything that
returns an mbuf or an obuf) should be marked this way too but I'll
leave that for somebody else to deal with.

I didn't attempt to mark alloc() with the 'malloc' attribute because
macro definitions could end up causing trouble.  Specifying its
deallocator would probably be useful but is at even bigger risk of
macro interference.

I'm not sure whether gcc 3 is really the right test for whether the
returns_nonnull attribute setting is available.
2022-09-24 04:39:12 -07:00
PatR
f9e5e4966a fix github issue #581 - "You see no door there."
Year old issue from copperwater:  'open' directed at a non-door told
player that there isn't a door and took no time unless character was
blind and learned what type of terrain it is, applying a key gave
the same message but used a turn and didn't update map to reflect any
terrain discovery.

Attempting to open an adjacent door or applying a key to one while in
a pit had a similar issue:  they produced the same "you can't reach
it from here" but had different time vs no-time outcome.

There may be other actions in the same situation.

Closes #581
2022-09-23 15:30:00 -07:00
copperwater
9118ec8262 Make replace_terrain respect fromterrain='w'
Noticed that an attempted terrain replacement wasn't taking hold even
though 'w' is supposed to mean "match any stone or wall"; this was
because w converts into non-terrain-type MATCH_WALL and replace_terrain
was doing a simple comparison on whether the potentially replaced
terrain matches that type. Add a special check here for w so it will
match the terrain types it's supposed to.

Note that using replace_terrain with 'w' now WILL match stone, since
this is the documented behavior of w, to match IS_STWALL rather than
just IS_WALL. If a level designer really wants to exclude stone, they
can work around this by either making a selection and filter out stone
terrain, or doing two replace_terrains with '-' and '|'.
2022-09-22 23:55:45 -07:00
PatR
61c61f8b04 dgn_bottom() fix
Use the level passed in instead of the hero's location when checking
the dungeon branch.

It probably doesn't make any difference, but use the argument that's
already being provided.
2022-09-22 23:16:19 -07:00
PatR
109b1f61f7 vibrating square
Give a [probably pointless] hint if the player tries to move '>'
while on the vibrating square.
2022-09-22 16:50:41 -07:00
PatR
2d4c5a8e44 refine bottom of Gehennom check
In the quest branch, dbg_bottom() returns a barrier level rather
than actual bottom.  Do things the same way for the gehennom branch.
2022-09-22 16:47:37 -07:00
PatR
de31fd4806 'fix' #K3716 - engraving with Fire Brand
Add a comment to the effect that engraving with Fire Brand doesn't
cause it to become dull.

[I'm not sure that is the behavior we really want.  It seems like an
unintended side-effect of changing Fire Brand's engrave type to BURN.]
2022-09-22 16:09:22 -07:00
PatR
e3acbcab31 'fix' #K3676 - artifact_hit()'s magr
Someone asked whether the 'magr' argument to artifact_hit() can be
Null or not since the code sometimes checks whether it is Null and
other times uses it unconditonally.  The answer is "it depends."
Can't reply to asker due to forced anonymity when the contact form
was submitted.
2022-09-22 15:34:16 -07:00
Michael Meyer
82337beedd Prevent impossible fall dmg if falling up
The way hole destinations work now theoretically allows for a
cross-branch hole or trap door to move you across branches in a way that
decreases your overall depth.  If this happened, it would cause an
impossible when the negative result of (depth(new) - depth(old)) was
used to calculate fall damage.  Limit fall damage to 1d6 if dist <= 0.
2022-09-22 11:36:48 +03:00
Michael Meyer
e148d5e925 Apply trap door destination restrictions in dodown
Missed this way to use the trap door (in a block added in 05761ba) in
previous commits, though I'm a little confused about whether that block
in dodown is even reachable given how various trap scenarios are handled
with dotrap earlier in the function.
2022-09-22 11:36:48 +03:00
Michael Meyer
81285b661e Apply dest. limit to monster trap door usage
To prevent monsters from falling past the bottom level or into the
sanctum early, and to maintain consistency between monster and hero hole
usage.
2022-09-22 11:36:48 +03:00
Michael Meyer
9f5b362601 Refine attempt to clamp trap door fall destination
This should prevent anyone from exploiting falling into the sanctum (by
taking advantage of a trap door in a bones file from a differently
laid-out dungeon, as described in the previous commit) to bypass the
invocation, in addition to falling past the actual end of the dungeon.
2022-09-22 11:36:48 +03:00
Michael Meyer
1830b206c7 Prevent hero from falling past end of dungeon
Similar story with saved trap door destinations: if a bones file near
the end of the dungeon came from a longer dungeon (i.e. with a
lower-depth castle) than the one the bones file is loaded into, the
trap door destination could be past the dungeon end.  Clamp the
destination so it won't be lower than the bottom level of the dungeon.
2022-09-22 11:36:48 +03:00
Michael Meyer
9bb09d48f1 Have monsters' hole destination match the hero's
The fixed destination of a hole or trap door was being used for the hero
but not for monsters.  Make everyone land in the same place, so you can
chase a monster into a hole and actually find it.
2022-09-22 11:36:48 +03:00
Michael Meyer
f8ec9dc32e Fix: antigravity trap doors
Trap doors saved their destinations as an absolute level, rather than a
relative one, so if you loaded bones from a special level their
destinations would reflect the dungeon layout from the bones player's
game.  For example, die on the Oracle level, on dlvl5, with a trap door
that goes to dlvl6.  Another player gets those bones on their Oracle
level, which is dlvl8... the trap door would still go to dlvl6.  Pretty
amazing trap door -- something you might see in a funhouse!

Include relative rather than absolute destinations in save and bones
files, much like stairs do, to avoid this problem.

I bumped EDITLEVEL because although this won't break save files in an
obvious way, it will interpret the (absolute) destinations in existing
save and bones files as relative, leading to some crazy long falls. :)
2022-09-22 11:36:47 +03:00
PatR
ecf55926be github pull request #628 - duplicate code
Pull request from argrath nearly a year ago: an 'if' and corresponding
'else' have the same code so there's no point in testing for if/else.

I'm still not convinced that simply removing the if/else is the right
fix here but nothing else is going on.  I've put part of the removed
code back inside '#if 0' in case it needs to be resurrected someday.

Closes #628
2022-09-21 17:02:45 -07:00
SHIRAKATA Kentaro
2a8ddf1145 remove duplicate code
Here, `then` clause and `else` clause is identical.
2022-09-21 17:00:01 -07:00
Michael Meyer
951a99f5e6 Fix: starving herbivore pet vs polymorphing corpse
The special handling of polymorphing corpses included an "is acceptable
food if starving" rule which ignored the pet's other food preferences,
so a starving herbivorous pet would become willing to eat a
non-vegetarian corpse iff the corpse would polymorph it when eaten.
Along the same lines but latent: if there were a vegan polymorphing
corpse, a carnivorous pet would eat it not only if starving, but also if
maltreated and on the verge of becoming feral.

Instead of trying to fix this by reimplementing all the herbi vs carni
rules specifically for polymorphing corpses, just have a "don't eat
polymorphing corpses if neither starving nor almost untame" rule, and
fall back to the normal palatable corpses tests once it's been
determined that the pet is willing to eat even a polymorphing corpse.

I rephrased the comment just to make it negative (about avoiding
polymorph, rather than polymorph being OK under certain circumstances)
to match the new form of the rule.
2022-09-20 17:25:18 -07:00
Michael Meyer
34aabca74b Describe engulf attacks a bit more consistently
Use verbiage for mon vs mon and hero (mostly hero) engulf attacks that
matches recent changes to monster vs hero engulf attacks more closely
(e.g. "swallows whole" instead of "engulfs" for purple worm, other
changes in b07fe59...).  Also ensure non-AD_DGST engulf attacks
(e.g. from revamped trapper or lurker above polyforms) aren't treated as
"eating" (or as involving "debris").

Also change the enfolds and digests macros so they produce booleans
rather than attack pointers (I got a compiler warning about casting
struct attack * to boolean when I did 'boolean b = digests(ptr);').
2022-09-20 16:54:23 -07:00
PatR
0145a020c1 fixes entry and tweaks for PR #871 - revive corpse
Pull requet from entrez:  give better feedback than "it" when hero
observes a corpse reviving into a monster that can't be seen.

Tweak reviving from a container which was coded as if the container
was optional.  That can lead to confusion when someone reads the
code so make the situation more explicit.

Fixes #871
2022-09-20 14:33:39 -07:00
Michael Meyer
74704c8836 Improve description of invisible mon revival
An invisible monster reviving would be called "it" (as in, "It rises
from the dead!").  Improve on this a bit by instead saying that "the
troll corpse disappears!" (similar to the messaging used when undead
turning is used on an invisible monster's corpse), or calling the
revived monster "something" (as in "something escapes from a sack!")
instead of "it".  Distinguish between the original location of the
corpse and the location of the revived monster when describing seeing
things that have happened to the corpse, since revival may not place it
on the corpse's location.
2022-09-20 13:51:37 -07:00
vultur-cadens
ce2f3ae259 Use a space instead of a hyphen in "disintegration-resistant"
This is for consistency with the other resistance insight messages,
which use spaces instead of hyphens.
2022-09-20 13:24:11 -07:00
Pasi Kallinen
ccaadaa00e Prevent trapdoors and holes dropping you into Sanctum 2022-09-20 12:07:37 +03:00
Michael Meyer
7e96026b44 Fix: impossible from splitting named stack on bill
Trying to split an unpaid stack of named items in a shop, with
perm_invent enabled, would cause an impossible 'unpaid_cost: object
wasn't on any bill' because copy_oextra -> oname triggered an inventory
update while the newly created split stack was marked unpaid but before
the billing information had been split to match.  Defer the copy_oextra
call until the billing info has already been split.
2022-09-19 18:44:42 -07:00
nhmall
8ef9cf85ab remove unused math.h in isaac64.c
Close  #878
2022-09-19 17:32:42 -04:00
Pasi Kallinen
2368c59f69 Knockback requires solid physical hit
Exclude unsolid monsters - air, water, and fire elementals.
2022-09-18 17:56:04 +03:00
Pasi Kallinen
bb3dc379bc Themerooms: Engraving hints the location of buried treasure
Add two new themeroom functions that are called when generating
the level: pre_themerooms_generate and post_themerooms_generate,
calles before and after themerooms_generate.

Allow the buried treasure -themeroom to put down an engraving
anywhere on the level, hinting at the location of the treasure.

des.object contents function now gets the generated object passed
to it as a parameter.
2022-09-18 12:45:16 +03:00
nhmall
2f7b202530 avoid a format-overflow warning
options.c: In function ‘option_help’:
options.c:8820:55: warning: ‘%s’ directive writing up to 255 bytes into a region of size 220 [-Wformat-overflow=]
 8820 |     Sprintf(buf, "Set options as OPTIONS=<options> in %s", configfile);
      |                                                       ^~   ~~~~~~~~~~
2022-09-17 19:29:09 -04:00
nhmall
6151623cce Revert "NEED_VARARGS bit for end.c and files.c"
This reverts commit af71163d99.
2022-09-17 15:58:05 -04:00
nhmall
af71163d99 NEED_VARARGS bit for end.c and files.c
avoid build failure in the event that NEED_VARARGS is already defined
on the compiler command line.
2022-09-17 12:31:26 -04:00
PatR
a483482082 Revert "onefile: isaac64.c <math.h> vs yn()"
This reverts commit 94945a719a.
It was too intrusive and can be handled by the 'onefile' script
by compiling isaac64.c before any source file that includes hack.h.
2022-09-16 17:45:31 -07:00
PatR
829aedd923 insults
random_insult[] and random_malediction[] are only used in wizard.c
so make them file-scope static instead of global.
2022-09-16 16:38:44 -07:00
PatR
e4ff874e0b fix issue #875 - contnr-to-contnr tip explosion
Issue reported by k2:  tipping a wand of cancellation, bag of
holding, or bag of tricks from a non-magic container into a bag of
holding causes the bag of holding to explode but it wasn't dealing
out explosion damage nor being logged for livelog/chronicle the way
putting the item directly into a bag of holding is handled.

This fixes the described issues but bones handling leaves a lot to
be desired.

Fixes #875
2022-09-16 16:14:20 -07:00
Pasi Kallinen
d4c28b3ab5 Prevent impossible lighting a massive stack of candles 2022-09-16 19:55:49 +03:00
nhmall
a5d462b194 more inconsistencies 2022-09-16 10:44:39 -04:00
nhmall
018a39d2de modernize added old-style function declarator 2022-09-16 00:55:08 -04:00