diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-25 15:37:08 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-25 15:37:08 +0000 |
commit | 12b89633e82cf30122e96aaa65e9eebefba6e719 (patch) | |
tree | ede539aa683b474cfc8389995da74f5d41e516f0 /crawl-ref/source | |
parent | 038933c5364d09f01b7a99026aea6bafcf4dcc71 (diff) | |
download | crawl-ref-12b89633e82cf30122e96aaa65e9eebefba6e719.tar.gz crawl-ref-12b89633e82cf30122e96aaa65e9eebefba6e719.zip |
Don't give shout/talk messages if they're on the TALK_VISUAL channel
(e.g., "The jelly quivers", "The jelly jiggles") and you can't see
the relevant monster.
Fixes half of [2628480].
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9215 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/dat/database/shout.txt | 18 | ||||
-rw-r--r-- | crawl-ref/source/monspeak.cc | 17 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 16 | ||||
-rw-r--r-- | crawl-ref/source/view.cc | 7 |
4 files changed, 28 insertions, 30 deletions
diff --git a/crawl-ref/source/dat/database/shout.txt b/crawl-ref/source/dat/database/shout.txt index 3a6a06fea1..e2cf21c1a3 100644 --- a/crawl-ref/source/dat/database/shout.txt +++ b/crawl-ref/source/dat/database/shout.txt @@ -263,25 +263,25 @@ Wanderer player ghost %%%% 'a' -@The_monster@ twitches @possessive@ antennae in your direction. +VISUAL:@The_monster@ twitches @possessive@ antennae in your direction. %%%% 'cap-B' -@The_monster@ twitches @possessive@ antennae in your direction. +VISUAL:@The_monster@ twitches @possessive@ antennae in your direction. %%%% # Giant spores have their own visual, this is only for the eyeball # related ones. 'cap-G' -@The_monster@ turns @possessive@ gaze towards you. +VISUAL:@The_monster@ turns @possessive@ gaze towards you. %%%% 'j' -@The_monster@ swivels @possessive@ eye-stalks towards you. +VISUAL:@The_monster@ swivels @possessive@ eye-stalks towards you. %%%% 'cap-J' -@The_monster@ quivers. +VISUAL:@The_monster@ quivers. ######################################## # Shouts for specific monsters ######################################## @@ -290,7 +290,7 @@ Wanderer player ghost # other 'G' monsters. giant spore -@The_monster@ waves @possessive@ rhizomes. +VISUAL:@The_monster@ waves @possessive@ rhizomes. %%%% # Shadow imps and white imps copy imps. imp @@ -298,11 +298,11 @@ imp # Shout one half the time, taunt the other half. @__SHOUT@ -@The_monster@ @says@, "@imp_taunt@" +SOUND:@The_monster@ @says@, "@imp_taunt@" %%%% moth of wrath -@The_monster@'s fur bristles in rage as it notices you. +VISUAL:@The_monster@'s fur bristles in rage as it notices you. %%%% shadow imp @@ -318,5 +318,5 @@ white imp Polyphemus # This would also work for other monsters that are surrounded by allies. -@The_monster@ shouts, "Attack, my pets! Attack!" +SOUND:@The_monster@ shouts, "Attack, my pets! Attack!" %%%% diff --git a/crawl-ref/source/monspeak.cc b/crawl-ref/source/monspeak.cc index 2e82194879..c956118664 100644 --- a/crawl-ref/source/monspeak.cc +++ b/crawl-ref/source/monspeak.cc @@ -749,7 +749,7 @@ void mons_speaks_msg(const monsters *monster, const std::string &msg, // This function is a little bit of a problem for the message // channels since some of the messages it generates are "fake" - // warning to scare the player. In order to accomidate this + // warning to scare the player. In order to accomodate this // intent, we're falsely categorizing various things in the // function as spells and danger warning... everything else // just goes into the talk channel -- bwr @@ -795,21 +795,14 @@ void mons_speaks_msg(const monsters *monster, const std::string &msg, // Except for VISUAL, none of the above influence these. if (line == "__YOU_RESIST" && (!silence || param == "VISUAL")) - { canned_msg( MSG_YOU_RESIST ); - continue; - } else if (line == "__NOTHING_HAPPENS" && (!silence || param == "VISUAL")) - { canned_msg( MSG_NOTHING_HAPPENS ); - continue; - } else if (line == "__MORE" && (!silence || param == "VISUAL")) - { more(); - continue; - } - - mpr(line.c_str(), msg_type); + else if (msg_type == MSGCH_TALK_VISUAL && !you.can_see(monster)) + ; // do nothing + else + mpr(line.c_str(), msg_type); } } diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 32e3c578ce..3540f91167 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -8125,7 +8125,7 @@ static void _find_good_alternate_move(monsters *monster, for (int mod = sdir, i = 0; i < 2; mod += inc, i++) { - int newdir = (dir + 8 + mod) % 8; + const int newdir = (dir + 8 + mod) % 8; if (good_move[mon_compass[newdir].x+1][mon_compass[newdir].y+1]) { dist[i] = distance(monster->pos()+mon_compass[newdir], @@ -8133,11 +8133,13 @@ static void _find_good_alternate_move(monsters *monster, } else { - dist[i] = (mons_is_fleeing(monster)) ? (-FAR_AWAY) - : FAR_AWAY; + dist[i] = (mons_is_fleeing(monster)) ? (-FAR_AWAY) : FAR_AWAY; } } + const int dir0 = ((dir + 8 + sdir) % 8); + const int dir1 = ((dir + 8 - sdir) % 8); + // Now choose. if (dist[0] == dist[1] && abs(dist[0]) == FAR_AWAY) continue; @@ -8147,12 +8149,12 @@ static void _find_good_alternate_move(monsters *monster, { if (dist[0] >= dist[1] && dist[0] >= current_distance) { - mmov = mon_compass[((dir+8)+sdir)%8]; + mmov = mon_compass[dir0]; break; } if (dist[1] >= dist[0] && dist[1] >= current_distance) { - mmov = mon_compass[((dir+8)-sdir)%8]; + mmov = mon_compass[dir1]; break; } } @@ -8160,12 +8162,12 @@ static void _find_good_alternate_move(monsters *monster, { if (dist[0] <= dist[1] && dist[0] <= current_distance) { - mmov = mon_compass[((dir+8)+sdir)%8]; + mmov = mon_compass[dir0]; break; } if (dist[1] <= dist[0] && dist[1] <= current_distance) { - mmov = mon_compass[((dir+8)-sdir)%8]; + mmov = mon_compass[dir1]; break; } } diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index a13194baa1..0e836ba0d9 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -1197,8 +1197,11 @@ void handle_monster_shouts(monsters* monster, bool force) } } - msg = do_mon_str_replacements(msg, monster, s_type); - msg::streams(channel) << msg << std::endl; + if (channel != MSGCH_TALK_VISUAL || you.can_see(monster)) + { + msg = do_mon_str_replacements(msg, monster, s_type); + msg::streams(channel) << msg << std::endl; + } } const int noise_level = get_shout_noise_level(s_type); |