24 float since_hit =
time - this.hit_time;
26 float size = this.m_size - since_hit * this.m_shrink_rate * this.m_size;
27 float alpha_ = this.alpha - since_hit * this.fade_rate;
28 bool haslifetime = (autocvar_cl_damagetext_lifetime < 0
29 || (since_hit < autocvar_cl_damagetext_lifetime));
30 if (alpha_ <= 0 ||
size <= 0 || !haslifetime)
38 if (this.m_screen_coords)
48 + world_offset.x * forward
49 + world_offset.y * right
50 + world_offset.z * up;
56 screen_pos.y +=
size / 2;
59 string dtext = this.text;
61 while (
substring(dtext, j, 1) ==
" " && j >= 0)
76 if (screen_pos.z >= 0)
80 if (this.m_friendlyfire)
81 rgb = this.m_color_friendlyfire;
88 if (w != WEP_Null) rgb = w.
m_color;
94 drawcolorcodedstring2_builtin(screen_pos, this.text,
103 int _health,
int _armor,
int _potential_damage,
int _deathtype)
110 setorigin(
this, _origin);
132 s = strreplace(
"{armor}", (
135 : sprintf(
"%d", armor)
137 s = strreplace(
"{potential}", (
140 : sprintf(
"%d", potential)
142 s = strreplace(
"{potential_health}", (
145 : sprintf(
"%d", potential_health)
148 s = strreplace(
"{health}", (
151 : sprintf(
"%d (%d)",
health, potential_health)
153 s = strreplace(
"{total}", (
155 ? sprintf(
"%d", total)
156 : sprintf(
"%d (%d)", total, potential)
165 if (opening_pos == -1)
break;
166 int closing_pos =
strstrofs(s,
"}", opening_pos);
167 if (closing_pos == -1 || closing_pos <= opening_pos)
break;
182 int _health,
int _armor,
int _potential_damage,
int _deathtype,
bool _friendlyfire)
202 _health, _armor, _potential_damage, _deathtype);
209 --DamageText_screen_count;
216 return damage_text.alpha - (
time - damage_text.hit_time) * damage_text.fade_rate;
222 int server_entity_index =
ReadByte();
227 int health, armor, potential_damage;
229 else health = ReadShort();
232 else armor = ReadShort();
235 else potential_damage = ReadShort();
246 &&
health == 0 && armor == 0)
250 int client_entity_index = server_entity_index - 1;
272 if (flags & DTFLAG_STOP_ACCUMULATION
273 || (current_alpha(it) < alphathreshold)
274 || ((autocvar_cl_damagetext_accumulate_lifetime >= 0)
275 && (time - it.hit_time > autocvar_cl_damagetext_accumulate_lifetime)))
281 health += it.m_healthdamage;
282 armor += it.m_armordamage;
283 potential_damage += it.m_potential_damage;
290 if (can_use_3d && !prefer_2d)
294 position =
entcs.origin;
301 ++DamageText_screen_count;
321 DamageText_update(entDT, position, is2d,
health, armor, potential_damage, deathtype);
326 health, armor, potential_damage, deathtype, friendlyfire);
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
var float(entity ent) nudgeoutofsolid_OrFallback
float current_alpha(entity damage_text)
float autocvar_cl_damagetext_alpha_lifetime
bool autocvar_cl_damagetext
bool autocvar_cl_damagetext_format_hide_redundant
float autocvar_cl_damagetext_size_min
float autocvar_cl_damagetext_2d_close_range
vector autocvar_cl_damagetext_friendlyfire_color
float autocvar_cl_damagetext_size_min_damage
vector autocvar_cl_damagetext_offset_screen
float autocvar_cl_damagetext_2d_alpha_start
vector autocvar_cl_damagetext_velocity_world
float autocvar_cl_damagetext_accumulate_alpha_rel
float autocvar_cl_damagetext_size_max_damage
float autocvar_cl_damagetext_size_max
bool autocvar_cl_damagetext_2d_out_of_view
vector autocvar_cl_damagetext_2d_pos
vector autocvar_cl_damagetext_color
vector autocvar_cl_damagetext_offset_world
float autocvar_cl_damagetext_alpha_start
string autocvar_cl_damagetext_format
bool autocvar_cl_damagetext_color_per_weapon
float autocvar_cl_damagetext_2d_alpha_lifetime
vector autocvar_cl_damagetext_2d_overlap_offset
bool autocvar_cl_damagetext_format_verbose
float autocvar_cl_damagetext_2d_size_lifetime
vector autocvar_cl_damagetext_velocity_screen
vector autocvar_cl_damagetext_2d_velocity
int autocvar_cl_damagetext_friendlyfire
bool autocvar_cl_damagetext_2d
DamageText(int _group, vector _origin, bool _screen_coords, int _health, int _armor, int _potential_damage, int _deathtype, bool _friendlyfire)
void DamageText_draw2d(DamageText this)
vector m_color_friendlyfire
void DamageText_update(DamageText this, vector _origin, bool screen_coords, int _health, int _armor, int _potential_damage, int _deathtype)
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
vector m_color
M: color : waypointsprite color.
IntrusiveList g_damagetext
int spectatee_status
the -1 disables HUD panels before CSQC receives necessary data
const float DRAWFLAG_NORMAL
const int DTFLAG_BIG_HEALTH
const int DTFLAG_NO_POTENTIAL
const int DTFLAG_BIG_ARMOR
const int DTFLAG_SAMETEAM
const int DTFLAG_BIG_POTENTIAL
#define DAMAGETEXT_PRECISION_MULTIPLIER
const int DTFLAG_NO_ARMOR
#define DEATH_WEAPONOF(t)
#define MAKE_VECTORS(angles, forward, right, up)
Same as the makevectors builtin but uses the provided locals instead of the v_* globals.
#define entcs_receiver(...)
ERASEABLE void IL_REMOVE(IntrusiveList this, entity it)
Remove any element, anywhere in the list.
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define IL_EACH(this, cond, body)
noref float vid_conheight
#define NET_HANDLE(id, param)
ERASEABLE float map_bound_ranges(float value, float src_min, float src_max, float dest_min, float dest_max)
Same as map_ranges except that values outside the source range are clamped to min or max.
ERASEABLE float almost_equals_eps(float a, float b, float times_eps)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
#define STATIC_ATTRIB(cname, name, type, val)
#define make_pure(e)
direct use is
#define DESTRUCTOR(cname)
#define CONSTRUCTOR(cname,...)
#define CONSTRUCT(cname,...)
float health
Legacy fields for the resources. To be removed.
ERASEABLE string substring_range(string s, float b, float e)
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
vector project_3d_to_2d(vector vec)
bool projected_on_screen(vector screen_pos)