summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-16 17:29:52 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-16 17:29:52 +0100
commit71adb1db298adf054f6ae453a5b40807fbf021d3 (patch)
tree7c5c057b70e2fc23e98f925a7c7d8d13d72a79a4
parent6acd640e5aa287d45368f50bf5776e72b1fe4159 (diff)
downloadcrawl-ref-71adb1db298adf054f6ae453a5b40807fbf021d3.tar.gz
crawl-ref-71adb1db298adf054f6ae453a5b40807fbf021d3.zip
Wrap view flashing in flash_view.
This also removes env.show updates when flashing.
-rw-r--r--crawl-ref/source/abyss.cc3
-rw-r--r--crawl-ref/source/godabil.cc7
-rw-r--r--crawl-ref/source/misc.cc3
-rw-r--r--crawl-ref/source/mon-abil.cc3
-rw-r--r--crawl-ref/source/player.cc9
-rw-r--r--crawl-ref/source/religion.cc3
-rw-r--r--crawl-ref/source/spells2.cc9
-rw-r--r--crawl-ref/source/spells3.cc3
-rw-r--r--crawl-ref/source/spells4.cc6
-rw-r--r--crawl-ref/source/view.cc6
-rw-r--r--crawl-ref/source/view.h1
11 files changed, 23 insertions, 30 deletions
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index fbed1c9900..90431bb9be 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -948,8 +948,7 @@ bool lugonu_corrupt_level(int power)
mpr("Lugonu's Hand of Corruption reaches out!", MSGCH_GOD);
- you.flash_colour = MAGENTA;
- viewwindow(false);
+ flash_view(MAGENTA);
_initialise_level_corrupt_seeds(power);
diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc
index d7c635b2c6..508f6b3e64 100644
--- a/crawl-ref/source/godabil.cc
+++ b/crawl-ref/source/godabil.cc
@@ -1337,8 +1337,7 @@ void cheibriados_time_step(int pow) // pow is the number of turns to skip
coord_def old_pos = you.pos();
mpr("You step out of the flow of time.");
- you.flash_colour = LIGHTBLUE;
- viewwindow(false);
+ flash_view(LIGHTBLUE);
you.moveto(coord_def(0, 0));
you.duration[DUR_TIME_STEP] = pow;
@@ -1358,9 +1357,9 @@ void cheibriados_time_step(int pow) // pow is the number of turns to skip
delay(1000);
#endif
- you.flash_colour = 0;
you.moveto(old_pos);
you.duration[DUR_TIME_STEP] = 0;
- viewwindow(false);
+
+ flash_view(0);
mpr("You return to the normal time flow.");
}
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 9030989fc0..f2917cd9fd 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -2258,8 +2258,7 @@ void down_stairs( int old_level, dungeon_feature_type force_stair,
tiles.add_overlay(you.pos(), tileidx_zap(GREEN));
update_screen();
#else
- you.flash_colour = LIGHTGREEN;
- viewwindow(false);
+ flash_view(LIGHTGREEN);
#endif
mpr("The lock glows an eerie green colour!");
more();
diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc
index 08ae3bbbe3..e9c5c15051 100644
--- a/crawl-ref/source/mon-abil.cc
+++ b/crawl-ref/source/mon-abil.cc
@@ -295,8 +295,7 @@ static bool _do_merge(monsters *initial_slime, monsters *merge_to)
merge_to->name(DESC_NOCAP_A).c_str());
}
- you.flash_colour = LIGHTGREEN;
- viewwindow(false);
+ flash_view(LIGHTGREEN);
int flash_delay = 150;
// Scale delay to match change in arena_delay.
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index f8e655cdc8..858b963f84 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -7024,8 +7024,7 @@ void player::hibernate(int)
mpr("You fall asleep.");
stop_delay();
- flash_colour = DARKGREY;
- viewwindow(false);
+ flash_view(DARKGREY);
// Do this *after* redrawing the view, or viewwindow() will no-op.
set_duration(DUR_SLEEP, 3 + random2avg(5, 2));
@@ -7041,8 +7040,7 @@ void player::put_to_sleep(int power)
mpr("You fall asleep!");
stop_delay();
- flash_colour = DARKGREY;
- viewwindow(false);
+ flash_view(DARKGREY);
// As above, do this after redraw.
set_duration(DUR_SLEEP, 5 + random2avg(power/10, 5));
@@ -7054,8 +7052,7 @@ void player::awake()
duration[DUR_SLEEP] = 0;
mpr("You wake up.");
- this->flash_colour = BLACK;
- viewwindow(false);
+ flash_view(BLACK);
}
void player::check_awaken(int disturbance)
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 4b22cd0f8b..875a43eaac 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -4288,8 +4288,7 @@ static bool _bless_weapon(god_type god, brand_type brand, int colour)
mpr("Your weapon shines brightly!", MSGCH_GOD);
- you.flash_colour = colour;
- viewwindow(false);
+ flash_view(colour);
simple_god_message(" booms: Use this gift wisely!");
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index fca185bf16..06311a9c0e 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -641,8 +641,7 @@ void cast_toxic_radiance()
{
mpr("You radiate a sickly green light!");
- you.flash_colour = GREEN;
- viewwindow(false);
+ flash_view(GREEN);
more();
mesclr();
@@ -707,8 +706,7 @@ void cast_refrigeration(int pow)
{
mpr("The heat is drained from your surroundings.");
- you.flash_colour = LIGHTCYAN;
- viewwindow(false);
+ flash_view(LIGHTCYAN);
more();
mesclr();
@@ -787,8 +785,7 @@ void drain_life(int pow)
// this function with spell level power.
ASSERT(pow <= 27);
- you.flash_colour = DARKGREY;
- viewwindow(false);
+ flash_view(DARKGREY);
more();
mesclr();
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 52f615e736..d50eb51328 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -1826,8 +1826,7 @@ bool cast_sanctuary(const int power)
else
mpr("You are suddenly bathed in radiance!");
- you.flash_colour = WHITE;
- viewwindow(false);
+ flash_view(WHITE);
holy_word(100, HOLY_WORD_ZIN, you.pos(), true);
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 5b965b3d72..f3086187c3 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -590,8 +590,7 @@ static int _ignite_poison_monsters(coord_def where, int pow, int, actor *)
void cast_ignite_poison(int pow)
{
- you.flash_colour = RED;
- viewwindow(false);
+ flash_view(RED);
// Poison branding becomes fire branding.
if (you.weapon()
@@ -739,8 +738,7 @@ void cast_ignite_poison(int pow)
#ifndef USE_TILES
delay(100); // show a brief flash
#endif
- you.flash_colour = 0;
- viewwindow(false);
+ flash_view(0);
}
void cast_silence(int pow)
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index a81f5389df..afa1718677 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -619,6 +619,12 @@ bool view_update()
return (false);
}
+void flash_view(int colour)
+{
+ you.flash_colour = colour;
+ viewwindow(false, false);
+}
+
static void _debug_pane_bounds()
{
#if DEBUG_PANE_BOUNDS
diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h
index c02e269a58..7a618c182b 100644
--- a/crawl-ref/source/view.h
+++ b/crawl-ref/source/view.h
@@ -36,6 +36,7 @@ std::string screenshot(bool fullscreen = false);
bool view_update();
void view_update_at(const coord_def &pos);
+void flash_view(int colour = BLACK); // inside #ifndef USE_TILE?
#ifndef USE_TILE
void flash_monster_colour(const monsters *mon, unsigned char fmc_colour,
int fmc_delay);