]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Directly handle thickness of particle beam, properly check takedamage,
authorSamual Lenks <samual@xonotic.org>
Tue, 18 Feb 2014 22:24:09 +0000 (17:24 -0500)
committerSamual Lenks <samual@xonotic.org>
Tue, 18 Feb 2014 22:24:09 +0000 (17:24 -0500)
attempt handling spectators properly

qcsrc/client/particles.qc
qcsrc/common/weapons/w_arc.qc

index 18fe6726a0d71715bc947ae19a19a614ac99d2c6..7259b808cf141d039f82bce2c0ca0e936e78f3dd 100644 (file)
@@ -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;
                }
        }
 
index d6077050f88ee3a269947b623d308b6eddeac3ef..519f565d05329096da7317fd2237336e695226f6 100644 (file)
@@ -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);