X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fturrets%2Fcl_turrets.qc;h=fb27cd12137fef8e36cd30dfb09f133077c3cf6c;hp=c21e327d4470655336e6033d1823587c65f6e458;hb=f8fe0e4aa8dad544f243ae997dfeb9cdccd55ee2;hpb=34e7f534e2015466228eb3a78c9857741b736dca diff --git a/qcsrc/common/turrets/cl_turrets.qc b/qcsrc/common/turrets/cl_turrets.qc index c21e327d44..fb27cd1213 100644 --- a/qcsrc/common/turrets/cl_turrets.qc +++ b/qcsrc/common/turrets/cl_turrets.qc @@ -37,7 +37,7 @@ void turret_draw(entity this) this.tur_head.angles += dt * this.tur_head.avelocity; - if (this.health < 127) + if (GetResourceAmount(this, RESOURCE_HEALTH) < 127) { dt = random(); @@ -45,11 +45,11 @@ void turret_draw(entity this) te_spark(this.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16); } - if(this.health < 85) + if(GetResourceAmount(this, RESOURCE_HEALTH) < 85) if(dt < 0.01) pointparticles(EFFECT_SMOKE_LARGE, (this.origin + (randomvec() * 80)), '0 0 0', 1); - if(this.health < 32) + if(GetResourceAmount(this, RESOURCE_HEALTH) < 32) if(dt < 0.015) pointparticles(EFFECT_SMOKE_SMALL, (this.origin + (randomvec() * 80)), '0 0 0', 1); @@ -105,21 +105,17 @@ void turret_draw2d(entity this) if(this.maxdistance > waypointsprite_normdistance) - a *= pow(bound(0, (this.maxdistance - dist) / (this.maxdistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent); + a *= (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; + a *= (bound(0, (waypointsprite_fadedistance - dist) / (waypointsprite_fadedistance - waypointsprite_normdistance), 1) ** waypointsprite_distancealphaexponent) * (1 - waypointsprite_minalpha) + waypointsprite_minalpha; if(rgb == '0 0 0') { this.teamradar_color = '1 0 1'; - LOG_INFOF("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage); + LOG_INFOF("WARNING: sprite of name %s has no color, using pink so you notice it", spriteimage); } - txt = this.netname; - if(autocvar_g_waypointsprite_spam && waypointsprite_count >= autocvar_g_waypointsprite_spam) - txt = _("Spam"); - else - txt = spritelookuptext(this, spriteimage); + txt = spritelookuptext(this, spriteimage); if(time - floor(time) > 0.5 && t == this.team) { @@ -161,7 +157,7 @@ void turret_draw2d(entity this) (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o_x, (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)) - o_y); - float crosshairdistance = sqrt( pow(o.x - vid_conwidth/2, 2) + pow(o.y - vid_conheight/2, 2) ); + float crosshairdistance = sqrt( ((o.x - vid_conwidth/2) ** 2) + ((o.y - vid_conheight/2) ** 2) ); t = waypointsprite_scale; a *= waypointsprite_alpha; @@ -180,11 +176,11 @@ void turret_draw2d(entity this) } o = drawspritearrow(o, M_PI, rgb, a, SPRITE_ARROW_SCALE * t); - o = drawspritetext(o, M_PI, (SPRITE_HEALTHBAR_WIDTH + 2 * SPRITE_HEALTHBAR_BORDER) * t, rgb, a, waypointsprite_fontsize * '1 1 0', txt); + o = drawsprite_TextOrIcon(true, o, M_PI, (SPRITE_HEALTHBAR_WIDTH + 2 * SPRITE_HEALTHBAR_BORDER) * t, rgb, a, waypointsprite_fontsize * '1 1 0', txt); drawhealthbar( o, 0, - this.health / 255, + GetResourceAmount(this, RESOURCE_HEALTH) / 255, '0 0 0', '0 0 0', 0.5 * SPRITE_HEALTHBAR_WIDTH * t, @@ -212,7 +208,7 @@ void turret_construct(entity this, bool isnew) setorigin(this, this.origin); _setmodel(this, tur.model); _setmodel(this.tur_head, tur.head_model); - setsize(this, tur.mins, tur.maxs); + setsize(this, tur.m_mins, tur.m_maxs); setsize(this.tur_head, '0 0 0', '0 0 0'); if(this.m_id == TUR_EWHEEL.m_id) @@ -225,7 +221,7 @@ void turret_construct(entity this, bool isnew) set_movetype(this.tur_head, MOVETYPE_NOCLIP); set_movetype(this, MOVETYPE_NOCLIP); this.tur_head.angles = this.angles; - this.health = 255; + SetResourceAmountExplicit(this, RESOURCE_HEALTH, 255); this.solid = SOLID_BBOX; this.tur_head.solid = SOLID_NOT; set_movetype(this, MOVETYPE_NOCLIP); @@ -365,9 +361,7 @@ NET_HANDLE(ENT_CLIENT_TURRET, bool isnew) { this.m_id = ReadByte(); - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); this.angles_x = ReadAngle(); @@ -401,14 +395,10 @@ NET_HANDLE(ENT_CLIENT_TURRET, bool isnew) if(sf & TNSF_MOVE) { - this.origin_x = ReadShort(); - this.origin_y = ReadShort(); - this.origin_z = ReadShort(); + this.origin = ReadVector(); setorigin(this, this.origin); - this.velocity_x = ReadShort(); - this.velocity_y = ReadShort(); - this.velocity_z = ReadShort(); + this.velocity = ReadVector(); this.angles_y = ReadShort(); @@ -432,13 +422,13 @@ NET_HANDLE(ENT_CLIENT_TURRET, bool isnew) } _tmp = ReadByte(); - if(_tmp == 0 && this.health != 0) + float myhp = GetResourceAmount(this, RESOURCE_HEALTH); + if(_tmp == 0 && myhp != 0) turret_die(this); - else if(this.health && this.health != _tmp) + else if(myhp && myhp != _tmp) this.helpme = servertime + 10; - this.health = _tmp; + SetResourceAmountExplicit(this, RESOURCE_HEALTH, _tmp); } - //this.enemy.health = this.health / 255; return true; }