From 7349f13b440e1a5b00a5ffff01880d130ae34c1d Mon Sep 17 00:00:00 2001 From: ennewalker Date: Sat, 20 Dec 2008 15:55:02 +0000 Subject: Fixing tiles slowdowns while resting. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7886 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 1 - crawl-ref/source/delay.cc | 3 ++- crawl-ref/source/output.cc | 23 +++++++++++++++++++++++ crawl-ref/source/tilesdl.cc | 5 +++++ crawl-ref/source/tilesdl.h | 1 + 5 files changed, 31 insertions(+), 2 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index b4b200708d..748f1a58d2 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -2513,7 +2513,6 @@ static void _prep_input() set_redraw_status( REDRAW_LINE_2_MASK | REDRAW_LINE_3_MASK ); print_stats(); - update_screen(); } // Decrement a single duration. Print the message if the duration runs out. diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index c05b65fc49..4006414ab9 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -1519,7 +1519,8 @@ static command_type _get_running_command() you.running.rest(); #ifdef USE_TILE - tiles.redraw(); + if (tiles.need_redraw()) + tiles.redraw(); #endif if (!is_resting() && you.running.hp == you.hp diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 76058d803b..eb0e98043a 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -784,6 +784,20 @@ static void _print_status_lights(int y) } } +static bool _need_stats_printed() +{ + return you.redraw_hit_points + || you.redraw_magic_points + || you.redraw_armour_class + || you.redraw_evasion + || you.redraw_strength + || you.redraw_intelligence + || you.redraw_dexterity + || you.redraw_experience + || you.wield_change + || you.redraw_quiver; +} + void print_stats(void) { textcolor(LIGHTGREY); @@ -797,6 +811,10 @@ void print_stats(void) if (MP_Bar.wants_redraw()) you.redraw_magic_points = true; +#ifdef USE_TILE + bool has_changed = _need_stats_printed(); +#endif + if (you.redraw_hit_points) { you.redraw_hit_points = false; _print_stats_hp ( 1, 3); } if (you.redraw_magic_points) { you.redraw_magic_points = false; _print_stats_mp ( 1, 4); } if (you.redraw_armour_class) { you.redraw_armour_class = false; _print_stats_ac ( 1, 5); } @@ -862,7 +880,12 @@ void print_stats(void) } textcolor(LIGHTGREY); +#ifdef USE_TILE + if (has_changed) + update_screen(); +#else update_screen(); +#endif } static std::string _level_description_string_hud() diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc index 1cc27c12a2..688512902b 100644 --- a/crawl-ref/source/tilesdl.cc +++ b/crawl-ref/source/tilesdl.cc @@ -1288,3 +1288,8 @@ void TilesFramework::set_need_redraw() { m_need_redraw = true; } + +bool TilesFramework::need_redraw() const +{ + return m_need_redraw; +} diff --git a/crawl-ref/source/tilesdl.h b/crawl-ref/source/tilesdl.h index 258ea5b3a3..89ee8dca5c 100644 --- a/crawl-ref/source/tilesdl.h +++ b/crawl-ref/source/tilesdl.h @@ -107,6 +107,7 @@ public: void update_inventory(); void set_need_redraw(); + bool need_redraw() const; void redraw(); void place_cursor(cursor_type type, const coord_def &gc); -- cgit v1.2.3-54-g00ecf