-void turret_remove()
-{SELFPARAM();
- remove(self.tur_head);
- //remove(self.enemy);
- self.tur_head = world;
+void turret_remove(entity this)
+{
+ remove(this.tur_head);
+ //remove(this.enemy);
+ this.tur_head = world;
}
.vector glowmod;
{
float dt;
- dt = time - self.move_time;
- self.move_time = time;
+ dt = time - this.move_time;
+ this.move_time = time;
if(dt <= 0)
return;
- self.tur_head.angles += dt * self.tur_head.move_avelocity;
+ this.tur_head.angles += dt * this.tur_head.move_avelocity;
- if (self.health < 127)
+ if (this.health < 127)
{
dt = random();
if(dt < 0.03)
- te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
+ te_spark(this.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
}
- if(self.health < 85)
+ if(this.health < 85)
if(dt < 0.01)
- pointparticles(EFFECT_SMOKE_LARGE, (self.origin + (randomvec() * 80)), '0 0 0', 1);
+ pointparticles(EFFECT_SMOKE_LARGE, (this.origin + (randomvec() * 80)), '0 0 0', 1);
- if(self.health < 32)
+ if(this.health < 32)
if(dt < 0.015)
- pointparticles(EFFECT_SMOKE_SMALL, (self.origin + (randomvec() * 80)), '0 0 0', 1);
+ pointparticles(EFFECT_SMOKE_SMALL, (this.origin + (randomvec() * 80)), '0 0 0', 1);
}
void turret_draw2d(entity this)
{
- if(self.netname == "")
+ if(this.netname == "")
return;
if(!autocvar_g_waypointsprite_turrets)
if(autocvar_cl_hidewaypoints)
return;
- float dist = vlen(self.origin - view_origin);
- float t = (GetPlayerColor(player_localnum) + 1);
+ float dist = vlen(this.origin - view_origin);
+ float t = (entcs_GetTeam(player_localnum) + 1);
vector o;
string txt;
if(autocvar_cl_vehicles_hud_tactical)
- if(dist < 10240 && t != self.team)
+ if(dist < 10240 && t != this.team)
{
// TODO: Vehicle tactical hud
- o = project_3d_to_2d(self.origin + '0 0 32');
+ o = project_3d_to_2d(this.origin + '0 0 32');
if(o_z < 0
|| o_x < (vid_conwidth * waypointsprite_edgeoffset_left)
|| o_y < (vid_conheight * waypointsprite_edgeoffset_top)
o_z = 0;
if(hud != HUD_NORMAL)
{
- if((get_turretinfo(self.m_id)).spawnflags & TUR_FLAG_MOVE)
+ if((get_turretinfo(this.m_id)).spawnflags & TUR_FLAG_MOVE)
txt = "gfx/vehicles/turret_moving.tga";
else
txt = "gfx/vehicles/turret_stationary.tga";
}
}
- if(dist > self.maxdistance)
+ if(dist > this.maxdistance)
return;
- string spriteimage = self.netname;
- float a = self.alpha * autocvar_hud_panel_fg_alpha;
- vector rgb = spritelookupcolor(self, spriteimage, self.teamradar_color);
+ string spriteimage = this.netname;
+ float a = this.alpha * autocvar_hud_panel_fg_alpha;
+ vector rgb = spritelookupcolor(this, spriteimage, this.teamradar_color);
- if(self.maxdistance > waypointsprite_normdistance)
- a *= pow(bound(0, (self.maxdistance - dist) / (self.maxdistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent);
- else if(self.maxdistance > 0)
+ if(this.maxdistance > waypointsprite_normdistance)
+ a *= pow(bound(0, (this.maxdistance - dist) / (this.maxdistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent);
+ else if(this.maxdistance > 0)
a *= pow(bound(0, (waypointsprite_fadedistance - dist) / (waypointsprite_fadedistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent) * (1 - waypointsprite_minalpha) + waypointsprite_minalpha;
if(rgb == '0 0 0')
{
- self.teamradar_color = '1 0 1';
+ this.teamradar_color = '1 0 1';
LOG_INFOF("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage);
}
- txt = self.netname;
+ txt = this.netname;
if(autocvar_g_waypointsprite_spam && waypointsprite_count >= autocvar_g_waypointsprite_spam)
txt = _("Spam");
else
- txt = spritelookuptext(spriteimage);
+ txt = spritelookuptext(this, spriteimage);
- if(time - floor(time) > 0.5 && t == self.team)
+ if(time - floor(time) > 0.5 && t == this.team)
{
- if(self.helpme && time < self.helpme)
+ if(this.helpme && time < this.helpme)
{
a *= SPRITE_HELPME_BLINK;
txt = sprintf(_("%s under attack!"), txt);
}
else
- a *= spritelookupblinkvalue(spriteimage);
+ a *= spritelookupblinkvalue(this, spriteimage);
}
if(autocvar_g_waypointsprite_uppercase)
rgb = fixrgbexcess(rgb);
- o = project_3d_to_2d(self.origin + '0 0 64');
+ o = project_3d_to_2d(this.origin + '0 0 64');
if(o_z < 0
|| o_x < (vid_conwidth * waypointsprite_edgeoffset_left)
|| o_y < (vid_conheight * waypointsprite_edgeoffset_top)
drawhealthbar(
o,
0,
- self.health / 255,
+ this.health / 255,
'0 0 0',
'0 0 0',
0.5 * SPRITE_HEALTHBAR_WIDTH * t,
}
entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, float _explode);
-void turret_gibboom();
+void turret_gibboom(entity this);
void turret_gib_draw(entity this)
{
- Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
+ Movetype_Physics_MatchTicrate(this, autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
- self.drawmask = MASK_NORMAL;
+ this.drawmask = MASK_NORMAL;
- if(self.cnt)
+ if(this.cnt)
{
- if(time >= self.nextthink)
+ if(time >= this.nextthink)
{
- turret_gibboom();
- remove(self);
+ turret_gibboom(this);
+ remove(this);
}
}
else
{
- self.alpha = bound(0, self.nextthink - time, 1);
- if(self.alpha < ALPHA_MIN_VISIBLE)
- remove(self);
+ this.alpha = bound(0, this.nextthink - time, 1);
+ if(this.alpha < ALPHA_MIN_VISIBLE)
+ remove(this);
}
}
-void turret_gibboom()
-{SELFPARAM();
- float i;
-
- sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_ROCKET_EXPLODE, self.origin, '0 0 0', 1);
+void turret_gibboom(entity this)
+{
+ sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1);
- for (i = 1; i < 5; i = i + 1)
- turret_gibtoss(strcat("models/turrets/head-gib", ftos(i), ".md3"), self.origin + '0 0 2', self.velocity + randomvec() * 700, '0 0 0', false);
+ for (int j = 1; j < 5; j = j + 1)
+ turret_gibtoss(strcat("models/turrets/head-gib", ftos(j), ".md3"), this.origin + '0 0 2', this.velocity + randomvec() * 700, '0 0 0', false);
}
entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, float _explode)
if(trace_startsolid)
return world;
- gib = spawn();
+ gib = new(turret_gib);
setorigin(gib, _from);
_setmodel(gib, _model);
gib.colormod = _cmod;
gib.move_avelocity = prandomvec() * 32;
gib.move_time = time;
gib.damageforcescale = 1;
- gib.classname = "turret_gib";
return gib;
}
setmodel(self.tur_head, MDL_Null);
}
-void ent_turret()
-{SELFPARAM();
+NET_HANDLE(ENT_CLIENT_TURRET, bool isnew)
+{
float sf;
sf = ReadByte();
self.health = _tmp;
}
//self.enemy.health = self.health / 255;
+ return true;
}