24 sendflags =
M_ARGV(2,
int);
25 hide_flags =
M_ARGV(3,
int);
37 dt =
bound(0, dt * 32, 16383);
121 if (sendflags & 0x80)
127 this.build_finished = 0;
133 if (this.build_finished)
136 this.build_starthealth = 0;
143 this.build_finished = 0;
150 setorigin(
this, this.
origin);
172 this.maxdistance = ReadShort();
179 this.teamradar_icon = f &
BITS(7);
182 this.(teamradar_times[this.teamradar_time_index]) =
time;
185 this.teamradar_color_x =
ReadByte() / 255.0;
186 this.teamradar_color_y =
ReadByte() / 255.0;
187 this.teamradar_color_z =
ReadByte() / 255.0;
202 if (s == WP_Weapon.netname) {
207 if(s == WP_FlagReturn.netname)
return 2;
215 if (s == WP_Item.netname || s == RADARICON_Item.netname)
return REGISTRY_GET(Items, this.
wp_extra).m_color;
237 FOREACH(Waypoints, it.netname == s, {
257 FOREACH(Waypoints, it.netname == s, {
270 hotspot = -1 * hotspot;
274 v2 = hotspot +
'1 0 0' * sz.x;
275 v3 = hotspot +
'1 0 0' * sz.x +
'0 1 0' * sz.y;
276 v4 = hotspot +
'0 1 0' * sz.y;
286 R_BeginPolygon(pic, f,
true);
287 R_PolygonVertex(v1,
'0 0 0', rgb, a);
288 R_PolygonVertex(v2,
'1 0 0', rgb, a);
289 R_PolygonVertex(v3,
'1 1 0', rgb, a);
290 R_PolygonVertex(v4,
'0 1 0', rgb, a);
296 R_BeginPolygon(pic, f,
true);
297 R_PolygonVertex(o,
'0 0 0', rgb, a);
298 R_PolygonVertex(o + ri,
'1 0 0', rgb, a);
299 R_PolygonVertex(o + up + ri,
'1 1 0', rgb, a);
300 R_PolygonVertex(o + up,
'0 1 0', rgb, a);
304void 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)
309 hotspot = -1 * hotspot;
321 owidth = width + 2 * border;
322 o += up * -(margin + border + theheight) + ri * (sz.x - owidth) * 0.5;
324 drawquad(o - up * border, ri * owidth, up * border,
"", rgb, a, f);
325 drawquad(o + up * theheight, ri * owidth, up * border,
"", rgb, a, f);
326 drawquad(o, ri * border, up * theheight,
"", rgb, a, f);
327 drawquad(o + ri * (owidth - border), ri * border, up * theheight,
"", rgb, a, f);
328 drawquad(o + ri * (border + align * ((1 - h) * width)), ri * width * h, up * theheight,
"", hrgb, ha, f);
334 float size = 9.0 * t;
335 float border = 1.5 * t;
336 float margin = 4.0 * t;
338 float borderDiag = border *
M_SQRT2;
345 R_PolygonVertex(o,
'0 0 0',
'0 0 0', a);
346 R_PolygonVertex(o +
Rotate(arrowY - borderX,
ang),
'0 0 0',
'0 0 0', a);
347 R_PolygonVertex(o +
Rotate(borderY - borderX,
ang),
'0 0 0',
'0 0 0', a);
348 R_PolygonVertex(o +
Rotate(borderY + borderX,
ang),
'0 0 0',
'0 0 0', a);
349 R_PolygonVertex(o +
Rotate(arrowY + borderX,
ang),
'0 0 0',
'0 0 0', a);
353 R_PolygonVertex(o +
Rotate(
eY * borderDiag,
ang),
'0 0 0', rgb, a);
354 R_PolygonVertex(o +
Rotate(arrowY - arrowX,
ang),
'0 0 0', rgb, a);
355 R_PolygonVertex(o +
Rotate(arrowY + arrowX,
ang),
'0 0 0', rgb, a);
366 float sw = is_text ?
stringwidth(str,
false, sz) : sz.x;
367 float w = sw > minwidth ? sw : minwidth;
373 float ca =
cos(
ang) * aspect;
378 algny = 0.5 - 0.5 * (f ? (ca / f) : 0);
383 algnx = 0.5 - 0.5 * (f ? (sa / f) : 0);
401 o.x += 0.5 * (w - sw);
416 vector yvec =
'0.299 0.587 0.114';
417 return rgb + dst * ((src * yvec) / (dst * yvec)) * ((rgb -
'1 1 1') * src);
426 if (rgb.z > 1) rgb.z = 1;
427 }
else if (rgb.z > 1) {
429 if (rgb.y > 1) rgb.y = 1;
431 }
else if (rgb.y > 1) {
435 if (rgb.z > 1) rgb.z = 1;
436 }
else if (rgb.z > 1) {
438 if (rgb.x > 1) rgb.x = 1;
440 }
else if (rgb.z > 1) {
444 if (rgb.y > 1) rgb.y = 1;
445 }
else if (rgb.y > 1) {
447 if (rgb.x > 1) rgb.x = 1;
460 if (this.hideflags & 2)
472 string spriteimage =
"";
498 spriteimage = this.netname3;
499 else if (this.
team == t)
500 spriteimage = this.netname2;
505 error(
"Invalid waypointsprite rule!");
509 if (spriteimage ==
"")
517 if(this.maxdistance > 0)
527 this.teamradar_color =
'1 0 1';
528 LOG_INFOF(
"WARNING: sprite of name %s has no color, using pink so you notice it", spriteimage);
532 float blink_time = (health_val >= 0) ? (health_val * 10) :
time;
533 if (blink_time -
floor(blink_time) > 0.5)
535 if (this.helpme &&
time < this.helpme)
564 ang = atan2(-d.x, -d.y);
570 if (
f1 == 0) {
f1 = 0.000001; }
571 if (
f2 == 0) {
f2 = 0.000001; }
599 ang = atan2(-d.x, -d.y);
627 if (this.build_finished)
629 if (
time < this.build_finished + 0.25)
631 if (
time < this.build_started)
633 else if (
time < this.build_finished)
634 SetResourceExplicit(
this, RES_HEALTH, (
time - this.build_started) / (this.build_finished - this.build_started) * (1 - this.build_starthealth) + this.build_starthealth);
650 bool icon_found = !(!spr_icon || spr_icon ==
"");
656 pic =
strcat(
"gfx/hud/default/", spr_icon);
671 if (this.helpme &&
time < this.helpme)
672 txt = sprintf(_(
"%s needing help!"), txt);
674 txt = strtoupper(txt);
694 float align = 0, marg;
695 if (this.build_finished)
734 int ext_len =
strlen(ext);
736 for (
int i = 0; i < n; ++i)
744 int f =
stof(sframes) + 1;
789 string m1 = _m1.netname;
790 string m2 = _m2.netname;
791 string m3 = _m3.netname;
811 f =
bound(0, f, e.max_health);
812 float step = e.max_health / 40;
823 if (f != e.max_health || e.pain_finished)
833 if (f != e.pain_finished || e.max_health)
862 int new_cnt = (e.cnt &
BIT(7)) | (i &
BITS(7));
863 if (new_cnt != e.cnt || col != e.colormod)
874 if (
time < e.waypointsprite_pingtime)
return;
875 e.waypointsprite_pingtime =
time + 0.3;
893 e.teleport_time =
time + t;
895 else if (t < (e.teleport_time -
time))
901 float current_fadetime = e.teleport_time -
time;
902 e.teleport_time =
time + t;
904 e.fade_time = -e.fade_time;
905 e.fade_time *= t / current_fadetime;
921 if (wp.owner) wp.owner.(wp.owned_by_field) =
NULL;
928 if (wp.classname !=
"sprite_waypoint")
930 backtrace(
"Trying to disown a non-waypointsprite");
935 if (wp.exteriormodeltoclient == wp.owner)
936 wp.exteriormodeltoclient =
NULL;
937 wp.owner.(wp.owned_by_field) =
NULL;
946 bool doremove =
false;
976 if (this.
team != view.team)
998 return e2.team == e.team;
1012 return this.waypointsprite_visible_for_player(
this, client, e);
1027 float _lifetime,
float maxdistance,
1035 entity wp =
new(sprite_waypoint);
1036 wp.fade_time = _lifetime;
1038 _lifetime = -_lifetime;
1039 wp.teleport_time =
time + _lifetime;
1040 wp.exteriormodeltoclient = ref;
1044 setorigin(wp, ref.origin + ofs);
1051 wp.currentammo = hideable;
1055 delete(own.(ownfield));
1056 own.(ownfield) = wp;
1057 wp.owned_by_field = ownfield;
1059 wp.fade_rate = maxdistance;
1061 wp.nextthink =
time;
1062 wp.model1 = spr.netname;
1067 wp.colormod = spr.m_color;
1080 return WaypointSprite_Spawn(spr, 0, 0,
NULL, ofs,
NULL, 0, own, ownfield,
true, icon);
1091 float t =
teamplay ? player.team : 0;
1093 return WaypointSprite_Spawn(spr,
waypointsprite_deployed_lifetime, maxdistance,
NULL, ofs,
NULL, t, player,
waypointsprite_deployed_fixed,
false, icon);
1103 return WaypointSprite_Spawn(spr, 0, 0,
NULL, ofs,
NULL, 0, player,
waypointsprite_deployed_personal,
false, icon);
1113 if (player.waypointsprite_attachedforcarrier)
1115 float t =
teamplay ? player.team : 0;
1117 return WaypointSprite_Spawn(spr,
waypointsprite_deployed_lifetime, maxdistance, player,
'0 0 64',
NULL, t, player,
waypointsprite_attached,
false, icon);
1127 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.
#define drawstring(position, text, scale, rgb, alpha, flag)
#define draw_beginBoldFont()
#define drawpic_aspect(pos, pic, mySize, color, theAlpha, drawflag)
#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
WriteString(chan, ent.netname)
WriteByte(chan, ent.angles.y/DEC_FACTOR)
SetResourceExplicit(ent, RES_ARMOR, ReadByte() *DEC_FACTOR)) ENTCS_PROP(NAME
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)
const float M_SQRT2
sqrt(2)
#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
powerup timer