REGISTER_NET_LINKED(waypointsprites)
#ifdef SVQC
-/** flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable] */
bool WaypointSprite_SendEntity(entity this, entity to, float sendflags)
{
WriteHeader(MSG_ENTITY, waypointsprites);
if (this.max_health || (this.pain_finished && (time < this.pain_finished + 0.25)))
sendflags |= 0x80;
- int f = 0;
- if(this.currentammo == 1)
- f |= 1; // hideable
- if(this.exteriormodeltoclient == to)
- f |= 2; // my own
- if(this.currentammo == 2)
- f |= 2; // radar only
+ int hide_flags = 0;
+ if(this.currentammo == 1) hide_flags |= 1; // hideable
+ else if(this.currentammo == 2) hide_flags |= 2; // radar only
+ if(this.exteriormodeltoclient == to) hide_flags |= 2; // my own
- MUTATOR_CALLHOOK(SendWaypoint, this, to, sendflags, f);
+ MUTATOR_CALLHOOK(SendWaypoint, this, to, sendflags, hide_flags);
sendflags = M_ARGV(2, int);
- f = M_ARGV(3, int);
+ hide_flags = M_ARGV(3, int);
WriteByte(MSG_ENTITY, sendflags);
WriteByte(MSG_ENTITY, this.wp_extra);
{
WriteCoord(MSG_ENTITY, this.fade_time);
WriteCoord(MSG_ENTITY, this.teleport_time);
- WriteShort(MSG_ENTITY, this.fade_rate); // maxdist
- WriteByte(MSG_ENTITY, f);
+ WriteShort(MSG_ENTITY, bound(0, this.fade_rate, 32767)); // maxdist
+ WriteByte(MSG_ENTITY, hide_flags);
}
if (sendflags & 32)
strfree(this.netname3);
}
-/** flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable] */
void Ent_WaypointSprite(entity this, bool isnew)
{
int sendflags = ReadByte();
}
vector sz;
- vector txt_color;
- string txt = string_null;
+ vector col = rgb;
+ string txt = string_null; // it will contain either the text or the icon path
if (is_text)
{
txt = spritelookuptext(this, spriteimage);
txt = sprintf(_("%s needing help!"), txt);
if (autocvar_g_waypointsprite_uppercase)
txt = strtoupper(txt);
- txt_color = rgb;
sz = waypointsprite_fontsize * '1 1 0';
}
else
{
- // for convenience icon path and color are saved to txt and txt_color
- txt = pic;
- txt_color = ((autocvar_g_waypointsprite_iconcolor) ? '1 1 1' : rgb);
+ txt = pic; // icon path
+ if (autocvar_g_waypointsprite_iconcolor == 0)
+ col = '1 1 1';
+ else if (autocvar_g_waypointsprite_iconcolor > 0 && autocvar_g_waypointsprite_iconcolor != 1)
+ {
+ col = rgb_to_hsv(col);
+ col.y *= autocvar_g_waypointsprite_iconcolor; // scale saturation
+ col = hsv_to_rgb(col);
+ }
sz = autocvar_g_waypointsprite_iconsize * '1 1 0';
}
marg = SPRITE_HEALTHBAR_MARGIN * t + 0.5 * sz.y;
float minwidth = (SPRITE_HEALTHBAR_WIDTH + 2 * SPRITE_HEALTHBAR_BORDER) * t;
- o = drawsprite_TextOrIcon(is_text, o, ang, minwidth, txt_color, a, sz, txt);
+ o = drawsprite_TextOrIcon(is_text, o, ang, minwidth, col, a, sz, txt);
drawhealthbar(
o,
0,
}
else
{
- drawsprite_TextOrIcon(is_text, o, ang, 0, txt_color, a, sz, txt);
+ drawsprite_TextOrIcon(is_text, o, ang, 0, col, a, sz, txt);
}
draw_endBoldFont();