From 1a2eb5c482d9754544d267ff71bbec4c7411ab60 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sat, 15 Sep 2007 15:33:21 +0000 Subject: Fixed a bug that made silence last forever. This also meant moving "Your hearing returns." where it belongs, thus fixing 1773460. I also moved a couple of messages (namely weapon noises, and hell effects) into MSGCH_TALK and MSGCH_SOUND, both of which now are ignored as travel stoppers. I didn't check all instances of potential talk and noises, but if there are cases where we want a message to always stop resting, we could move the message in question to MSGCH_WARN or MSGCH_MONSTER_SPELL. Conversely, there's probably lots of stuff around that could also get ignored. Users can still specify messages in stop_travel that will interrupt both rest and travel. (There's currently no distinction, and I made no changes on that account.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2089 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 12 ++++++++---- crawl-ref/source/it_use2.cc | 2 +- crawl-ref/source/it_use3.cc | 7 +++++-- crawl-ref/source/item_use.cc | 9 ++++++--- crawl-ref/source/items.cc | 44 +++++++++++++++++++++++++------------------- crawl-ref/source/message.cc | 12 +++++++++++- 6 files changed, 56 insertions(+), 30 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 5e0cf7eb1b..03addb8192 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1798,6 +1798,9 @@ static void decrement_durations() if (decrement_a_duration(DUR_ICY_ARMOUR, "Your icy armour evaporates.")) you.redraw_armour_class = true; + if (decrement_a_duration(DUR_SILENCE, "Your hearing returns.")) + you.attribute[ATTR_WAS_SILENCED] = 0; + decrement_a_duration(DUR_REPEL_MISSILES, "You feel less protected from missiles.", 6, coinflip(), @@ -2202,8 +2205,6 @@ static void world_reacts() StashTracker::ST_AGGRESSIVE : StashTracker::ST_PASSIVE); - bool its_quiet; //jmf: for silence messages - if (you.num_turns != -1) { you.num_turns++; @@ -2334,7 +2335,10 @@ static void world_reacts() } //jmf: added silence messages - its_quiet = silenced(you.x_pos, you.y_pos); + // [jpeg] Commenting out until we add other sources of Silence + // than the player casting the spell (messages handled elsewhere) +/* + bool its_quiet = silenced(you.x_pos, you.y_pos); if (you.attribute[ATTR_WAS_SILENCED] != its_quiet) { @@ -2352,7 +2356,7 @@ static void world_reacts() you.attribute[ATTR_WAS_SILENCED] = its_quiet; } - +*/ viewwindow(true, false); if (you.duration[DUR_PARALYSIS] > 0 && any_messages()) diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc index de7f018b9d..d05bc34b02 100644 --- a/crawl-ref/source/it_use2.cc +++ b/crawl-ref/source/it_use2.cc @@ -383,7 +383,7 @@ void unwield_item(bool showMsgs) { case SPWPN_SINGING_SWORD: if (showMsgs) - mpr("The Singing Sword sighs."); + mpr("The Singing Sword sighs.", MSGCH_TALK); break; case SPWPN_WRATH_OF_TROG: if (showMsgs) diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc index 09d736e888..7119f13e41 100644 --- a/crawl-ref/source/it_use3.cc +++ b/crawl-ref/source/it_use3.cc @@ -112,7 +112,7 @@ void special_wielded() "makes a deep moaning sound.", "gives off a wolf whistle.", "wails.", "giggles.", "lets out a whoop!", "yawns loudly.", "chatters happily.", "recites a poem.", "prattles on and on.", - "regales you with its life story.", "intones a prayer.", + "regales you with its life story.", "intones a prayer.", "shouts 'Whoopee!'", "hurls insults at you.", "cries out!", "argues with itself.", "complains about the scenery.", "says 'I'm bored.'", "calls out a warning!", "swears loudly.", @@ -148,6 +148,8 @@ void special_wielded() int num_suffixes; std::string message; + msg_channel_type channel = MSGCH_TALK; + if (you.special_wield == SPWLD_SING) { message = "The Singing Sword "; @@ -172,6 +174,7 @@ void special_wielded() num_suffixes = sizeof(suffixes_sounds) / sizeof(suffixes_sounds[0]); message += suffixes_sounds[random2(num_suffixes)]; + channel = MSGCH_SOUND; } else // normal chatter { @@ -183,7 +186,7 @@ void special_wielded() message += suffixes_talk[random2(num_suffixes)]; } } - mpr(message.c_str(), MSGCH_SOUND); + mpr(message.c_str(), channel); } // makes_noise break; diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 9df636088b..c3174898fb 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -475,7 +475,10 @@ void wield_effects(int item_wield_2, bool showMsgs) break; case SPWPN_ELECTROCUTION: - mpr("You hear the crackle of electricity."); + if (!silenced(you.x_pos, you.y_pos)) + mpr("You hear the crackle of electricity.", MSGCH_SOUND); + else + mpr("You see sparks fly."); break; case SPWPN_ORC_SLAYING: @@ -529,9 +532,9 @@ void wield_effects(int item_wield_2, bool showMsgs) case SPWPN_SINGING_SWORD: if (!was_known) - mprf("%s says, 'Hi! I'm the Singing Sword!'", old_desc); + mprf(MSGCH_TALK, "%s says, 'Hi! I'm the Singing Sword!'", old_desc); else - mpr("The Singing Sword hums in delight!"); + mpr("The Singing Sword hums in delight!", MSGCH_TALK); break; case SPWPN_WRATH_OF_TROG: diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index ae6b7a94ea..59912b8e81 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -2196,26 +2196,32 @@ void handle_time( long time_delta ) { temp_rand = random2(17); - mpr((temp_rand == 0) ? "\"You will not leave this place.\"" : - (temp_rand == 1) ? "\"Die, mortal!\"" : - (temp_rand == 2) ? "\"We do not forgive those who trespass against us!\"" : - (temp_rand == 3) ? "\"Trespassers are not welcome here!\"" : - (temp_rand == 4) ? "\"You do not belong in this place!\"" : - (temp_rand == 5) ? "\"Leave now, before it is too late!\"" : - (temp_rand == 6) ? "\"We have you now!\"" : - (temp_rand == 7) ? "You feel a terrible foreboding..." : - (temp_rand == 8) ? "You hear words spoken in a strange and terrible language..." : - - (temp_rand == 9) ? (player_can_smell()) ? "You smell brimstone." : - "Brimstone rains from above." : - (temp_rand == 10) ? "Something frightening happens." : - (temp_rand == 11) ? "You sense an ancient evil watching you..." : - (temp_rand == 12) ? "You feel lost and a long, long way from home..." : + mpr((temp_rand == 0) ? "\"You will not leave this place.\"" : + (temp_rand == 1) ? "\"Die, mortal!\"" : + (temp_rand == 2) ? "\"We do not forgive those who trespass against us!\"" : + (temp_rand == 3) ? "\"Trespassers are not welcome here!\"" : + (temp_rand == 4) ? "\"You do not belong in this place!\"" : + (temp_rand == 5) ? "\"Leave now, before it is too late!\"" : + (temp_rand == 6) ? "\"We have you now!\"" : + // plain messages + (temp_rand == 7) ? (player_can_smell()) ? "You smell brimstone." : + "Brimstone rains from above." : + (temp_rand == 8) ? "You feel lost and a long, long way from home..." : + (temp_rand == 9) ? "You shiver with fear." : + // warning + (temp_rand == 10) ? "You feel a terrible foreboding..." : + (temp_rand == 11) ? "Something frightening happens." : + (temp_rand == 12) ? "You sense an ancient evil watching you..." : (temp_rand == 13) ? "You suddenly feel all small and vulnerable." : - (temp_rand == 14) ? "A gut-wrenching scream fills the air!" : - (temp_rand == 15) ? "You shiver with fear." : - (temp_rand == 16) ? "You sense a hostile presence." - : "You hear diabolical laughter!", MSGCH_TALK); + (temp_rand == 14) ? "You sense a hostile presence." : + // sounds + (temp_rand == 15) ? "A gut-wrenching scream fills the air!" : + (temp_rand == 16) ? "You hear words spoken in a strange and terrible language..." + : "You hear diabolical laughter!", + (temp_rand < 7 ? MSGCH_TALK : + temp_rand < 10 ? MSGCH_PLAIN : + temp_rand < 15 ? MSGCH_WARN + : MSGCH_SOUND) ); temp_rand = random2(27); diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc index 123533f1de..fef6efa68a 100644 --- a/crawl-ref/source/message.cc +++ b/crawl-ref/source/message.cc @@ -479,8 +479,12 @@ static void mpr_check_patterns(const std::string& message, } } - if (channel != MSGCH_DIAGNOSTICS && channel != MSGCH_EQUIPMENT) + // reusing travel_stop_message here + if (channel != MSGCH_DIAGNOSTICS && channel != MSGCH_EQUIPMENT + && channel != MSGCH_SOUND && channel != MSGCH_TALK) + { interrupt_activity( AI_MESSAGE, channel_to_str(channel) + ":" + message ); + } // Check messages for all forms of running now. if (you.running) @@ -588,6 +592,12 @@ static void base_mpr(const char *inf, msg_channel_type channel, int param) if ( colour == MSGCOL_MUTED ) return; + + if (silenced(you.x_pos, you.y_pos) && + (channel == MSGCH_SOUND || channel == MSGCH_TALK)) + { + return; + } if (need_prefix) { -- cgit v1.2.3-54-g00ecf