|
| 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") |
|
| AUTOCVAR_SAVE (cl_damagetext_format_verbose, bool, false, "{health} shows {potential_health} too when they differ; {total} shows {potential} too when they differ") |
|
| AUTOCVAR_SAVE (cl_damagetext_format_hide_redundant, bool, false, "hide {armor} if 0; hide {potential} and {potential_health} when same as actual") |
|
| 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_min, float, 10, "Damage text font size for small damage") |
|
| AUTOCVAR_SAVE (cl_damagetext_size_min_damage, float, 25, "How much damage is considered small") |
|
| AUTOCVAR_SAVE (cl_damagetext_size_max, float, 16, "Damage text font size for large damage") |
|
| AUTOCVAR_SAVE (cl_damagetext_size_max_damage, float, 140, "How much damage is considered large") |
|
| AUTOCVAR_SAVE (cl_damagetext_alpha_start, float, 1, "Damage text initial alpha") |
|
| AUTOCVAR_SAVE (cl_damagetext_alpha_lifetime, float, 3, "Damage text lifetime in seconds") |
|
| AUTOCVAR_SAVE (cl_damagetext_velocity_screen, vector, '0 0 0', "Damage text move direction (screen coordinates)") |
|
| AUTOCVAR_SAVE (cl_damagetext_velocity_world, vector, '0 0 20', "Damage text move direction (world coordinates relative to player's view)") |
|
| AUTOCVAR_SAVE (cl_damagetext_offset_screen, vector, '0 -45 0', "Damage text offset (screen coordinates)") |
|
| AUTOCVAR_SAVE (cl_damagetext_offset_world, vector, '0 0 0', "Damage text offset (world coordinates relative to player's view)") |
|
| AUTOCVAR_SAVE (cl_damagetext_accumulate_range, float, 30, "Damage text spawned within this range is accumulated") |
|
| AUTOCVAR_SAVE (cl_damagetext_accumulate_alpha_rel, float, 0.65, "Only update existing damage text when it's above this much percentage (0 to 1) of the starting alpha") |
|
| AUTOCVAR_SAVE (cl_damagetext_friendlyfire, int, 1, "0: never show for friendly fire, 1: when more than 0 damage, 2: always") |
|
| AUTOCVAR_SAVE (cl_damagetext_friendlyfire_color, vector, '1 0 0', "Damage text color for friendlyfire") |
|
| AUTOCVAR_SAVE (cl_damagetext_2d, bool, true, "Show damagetext in 2D coordinates if the enemy's location is not known") |
|
| AUTOCVAR_SAVE (cl_damagetext_2d_pos, vector, '0.47 0.53 0', "2D damage text initial position (X and Y between 0 and 1)") |
|
| AUTOCVAR_SAVE (cl_damagetext_2d_alpha_start, float, 1, "2D damage text initial alpha") |
|
| AUTOCVAR_SAVE (cl_damagetext_2d_alpha_lifetime, float, 1.3, "2D damage text lifetime (alpha fading) in seconds") |
|
| AUTOCVAR_SAVE (cl_damagetext_2d_size_lifetime, float, 3, "2D damage text lifetime (size shrinking) in seconds") |
|
| AUTOCVAR_SAVE (cl_damagetext_2d_velocity, vector, '-25 0 0', "2D damage text move direction (screen coordinates)") |
|
| AUTOCVAR_SAVE (cl_damagetext_2d_overlap_offset, vector, '0 -15 0', "Offset 2D damage text by this much to prevent overlapping (screen coordinates)") |
|
| AUTOCVAR_SAVE (cl_damagetext_2d_close_range, float, 125, "Always use 2D damagetext for hits closer that this") |
|
| AUTOCVAR_SAVE (cl_damagetext_2d_out_of_view, bool, true, "Always use 2D damagetext for hits that occurred off-screen") |
|
float | current_alpha (entity damage_text) |
|
| NET_HANDLE (damagetext, bool isNew) |
|
| STATIC_INIT (DamageText_LegacyFormat) |
|
NET_HANDLE |
( |
damagetext |
, |
|
|
bool |
isNew |
|
) |
| |
Definition at line 207 of file cl_damagetext.qc.
References current_alpha(), DTFLAG_BIG_ARMOR, DTFLAG_BIG_HEALTH, DTFLAG_BIG_POTENTIAL, DTFLAG_NO_ARMOR, DTFLAG_NO_POTENTIAL, DTFLAG_SAMETEAM, entity(), flags, g_drawables_2d, health, IL_EACH, make_impure, make_pure, max(), NEW, NULL, project_3d_to_2d(), projected_on_screen(), spectatee_status, vdist, vec2, vector(), vid_conheight, vid_conwidth, and view_origin.
210 int server_entity_index = ReadByte();
211 int deathtype = ReadInt24_t();
212 int flags = ReadByte();
215 int health, armor, potential_damage;
217 else health = ReadShort();
220 else armor = ReadShort();
223 else potential_damage = ReadShort();
227 if (autocvar_cl_damagetext == 0)
return;
229 if (autocvar_cl_damagetext_friendlyfire == 0)
return;
230 if (autocvar_cl_damagetext_friendlyfire == 1 && health == 0 && armor == 0)
return;
233 int client_entity_index = server_entity_index - 1;
234 entity entcs = entcs_receiver(client_entity_index);
236 bool can_use_3d = entcs && entcs.has_origin;
237 bool too_close =
vdist(entcs.origin -
view_origin, <, autocvar_cl_damagetext_2d_close_range);
239 bool prefer_2d =
spectatee_status != -1 && autocvar_cl_damagetext_2d && (too_close || prefer_in_view);
241 if (can_use_3d && !prefer_2d) {
244 for (
entity e = findradius(entcs.origin,
max(autocvar_cl_damagetext_accumulate_range, 1)); e; e = e.chain) {
245 if (e.instanceOfDamageText
246 && !e.m_screen_coords
247 && e.m_group == server_entity_index
248 &&
current_alpha(e) > autocvar_cl_damagetext_accumulate_alpha_rel * autocvar_cl_damagetext_alpha_start) {
249 DamageText_update(e, entcs.origin, e.m_healthdamage + health, e.m_armordamage + armor, e.m_potential_damage + potential_damage, deathtype);
253 make_impure(
NEW(
DamageText, server_entity_index, entcs.origin,
false, health, armor, potential_damage, deathtype, friendlyfire));
257 IL_EACH(
g_drawables_2d, it.instanceOfDamageText && it.m_screen_coords && it.m_group == server_entity_index, {
258 DamageText_update(it, screen_pos, it.m_healthdamage + health, it.m_armordamage + armor, it.m_potential_damage + potential_damage, deathtype);
263 if (DamageText_screen_first ==
NULL) {
264 DamageText dt =
NEW(
DamageText, server_entity_index, screen_pos,
true, health, armor, potential_damage, deathtype, friendlyfire);
266 DamageText_screen_first = dt;
267 DamageText_screen_count = 1;
269 screen_pos += autocvar_cl_damagetext_2d_overlap_offset * DamageText_screen_count;
270 DamageText_screen_count++;
271 make_impure(
NEW(
DamageText, server_entity_index, screen_pos,
true, health, armor, potential_damage, deathtype, friendlyfire));
#define IL_EACH(this, cond, body)
vector project_3d_to_2d(vector vec)
bool projected_on_screen(vector screen_pos)
const int DTFLAG_NO_POTENTIAL
const int DTFLAG_NO_ARMOR
const int DTFLAG_BIG_POTENTIAL
float current_alpha(entity damage_text)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
const int DTFLAG_SAMETEAM
const int DTFLAG_BIG_HEALTH
const int DTFLAG_BIG_ARMOR
IntrusiveList g_drawables_2d