From c917efe2ecd38f449619d7b25160c8053b81e108 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Mon, 20 Jul 2009 19:32:38 +0000 Subject: Use ETC_MAGIC for beam animations with unknown effect, so we don't accidentally leak information about unID'd wands etc. Some additional space fixes. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10358 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 27 +++++++++++++++++++-------- crawl-ref/source/initfile.cc | 4 ++-- crawl-ref/source/itemprop.cc | 2 +- crawl-ref/source/ouch.cc | 4 ++-- crawl-ref/source/player.cc | 8 ++++---- crawl-ref/source/religion.cc | 4 ++-- crawl-ref/source/tilepick.cc | 2 +- 7 files changed, 31 insertions(+), 20 deletions(-) diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 6ab37e09e2..72d7458ee5 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -132,13 +132,14 @@ kill_category bolt::whose_kill() const // A simple animated flash from Rupert Smith (expanded to be more // generic). -void zap_animation(int colour, const monsters *mon, bool force) +static void _zap_animation(int colour, const monsters *mon = NULL, + bool force = false) { coord_def p = you.pos(); if (mon) { - if (!force && !player_monster_visible( mon )) + if (!force && !player_monster_visible(mon)) return; p = mon->pos(); @@ -158,7 +159,6 @@ void zap_animation(int colour, const monsters *mon, bool force) #ifdef USE_TILE tiles.add_overlay(p, tileidx_zap(colour)); #else - view_update(); cgotoxy(drawp.x, drawp.y, GOTO_DNGN); put_colour_ch(colour, dchar_glyph(DCHAR_FIRED_ZAP)); @@ -170,7 +170,7 @@ void zap_animation(int colour, const monsters *mon, bool force) } // Special front function for zap_animation to interpret enchantment flavours. -static void _ench_animation( int flavour, const monsters *mon, bool force ) +static void _ench_animation(int flavour, const monsters *mon, bool force) { const int elem = (flavour == BEAM_HEALING) ? ETC_HEAL : (flavour == BEAM_PAIN) ? ETC_UNHOLY : @@ -183,7 +183,7 @@ static void _ench_animation( int flavour, const monsters *mon, bool force ) || flavour == BEAM_BLINK) ? ETC_WARP : ETC_ENCHANT; - zap_animation(element_colour(elem), mon, force); + _zap_animation(element_colour(elem), mon, force); } // If needs_tracer is true, we need to check the beam path for friendly @@ -1603,7 +1603,12 @@ void bolt::draw(const coord_def& p) #ifdef USE_TILE if (tile_beam == -1) - tile_beam = tileidx_bolt(*this); + { + if (effect_known) + tile_beam = tileidx_bolt(*this); + else + tile_beam = tileidx_zap(ETC_MAGIC); + } if (tile_beam != -1 && in_los_bounds(drawpos)) { @@ -3576,7 +3581,10 @@ void bolt::affect_player_enchantment() } // You didn't resist it. - _ench_animation( real_flavour ); + if (effect_known) + _ench_animation(real_flavour); + else + _zap_animation(-1); bool nasty = true, nice = false; @@ -4273,7 +4281,10 @@ void bolt::enchantment_affect_monster(monsters* mon) // Doing this here so that the player gets to see monsters // "flicker and vanish" when turning invisible.... - _ench_animation( real_flavour, mon ); + if (effect_known) + _ench_animation( real_flavour, mon ); + else + _zap_animation(-1, mon, false); // Try to hit the monster with the enchantment. const mon_resist_type ench_result = try_enchant_monster(mon); diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index eeb349a65b..3aa40954c6 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -1856,7 +1856,7 @@ static void _bindkey(std::string field) } else if (key_str.length() == 2) { - if(key_str[0] != '^') + if (key_str[0] != '^') { mprf(MSGCH_ERROR, "Invalid key '%s' in bindkey directive '%s'", key_str.c_str(), field.c_str()); @@ -3178,7 +3178,7 @@ void game_options::read_option_line(const std::string &str, bool runscript) } #endif - else if(key == "bindkey") + else if (key == "bindkey") { _bindkey(field); } diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index d2f104963a..fc4548158c 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -2578,7 +2578,7 @@ int item_mass(const item_def &item) if (brand == SPMSL_SILVER) unit_mass *= 2; - else if(brand == SPMSL_STEEL) + else if (brand == SPMSL_STEEL) unit_mass *= 3; break; } diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index d288dd0d30..ddd810801d 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -851,9 +851,9 @@ static void _maybe_spawn_jellies(int dam, const char* aux, int how_many = 0; if (dam >= you.hp_max * 0.75) how_many = random2(4) + 2; - else if(dam >= you.hp_max / 2) + else if (dam >= you.hp_max / 2) how_many = random2(2) + 2; - else if(dam >= you.hp_max / 4) + else if (dam >= you.hp_max / 4) how_many = random2(1) + 1; if (how_many > 0) diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 10b2e1f904..a6b06e0e04 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -7141,8 +7141,8 @@ void player::paralyse(actor *who, int str) int ¶lysis(duration[DUR_PARALYSIS]); - mprf( "You %s the ability to move!", - paralysis ? "still haven't" : "suddenly lose" ); + mprf("You %s the ability to move!", + paralysis ? "still haven't" : "suddenly lose"); if (str > paralysis && (paralysis < 3 || one_chance_in(paralysis))) paralysis = str; @@ -7157,8 +7157,8 @@ void player::petrify(actor *who, int str) int &petrif(duration[DUR_PETRIFIED]); - mprf( "You %s the ability to move!", - petrif ? "still haven't" : "suddenly lose" ); + mprf("You %s the ability to move!", + petrif ? "still haven't" : "suddenly lose"); if (str > petrif && (petrif < 3 || one_chance_in(petrif))) petrif = str; diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 35dd4c61f2..07c2c97250 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -3479,8 +3479,8 @@ void set_attack_conducts(god_conduct_trigger conduct[3], const monsters *mon, mon->name(DESC_PLAIN, true).c_str()); _first_attack_was_friendly[midx] = true; } - else if(_first_attack_conduct[midx] - || _first_attack_was_friendly[midx]) + else if (_first_attack_conduct[midx] + || _first_attack_was_friendly[midx]) { conduct[0].set(DID_ATTACK_FRIEND, 5, known, mon); _first_attack_was_friendly[midx] = true; diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc index 415ce076e4..ea9afe434c 100644 --- a/crawl-ref/source/tilepick.cc +++ b/crawl-ref/source/tilepick.cc @@ -2690,7 +2690,7 @@ void tileidx_unseen(unsigned int &fg, unsigned int &bg, int ch, int tileidx_bolt(const bolt &bolt) { - int col = bolt.colour; + const int col = bolt.colour; return tileidx_zap(col); } -- cgit v1.2.3-54-g00ecf