summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-03 08:49:53 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-03 08:49:53 +0000
commitf5b7f9f83ba80c0e512b886fca3821290a949f79 (patch)
treec9f0604369bcb6b7dcccf4d1edc394fd7f0b0af9
parent00033a21e5e9bce12e82e37cbfccd78a58cd8b4e (diff)
downloadcrawl-ref-f5b7f9f83ba80c0e512b886fca3821290a949f79.tar.gz
crawl-ref-f5b7f9f83ba80c0e512b886fca3821290a949f79.zip
Added hp_colour and mp_colour per 1606160. Removed hp_attention.
hp_warning is still there for the * * * LOW HITPOINT WARNING * * * message. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@543 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/docs/crawl_options.txt12
-rw-r--r--crawl-ref/init.txt3
-rw-r--r--crawl-ref/source/externs.h3
-rw-r--r--crawl-ref/source/initfile.cc77
-rw-r--r--crawl-ref/source/output.cc35
5 files changed, 98 insertions, 32 deletions
diff --git a/crawl-ref/docs/crawl_options.txt b/crawl-ref/docs/crawl_options.txt
index 5b896f4edb..01130f918c 100644
--- a/crawl-ref/docs/crawl_options.txt
+++ b/crawl-ref/docs/crawl_options.txt
@@ -45,7 +45,7 @@ The contents of this text are:
easy_unequip, easy_confirm, easy_quit_item_prompts,
easy_exit_menu, default_autoprayer, sort_menus
4-i Message and Display Improvements.
- hp_warning, hp_attention, always_greet, terse_hand,
+ hp_warning, hp_colour, mp_colour, always_greet, terse_hand,
delay_message_clear, menu_colour, increasing_skill_progress
4-j Missiles.
fire_items_start, fire_order
@@ -649,9 +649,13 @@ hp_warning = 10
channel when the player takens damage and their hitpoints are less than
this percentage of their maximum (use 0 to turn off these messages).
-hp_attention = 25
- hp_attention gives a less alert warning than hp_warning (it appears in
- yellow instead of red).
+hp_colour = lightgrey, 50:yellow, 25:red
+ hp_colour colours your HP appropriately in the display. In the
+ default setting, your HP will appear in red if at less then 25%,
+ yellow if at less than 50%, and lightgrey otherwise.
+
+mp_colour = lightgrey, 50:yellow, 25:red
+ mp_colour does to MP what hp_colour does to HP.
terse_hand = false
Set this to false to have the "in hand" description on the main screen
diff --git a/crawl-ref/init.txt b/crawl-ref/init.txt
index 4a4af3b7fa..324e40822d 100644
--- a/crawl-ref/init.txt
+++ b/crawl-ref/init.txt
@@ -150,7 +150,8 @@ stab_brand = hi:blue
##### 4-i Messages and Display Enhancements #####
#
# hp_warning = 10
-# hp_attention = 25
+# hp_colour = lightgrey, 99:green, 50:yellow, 25:red
+# mp_colour = lightgrey, 99:green, 50:yellow, 25:red
# terse_hand = true
# delay_message_clear = true
# always_greet = false
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index f003ea590b..e310410274 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -774,7 +774,6 @@ public:
int priest; // choice of god for priests (Zin/Yred)
bool random_pick; // randomly generate character
int hp_warning; // percentage hp for danger warning
- int hp_attention; // percentage hp for danger attention
char race; // preselected race
char cls; // preselected class
bool terse_hand; // use terse description for wielded item
@@ -805,6 +804,8 @@ public:
int sc_entries; // # of score entries
int sc_format; // Format for score entries
+ std::vector<std::pair<int, int> > hp_colour;
+ std::vector<std::pair<int, int> > mp_colour;
std::string map_file_name; // name of mapping file to use
std::vector<text_pattern> banned_objects; // Objects we'll never pick up
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index e340d4c83c..ee6dc4fcd5 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -569,7 +569,6 @@ void game_options::reset_options()
easy_confirm = CONFIRM_SAFE_EASY;
easy_quit_item_prompts = true;
hp_warning = 10;
- hp_attention = 25;
confirm_self_target = true;
safe_autopickup = true;
use_notes = true;
@@ -706,6 +705,14 @@ void game_options::reset_options()
"spells,,overview,mutations,messages,screenshot,"
"kills,notes");
+ hp_colour.clear();
+ hp_colour.push_back(std::pair<int,int>(100, LIGHTGREY));
+ hp_colour.push_back(std::pair<int,int>(50, YELLOW));
+ hp_colour.push_back(std::pair<int,int>(25, RED));
+ mp_colour.clear();
+ mp_colour.push_back(std::pair<int, int>(100, LIGHTGREY));
+ mp_colour.push_back(std::pair<int, int>(50, YELLOW));
+ mp_colour.push_back(std::pair<int, int>(25, RED));
banned_objects.clear();
note_monsters.clear();
note_messages.clear();
@@ -1630,16 +1637,6 @@ void game_options::read_option_line(const std::string &str, bool runscript)
field.c_str() );
}
}
- else if (key == "hp_attention")
- {
- hp_attention = atoi( field.c_str() );
- if (hp_attention < 0 || hp_attention > 100)
- {
- hp_attention = 0;
- fprintf( stderr, "Bad HP attention percentage -- %s\n",
- field.c_str() );
- }
- }
else if (key == "crawl_dir")
{
// We shouldn't bother to allocate this a second time
@@ -1755,8 +1752,7 @@ void game_options::read_option_line(const std::string &str, bool runscript)
}
else if (key == "autoinscribe")
{
- std::vector<std::string> thesplit =
- split_string(":", field);
+ std::vector<std::string> thesplit = split_string(":", field);
autoinscriptions.push_back(
std::pair<text_pattern,std::string>(thesplit[0],
thesplit[1]));
@@ -1765,15 +1761,62 @@ void game_options::read_option_line(const std::string &str, bool runscript)
{
map_file_name = field;
}
+ else if (key == "hp_colour" || key == "hp_color")
+ {
+ hp_colour.clear();
+ std::vector<std::string> thesplit = split_string(",", field);
+ for ( unsigned i = 0; i < thesplit.size(); ++i )
+ {
+ std::vector<std::string> insplit = split_string(":", thesplit[i]);
+ int hp_percent = 100;
+
+ if ( insplit.size() == 0 || insplit.size() > 2 ||
+ (insplit.size() == 1 && i != 0) )
+ {
+ fprintf(stderr, "Bad hp_colour string: %s\n", field.c_str());
+ break;
+ }
+
+ if ( insplit.size() == 2 )
+ hp_percent = atoi(insplit[0].c_str());
+
+ int scolour = str_to_colour(insplit[(insplit.size()==1) ? 0 : 1]);
+ hp_colour.push_back(std::pair<int, int>(hp_percent, scolour));
+ }
+ }
+ else if (key == "mp_color" || key == "mp_colour")
+ {
+ mp_colour.clear();
+ std::vector<std::string> thesplit = split_string(",", field);
+ for ( unsigned i = 0; i < thesplit.size(); ++i )
+ {
+ std::vector<std::string> insplit = split_string(":", thesplit[i]);
+ int mp_percent = 100;
+
+ if ( insplit.size() == 0 || insplit.size() > 2 ||
+ (insplit.size() == 1 && i != 0) )
+ {
+ fprintf(stderr, "Bad mp_colour string: %s\n", field.c_str());
+ break;
+ }
+
+ if ( insplit.size() == 2 )
+ mp_percent = atoi(insplit[0].c_str());
+
+ int scolour = str_to_colour(insplit[(insplit.size()==1) ? 0 : 1]);
+ mp_colour.push_back(std::pair<int, int>(mp_percent, scolour));
+ }
+ }
else if (key == "note_skill_levels")
{
std::vector<std::string> thesplit = split_string(",", field);
- for ( unsigned i = 0; i < thesplit.size(); ++i ) {
+ for ( unsigned i = 0; i < thesplit.size(); ++i )
+ {
int num = atoi(thesplit[i].c_str());
- if ( num > 0 && num <= 27 ) {
+ if ( num > 0 && num <= 27 )
note_skill_levels.push_back(num);
- }
- else {
+ else
+ {
fprintf(stderr, "Bad skill level to note -- %s\n",
thesplit[i].c_str());
continue;
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index d63d2f9344..d10f59bf13 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -65,16 +65,19 @@ void print_stats(void)
if (you.redraw_hit_points)
{
const int max_max_hp = you.hp_max + player_rotted();
- const int hp_warn = MAXIMUM( 25, Options.hp_warning );
- const int hp_attent = MAXIMUM( 10, Options.hp_attention );
-
+ const int hp_percent = (you.hp * 100) / max_max_hp;
+ for ( unsigned int i = 0; i < Options.hp_colour.size(); ++i )
+ {
+ if ( i+1 == Options.hp_colour.size() ||
+ hp_percent > Options.hp_colour[i+1].first )
+ {
+ textcolor(Options.hp_colour[i].second);
+ break;
+ }
+ }
+
gotoxy(44, 3);
- if (you.hp <= (you.hp_max * hp_warn) / 100)
- textcolor(RED);
- else if (you.hp <= (you.hp_max * hp_attent) / 100)
- textcolor(YELLOW);
-
cprintf( "%d", you.hp );
textcolor(LIGHTGREY);
@@ -94,9 +97,23 @@ void print_stats(void)
if (you.redraw_magic_points)
{
+
+ const int mp_percent = (you.magic_points * 100) / you.max_magic_points;
+ for ( unsigned int i = 0; i < Options.mp_colour.size(); ++i )
+ {
+ if ( i+1 == Options.mp_colour.size() ||
+ mp_percent > Options.mp_colour[i+1].first )
+ {
+ textcolor(Options.mp_colour[i].second);
+ break;
+ }
+ }
gotoxy(47, 4);
- cprintf( "%d/%d", you.magic_points, you.max_magic_points );
+ cprintf( "%d", you.magic_points);
+
+ textcolor(LIGHTGREY);
+ cprintf("/%d", you.max_magic_points );
#ifdef UNIX
clear_to_end_of_line();