summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/output.cc46
-rw-r--r--crawl-ref/source/output.h5
-rw-r--r--crawl-ref/source/travel.cc10
3 files changed, 52 insertions, 9 deletions
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index c45522a38a..475ca9db31 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -40,8 +40,10 @@
#include "skills2.h"
#include "stuff.h"
#include "transfor.h"
-
-#include "tiles.h"
+#ifdef USE_TILE
+ #include "tiles.h"
+ #include "travel.h"
+#endif
static int bad_ench_colour( int lvl, int orange, int red )
{
@@ -114,9 +116,13 @@ int draw_colour_bar(int val, int max_val, int old_val, int old_disp,
{
return -1;
}
+
+ // Don't redraw colour bars during running/resting
+ // *unless* we'll stop doing so after that
+ if (you.running > 1 && val != max_val)
+ return -1;
const int width = crawl_view.hudsz.x - ox - 1;
-
int disp = width * val / max_val;
gotoxy(ox, oy, GOTO_STAT);
@@ -144,9 +150,9 @@ void draw_mp_bar(int val, int max_val)
const int oy = 4;
const unsigned short default_colour = BLUE;
const unsigned short change = LIGHTBLUE;
- const unsigned short empty = DARKGRAY;
+ const unsigned short empty = DARKGRAY;
- static int old_val = 0;
+ static int old_val = 0;
static int old_disp = 0;
old_disp = draw_colour_bar(val, max_val, old_val, old_disp, ox, oy,
@@ -160,15 +166,26 @@ void draw_hp_bar(int val, int max_val)
const int oy = 3;
const unsigned short default_colour = GREEN;
const unsigned short change = RED;
- const unsigned short empty = DARKGRAY;
+ const unsigned short empty = DARKGRAY;
- static int old_val = 0;
+ static int old_val = 0;
static int old_disp = 0;
old_disp = draw_colour_bar(val, max_val, old_val, old_disp, ox, oy,
default_colour, change, empty);
old_val = val;
}
+
+static int count_digits(int val)
+{
+ if (val > 999)
+ return 4;
+ else if (val > 99)
+ return 3;
+ else if (val > 9)
+ return 2;
+ return 1;
+}
#endif
void print_stats(void)
@@ -213,11 +230,17 @@ void print_stats(void)
if (max_max_hp != you.hp_max)
cprintf( " (%d)", max_max_hp );
- clear_to_end_of_line();
you.redraw_hit_points = 0;
#ifdef USE_TILE
+ int col = count_digits(you.hp)+count_digits(you.hp_max) + 1;
+ if (max_max_hp != you.hp_max)
+ col += count_digits(max_max_hp) + 3;
+ for (int i = 15-col; i > 0; i--)
+ cprintf(" ");
draw_hp_bar(you.hp, you.hp_max);
+#else
+ clear_to_end_of_line();
#endif
}
@@ -244,11 +267,16 @@ void print_stats(void)
textcolor(LIGHTGREY);
cprintf("/%d", you.max_magic_points );
- clear_to_end_of_line();
you.redraw_magic_points = 0;
#ifdef USE_TILE
+ int col = count_digits(you.magic_points) +
+ count_digits(you.max_magic_points) + 1;
+ for (int i = 12-col; i > 0; i--)
+ cprintf(" ");
draw_mp_bar(you.magic_points, you.max_magic_points);
+#else
+ clear_to_end_of_line();
#endif
}
diff --git a/crawl-ref/source/output.h b/crawl-ref/source/output.h
index be635602b8..20ed669dc2 100644
--- a/crawl-ref/source/output.h
+++ b/crawl-ref/source/output.h
@@ -48,6 +48,11 @@ void update_message_status();
void update_turn_count();
+#ifdef USE_TILE
+void draw_hp_bar(int val, int max_val);
+void draw_mp_bar(int val, int max_val);
+#endif
+
void print_stats(void);
std::vector<formatted_string> get_full_detail(bool calc_unid, long score = -1);
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 3796137fe1..fc612ac569 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -27,6 +27,9 @@
#include "misc.h"
#include "mon-util.h"
#include "monstuff.h"
+#ifdef USE_TILE
+ #include "output.h"
+#endif
#include "overmap.h"
#include "place.h"
#include "player.h"
@@ -815,6 +818,13 @@ void start_running(void)
void stop_running(void)
{
you.running.stop();
+#ifdef USE_TILE
+ // redraw colour bars now as that's blocked during runmode
+ if (you.hp != you.hp_max)
+ draw_hp_bar(you.hp, you.hp_max);
+ if (you.magic_points != you.max_magic_points)
+ draw_mp_bar(you.magic_points, you.max_magic_points);
+#endif
}
static bool is_valid_explore_target(int x, int y)