Attached Files |
0002-MR-stat-bar.patch [^] (1,695 bytes) 2013-12-19 01:11 [Show Content] [Hide Content]From 4ba06cd0ebadd75fb575874006ba544b0e3cf090 Mon Sep 17 00:00:00 2001
From: Cedor <cedordark@yahoo.fr>
Date: Thu, 19 Dec 2013 00:54:39 +0100
Subject: [PATCH 1/2] MR stat bar
Added bars for magic resistance into the % screen. Five level, and adjectives
revamped.
---
crawl-ref/source/output.cc | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 3f9d110..2f891b8 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -2225,6 +2225,12 @@ static vector<formatted_string> _get_overview_resistances(
cols.add_formatted(0, buf, false);
+ const int rmagi = player_res_magic(calc_unid)/40;
+ // no colouring ATM
+ snprintf(buf, sizeof buf,"%sMR %s\n",
+ _determine_colour_string(0, 5), _itosym(rmagi,5));
+ cols.add_formatted(0, buf, false);
+
const int rinvi = you.can_see_invisible(calc_unid);
// TODO: Also show *Rage in clarity line
const int rclar = you.clarity(calc_unid);
@@ -2393,14 +2399,10 @@ string magic_res_adjective(int mr)
string prefix =
(mr < 10) ? "not" :
- (mr < 30) ? "slightly" :
- (mr < 60) ? "somewhat" :
- (mr < 90) ? "quite" :
- (mr < 120) ? "very" :
+ (mr < 50) ? "somewhat" :
+ (mr < 100) ? "very" :
(mr < 150) ? "extremely" :
- (mr < 190) ? "extraordinarily" :
- (mr < 240) ? "incredibly" :
- (mr < 300) ? "uncannily"
+ (mr < 200) ? "incredibly"
: "almost entirely";
return prefix + " resistant";
}
--
1.8.4.msysgit.0
0003-Stealth-bar.patch [^] (1,369 bytes) 2013-12-19 01:11 [Show Content] [Hide Content]From d16203bc4a5427468f8a8e105e804ca0c56ffc24 Mon Sep 17 00:00:00 2001
From: Cedor <cedordark@yahoo.fr>
Date: Thu, 19 Dec 2013 01:04:42 +0100
Subject: [PATCH 2/2] Stealth bar
Added stealth bar. five level, but still 10 adjectives. Need decision about
the numbers, and if we use a linear bar or not(adjectives aren't). If we go to
a 10 dot stealth bar, we'll have to mode it outside of the resists columns.
---
crawl-ref/source/output.cc | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 2f891b8..0fbc1fb 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -2230,6 +2230,14 @@ static vector<formatted_string> _get_overview_resistances(
snprintf(buf, sizeof buf,"%sMR %s\n",
_determine_colour_string(0, 5), _itosym(rmagi,5));
cols.add_formatted(0, buf, false);
+
+ // TODO: for proof of concept, done on a linear 5 dot bar,
+ // 10 might be too long for the column (need discussion)
+ const int stlth = you.stealth() / 100;
+ // no colouring either
+ snprintf(buf, sizeof buf, "%sStlth %s\n",
+ _determine_colour_string(0, 5), _itosym(stlth, 5));
+ cols.add_formatted(0, buf, false);
const int rinvi = you.can_see_invisible(calc_unid);
// TODO: Also show *Rage in clarity line
--
1.8.4.msysgit.0
0001-Rewriting-of-_itosym(corrected).patch [^] (6,154 bytes) 2013-12-19 09:25 [Show Content] [Hide Content]From 3ce08ba9ac210fc4278d59ec7ba0d6ffaef44355 Mon Sep 17 00:00:00 2001
From: Cedor <cedordark@yahoo.fr>
Date: Thu, 19 Dec 2013 00:46:25 +0100
Subject: [PATCH] Rewriting of _itosym
_itosym1, _itosym2, _itosym3 rewrited to a more generic function : _itosym
---
crawl-ref/source/output.cc | 89 ++++++++++++++++++++++++++--------------------
1 file changed, 50 insertions(+), 39 deletions(-)
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 5299c52..b50b2f6 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1662,29 +1662,40 @@ int update_monster_pane()
}
#endif
-static const char* _itosym1(int stat)
+// Convert a numeric resistance to it's symbolic counterpart.
+// Can handle any number of possible levels. The default is for 1 level
+// resistances (most often case), and negatives resistances allowed.
+// Resistances up to 4 possible levels are spaced (arbitrary choice), and
+// starting to 5 levels, they are continous.
+// params:
+// level : actual level
+// max : number of maximum levels of the resistance
+static const char* _itosym(int level, int max = 1)
{
- return (stat >= 1) ? "+ " :
- (stat == 0) ? ". " :
- "x ";
-}
+ if (max < 1)
+ return "";
-static const char* _itosym2(int stat)
-{
- return (stat >= 2) ? "+ +" :
- (stat == 1) ? "+ ." :
- ". .";
-}
+ string sym;
+ bool spacing = (max >= 5) ? false : true;
-static const char* _itosym3(int stat)
-{
- return (stat >= 3) ? "+ + +" :
- (stat == 2) ? "+ + ." :
- (stat == 1) ? "+ . ." :
- (stat == 0) ? ". . ." :
- (stat == -1) ? "x . ." :
- (stat == -2) ? "x x ." :
- "x x x";
+ while (max > 0)
+ {
+ if (level == 0)
+ sym += ".";
+ else if (level > 0)
+ {
+ sym += "+";
+ --level;
+ }
+ else //negative stat
+ {
+ sym += "x";
+ ++level;
+ }
+ sym += (spacing) ? " " : "";
+ --max;
+ }
+ return sym.c_str();
}
static const char *s_equip_slot_names[] =
@@ -2195,13 +2206,13 @@ static vector<formatted_string> _get_overview_resistances(
"%sSustAb %s\n"
"%srMut %s\n"
,
- _determine_colour_string(rfire, 3), _itosym3(rfire),
- _determine_colour_string(rcold, 3), _itosym3(rcold),
- _determine_colour_string(rlife, 3), _itosym3(rlife),
- _determine_colour_string(rpois, 1), _itosym1(rpois),
- _determine_colour_string(relec, 1), _itosym1(relec),
- _determine_colour_string(rsust, 2), _itosym2(rsust),
- _determine_colour_string(rmuta, 1), _itosym1(rmuta));
+ _determine_colour_string(rfire, 3), _itosym(rfire,3),
+ _determine_colour_string(rcold, 3), _itosym(rcold,3),
+ _determine_colour_string(rlife, 3), _itosym(rlife,3),
+ _determine_colour_string(rpois, 1), _itosym(rpois),
+ _determine_colour_string(relec, 1), _itosym(relec),
+ _determine_colour_string(rsust, 2), _itosym(rsust,2),
+ _determine_colour_string(rmuta, 1), _itosym(rmuta));
cols.add_formatted(0, buf, false);
const int saplevel = player_mutation_level(MUT_SAPROVOROUS);
@@ -2214,7 +2225,7 @@ static vector<formatted_string> _get_overview_resistances(
_determine_colour_string(
show_gourm ? 1 : saplevel, show_gourm ? 1 : 3),
show_gourm ? "Gourm " : "Saprov",
- show_gourm ? _itosym1(1) : _itosym3(saplevel));
+ show_gourm ? _itosym(1) : _itosym(saplevel,3));
cols.add_formatted(0, buf, false);
@@ -2235,13 +2246,13 @@ static vector<formatted_string> _get_overview_resistances(
"%sSpirit %s\n"
"%sWarding %s\n"
,
- _determine_colour_string(rinvi, 1), _itosym1(rinvi),
- _determine_colour_string(rclar, 1), _itosym1(rclar),
- _determine_colour_string(rcons, 1), _itosym1(rcons),
- _determine_colour_string(rcorr, 1), _itosym1(rcorr),
- _determine_colour_string(rrott, 1), _itosym1(rrott),
- _determine_colour_string(rspir, 1), _itosym1(rspir),
- _determine_colour_string(rward, 1), _itosym1(rward));
+ _determine_colour_string(rinvi, 1), _itosym(rinvi),
+ _determine_colour_string(rclar, 1), _itosym(rclar),
+ _determine_colour_string(rcons, 1), _itosym(rcons),
+ _determine_colour_string(rcorr, 1), _itosym(rcorr),
+ _determine_colour_string(rrott, 1), _itosym(rrott),
+ _determine_colour_string(rspir, 1), _itosym(rspir),
+ _determine_colour_string(rward, 1), _itosym(rward));
cols.add_formatted(1, buf, false);
const int stasis = you.stasis(calc_unid);
@@ -2250,17 +2261,17 @@ static vector<formatted_string> _get_overview_resistances(
if (notele && !stasis)
{
snprintf(buf, sizeof buf, "%sNoTele %s",
- _determine_colour_string(-1, 1), _itosym1(1));
+ _determine_colour_string(-1, 1), _itosym(1));
}
else if (rrtel && !stasis)
{
snprintf(buf, sizeof buf, "%sRndTele %s",
- _determine_colour_string(-1, 1), _itosym1(1));
+ _determine_colour_string(-1, 1), _itosym(1));
}
else
{
snprintf(buf, sizeof buf, "%sStasis %s",
- _determine_colour_string(stasis, 1), _itosym1(stasis));
+ _determine_colour_string(stasis, 1), _itosym(stasis));
}
cols.add_formatted(1, buf, false);
@@ -2268,7 +2279,7 @@ static vector<formatted_string> _get_overview_resistances(
if (no_cast)
{
snprintf(buf, sizeof buf, "%sNoCast %s",
- _determine_colour_string(-1, 1), _itosym1(1));
+ _determine_colour_string(-1, 1), _itosym(1));
cols.add_formatted(1, buf, false);
}
--
1.8.4.msysgit.0
0003-Stealth-bar(10dots).patch [^] (1,752 bytes) 2013-12-19 10:47 [Show Content] [Hide Content]From f6597aac33102337ff5a105021f2fe39ea0d0056 Mon Sep 17 00:00:00 2001
From: Cedor <cedordark@yahoo.fr>
Date: Thu, 19 Dec 2013 01:04:42 +0100
Subject: [PATCH] Stealth bar
Added stealth bar. 10 levels bar, reflecting the adjectives.
---
crawl-ref/source/output.cc | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 95526eb..51dd862 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1765,6 +1765,27 @@ static const char* _determine_colour_string(int level, int max_level)
}
}
+static string _stealth_bar(int sw) {
+ string bar;
+ //no coloring
+ bar += _determine_colour_string(0, 5);
+ bar += "Stlth ";
+ const int stealth = check_stealth();
+ // here we reflect the log adjectives
+ bar += (stealth > 10) ? "+" : ".";
+ bar += (stealth > 30) ? "+" : ".";
+ bar += (stealth > 60) ? "+" : ".";
+ bar += (stealth > 90) ? "+" : ".";
+ bar += (stealth > 120) ? "+" : ".";
+ bar += (stealth > 160) ? "+" : ".";
+ bar += (stealth > 220) ? "+" : ".";
+ bar += (stealth > 300) ? "+" : ".";
+ bar += (stealth > 400) ? "+" : ".";
+ bar += (stealth > 520) ? "+" : ".";
+ bar += "\n";
+ linebreak_string(bar, sw);
+ return bar;
+}
static string _status_mut_abilities(int sw);
// helper for print_overview_screen
@@ -2326,7 +2347,8 @@ static char _get_overview_screen_results()
overview.add_item_formatted_string(blines[i], hotkey);
}
}
-
+
+ overview.add_text(_stealth_bar(get_number_of_cols()));
overview.add_text(" ");
overview.add_text(_status_mut_abilities(get_number_of_cols()));
--
1.8.4.msysgit.0
0001-Rewriting-of-_itosym-v2.patch [^] (6,298 bytes) 2014-01-05 14:52 [Show Content] [Hide Content]From e3e74067fd9e5ebb954fe06a0ca7a04bc546245c Mon Sep 17 00:00:00 2001
From: Cedor <cedordark@yahoo.fr>
Date: Thu, 19 Dec 2013 00:46:25 +0100
Subject: [PATCH 1/2] Rewriting of _itosym
_itosym1, _itosym2, _itosym3 rewrited to a more generic function : _itosym
---
crawl-ref/source/output.cc | 89 ++++++++++++++++++++++++++--------------------
1 file changed, 50 insertions(+), 39 deletions(-)
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index d4ed5e8..75ab0a9 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1659,29 +1659,40 @@ int update_monster_pane()
}
#endif
-static const char* _itosym1(int stat)
+// Convert a numeric resistance to it's symbolic counterpart.
+// Can handle any number of possible levels. The default is for 1 level
+// resistances (most often case), and negatives resistances allowed.
+// Resistances up to 4 possible levels are spaced (arbitrary choice), and
+// starting to 5 levels, they are continous.
+// params:
+// level : actual level
+// max : number of maximum levels of the resistance
+string _itosym(int level, int max = 1)
{
- return (stat >= 1) ? "+ " :
- (stat == 0) ? ". " :
- "x ";
-}
+ if (max < 1)
+ return "";
-static const char* _itosym2(int stat)
-{
- return (stat >= 2) ? "+ +" :
- (stat == 1) ? "+ ." :
- ". .";
-}
+ string sym;
+ bool spacing = (max >= 5) ? false : true;
-static const char* _itosym3(int stat)
-{
- return (stat >= 3) ? "+ + +" :
- (stat == 2) ? "+ + ." :
- (stat == 1) ? "+ . ." :
- (stat == 0) ? ". . ." :
- (stat == -1) ? "x . ." :
- (stat == -2) ? "x x ." :
- "x x x";
+ while (max > 0)
+ {
+ if (level == 0)
+ sym += ".";
+ else if (level > 0)
+ {
+ sym += "+";
+ --level;
+ }
+ else //negative stat
+ {
+ sym += "x";
+ ++level;
+ }
+ sym += (spacing) ? " " : "";
+ --max;
+ }
+ return sym;
}
static const char *s_equip_slot_names[] =
@@ -2192,13 +2203,13 @@ static vector<formatted_string> _get_overview_resistances(
"%sSustAb %s\n"
"%srMut %s\n"
,
- _determine_colour_string(rfire, 3), _itosym3(rfire),
- _determine_colour_string(rcold, 3), _itosym3(rcold),
- _determine_colour_string(rlife, 3), _itosym3(rlife),
- _determine_colour_string(rpois, 1), _itosym1(rpois),
- _determine_colour_string(relec, 1), _itosym1(relec),
- _determine_colour_string(rsust, 2), _itosym2(rsust),
- _determine_colour_string(rmuta, 1), _itosym1(rmuta));
+ _determine_colour_string(rfire, 3), _itosym(rfire,3).c_str(),
+ _determine_colour_string(rcold, 3), _itosym(rcold,3).c_str(),
+ _determine_colour_string(rlife, 3), _itosym(rlife,3).c_str(),
+ _determine_colour_string(rpois, 1), _itosym(rpois).c_str(),
+ _determine_colour_string(relec, 1), _itosym(relec).c_str(),
+ _determine_colour_string(rsust, 2), _itosym(rsust,2).c_str(),
+ _determine_colour_string(rmuta, 1), _itosym(rmuta).c_str());
cols.add_formatted(0, buf, false);
const int saplevel = player_mutation_level(MUT_SAPROVOROUS);
@@ -2211,7 +2222,7 @@ static vector<formatted_string> _get_overview_resistances(
_determine_colour_string(
show_gourm ? 1 : saplevel, show_gourm ? 1 : 3),
show_gourm ? "Gourm " : "Saprov",
- show_gourm ? _itosym1(1) : _itosym3(saplevel));
+ show_gourm ? _itosym(1).c_str() : _itosym(saplevel,3).c_str());
cols.add_formatted(0, buf, false);
@@ -2232,13 +2243,13 @@ static vector<formatted_string> _get_overview_resistances(
"%sSpirit %s\n"
"%sWarding %s\n"
,
- _determine_colour_string(rinvi, 1), _itosym1(rinvi),
- _determine_colour_string(rclar, 1), _itosym1(rclar),
- _determine_colour_string(rcons, 1), _itosym1(rcons),
- _determine_colour_string(rcorr, 1), _itosym1(rcorr),
- _determine_colour_string(rrott, 1), _itosym1(rrott),
- _determine_colour_string(rspir, 1), _itosym1(rspir),
- _determine_colour_string(rward, 1), _itosym1(rward));
+ _determine_colour_string(rinvi, 1), _itosym(rinvi).c_str(),
+ _determine_colour_string(rclar, 1), _itosym(rclar).c_str(),
+ _determine_colour_string(rcons, 1), _itosym(rcons).c_str(),
+ _determine_colour_string(rcorr, 1), _itosym(rcorr).c_str(),
+ _determine_colour_string(rrott, 1), _itosym(rrott).c_str(),
+ _determine_colour_string(rspir, 1), _itosym(rspir).c_str(),
+ _determine_colour_string(rward, 1), _itosym(rward).c_str());
cols.add_formatted(1, buf, false);
const int stasis = you.stasis(calc_unid);
@@ -2247,17 +2258,17 @@ static vector<formatted_string> _get_overview_resistances(
if (notele && !stasis)
{
snprintf(buf, sizeof buf, "%sNoTele %s",
- _determine_colour_string(-1, 1), _itosym1(1));
+ _determine_colour_string(-1, 1), _itosym(1).c_str());
}
else if (rrtel && !stasis)
{
snprintf(buf, sizeof buf, "%sRndTele %s",
- _determine_colour_string(-1, 1), _itosym1(1));
+ _determine_colour_string(-1, 1), _itosym(1).c_str());
}
else
{
snprintf(buf, sizeof buf, "%sStasis %s",
- _determine_colour_string(stasis, 1), _itosym1(stasis));
+ _determine_colour_string(stasis, 1), _itosym(stasis).c_str());
}
cols.add_formatted(1, buf, false);
@@ -2265,7 +2276,7 @@ static vector<formatted_string> _get_overview_resistances(
if (no_cast)
{
snprintf(buf, sizeof buf, "%sNoCast %s",
- _determine_colour_string(-1, 1), _itosym1(1));
+ _determine_colour_string(-1, 1), _itosym(1).c_str());
cols.add_formatted(1, buf, false);
}
--
1.8.4.msysgit.0
0002-MR-stat-bar-v2.patch [^] (1,703 bytes) 2014-01-05 14:52 [Show Content] [Hide Content]From 2e5e40fe9edab0446ae62551ba9ffb8740228510 Mon Sep 17 00:00:00 2001
From: Cedor <cedordark@yahoo.fr>
Date: Thu, 19 Dec 2013 00:54:39 +0100
Subject: [PATCH 2/2] MR stat bar
Added bars for magic resistance into the % screen. Five level, and adjectives
revamped.
---
crawl-ref/source/output.cc | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 75ab0a9..5806b34 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -2226,6 +2226,12 @@ static vector<formatted_string> _get_overview_resistances(
cols.add_formatted(0, buf, false);
+ const int rmagi = player_res_magic(calc_unid)/40;
+ // no colouring ATM
+ snprintf(buf, sizeof buf,"%sMR %s\n",
+ _determine_colour_string(0, 5), _itosym(rmagi,5).c_str());
+ cols.add_formatted(0, buf, false);
+
const int rinvi = you.can_see_invisible(calc_unid);
// TODO: Also show *Rage in clarity line
const int rclar = you.clarity(calc_unid);
@@ -2394,14 +2400,10 @@ string magic_res_adjective(int mr)
string prefix =
(mr < 10) ? "not" :
- (mr < 30) ? "slightly" :
- (mr < 60) ? "somewhat" :
- (mr < 90) ? "quite" :
- (mr < 120) ? "very" :
+ (mr < 50) ? "somewhat" :
+ (mr < 100) ? "very" :
(mr < 150) ? "extremely" :
- (mr < 190) ? "extraordinarily" :
- (mr < 240) ? "incredibly" :
- (mr < 300) ? "uncannily"
+ (mr < 200) ? "incredibly"
: "almost entirely";
return prefix + " resistant";
}
--
1.8.4.msysgit.0
0001-Rewriting-of-_itosym-v3.patch [^] (9,123 bytes) 2014-01-05 21:03 [Show Content] [Hide Content]From fa218ee03c1da2f16213b2d4e1c026cf704fc5ac Mon Sep 17 00:00:00 2001
From: Cedor <cedordark@yahoo.fr>
Date: Thu, 19 Dec 2013 00:46:25 +0100
Subject: [PATCH] Rewriting of _itosym
_itosym1, _itosym2, _itosym3 rewrited to a more generic function : _itosym.
Plus rewriting of resist view with strings instead of char[].
---
crawl-ref/source/output.cc | 172 +++++++++++++++++++++++++--------------------
1 file changed, 94 insertions(+), 78 deletions(-)
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index d4ed5e8..a732cc8 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1659,29 +1659,40 @@ int update_monster_pane()
}
#endif
-static const char* _itosym1(int stat)
+// Convert a numeric resistance to it's symbolic counterpart.
+// Can handle any number of possible levels. The default is for 1 level
+// resistances (most often case), and negatives resistances allowed.
+// Resistances up to 4 possible levels are spaced (arbitrary choice), and
+// starting to 5 levels, they are continous.
+// params:
+// level : actual level
+// max : number of maximum levels of the resistance
+string _itosym(int level, int max = 1)
{
- return (stat >= 1) ? "+ " :
- (stat == 0) ? ". " :
- "x ";
-}
+ if (max < 1)
+ return "";
-static const char* _itosym2(int stat)
-{
- return (stat >= 2) ? "+ +" :
- (stat == 1) ? "+ ." :
- ". .";
-}
+ string sym;
+ bool spacing = (max >= 5) ? false : true;
-static const char* _itosym3(int stat)
-{
- return (stat >= 3) ? "+ + +" :
- (stat == 2) ? "+ + ." :
- (stat == 1) ? "+ . ." :
- (stat == 0) ? ". . ." :
- (stat == -1) ? "x . ." :
- (stat == -2) ? "x x ." :
- "x x x";
+ while (max > 0)
+ {
+ if (level == 0)
+ sym += ".";
+ else if (level > 0)
+ {
+ sym += "+";
+ --level;
+ }
+ else //negative stat
+ {
+ sym += "x";
+ ++level;
+ }
+ sym += (spacing) ? " " : "";
+ --max;
+ }
+ return sym;
}
static const char *s_equip_slot_names[] =
@@ -2167,106 +2178,111 @@ static vector<formatted_string> _get_overview_stats()
return cols1.formatted_lines();
}
+// generator of resistance strings:
+// params :
+// name : name of the resist, correct spacing is handled here
+// spacing : width of the naming
+// value : actual value of the resistance (can be negative)
+// max : maximum value of the resistance (for color AND representation),
+// default is the most often case (1)
+// pos_resist : special case for negative (false) resistances (no tele,
+// random tele, *Rage) inverse the value for the color choice
+static string _resist_composer(
+ const char * name, int spacing, int value, int max = 1, bool pos_resist = true)
+{
+ string out;
+ out += _determine_colour_string(pos_resist? value : value*-1, max);
+ out += chop_string(name, spacing);
+ out += _itosym(value,max);
+
+ return out;
+}
+
static vector<formatted_string> _get_overview_resistances(
vector<char> &equip_chars, bool calc_unid, int sw)
{
- char buf[1000];
-
// 3 columns, splits at columns 18, 33
column_composer cols(3, 18, 33);
-
+ //first column naming is done on 7 chars, second is on 9 chars
+ int cwidth = 7;
+ string out;
+
const int rfire = player_res_fire(calc_unid);
+ out += _resist_composer("rFire", cwidth, rfire, 3) + "\n";
+
const int rcold = player_res_cold(calc_unid);
+ out += _resist_composer("rCold", cwidth, rcold, 3) + "\n";
+
const int rlife = player_prot_life(calc_unid);
+ out += _resist_composer("rNeg", cwidth, rlife, 3) + "\n";
+
const int rpois = player_res_poison(calc_unid);
+ out += _resist_composer("rPois", cwidth, rpois) + "\n";
+
const int relec = player_res_electricity(calc_unid);
+ out += _resist_composer("rElec", cwidth, relec) + "\n";
+
const int rsust = player_sust_abil(calc_unid);
+ out += _resist_composer("SustAb", cwidth, rsust, 2) + "\n";
+
const int rmuta = (you.rmut_from_item(calc_unid)
|| player_mutation_level(MUT_MUTATION_RESISTANCE) == 3);
- snprintf(buf, sizeof buf,
- "%srFire %s\n"
- "%srCold %s\n"
- "%srNeg %s\n"
- "%srPois %s\n"
- "%srElec %s\n"
- "%sSustAb %s\n"
- "%srMut %s\n"
- ,
- _determine_colour_string(rfire, 3), _itosym3(rfire),
- _determine_colour_string(rcold, 3), _itosym3(rcold),
- _determine_colour_string(rlife, 3), _itosym3(rlife),
- _determine_colour_string(rpois, 1), _itosym1(rpois),
- _determine_colour_string(relec, 1), _itosym1(relec),
- _determine_colour_string(rsust, 2), _itosym2(rsust),
- _determine_colour_string(rmuta, 1), _itosym1(rmuta));
- cols.add_formatted(0, buf, false);
-
+ out += _resist_composer("rMut", cwidth, rmuta) + "\n";
+
const int saplevel = player_mutation_level(MUT_SAPROVOROUS);
const bool show_gourm = (you.species != SP_MUMMY
&& you.species != SP_VAMPIRE
&& player_mutation_level(MUT_HERBIVOROUS) < 3
&& you.gourmand());
-
- snprintf(buf, sizeof buf, "%s%s %s",
- _determine_colour_string(
- show_gourm ? 1 : saplevel, show_gourm ? 1 : 3),
- show_gourm ? "Gourm " : "Saprov",
- show_gourm ? _itosym1(1) : _itosym3(saplevel));
-
- cols.add_formatted(0, buf, false);
-
+ out += _resist_composer(show_gourm ? "Gourm" : "Saprov",
+ cwidth,
+ show_gourm ? 1 : saplevel,
+ show_gourm ? 1 : 3) + "\n";
+
+ cols.add_formatted(0, out, false);
+
+ //second column
+ out.clear();
+ cwidth = 9;
const int rinvi = you.can_see_invisible(calc_unid);
+ out += _resist_composer("SeeInvis", cwidth, rinvi) + "\n";
// TODO: Also show *Rage in clarity line
const int rclar = you.clarity(calc_unid);
+ out += _resist_composer("Clarity", cwidth, rclar) + "\n";
const int rcons = you.conservation(calc_unid);
+ out += _resist_composer("Conserve", cwidth, rcons) + "\n";
const int rcorr = you.res_corr(calc_unid);
+ out += _resist_composer("rCorr", cwidth, rcorr) + "\n";
const int rrott = you.res_rotting();
+ out += _resist_composer("rRot", cwidth, rrott) + "\n";
const int rspir = you.spirit_shield(calc_unid);
+ out += _resist_composer("Spirit", cwidth, rspir) + "\n";
const int rward = you.warding(calc_unid);
- snprintf(buf, sizeof buf,
- "%sSeeInvis %s\n"
- "%sClarity %s\n"
- "%sConserve %s\n"
- "%srCorr %s\n"
- "%srRot %s\n"
- "%sSpirit %s\n"
- "%sWarding %s\n"
- ,
- _determine_colour_string(rinvi, 1), _itosym1(rinvi),
- _determine_colour_string(rclar, 1), _itosym1(rclar),
- _determine_colour_string(rcons, 1), _itosym1(rcons),
- _determine_colour_string(rcorr, 1), _itosym1(rcorr),
- _determine_colour_string(rrott, 1), _itosym1(rrott),
- _determine_colour_string(rspir, 1), _itosym1(rspir),
- _determine_colour_string(rward, 1), _itosym1(rward));
- cols.add_formatted(1, buf, false);
-
+ out += _resist_composer("Warding", cwidth, rward) + "\n";
+
const int stasis = you.stasis(calc_unid);
const int notele = you.no_tele(calc_unid);
const int rrtel = !!player_teleport(calc_unid);
if (notele && !stasis)
{
- snprintf(buf, sizeof buf, "%sNoTele %s",
- _determine_colour_string(-1, 1), _itosym1(1));
+ out += _resist_composer("NoTele", cwidth, 1, 1, false) + "\n";
}
else if (rrtel && !stasis)
{
- snprintf(buf, sizeof buf, "%sRndTele %s",
- _determine_colour_string(-1, 1), _itosym1(1));
+ out += _resist_composer("RndTele", cwidth, 1, 1, false) + "\n";
}
else
{
- snprintf(buf, sizeof buf, "%sStasis %s",
- _determine_colour_string(stasis, 1), _itosym1(stasis));
+ out += _resist_composer("Stasis", cwidth, stasis) + "\n";
}
- cols.add_formatted(1, buf, false);
+ cols.add_formatted(1, out, false);
const int no_cast = you.no_cast(calc_unid);
if (no_cast)
{
- snprintf(buf, sizeof buf, "%sNoCast %s",
- _determine_colour_string(-1, 1), _itosym1(1));
- cols.add_formatted(1, buf, false);
+ out.clear();
+ out += _resist_composer("NoCast", cwidth, 1, 1, false);
+ cols.add_formatted(1, out, false);
}
_print_overview_screen_equip(cols, equip_chars, sw);
--
1.8.4.msysgit.0
0002-MR-stat-bar-v3.patch [^] (1,919 bytes) 2014-01-05 22:04 [Show Content] [Hide Content]From a8198bcffc2c1f7d600abf7321845768e067ddd5 Mon Sep 17 00:00:00 2001
From: Cedor <cedordark@yahoo.fr>
Date: Sun, 5 Jan 2014 22:02:39 +0100
Subject: [PATCH 2/2] MR stat bar
Added bars for magic resistance into the % screen. Five level, and adjectives
revamped.
---
crawl-ref/source/output.cc | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index a732cc8..6ad6273 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1741,6 +1741,10 @@ int equip_name_to_slot(const char *s)
// Take maximum possible level into account.
static const char* _determine_colour_string(int level, int max_level)
{
+ //special case for MR bar : force no coloring
+ if (max_level >3)
+ level = 0;
+
switch (level)
{
case 3:
@@ -2239,6 +2243,11 @@ static vector<formatted_string> _get_overview_resistances(
show_gourm ? 1 : saplevel,
show_gourm ? 1 : 3) + "\n";
+
+ const int rmagi = player_res_magic(calc_unid)/40;
+ // no colouring ATM
+ out += _resist_composer("MR", cwidth, rmagi,5) + "\n";
+
cols.add_formatted(0, out, false);
//second column
@@ -2399,14 +2408,10 @@ string magic_res_adjective(int mr)
string prefix =
(mr < 10) ? "not" :
- (mr < 30) ? "slightly" :
- (mr < 60) ? "somewhat" :
- (mr < 90) ? "quite" :
- (mr < 120) ? "very" :
+ (mr < 50) ? "somewhat" :
+ (mr < 100) ? "very" :
(mr < 150) ? "extremely" :
- (mr < 190) ? "extraordinarily" :
- (mr < 240) ? "incredibly" :
- (mr < 300) ? "uncannily"
+ (mr < 200) ? "incredibly"
: "almost entirely";
return prefix + " resistant";
}
--
1.8.4.msysgit.0
|