From 28364e961a56dcc73cf7d15562d253d392745642 Mon Sep 17 00:00:00 2001 From: dolorous Date: Wed, 28 May 2008 21:35:27 +0000 Subject: Add more noise-related cleanups. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5318 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 23 ++++++++++++----------- crawl-ref/source/beam.cc | 7 +++---- crawl-ref/source/effects.cc | 6 +++--- crawl-ref/source/it_use3.cc | 2 +- crawl-ref/source/item_use.cc | 8 ++++---- crawl-ref/source/monstuff.cc | 8 +++----- crawl-ref/source/religion.cc | 6 +++--- crawl-ref/source/spells1.cc | 4 ++-- crawl-ref/source/spells2.cc | 2 +- crawl-ref/source/spells3.cc | 2 +- crawl-ref/source/spells4.cc | 8 +++----- crawl-ref/source/spl-cast.cc | 6 +----- crawl-ref/source/view.cc | 6 +++--- crawl-ref/source/view.h | 2 +- 14 files changed, 41 insertions(+), 49 deletions(-) diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 5b364affc1..6dfa3d0680 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -3539,7 +3539,6 @@ static void _open_door(int move_x, int move_y, bool check_confused) { if (mons_is_caught(&menv[mon])) { - std::string prompt = "Do you want to try to take the net off "; prompt += (&menv[mon])->name(DESC_NOCAP_THE); prompt += '?'; @@ -3616,19 +3615,19 @@ static void _open_door(int move_x, int move_y, bool check_confused) { // XXX: better flavour for larger doors? if (silenced(you.x_pos, you.y_pos)) - { mprf("The %s%s flies open!", adj, noun); - } else { - mprf("The %s%s flies open with a bang!", adj, noun); - noisy( 15, you.x_pos, you.y_pos ); + mprf(MSGCH_SOUND, "The %s%s flies open with a bang!", + adj, noun); + noisy(15, you.x_pos, you.y_pos); } } else if (one_chance_in(skill) && !silenced(you.x_pos, you.y_pos)) { - mprf( "As you open the %s%s, it creaks loudly!", adj, noun ); - noisy( 10, you.x_pos, you.y_pos ); + mprf(MSGCH_SOUND, "As you open the %s%s, it creaks loudly!", + adj, noun); + noisy(10, you.x_pos, you.y_pos); } else { @@ -3769,14 +3768,16 @@ static void _close_door(int door_x, int door_y) } else { - mprf("You slam the %s%s shut with an echoing bang!", adj, noun); - noisy( 25, you.x_pos, you.y_pos ); + mprf(MSGCH_SOUND, "You slam the %s%s shut with an echoing bang!", + adj, noun); + noisy(25, you.x_pos, you.y_pos); } } else if (one_chance_in(skill) && !silenced(you.x_pos, you.y_pos)) { - mprf("As you close the %s%s, it creaks loudly!", adj, noun); - noisy( 10, you.x_pos, you.y_pos ); + mprf(MSGCH_SOUND, "As you close the %s%s, it creaks loudly!", + adj, noun); + noisy(10, you.x_pos, you.y_pos); } else { diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 71c5e5f9a3..f78121bc8e 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -265,11 +265,10 @@ bool zapping(zap_type ztype, int power, bolt &pbolt, bool needs_tracer, if (!msg.empty()) mpr(msg.c_str()); - if (ztype == ZAP_LIGHTNING && !silenced(you.x_pos, you.y_pos)) + if (ztype == ZAP_LIGHTNING) { // XXX: needs to check silenced at other location, too {dlb} - mpr("You hear a mighty clap of thunder!", MSGCH_SOUND); - noisy( 25, you.x_pos, you.y_pos ); + noisy(25, you.x_pos, you.y_pos, "You hear a mighty clap of thunder!"); } fire_beam(pbolt); @@ -5244,7 +5243,7 @@ void explosion( bolt &beam, bool hole_in_the_middle, r = MAX_EXPLOSION_RADIUS; // make a noise - noisy( 10 + 5*r, beam.target_x, beam.target_y ); + noisy(10 + 5 * r, beam.target_x, beam.target_y); // set map to false explode_map.init(false); diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 7f1191f5dd..fae20f6a8a 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -1966,7 +1966,7 @@ void yell(bool force) if (force) { mprf("A %s rips itself from your throat!", shout_verb.c_str()); - noisy( noise_level, you.x_pos, you.y_pos ); + noisy(noise_level, you.x_pos, you.y_pos); return; } @@ -2003,8 +2003,8 @@ void yell(bool force) case '!': // for players using the old keyset case 't': mprf(MSGCH_SOUND, "You %s for attention!", shout_verb.c_str()); + noisy(noise_level, you.x_pos, you.y_pos); you.turn_is_over = true; - noisy( noise_level, you.x_pos, you.y_pos ); return; case 'f': @@ -2080,7 +2080,7 @@ void yell(bool force) if (mons_targd != MHITNOT && mons_targd != MHITYOU) mpr("Attack!"); - noisy( 10, you.x_pos, you.y_pos ); + noisy(10, you.x_pos, you.y_pos); } // end yell() bool forget_inventory(bool quiet) diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc index 90fe0faa58..a825e11a08 100644 --- a/crawl-ref/source/it_use3.cc +++ b/crawl-ref/source/it_use3.cc @@ -239,7 +239,7 @@ void special_wielded() } if (makes_noise) - noisy( 25, you.x_pos, you.y_pos ); + noisy(25, you.x_pos, you.y_pos); if (old_plus != you.inv[wpn].plus || old_plus2 != you.inv[wpn].plus2 diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index a1732b0fe6..222bbb9285 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -2377,7 +2377,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, exDamBonus = 0; ammoDamBonus = 0; - // ... but accuracy is important for this one. + // ...but accuracy is important for this one. baseHit = 1; exHitBonus += (skill_bump(SK_THROWING) * 7 / 2); // Adjust for strength and dex. @@ -2550,11 +2550,11 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, dec_inv_item_quantity( throw_2, 1 ); } - // Throwing and blowguns are silent + // Throwing and blowguns are silent... if (projected == LRET_LAUNCHED && lnchType != WPN_BLOWGUN) - noisy( 6, you.x_pos, you.y_pos ); + noisy(6, you.x_pos, you.y_pos); - // ... but any monster nearby can see that something has been thrown: + // ...but any monster nearby can see that something has been thrown. alert_nearby_monsters(); you.turn_is_over = true; diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 054264beed..0affe99ecf 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -6215,16 +6215,14 @@ static bool _monster_move(monsters *monster) mprf(MSGCH_TALK_VISUAL, "%s rages.", monster->name(DESC_CAP_THE).c_str()); } - noisy( noise_level, monster->x, monster->y ); + noisy(noise_level, monster->x, monster->y); } else if (one_chance_in(5)) - { handle_monster_shouts(monster, true); - } else { - // Just be noisy without messaging the player - noisy( noise_level, monster->x, monster->y ); + // Just be noisy without messaging the player. + noisy(noise_level, monster->x, monster->y); } } } diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 1802a64488..de6aa4d5b3 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -3009,7 +3009,7 @@ static bool _tso_retribution() if (coinflip()) { simple_god_message(" booms out: \"Take the path of righteousness! REPENT!\"", god); - noisy( 25, you.x_pos, you.y_pos ); // same as scroll of noise + noisy(25, you.x_pos, you.y_pos); // same as scroll of noise } else { @@ -3109,11 +3109,11 @@ static bool _zin_retribution() case 7: case 8: // famine (20%) simple_god_message(" sends a famine down upon you!", god); - make_hungry( you.hunger/2, false ); + make_hungry(you.hunger / 2, false); break; case 9: // noisiness (10%) simple_god_message(" booms out: \"Turn to the light! REPENT!\"", god); - noisy( 25, you.x_pos, you.y_pos ); // same as scroll of noise + noisy(25, you.x_pos, you.y_pos); // same as scroll of noise break; } return false; diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index cd3fe5e673..1296f1f418 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -391,8 +391,8 @@ void cast_chain_lightning( int powc ) // Trying to limit message spamming here so we'll only mention // the thunder when it's out of LoS. - if (noisy( 25, sx, sy ) && !see_source) - mpr( "You hear a mighty clap of thunder!", MSGCH_SOUND ); + if (!see_source) + noisy(25, sx, sy, "You hear a mighty clap of thunder!"); if (see_source && !see_targ) mpr( "The lightning arcs out of your line of sight!" ); diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 3c8e6c4f7c..b1e52bf169 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -675,7 +675,7 @@ bool brand_weapon(brand_type which_brand, int power) // well, in theory, we could be silenced, but then how are // we casting the brand spell? msg += " shrieks in agony."; - noisy( 15, you.x_pos, you.y_pos ); + noisy(15, you.x_pos, you.y_pos); duration_affected = 8; break; diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index a49e221fc9..fc80ab2600 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -1125,7 +1125,7 @@ bool project_noise(void) { if (in_bounds(pos) && !grid_is_solid(grd(pos))) { - noisy( 30, pos.x, pos.y ); + noisy(30, pos.x, pos.y); success = true; } diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index afec4122c8..77393b1c8c 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -293,8 +293,7 @@ static int shatter_walls(int x, int y, int pow, int garbage) if (random2(100) < chance) { - if (!silenced( x, y )) - noisy( 30, x, y ); + noisy(30, x, y); grd[x][y] = DNGN_FLOOR; return (1); @@ -306,10 +305,9 @@ static int shatter_walls(int x, int y, int pow, int garbage) void cast_shatter(int pow) { int damage = 0; - const bool sil = silenced( you.x_pos, you.y_pos ); + const bool sil = silenced(you.x_pos, you.y_pos); - if (!sil) - noisy( 30, you.x_pos, you.y_pos ); + noisy(30, you.x_pos, you.y_pos); mprf((sil ? MSGCH_PLAIN : MSGCH_SOUND), "The dungeon %s!", (sil ? "shakes" : "rumbles")); diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 9ae39a07bd..68cc286348 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -1095,11 +1095,7 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) break; case SPELL_CREATE_NOISE: // unused, the player can shout to do this - bwr - if (!silenced(you.x_pos, you.y_pos)) - { - mpr("You hear a voice call your name!", MSGCH_SOUND); - noisy( 25, you.x_pos, you.y_pos ); - } + noisy(25, you.x_pos, you.y_pos, "You hear a voice call your name!"); break; case SPELL_REMOVE_CURSE: diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index a0cc13a032..cfb056437c 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -1043,7 +1043,7 @@ void handle_monster_shouts(monsters* monster, bool force) } if (noise_level > 0) - noisy( noise_level, monster->x, monster->y ); + noisy(noise_level, monster->x, monster->y); } #ifdef WIZARD @@ -1455,13 +1455,13 @@ void cloud_grid(void) // player is appropriate. // // Returns true if the PC heard the noise. -bool noisy( int loudness, int nois_x, int nois_y, const char *msg ) +bool noisy(int loudness, int nois_x, int nois_y, const char *msg) { struct monsters *monster = 0; // NULL {dlb} bool ret = false; // If the origin is silenced there is no noise. - if (silenced( nois_x, nois_y )) + if (silenced(nois_x, nois_y)) return (false); const int dist = loudness * loudness; diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h index 357cfbf597..b0e6e0c2c4 100644 --- a/crawl-ref/source/view.h +++ b/crawl-ref/source/view.h @@ -105,7 +105,7 @@ bool magic_mapping(int map_radius, int proportion, bool suppress_msg, * called from: acr - effects - it_use2 - it_use3 - item_use - spell - * spells - spells3 - spells4 * *********************************************************************** */ -bool noisy( int loudness, int nois_x, int nois_y, const char *msg = NULL ); +bool noisy(int loudness, int nois_x, int nois_y, const char *msg = NULL); void blood_smell( int strength, int blood_x, int blood_y); void handle_monster_shouts(monsters* monster, bool force = false); -- cgit v1.2.3-54-g00ecf