Commit Graph

9016 Commits

Author SHA1 Message Date
Michael Meyer
a69ff06e85 Make mstate flag checks more mutually consistent
Various places checking for whether a monster was on the map based on
mstate flags were inconsistent about which ones they checked (and then
place_monster() was additionally inconsistent with all of them about
which bits were cleared when placing a monster onto the map).  I think
some places were also more convoluted than is now necessary because they
date back to mstate being an alias for mspare1, which it shared with
migflags before those became two separate dedicated fields (MSTATE_MASK
also dates back to this and is no longer used, so I removed it).

I tried to go through all the MON_foo mstate bits, understand when/why
they are set, and make the various functions I noticed more consistent
(with each other, and with my understanding of how the bits work) about
how they are treated.  I don't know for a fact that I understood
everything right -- some diagnostic bits that aren't used for much of
anything, like MON_OBLITERATE, had me mystified until I read the 5ee78c5
commit message -- but this patch hasn't caused any new problems (sanity
check or otherwise) with the fuzzer in my testing so far.  All the same,
it could probably use review by someone who has a good sense of what the
mstate bits mean.
2023-11-08 10:41:40 -08:00
SHIRAKATA Kentaro
7d007ea365 null-check argument bl before using it 2023-11-09 00:10:23 +09:00
SHIRAKATA Kentaro
7e735d9386 remove unused assignments 2023-11-07 16:26:12 -08:00
Michael Meyer
a1b1f3b250 Try to unify "back on solid ground" messaging
Put everything through a single function that can handle all the
complicated parts of using the correct proposition for different terrain
types, and will not just call things "solid ground" indiscriminately.
This got complicated but I'm not sure if it's possible to do it much
simpler while still using the distinct names for each type of terrain
(unless you are OK with the sentences sounding sort of wonky).
2023-11-07 16:13:55 -08:00
Michael Meyer
53be8be3e9 Fix: mention_decor preposition vs unusual terrain
When moving off a body of water with mention_decor on, describe_decor()
would produce messages like "You are back on cloud", "You are back on
wall", and "You are back on air bubble."  For those types of terrain
that were producing odd sentences like this, change the format to "You
are back in a cloud", "You are back in a wall", "You are back in an air
bubble", and "You are back in the air."
2023-11-07 16:13:54 -08:00
Michael Meyer
702f914306 pooleffects messaging vs mention_decor
With mention_decor enabled, exiting the water on the Plane of Water
would produce the series of messages "You pop into an air bubble.  You
are back on air bubble."  Suppress the second message.  The lack of
article there seems like a problem too...

Also, acknowledge flight/levitation and use ice_descr in the pooleffects
"solid land" message.  This should make it more consistent with how
mention_decor does a similar message, especially changes to how it
describes ice based on its melt timer.
2023-11-07 16:13:54 -08:00
Michael Meyer
346cd9e35b Revert part of "Fix: hurtling into wall of water"
Turns out this change to more accurately describe the wall of water in a
situation that shouldn't come up in-game messed up some uses of
dfeature_at which do a string comparison between the result and "pool of
water" to determine how to behave.
2023-11-07 16:13:54 -08:00
Michael Meyer
b993edca74 Follow-ups on EXPLORERS authorization
I realized that failed explore-mode authorization on a special-mode
saved game cannot downgrade the game mode further down to a normal game,
because this would dump the player back into a state where she has
completed some part of the game in explore mode but is eligible for the
topten list.  This is even more true when the game was formerly a
wizard-mode game.  Unforunately, that was the state my previous commits
left the game in.

Instead, if restoring an explore-mode or wizard-mode savegame, and the
player is authorized via sysconf for neither of those modes, fail
restoration entirely and start a new game instead.  That's sort of
clunky and there could probably be more explanation provided, but it
should be an exceedingly rare occurance and I'm not sure what
alternative exists that would still honor the EXPLORERS and WIZARDS
restrictions.  This shouldn't affect the way they default 'down a mode'
in other circumstances, i.e. the overwhelming majority of situations in
which EXPLORERS authorization is needed/checked.

For the same reason, I realized that the player can't be prompted
whether or not to enter explore mode, if being downgraded from a
no-longer-authorized wizmode save while explore mode is authorized.  The
change from wizard mode to explore mode must be mandatory.  I have also
switched that up so that it will force the change -- unfortunately, this
has the side effect of allowing the preservation of the save, but it's
more important to make sure a wizard mode game doesn't get reverted to
normal mode.  They won't be able to load the save into wizard mode
anyway.
2023-11-07 15:38:10 -08:00
Michael Meyer
1e237e4b8f Fix: shunt to explore mode after wizmode auth fail
If an unauthorized player requests the game launch in wizard mode, it
will try to put her in explore mode instead.  If this happened during
restoration of a previous (normal) saved game, the setting of discover
in wd_message() would bypass iflags.deferred_X, allowing the player to
select to keep the non-explore-mode save file.  [Actually, when I tested
it I always got an error when answering yes to the "keep the save file?"
prompt, but that's a problem too...]  Because deferred_X was still 1
after this, the pline "You are already in explore mode" would also be
printed following the prompt (when moveloop_preamble() attempted to set
explore mode).

Fix this so that loading a normal game with -D, then failing the
authorization, boots into explore mode via iflags.deferred_X and the
"really enter explore mode?" prompt, as it would have if -X were
specified on the command line to begin with.
2023-11-07 15:38:10 -08:00
Michael Meyer
85b727c92c Apply sysconf EXPLORERS restriction on startup
The sysconf EXPLORERS list restricting access to explore mode was being
evaluated and used when a player used the #exploremode command in-game,
or when specifying -X or OPTIONS=playmode:explore on the command line
when resuming a normal game, but not when starting an entirely new game.
When SYSCF is avilable, check for authorization early, similar to debug
mode authorization, to restrict access to explore mode to EXPLORERS
under (hopefully) all circumstances.
2023-11-07 15:38:08 -08:00
nhmall
1538b401e9 quiet a new warning after pull request #1119
hack.c
.\hack.c(1607): warning C4018: '<': signed/unsigned mismatch
2023-11-06 07:37:34 -05:00
PatR
ac57c070be simplified menu_headings fix
Reported by entrez, some putstr() to text window got changed to
add_menu_str().  I didn't test with curses; with tty some headers
ended up in limbo:  "Artifacts" header for '` a y' (wizard mode show
artifacts, something I had forgotten even existed) and also monster
class headers for 'm #vanquished by-class' (available to everyone).
Qt lost them too, but at least it didn't panic.

Not due to over-simplification:  end of game disclosure suppresses
header line highlighting, except when disclosing final inventory.
Change it to do so, although it would be simpler overall to just not
bother with any menu_headings highlight suppression.
2023-11-05 23:50:12 -08:00
Michael Meyer
98d2b0ecb3 Follow up on disturbing buried zombies
Change 852f8e4 by requiring a minimum impact before a buried zombie
nearby will be disturbed: light, but still excluding things like
scrolls, if it's a violent impact (dropped while levitating, thrown, or
kicked), and fairly heavy if the hero is just placing the item on the
ground normally.

Moving the call out of flooreffects meant it no longer applied to
pushing boulders around, so have moverock disturb nearby zombies.  I
additionally had wake_nearby do the same thing.

Finally, I renamed check_buried_zombies (which doesn't really reflect
what it does) to disturb_buried_zombies.
2023-11-05 21:51:45 -08:00
PatR
e384e3a5a1 suppress 'variable not used' warning
My compiler didn't warn about this.  The value conditionally gets set
but then isn't used anywhere besides that.  For the time being, give
'skipped_noninuse' a fake use rather than eliminate it altogether.
2023-11-05 17:23:46 -08:00
PatR
54a64c35ae pull request #1120 - split same-race-sacrifice from
dosacrifice() into a separate routine.

Pull request from argrath:  move the code that handles same-race
sacrifice into a separate routine.

Log message for commit d5fa2f8ba0.

Closes #1120
2023-11-05 15:20:22 -08:00
PatR
e7b685abe5 pull request #1115 - streamline level_tele()
Pull request from entrez:  clean up the if/else-if/else logic in
level_tele().

Trying things a little differently this time.  This is an extra log
message for commit 4876b70b9b.

Closes #1115
2023-11-05 15:15:27 -08:00
Michael Meyer
6cfd3367bc Encyclopedia lookup: check all existing fruitnames
Use fruit_from_name instead of checking gp.pl_fruit directly so that
changing the fruitname won't cause fruits already in the player's
inventory to stop working with lookup.
2023-11-05 14:55:27 -08:00
nhkeni
6c8035d1e7 allow --showpath for --showpaths 2023-11-05 10:26:13 -05:00
Pasi Kallinen
8dc7a4882a Make spell menu work with repeat command 2023-11-05 13:49:04 +02:00
PatR
2ee7509945 replace getenv("TTYINV") with perminv_mode option
Add a new option 'perminv_mode' to augment perm_invent.  It handles
the same choices as the temporary TTYINV method:  show all items other
than gold, show full inventory including gold, or only show in-use
items (similar to the '*' command).

For tty, both the all-except-gold and full-inventory modes can add
the poorly named 'sparse' variation which populates unused slots in
its fixed grid with the inventory letter that would go in each.

For others, the default has been changed from full-inventory to
all-except-gold.  Note that gold is treated as part of 'all' or of
'in-use' if it is quivered because having the amount be shown on the
status line doesn't make that redundant.

Changing the default may mess up WinGUI if it assumes that perm_invent
is full inventory with gold.

Initially I was going to change perm_invent into a compound but this
leaves it as an on/off toggle and adds perminv_mode as a separate
option for how to show the inventory when the toggle is on.  It may
make sense to combine them since dual controls is a little confusing,
but right now setting perm_invent On when perminv_mode is 'none'
changes that to 'all' and changing perminv_mode away from 'none' when
perm_invent is Off toggles it to On.

Guidebook.mn has been updated but as usual Guidebook.tex is lagging.
2023-11-05 02:31:26 -08:00
Pasi Kallinen
2bb7239867 Fix iron bars dissolving turning floor into doorway 2023-11-04 13:41:12 +02:00
Pasi Kallinen
738c2239c9 Lightning has a small chance of melting iron bars 2023-11-04 13:04:27 +02:00
SHIRAKATA Kentaro
d5fa2f8ba0 Split sacrificing same race into separete function 2023-11-04 13:52:31 +09:00
Pasi Kallinen
56f4657041 Simplify add_menu, part 10 2023-11-03 22:37:50 +02:00
Pasi Kallinen
4dd9602f4b Simplify add_menu, part 9 2023-11-03 22:32:36 +02:00
Pasi Kallinen
ee27757b60 Simplify add_menu, part 8 2023-11-03 22:23:46 +02:00
Pasi Kallinen
06235b7841 Simplify add_menu, part 7 2023-11-03 22:04:55 +02:00
Pasi Kallinen
70c47c4054 Simplify add_menu, part 6 2023-11-03 21:48:46 +02:00
Pasi Kallinen
93fd946ff6 Simplify add_menu, part 5 2023-11-03 21:41:26 +02:00
Pasi Kallinen
175d167896 Simplify add_menu, part 4 2023-11-03 21:27:22 +02:00
Pasi Kallinen
7592ce81f4 Simplify add_menu, part 3 2023-11-03 21:09:34 +02:00
Pasi Kallinen
2fd177ddb5 Simplify add_menu, part 2 2023-11-03 21:01:17 +02:00
vultur-cadens
43f42b35e6 potion of sickness hit effect
The potion of sickness would previously always print the message
"<mon> looks rather ill." when hitting a non-poison-resistant monster,
even if all effects were resisted due to monster magic resistance.

To make the potion more useful against high-MR monsters, this change
removes the dependence on monster MR, but also removes the halving of
maximum HP to prevent it from being overpowered.  Hitting with a
potion of sickness now reliably halves only the current HP of
non-poison-resistant targets.

The effect of poisoned projectiles, which can be created from a potion
of sickness, is not resisted by monster MR, so it does not make much
sense for the potion effect to be subject to monster MR.  There is
also code to make Pestilence suffer the sickness effect when hit by a
potion of healing, but due to monster MR, it had no practical effect
other than printing a misleading message.
2023-11-03 11:18:29 -07:00
Michael Meyer
ccf997b28b Cache and restore gb.bhitpos in water_damage_chain
If throwing an item while levitating sent the hero hurtling into a wall
of water, the item would land in the water due to water_damage_chain's
use of bhitpos.  Restore the previous value when it is finished to avoid
interfering with the use of bhitpos further up the call stack.
2023-11-03 11:04:35 -07:00
Michael Meyer
5ba7939110 Fix: hurtling into wall of water
A hero hurtled into a wall of water while levitating, flying, or wearing
water-walking boots wouldn't be stopped by it unless it was on the Plane
of Water.  Make it stop hurtling heroes immediately no matter the
location.

I also noticed that once I was hurtled safely into the wall of water, it
was described as a "pool" when I examined it with ':'.  Fix that, too,
even though I think it shouldn't really be encountered in-game.
2023-11-03 11:04:34 -07:00
Pasi Kallinen
a6051dae81 Simplify adding menu headings 2023-11-03 19:07:15 +02:00
Pasi Kallinen
852f8e4996 Dropping items disturbs buried zombies 2023-11-02 20:31:51 +02:00
Pasi Kallinen
e6993f2ef1 Digging down on a magical trap causes it to explode 2023-11-02 19:18:18 +02:00
PatR
c1045cc18a sanity check: avoid "you over monster" impossible
I did this several months ago to avoid a sanity check warning (and
consequent fuzzer panic) when an engulfer expels the hero on a full
level.  I was hoping to refine it but never went back; install it
now before forgetting about it entirely.

If a chameleon changes from wall-phazer to engulfer while in a spot
the hero can't move onto and engulfs him/her, expelling the hero
after the engulfer has taken the hero's spot might be forced to put
the hero on top of the engulfer or another monster when unable to
use the engulfer's former spot.  Rather than try to figure out all
the possible ways this might happen and attempt to deal with each
of them, just prevent an engulf attack from succeeding if the hero
wouldn't be able to move to the engulfer's spot.  (Does not prevent
an air elemental over water from engulfing the hero.)
2023-11-02 09:12:37 -07:00
PatR
8cd032a6aa thawing ice fix
Ice in front of a raised drawbridge was desccribed as "[ice:19?]"
and didn't present any thaw status when hero was close.
2023-11-02 01:13:18 -07:00
PatR
a985fa1167 comment fixup for saving cond_xyz
This started as a typo/thinko fix but ended up rewording the comment.
2023-11-01 22:07:43 -07:00
PatR
986596b26d tweak to #K4026 fix 2023-11-01 02:08:39 -07:00
PatR
fa0f3751a3 fix #K4026 - "object lost" panic during theft
"object lost" panic occurred when hero's worn amulet of magical
breathing was stolen.  This prevents drown() -> emergency_disrobe()
from dropping an item while in the midst of it being stolen, avoiding
the possibility of it no longer being in inventory when the theft
completes.  There may be variations other than drowning that lead to
unwear -> drop-or-destroy that are still vulnerable, and this fix can
potentially cause items to vanish from hangup save files.

It also has a side-effect of not being able to drop levitation boots
to lighten encumbrance enough to crawl out of water if the drowning
occurs while they are being taken off, not just when being stolen,
even though they should be easily droppable in such circumstance.  The
hero will just need to drop other things instead.
2023-11-01 01:54:32 -07:00
PatR
c8a84acfa5 handle C++ vs enum arithmatic differently
The cast to (int) was much simpler but this seems better overall.
2023-10-31 15:04:14 -07:00
PatR
c13b0953c2 still more #saveoptions and cond_ options
If any cond_xyz options came from the old RC file or were changed with
'm O' but they were all back to their default values when #saveoptions
was executed, the new RC file would end up with 'OPTIONS=\n' at the
end.  Then if that RC file gets loaded in a subsequent game, there
will be a warning about "Empty statement".
2023-10-31 11:21:04 -07:00
Pasi Kallinen
4b70213677 #saveoptions fixme comment 2023-10-31 18:16:56 +02:00
Pasi Kallinen
1d9726f821 More #saveoptions and cond_ options
Only save the cond_ options that are different from the default.
2023-10-31 14:57:36 +02:00
PatR
6303141f1d fix #K4025 - #saveoptions vs cond_ options
Confusion between 'o_status_cond' and 'pfx_cond_'.  Still confusing
but I think now working as intended and expected.

If any cond_xyz option has been loaded from the RC file or changed via
'm O', #saveoptions still saves the full set rather than just the ones
that are different from their default value.
2023-10-31 01:19:20 -07:00
nhmall
a3f452bbe0 Verbose reversion follow-up 2023-10-29 21:02:47 -04:00
nhmall
6cbefc7c2d Revert "granular verbose message suppression mechanics"
This reverts commit be76727265.
2023-10-29 20:39:07 -04:00