13 sendflags = sendflags & 0x7F;
24 sendflags =
M_ARGV(2,
int);
25 hide_flags =
M_ARGV(3,
int);
39 dt =
bound(0, dt * 32, 16383);
124 if (sendflags & 0x80)
130 this.build_finished = 0;
136 if (this.build_finished)
139 this.build_starthealth = 0;
146 this.build_finished = 0;
153 setorigin(
this, this.
origin);
181 this.maxdistance = ReadShort();
188 this.teamradar_icon = f &
BITS(7);
191 this.(teamradar_times[this.teamradar_time_index]) =
time;
194 this.teamradar_color_x =
ReadByte() / 255.0;
195 this.teamradar_color_y =
ReadByte() / 255.0;
196 this.teamradar_color_z =
ReadByte() / 255.0;
211 if (s == WP_Weapon.netname) {
216 if(s == WP_FlagReturn.netname)
return 2;
224 if (s == WP_Item.netname || s == RADARICON_Item.netname)
return REGISTRY_GET(Items, this.
wp_extra).m_color;
246 FOREACH(Waypoints, it.netname == s, {
266 FOREACH(Waypoints, it.netname == s, {
279 hotspot = -1 * hotspot;
283 v2 = hotspot +
'1 0 0' * sz.x;
284 v3 = hotspot +
'1 0 0' * sz.x +
'0 1 0' * sz.y;
285 v4 = hotspot +
'0 1 0' * sz.y;
295 R_BeginPolygon(pic, f,
true);
296 R_PolygonVertex(v1,
'0 0 0', rgb, a);
297 R_PolygonVertex(v2,
'1 0 0', rgb, a);
298 R_PolygonVertex(v3,
'1 1 0', rgb, a);
299 R_PolygonVertex(v4,
'0 1 0', rgb, a);
305 R_BeginPolygon(pic, f,
true);
306 R_PolygonVertex(o,
'0 0 0', rgb, a);
307 R_PolygonVertex(o + ri,
'1 0 0', rgb, a);
308 R_PolygonVertex(o + up + ri,
'1 1 0', rgb, a);
309 R_PolygonVertex(o + up,
'0 1 0', rgb, a);
313void drawhealthbar(
vector org,
float rot,
float h,
vector sz,
vector hotspot,
float width,
float theheight,
float margin,
float border,
float align,
vector rgb,
float a,
vector hrgb,
float ha,
float f)
318 hotspot = -1 * hotspot;
330 owidth = width + 2 * border;
331 o = o - up * (margin + border + theheight) + ri * (sz.x - owidth) * 0.5;
333 drawquad(o - up * border, ri * owidth, up * border,
"", rgb, a, f);
334 drawquad(o + up * theheight, ri * owidth, up * border,
"", rgb, a, f);
335 drawquad(o, ri * border, up * theheight,
"", rgb, a, f);
336 drawquad(o + ri * (owidth - border), ri * border, up * theheight,
"", rgb, a, f);
337 drawquad(o + ri * (border + align * ((1 - h) * width)), ri * width * h, up * theheight,
"", hrgb, ha, f);
343 float size = 9.0 * t;
344 float border = 1.5 * t;
345 float margin = 4.0 * t;
347 float borderDiag = border *
M_SQRT2;
354 R_PolygonVertex(o,
'0 0 0',
'0 0 0', a);
355 R_PolygonVertex(o +
Rotate(arrowY - borderX,
ang),
'0 0 0',
'0 0 0', a);
356 R_PolygonVertex(o +
Rotate(borderY - borderX,
ang),
'0 0 0',
'0 0 0', a);
357 R_PolygonVertex(o +
Rotate(borderY + borderX,
ang),
'0 0 0',
'0 0 0', a);
358 R_PolygonVertex(o +
Rotate(arrowY + borderX,
ang),
'0 0 0',
'0 0 0', a);
362 R_PolygonVertex(o +
Rotate(
eY * borderDiag,
ang),
'0 0 0', rgb, a);
363 R_PolygonVertex(o +
Rotate(arrowY - arrowX,
ang),
'0 0 0', rgb, a);
364 R_PolygonVertex(o +
Rotate(arrowY + arrowX,
ang),
'0 0 0', rgb, a);
375 float aspect, sa, ca;
396 algny = 0.5 - 0.5 * (f ? (ca / f) : 0);
401 algnx = 0.5 - 0.5 * (f ? (sa / f) : 0);
419 o.x += 0.5 * (w - sw);
434 vector yvec =
'0.299 0.587 0.114';
435 return rgb + dst * ((src * yvec) / (dst * yvec)) * ((rgb -
'1 1 1') * src);
444 if (rgb.z > 1) rgb.z = 1;
445 }
else if (rgb.z > 1) {
447 if (rgb.y > 1) rgb.y = 1;
449 }
else if (rgb.y > 1) {
453 if (rgb.z > 1) rgb.z = 1;
454 }
else if (rgb.z > 1) {
456 if (rgb.x > 1) rgb.x = 1;
458 }
else if (rgb.z > 1) {
462 if (rgb.y > 1) rgb.y = 1;
463 }
else if (rgb.y > 1) {
465 if (rgb.x > 1) rgb.x = 1;
478 if (this.hideflags & 2)
490 string spriteimage =
"";
516 spriteimage = this.netname3;
517 else if (this.
team == t)
518 spriteimage = this.netname2;
523 error(
"Invalid waypointsprite rule!");
527 if (spriteimage ==
"")
535 if(this.maxdistance > 0)
545 this.teamradar_color =
'1 0 1';
546 LOG_INFOF(
"WARNING: sprite of name %s has no color, using pink so you notice it", spriteimage);
550 float blink_time = (health_val >= 0) ? (health_val * 10) :
time;
551 if (blink_time -
floor(blink_time) > 0.5)
553 if (this.helpme &&
time < this.helpme)
584 ang = atan2(-d.x, -d.y);
590 if (
f1 == 0) {
f1 = 0.000001; }
591 if (
f2 == 0) {
f2 = 0.000001; }
620 ang = atan2(-d.x, -d.y);
648 if (this.build_finished)
650 if (
time < this.build_finished + 0.25)
652 if (
time < this.build_started)
654 else if (
time < this.build_finished)
655 SetResourceExplicit(
this, RES_HEALTH, (
time - this.build_started) / (this.build_finished - this.build_started) * (1 - this.build_starthealth) + this.build_starthealth);
671 bool icon_found = !(!spr_icon || spr_icon ==
"");
677 pic =
strcat(
"gfx/hud/default/", spr_icon);
692 if (this.helpme &&
time < this.helpme)
693 txt = sprintf(_(
"%s needing help!"), txt);
695 txt = strtoupper(txt);
715 float align = 0, marg;
716 if (this.build_finished)
757 int ext_len =
strlen(ext);
759 for (
int i = 0; i < n; ++i)
767 int f =
stof(sframes) + 1;
812 string m1 = _m1.netname;
813 string m2 = _m2.netname;
814 string m3 = _m3.netname;
834 f =
bound(0, f, e.max_health);
835 float step = e.max_health / 40;
846 if (f != e.max_health || e.pain_finished)
856 if (f != e.pain_finished || e.max_health)
885 int new_cnt = (e.cnt &
BIT(7)) | (i &
BITS(7));
886 if (new_cnt != e.cnt || col != e.colormod)
897 if (
time < e.waypointsprite_pingtime)
return;
898 e.waypointsprite_pingtime =
time + 0.3;
916 e.teleport_time =
time + t;
918 else if (t < (e.teleport_time -
time))
924 float current_fadetime = e.teleport_time -
time;
925 e.teleport_time =
time + t;
927 e.fade_time = -e.fade_time;
928 e.fade_time = e.fade_time * t / current_fadetime;
944 if (wp.owner) wp.owner.(wp.owned_by_field) =
NULL;
951 if (wp.classname !=
"sprite_waypoint")
953 backtrace(
"Trying to disown a non-waypointsprite");
958 if (wp.exteriormodeltoclient == wp.owner)
959 wp.exteriormodeltoclient =
NULL;
960 wp.owner.(wp.owned_by_field) =
NULL;
969 bool doremove =
false;
1001 if (this.
team != view.team)
1023 return e2.team == e.team;
1037 return this.waypointsprite_visible_for_player(
this, client, e);
1052 float _lifetime,
float maxdistance,
1060 entity wp =
new(sprite_waypoint);
1061 wp.fade_time = _lifetime;
1063 _lifetime = -_lifetime;
1064 wp.teleport_time =
time + _lifetime;
1065 wp.exteriormodeltoclient = ref;
1069 setorigin(wp, ref.origin + ofs);
1076 wp.currentammo = hideable;
1080 delete(own.(ownfield));
1081 own.(ownfield) = wp;
1082 wp.owned_by_field = ownfield;
1084 wp.fade_rate = maxdistance;
1086 wp.nextthink =
time;
1087 wp.model1 = spr.netname;
1092 wp.colormod = spr.m_color;
1105 return WaypointSprite_Spawn(spr, 0, 0,
NULL, ofs,
NULL, 0, own, ownfield,
true, icon);
1126 return WaypointSprite_Spawn(spr,
waypointsprite_deployed_lifetime, maxdistance,
NULL, ofs,
NULL, t, player,
waypointsprite_deployed_fixed,
false, icon);
1136 return WaypointSprite_Spawn(spr, 0, 0,
NULL, ofs,
NULL, 0, player,
waypointsprite_deployed_personal,
false, icon);
1147 if (player.waypointsprite_attachedforcarrier)
1158 return WaypointSprite_Spawn(spr,
waypointsprite_deployed_lifetime, maxdistance, player,
'0 0 64',
NULL, t, player,
waypointsprite_attached,
false, icon);
1168 entity e =
WaypointSprite_Spawn(spr, 0, 0, carrier,
'0 0 64',
NULL, carrier.team, carrier,
waypointsprite_attachedforcarrier,
false, icon);
#define MUTATOR_CALLHOOK(id,...)
#define REGISTER_MUTATOR(...)
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
#define drawstring(position, text, scale, rgb, alpha, flag)
#define drawpic(position, pic, size, rgb, alpha, flag)
#define draw_beginBoldFont()
#define draw_endBoldFont()
IntrusiveList g_radaricons
IntrusiveList g_drawables_2d
ERASEABLE vector rgb_to_hsv(vector rgb)
ERASEABLE vector hsv_to_rgb(vector hsv)
vector healtharmor_maxdamage(float h, float a, float armorblock, int deathtype)
const float DRAWFLAG_NORMAL
const float DRAWFLAG_ADDITIVE
float autocvar_g_balance_armor_blockpercent
entity exteriormodeltoclient
float autocvar__menu_alpha
float autocvar_hud_panel_fg_alpha
void InterpolateOrigin_Undo(entity this)
snap origin to iorigin2 (actual origin)
void InterpolateOrigin_Note(entity this)
void InterpolateOrigin_Do(entity this)
set origin based on iorigin1 (old pos), iorigin2 (desired pos), and time
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
int autocvar_sv_itemstime
#define FOREACH(list, cond, body)
noref float vid_conheight
#define NET_HANDLE(id, param)
#define WriteHeader(to, id)
#define REGISTER_NET_LINKED(id)
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
ERASEABLE string db_get(int db, string key)
ERASEABLE void db_put(int db, string key, string value)
#define get_monsterinfo(i)
spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2 f1points f2
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
float race_checkpointtime
float race_mycheckpointtime
#define REGISTRY_GET(id, i)
#define STATIC_INIT(func)
during worldspawn
const int MAX_TEAMRADAR_TIMES
ERASEABLE vector Rotate(vector v, float a)
vector project_3d_to_2d(vector vec)
vector drawsprite_TextOrIcon(bool is_text, vector o, float ang, float minwidth, vector rgb, float a, vector sz, string str)
void WaypointSprite_HelpMePing(entity e)
void WaypointSprite_ClearOwned(entity this)
entity WaypointSprite_DeployPersonal(entity spr, entity player, vector ofs, entity icon)
bool WaypointSprite_Customize(entity this, entity client)
bool WaypointSprite_SendEntity(entity this, entity to, float sendflags)
void drawhealthbar(vector org, float rot, float h, vector sz, vector hotspot, float width, float theheight, float margin, float border, float align, vector rgb, float a, vector hrgb, float ha, float f)
void WaypointSprite_Kill(entity wp)
void WaypointSprite_UpdateTeamRadar(entity e, entity icon, vector col)
entity WaypointSprite_DeployFixed(entity spr, bool limited_range, entity player, vector ofs, entity icon)
void drawquad(vector o, vector ri, vector up, string pic, vector rgb, float a, float f)
string spritelookupicon(entity this, string s)
void WaypointSprite_UpdateOrigin(entity e, vector o)
void WaypointSprite_Init()
void WaypointSprite_UpdateSprites(entity e, entity _m1, entity _m2, entity _m3)
void WaypointSprite_UpdateMaxHealth(entity e, float f)
void WaypointSprite_Ping(entity e)
void WaypointSprite_ClearPersonal(entity this)
vector drawspritearrow(vector o, float ang, vector rgb, float a, float t)
entity WaypointSprite_Spawn(entity spr, float _lifetime, float maxdistance, entity ref, vector ofs, entity showto, float t, entity own,.entity ownfield, float hideable, entity icon)
void WaypointSprite_Load()
string spritelookuptext(entity this, string s)
void WaypointSprite_Think(entity this)
bool WaypointSprite_visible_for_player(entity this, entity player, entity view)
entity WaypointSprite_getviewentity(entity e)
entity WaypointSprite_Attach(entity spr, entity player, bool limited_range, entity icon)
vector fixrgbexcess_move(vector rgb, vector src, vector dst)
void Ent_RemoveWaypointSprite(entity this)
vector spritelookupcolor(entity this, string s, vector def)
void WaypointSprite_FadeOutIn(entity e, float t)
entity WaypointSprite_AttachCarrier(entity spr, entity carrier, entity icon)
void WaypointSprite_PlayerGone(entity this)
void Draw_WaypointSprite(entity this)
void WaypointSprite_PlayerDead(entity this)
void Ent_WaypointSprite(entity this, bool isnew)
void WaypointSprite_UpdateHealth(entity e, float f)
vector fixrgbexcess(vector rgb)
float WaypointSprite_isteammate(entity e, entity e2)
entity WaypointSprite_SpawnFixed(entity spr, vector ofs, entity own,.entity ownfield, entity icon)
void WaypointSprite_Disown(entity wp, float fadetime)
void WaypointSprite_DetachCarrier(entity carrier)
void WaypointSprite_UpdateBuildFinished(entity e, float f)
void WaypointSprite_Reset(entity this)
void drawrotpic(vector org, float rot, string pic, vector sz, vector hotspot, vector rgb, float a, float f)
void WaypointSprite_Load_Frames(string ext)
float spritelookupblinkvalue(entity this, string s)
void WaypointSprite_UpdateRule(entity e, float t, float r)
const float SPRITE_HEALTHBAR_HEIGHT
entity waypointsprite_deployed_fixed
float autocvar_g_waypointsprite_edgeoffset_left
float autocvar_g_waypointsprite_timealphaexponent
float waypointsprite_limitedrange
float waypointsprite_count
float waypointsprite_alpha
const int SPRITERULE_DEFAULT
int wp_extra
Additional networked waypoint state, used for items, weapons, buffs.
bool autocvar_g_waypointsprite_uppercase
float waypointsprite_edgeoffset_left
float autocvar_g_waypointsprite_crosshairfadedistance
float waypointsprite_helpmetime
float autocvar_g_waypointsprite_fontsize
float waypointsprite_scale
float autocvar_g_waypointsprite_normdistance
float waypointsprite_deadlifetime
float waypointsprite_distancefadedistance
float waypointsprite_edgeoffset_top
entity waypointsprite_attached
float autocvar_g_waypointsprite_distancefadealpha
float autocvar_g_waypointsprite_iconsize
float autocvar_g_waypointsprite_alpha
float waypointsprite_distancealphaexponent
float autocvar_g_waypointsprite_crosshairfadealpha
float waypointsprite_crosshairfadescale
const float SPRITE_HELPME_BLINK
float waypointsprite_normdistance
float waypointsprite_edgefadescale
int autocvar_g_waypointsprite_itemstime
float waypointsprite_edgeoffset_right
float waypointsprite_crosshairfadealpha
float waypointsprite_fadedistance
float waypointsprite_edgefadedistance
entity waypointsprite_deployed_personal
float autocvar_g_waypointsprite_minalpha
const float SPRITE_ARROW_SCALE
float autocvar_sv_waypointsprite_limitedrange
float autocvar_sv_waypointsprite_deadlifetime
float waypointsprite_crosshairfadedistance
bool autocvar_g_waypointsprite_iconcolor
float autocvar_g_waypointsprite_scale
float waypointsprite_deployed_lifetime
bool autocvar_cl_hidewaypoints
entity waypointsprite_attachedforcarrier
const int SPRITERULE_SPECTATOR
float autocvar_g_waypointsprite_distancealphaexponent
float autocvar_g_waypointsprite_edgeoffset_right
float autocvar_g_waypointsprite_edgeoffset_top
const float SPRITE_HEALTHBAR_HEALTHALPHA
float autocvar_g_waypointsprite_distancefadescale
float autocvar_g_waypointsprite_edgefadescale
const float SPRITE_HEALTHBAR_BORDERALPHA
float autocvar_g_waypointsprite_crosshairfadescale
float waypointsprite_minscale
float waypointsprite_edgefadealpha
const float SPRITE_HEALTHBAR_WIDTH
const float SPRITE_HEALTHBAR_BORDER
float autocvar_g_waypointsprite_edgefadedistance
float waypointsprite_distancefadealpha
float autocvar_g_waypointsprite_edgeoffset_bottom
float waypointsprite_timealphaexponent
float waypointsprite_distancefadescale
float autocvar_g_waypointsprite_minscale
const float SPRITE_HEALTHBAR_MARGIN
float autocvar_g_waypointsprite_distancefadedistancemultiplier
float waypointsprite_fontsize
float autocvar_sv_waypointsprite_deployed_lifetime
const int SPRITERULE_TEAMPLAY
float waypointsprite_minalpha
float waypointsprite_edgeoffset_bottom
float waypointsprite_newcount
int autocvar_g_waypointsprite_spam
bool autocvar_g_waypointsprite_text
float autocvar_g_waypointsprite_edgefadealpha
const int WEP_FLAG_SUPERWEAPON