Damagetext: remove {health(ph)} and {total(p)}, add the cvar cl_damagetext_format_ver...
authorterencehill <piuntn@gmail.com>
Sat, 12 Nov 2016 19:35:22 +0000 (20:35 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 12 Nov 2016 19:35:22 +0000 (20:35 +0100)
defaultXonotic.cfg
qcsrc/common/mutators/mutator/damagetext/damagetext.qc

index 3f3cf443514fd2382b2722cda894d290da501b0f..18cdf29c13efd828310418658d71fc8283896663 100644 (file)
@@ -782,7 +782,8 @@ seta g_waypointsprite_turrets_maxdist 5000 "max distace for turret sprites"
 seta g_waypointsprite_tactical 1 "tactical overlay on turrets when in a vehicle"
 
 seta cl_damagetext "1" "Draw damage dealt where you hit the enemy"
-seta cl_damagetext_format "-{total}" "How to format the damage text. {health}, {armor}, {total}, {potential}: full damage not capped to target's health, {potential_health}: health damage not capped to target's health, {health(ph)}: shows potential_health too if different from health, {total(p)}: shows potential too if different from total"
+seta cl_damagetext_format "-{total}" "How to format the damage text. {health}, {armor}, {total}, {potential}: full damage not capped to target's health, {potential_health}: health damage not capped to target's health"
+seta cl_damagetext_format_verbose 0 "{health} shows {potential_health} too when they differ; {total} shows {potential} too when they differ"
 seta cl_damagetext_color "1 1 0" "Damage text color"
 seta cl_damagetext_color_per_weapon "0" "Damage text uses weapon color"
 seta cl_damagetext_size "8" "Damage text font size"
index b95cabb6ab7bfc0cc8d9debc9877660c08407dfa..57b34fae4c59694f5f8860faddd2313b318c01bb 100644 (file)
@@ -15,7 +15,8 @@ REGISTER_MUTATOR(damagetext, true);
 #if defined(CSQC) || defined(MENUQC)
 // no translatable cvar description please
 AUTOCVAR_SAVE(cl_damagetext,                        bool,   true,       "Draw damage dealt where you hit the enemy");
-AUTOCVAR_SAVE(cl_damagetext_format,                 string, "-{total}", "How to format the damage text. {health}, {armor}, {total}, {potential}: full damage not capped to target's health, {potential_health}: health damage not capped to target's health, {health(ph)}: shows potential_health too if different from health, {total(p)}: shows potential too if different from total");
+AUTOCVAR_SAVE(cl_damagetext_format,                 string, "-{total}", "How to format the damage text. {health}, {armor}, {total}, {potential}: full damage not capped to target's health, {potential_health}: health damage not capped to target's health");
+AUTOCVAR_SAVE(cl_damagetext_format_verbose,         bool,   false,      "{health} shows {potential_health} too when they differ; {total} shows {potential} too when they differ");
 STATIC_INIT(DamageText_LegacyFormat) {
     if (strstrofs(autocvar_cl_damagetext_format, "{", 0) < 0) autocvar_cl_damagetext_format = "-{total}";
 }
@@ -74,19 +75,17 @@ CLASS(DamageText, Object)
             int potential_health = rint((this.m_potential_damage - this.m_armordamage) / DAMAGETEXT_PRECISION_MULTIPLIER);
 
             string s = autocvar_cl_damagetext_format;
-            s = strreplace("{health}", sprintf("%d", health), s);
             s = strreplace("{armor}",  sprintf("%d", rint(this.m_armordamage / DAMAGETEXT_PRECISION_MULTIPLIER)), s);
-            s = strreplace("{total}",  sprintf("%d", total), s);
             s = strreplace("{potential}",  sprintf("%d", potential), s);
             s = strreplace("{potential_health}",  sprintf("%d", potential_health), s);
 
-            s = strreplace("{health(ph)}", (
-                               (health == potential_health)
+            s = strreplace("{health}", (
+                               (health == potential_health || !autocvar_cl_damagetext_format_verbose)
                                ? sprintf("%d",      health)
                                : sprintf("%d (%d)", health, potential_health)
                ), s);
-            s = strreplace("{total(p)}", (
-                               (total == potential)
+            s = strreplace("{total}", (
+                               (total == potential || !autocvar_cl_damagetext_format_verbose)
                                ? sprintf("%d",      total)
                                : sprintf("%d (%d)", total, potential)
                ), s);