diff options
author | gammafunk <gammafunk@gmail.com> | 2014-03-04 18:53:58 -0600 |
---|---|---|
committer | gammafunk <gammafunk@gmail.com> | 2014-03-06 11:42:35 -0600 |
commit | 4a7354f52e5f00663930a651e6502de5a8a8fb26 (patch) | |
tree | 59ece0838a119114249c1b2e86d34115829f7e0d /crawl-ref/source/mon-ench.cc | |
parent | 465263a558223b22c6597894e5a0dacdb376d401 (diff) | |
download | crawl-ref-4a7354f52e5f00663930a651e6502de5a8a8fb26.tar.gz crawl-ref-4a7354f52e5f00663930a651e6502de5a8a8fb26.zip |
Fix various issues with invisible monster indicators.
Currently if a monster enters LOS and goes invisible on the same turn,
it can disappear from the screen before the player has a proper
indication of where it was. This commit makes the following changes:
1. Fixes invisible monster indicators so that they can reliably be set
in the monster map knowledge update code at locations that of the
current monster being processed in this loop. The previous code tried
to set this indicator, but due to how the old loop cleared all flags
other than MAP_SEEN_FLAG and did tiles cell draws in the same pass as
map knowledge updates, these wouldn't work. This commit adds a
MAP_INVISIBLE_UPDATE flag to help retain MAP_INVISIBLE_MONSTER when
necessary, as well as a second loop in show_init that loops over a
vector of the updated cells found in the radius_iterator loop. This
second loop should be fast enough that it doesn't significantly affect
performance.
2. Add 'bool went_unseen_this_turn' and 'coord_def unseen_pos' to the
monster class (with the necessary save compat code) to allow monsters
that go invisible in LOS to always get an invisible indicator. The
code prefers to use indicators arising from the monster failing
stealth checks if those occur; they are based on the monster's true
position and hence are usually more accurate.
3. Somewhat simplify the stealth check code for invis indicators, and
only ever allow one invis indicator per monster. The stealth check
logic perhaps could be simplified further (there are multiple checks),
but I've preserved the existing checks for now. Also turned a
coinflip() in one of the secondary checks into a seeded/hashed
coinflip so it won't change over screen updates.
This commit lets players with antennae always see the location of an
invisible monster through an invis indicator, and sets the invis
indicator on the monster's last position whenever a monster becomes
unseen (e.g. going invis or already being invis but the player removes
sinv). If the monster fails a stealth check, that potentially more
accurate information is favored over the unseen position.
Diffstat (limited to 'crawl-ref/source/mon-ench.cc')
-rw-r--r-- | crawl-ref/source/mon-ench.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-ench.cc b/crawl-ref/source/mon-ench.cc index 3e76e24e3e..61038c456e 100644 --- a/crawl-ref/source/mon-ench.cc +++ b/crawl-ref/source/mon-ench.cc @@ -316,6 +316,14 @@ void monster::add_enchantment_effect(const mon_enchant &ench, bool quiet) break; } + case ENCH_INVIS: + if (testbits(flags, MF_WAS_IN_VIEW)) + { + went_unseen_this_turn = true; + unseen_pos = pos(); + } + break; + default: break; } |