diff options
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/acr.cc | 6 | ||||
-rw-r--r-- | crawl-ref/source/message.cc | 12 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 17 | ||||
-rw-r--r-- | crawl-ref/source/view.cc | 20 |
5 files changed, 40 insertions, 18 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index ebe09fae0e..88cec101ae 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1517,11 +1517,11 @@ static void _input() return; } + update_monsters_in_view(); + you.turn_is_over = false; _prep_input(); - update_monsters_in_view(); - const bool player_feels_safe = i_feel_safe(); if (Options.tutorial_left) @@ -3113,6 +3113,8 @@ static void _check_sanctuary() void world_reacts() { + you.turn_is_over = true; + if (!crawl_state.arena) religion_turn_end(); diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc index 0fd2787973..467b899600 100644 --- a/crawl-ref/source/message.cc +++ b/crawl-ref/source/message.cc @@ -417,6 +417,8 @@ void mprf( const char *format, ... ) va_end( argp ); } +static bool _updating_view = false; + void mpr(const char *inf, msg_channel_type channel, int param) { if (_msg_dump_file != NULL) @@ -459,6 +461,16 @@ void mpr(const char *inf, msg_channel_type channel, int param) return; } + // Flush out any "comes into view" monster announcements before the + // monster has a chance to give any other messages. + if (!_updating_view && you.turn_is_over + && (you_are_delayed() || crawl_state.is_repeating_cmd())) + { + _updating_view = true; + update_monsters_in_view(); + _updating_view = false; + } + if (channel == MSGCH_GOD && param == 0) param = you.religion; diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index d6e6a619f2..8298020cad 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -7583,9 +7583,6 @@ void monsters::check_redraw(const coord_def &old) const view_update_at(pos()); if (see_old) view_update_at(old); - // Force "comes into view" message to be given. - if (see_new && !see_old) - viewwindow(false, false); update_screen(); } } diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 9199d78f98..f59f53f4ce 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -4912,10 +4912,19 @@ static void _handle_nearby_ability(monsters *monster) #define MON_SPEAK_CHANCE 21 - if ((mons_class_flag(monster->type, M_SPEAKS) - || !monster->mname.empty()) - && (!mons_is_wandering(monster) || monster->attitude == ATT_NEUTRAL) - && one_chance_in(MON_SPEAK_CHANCE)) + if (monster->is_patrolling() || mons_is_wandering(monster) + || monster->attitude == ATT_NEUTRAL) + { + // Very fast wandering/patrolling monsters might, in one monster turn, + // move into the player's LOS and then back out (or the player + // might move into their LOS and the monster move back out before + // the player's view has a chance to update) so prevent them + // from speaking. + ; + } + else if ((mons_class_flag(monster->type, M_SPEAKS) + || !monster->mname.empty()) + && one_chance_in(MON_SPEAK_CHANCE)) { mons_speaks(monster); } diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 9066ba744c..f7a62bc8a7 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -1224,9 +1224,6 @@ void monster_grid(bool do_updates) if (monster->alive() && mons_near(monster)) { - if (player_monster_visible(monster)) - _handle_seen_interrupt(monster); - if (do_updates && (mons_is_sleeping(monster) || mons_is_wandering(monster)) && check_awaken(monster)) @@ -1277,12 +1274,6 @@ void update_monsters_in_view() if (!monster->alive()) continue; - monster->flags &= ~MF_WAS_IN_VIEW; - - // If the monster hasn't been seen by the time that the player - // gets control back then seen_context is out of date. - monster->seen_context.clear(); - if (mons_near(monster)) { if (monster->attitude == ATT_HOSTILE) @@ -1292,9 +1283,20 @@ void update_monsters_in_view() && (!mons_is_mimic(monster->type) || mons_is_known_mimic(monster))) { + if (!(monster->flags & MF_WAS_IN_VIEW) && you.turn_is_over) + _handle_seen_interrupt(monster); + seen_monster(monster); } + else + monster->flags &= ~MF_WAS_IN_VIEW; } + else + monster->flags &= ~MF_WAS_IN_VIEW; + + // If the monster hasn't been seen by the time that the player + // gets control back then seen_context is out of date. + monster->seen_context.clear(); } // Xom thinks it's hilarious the way the player picks up an ever |