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)
{
//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
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
last_origin = new_origin; // continue onto the next segment
last_top = top;
last_bottom = bottom;
+ lastthickness = thickness;
}
}
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
#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);