35 this.move_time =
time;
64 if(!autocvar_g_waypointsprite_turrets)
67 if(autocvar_cl_hidewaypoints)
77 if(dist < 10240 && t != this.
team)
91 txt =
"gfx/vehicles/turret_moving";
93 txt =
"gfx/vehicles/turret_stationary";
100 if(dist > this.maxdistance)
103 string spriteimage = this.
netname;
105 vector rgb = spritelookupcolor(
this, spriteimage, this.teamradar_color);
108 if(this.maxdistance > waypointsprite_normdistance)
109 a *= (
bound(0, (this.maxdistance - dist) / (this.maxdistance - waypointsprite_normdistance), 1) ** waypointsprite_distancealphaexponent);
110 else if(this.maxdistance > 0)
111 a *= (
bound(0, (waypointsprite_fadedistance - dist) / (waypointsprite_fadedistance - waypointsprite_normdistance), 1) ** waypointsprite_distancealphaexponent) * (1 - waypointsprite_minalpha) + waypointsprite_minalpha;
115 this.teamradar_color =
'1 0 1';
116 LOG_INFOF(
"WARNING: sprite of name %s has no color, using pink so you notice it", spriteimage);
119 txt = spritelookuptext(
this, spriteimage);
123 if(this.helpme &&
time < this.helpme)
125 a *= SPRITE_HELPME_BLINK;
126 txt = sprintf(_(
"%s under attack!"), txt);
129 a *= spritelookupblinkvalue(
this, spriteimage);
132 if(autocvar_g_waypointsprite_uppercase)
133 txt = strtoupper(txt);
144 rgb = fixrgbexcess(rgb);
148 || o_x < (
vid_conwidth * waypointsprite_edgeoffset_left)
156 float edgedistance_min =
min((o.y - (
vid_conheight * waypointsprite_edgeoffset_top)),
157 (o_x - (
vid_conwidth * waypointsprite_edgeoffset_left)),
163 t = waypointsprite_scale;
164 a *= waypointsprite_alpha;
167 a = a * (1 - (1 - waypointsprite_distancefadealpha) * (
bound(0, dist/waypointsprite_distancefadedistance, 1)));
168 t = t * (1 - (1 - waypointsprite_distancefadescale) * (
bound(0, dist/waypointsprite_distancefadedistance, 1)));
170 if (edgedistance_min < waypointsprite_edgefadedistance) {
171 a = a * (1 - (1 - waypointsprite_edgefadealpha) * (1 -
bound(0, edgedistance_min/waypointsprite_edgefadedistance, 1)));
172 t = t * (1 - (1 - waypointsprite_edgefadescale) * (1 -
bound(0, edgedistance_min/waypointsprite_edgefadedistance, 1)));
174 if(crosshairdistance < waypointsprite_crosshairfadedistance) {
175 a = a * (1 - (1 - waypointsprite_crosshairfadealpha) * (1 -
bound(0, crosshairdistance/waypointsprite_crosshairfadedistance, 1)));
176 t = t * (1 - (1 - waypointsprite_crosshairfadescale) * (1 -
bound(0, crosshairdistance/waypointsprite_crosshairfadedistance, 1)));
179 bool draw_healthbar = ((this.helpme &&
time < this.helpme) || !autocvar_g_waypointsprite_turrets_onlyhurt ||
hud != HUD_NORMAL);
180 bool draw_text = autocvar_g_waypointsprite_turrets_text;
182 if(draw_healthbar || draw_text)
184 o = drawspritearrow(o,
M_PI, rgb, a, SPRITE_ARROW_SCALE * t);
188 o = drawsprite_TextOrIcon(
true, o,
M_PI, (SPRITE_HEALTHBAR_WIDTH + 2 * SPRITE_HEALTHBAR_BORDER) * t, rgb, a, waypointsprite_fontsize *
'1 1 0', txt);
198 0.5 * SPRITE_HEALTHBAR_WIDTH * t,
199 0.5 * SPRITE_HEALTHBAR_HEIGHT * t,
200 SPRITE_HEALTHBAR_MARGIN * t + 0.5 * waypointsprite_fontsize,
201 SPRITE_HEALTHBAR_BORDER * t,
204 a * SPRITE_HEALTHBAR_BORDERALPHA,
206 a * SPRITE_HEALTHBAR_HEALTHALPHA,
219 this.
netname = tur.turret_name;
222 _setmodel(
this, tur.model);
223 _setmodel(this.
tur_head, tur.head_model);
224 setsize(
this, tur.m_mins, tur.m_maxs);
225 setsize(this.
tur_head,
'0 0 0',
'0 0 0');
227 if(this.
m_id == TUR_EWHEEL.m_id)
228 setattachment(this.
tur_head,
this,
"");
230 setattachment(this.
tur_head,
this,
"tag_head");
232 this.
tur_head.classname =
"turret_head";
248 this.maxdistance = autocvar_g_waypointsprite_turrets_maxdist;
249 this.teamradar_color =
'1 0 0';
258 tur.tr_setup(tur,
this);
290 for (
int j = 1; j < 5; j = j + 1)
302 gib =
new(turret_gib);
304 _setmodel(gib, _model);
305 gib.colormod = _cmod;
309 setsize(gib,
'-1 -1 -1',
'1 1 1');
312 gib.nextthink =
time + 0.2 * (autocvar_cl_gibs_lifetime * (1 +
prandom() * 0.15));
316 gib.nextthink =
time + autocvar_cl_gibs_lifetime * (1 +
prandom() * 0.15);
323 gib.move_time =
time;
324 gib.damageforcescale = 1;
333 if (!autocvar_cl_nogibs)
336 if(this.
m_id == TUR_EWHEEL.m_id)
338 else if (this.
m_id == TUR_WALKER.m_id)
340 else if (this.
m_id == TUR_TESLA.m_id)
356 headgib.angles = this.
tur_head.angles;
358 headgib.avelocity_y = headgib.avelocity_y * 5;
359 headgib.gravity = 0.5;
375 this.
m_id = ReadByte();
377 this.
origin = ReadVector();
380 this.
angles = ReadAngleVector2D();
394 this.
tur_head.angles_x = ReadShort();
395 this.
tur_head.angles_y = ReadShort();
404 this.
tur_head.avelocity_x = ReadShort();
405 this.
tur_head.avelocity_y = ReadShort();
410 this.
origin = ReadVector();
415 this.angles_y = ReadShort();
423 this.
frame = ReadByte();
430 if(_tmp != this.
team)
438 if(_tmp == 0 && myhp != 0)
440 else if(myhp && myhp > _tmp)
442 else if(myhp && myhp < _tmp)
#define get_turretinfo(i)
const float ALPHA_MIN_VISIBLE
NET_HANDLE(ENT_CLIENT_TURRET, bool isnew)
vector project_3d_to_2d(vector vec)
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
float autocvar_hud_panel_fg_alpha
void turret_head_draw(entity this)
vector Team_ColorRGB(int teamid)
void turret_gibboom(entity this)
void turret_draw(entity this)
void turret_changeteam(entity this)
bool autocvar_cl_vehicles_hud_tactical
void turret_remove(entity this)
entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, float _explode)
vector drawgetimagesize(string pic)
#define setmodel(this, m)
void turret_construct(entity this, bool isnew)
const float MOVE_NOMONSTERS
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
void Movetype_Physics_MatchTicrate(entity this, float tr, bool sloppy)
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
const float DRAWFLAG_NORMAL
void turret_draw2d(entity this)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
void turret_gib_draw(entity this)
float frame
primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4)
void turret_die(entity this)
#define sound(e, c, s, v, a)
IntrusiveList g_drawables
void set_movetype(entity this, int mt)
float frame1time
start time of framegroup animation
float autocvar_cl_vehicles_crosshair_size
IntrusiveList g_drawables_2d