From c0f78e0a9c09b12e57965f31fdfccf56e5815b84 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sun, 13 Mar 2016 20:57:44 +1100 Subject: [PATCH] Damagetext: simplify format specifier --- qcsrc/common/mutators/mutator/damagetext/damagetext.qc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qcsrc/common/mutators/mutator/damagetext/damagetext.qc b/qcsrc/common/mutators/mutator/damagetext/damagetext.qc index 866ffeb4c..70c574853 100644 --- a/qcsrc/common/mutators/mutator/damagetext/damagetext.qc +++ b/qcsrc/common/mutators/mutator/damagetext/damagetext.qc @@ -13,7 +13,7 @@ REGISTER_MUTATOR(damagetext, true); #if defined(CSQC) || defined(MENUQC) // no translatable cvar description please AUTOCVAR_SAVE(cl_damagetext, bool, false, "Draw damage dealt where you hit the enemy"); -AUTOCVAR_SAVE(cl_damagetext_format, string, "-%3$$d", "How to format the damage text. 1$ is health, 2$ is armor, 3$ is both"); +AUTOCVAR_SAVE(cl_damagetext_format, string, "-{total}", "How to format the damage text. {health}, {armor}, {total}"); AUTOCVAR_SAVE(cl_damagetext_color, vector, '1 1 0', "Damage text color"); AUTOCVAR_SAVE(cl_damagetext_color_per_weapon, bool, false, "Damage text uses weapon color"); AUTOCVAR_SAVE(cl_damagetext_size, float, 8, "Damage text font size"); @@ -51,7 +51,10 @@ CLASS(DamageText, Object) Weapon w = DEATH_WEAPONOF(this.m_deathtype); if (w != WEP_Null) rgb = w.wpcolor; } - string s = sprintf(autocvar_cl_damagetext_format, this.m_damage, this.m_armordamage, this.m_damage + this.m_armordamage); + string s = autocvar_cl_damagetext_format; + s = strreplace("{health}", sprintf("%d", this.m_damage), s); + s = strreplace("{armor}", sprintf("%d", this.m_armordamage), s); + s = strreplace("{total}", sprintf("%d", this.m_damage + this.m_armordamage), s); drawcolorcodedstring2(pos, s, this.m_size * '1 1 0', rgb, this.alpha, DRAWFLAG_NORMAL); } } -- 2.39.2