From: Samual Lenks Date: Tue, 18 Feb 2014 22:24:09 +0000 (-0500) Subject: Directly handle thickness of particle beam, properly check takedamage, X-Git-Tag: xonotic-v0.8.0~152^2~90 X-Git-Url: http://de.git.xonotic.org/?a=commitdiff_plain;h=5db24e729bea324c311f9a3fb5c4f458ea000f08;p=xonotic%2Fxonotic-data.pk3dir.git Directly handle thickness of particle beam, properly check takedamage, attempt handling spectators properly --- diff --git a/qcsrc/client/particles.qc b/qcsrc/client/particles.qc index 18fe6726a..7259b808c 100644 --- a/qcsrc/client/particles.qc +++ b/qcsrc/client/particles.qc @@ -463,14 +463,17 @@ void Draw_ArcBeam() float i; float segments = 20; // todo: calculate this in a similar way to server does + float maxthickness = 8; vector thickdir = normalize(cross(beamdir, view_origin - start_pos)); vector last_origin = start_pos; - - vector last_top = start_pos + (thickdir * 0); - vector last_bottom = start_pos - (thickdir * 0); + + float lastthickness = 0; + + vector last_top = start_pos + (thickdir * lastthickness); + vector last_bottom = start_pos - (thickdir * lastthickness); for(i = 1; i <= segments; ++i) { @@ -512,14 +515,16 @@ void Draw_ArcBeam() //float falloff = 1; #endif - vector top = hitorigin + (thickdir * 4); - vector bottom = hitorigin - (thickdir * 4); + float thickness = 8; + + vector top = hitorigin + (thickdir * thickness); + vector bottom = hitorigin - (thickdir * thickness); - R_BeginPolygon("", DRAWFLAG_NORMAL); - R_PolygonVertex(top, '0 1 0', '0.5 0.5 1', 0.5); - R_PolygonVertex(last_top, '0 1 0', '0.5 0.5 1', 0.5); - R_PolygonVertex(last_bottom, '0 0 0', '0.5 0.5 1', 0.5); - R_PolygonVertex(bottom, '0 0 0', '0.5 0.5 1', 0.5); + R_BeginPolygon("particles/lgbeam", DRAWFLAG_NORMAL); + R_PolygonVertex(top, '0 0.5 0' + ('0 0.5 0' * (thickness / maxthickness)), '0.5 0.5 1', 0.5); + R_PolygonVertex(last_top, '0 0.5 0' + ('0 0.5 0' * (lastthickness / maxthickness)), '0.5 0.5 1', 0.5); + R_PolygonVertex(last_bottom, '0 0.5 0' * (1 - (lastthickness / maxthickness)), '0.5 0.5 1', 0.5); + R_PolygonVertex(bottom, '0 0.5 0' * (1 - (thickness / maxthickness)), '0.5 0.5 1', 0.5); R_EndPolygon(); // draw collision effect @@ -535,6 +540,7 @@ void Draw_ArcBeam() default: te_customflash(hitorigin, 40, 2, '0 1 0'); break; } #endif + pointparticles(particleeffectnum("electro_lightning"), hitorigin, beamdir * -1, frametime * 2); break; // we're done with drawing this frame } else @@ -542,6 +548,7 @@ void Draw_ArcBeam() last_origin = new_origin; // continue onto the next segment last_top = top; last_bottom = bottom; + lastthickness = thickness; } } diff --git a/qcsrc/common/weapons/w_arc.qc b/qcsrc/common/weapons/w_arc.qc index d6077050f..519f565d0 100644 --- a/qcsrc/common/weapons/w_arc.qc +++ b/qcsrc/common/weapons/w_arc.qc @@ -77,7 +77,7 @@ float W_Arc_Beam_Send(entity to, float sf) WriteByte(MSG_ENTITY, ENT_CLIENT_ARC_BEAM); // don't send group 1, 2, or 3 if this beam is for the local player - if(to == self.owner) { sf &= ~7; } + if((to == self.owner) || (to.enemy == self.owner)) { sf &= ~7; } WriteByte(MSG_ENTITY, sf); if(sf & 1) // starting location // not sent if beam is for owner @@ -264,7 +264,7 @@ void W_Arc_Beam_Think(void) #endif float is_player = (trace_ent.classname == "player" || trace_ent.classname == "body" || (trace_ent.flags & FL_MONSTER)); - if(trace_ent && (trace_ent.takedamage == DAMAGE_AIM) && (is_player || WEP_CVAR(arc, beam_nonplayerdamage))) + if(trace_ent && trace_ent.takedamage && (is_player || WEP_CVAR(arc, beam_nonplayerdamage))) { // calculate our own hit origin as trace_endpos tends to jump around annoyingly (to player origin?) vector hitorigin = last_origin + (new_dir * segmentdist * trace_fraction);