7 // this function calculates w_shotorg and w_shotdir based on the weapon model
8 // offset, trueaim and antilag, and won't put w_shotorg inside a wall.
9 // make sure you call makevectors first (FIXME?)
10 void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector mi, vector ma, float antilag, float recoil, string snd, float chan, float maxdamage, float range)
12 float nudge = 1; // added to traceline target and subtracted from result
15 oldsolid = ent.dphitcontentsmask;
16 if(ent.weapon == WEP_RIFLE)
17 ent.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_CORPSE;
19 ent.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
21 WarpZone_traceline_antilag(world, ent.origin + ent.view_ofs, ent.origin + ent.view_ofs + s_forward * range, MOVE_NORMAL, ent, ANTILAG_LATENCY(ent));
22 // passing world, because we do NOT want it to touch dphitcontentsmask
24 WarpZone_TraceLine(ent.origin + ent.view_ofs, ent.origin + ent.view_ofs + s_forward * range, MOVE_NOMONSTERS, ent);
25 ent.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
31 w_shotend = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); // warpzone support
36 // un-adjust trueaim if shotend is too close
37 if(vlen(w_shotend - (ent.origin + ent.view_ofs)) < autocvar_g_trueaim_minrange)
38 w_shotend = ent.origin + ent.view_ofs + s_forward * autocvar_g_trueaim_minrange;
41 if(accuracy_canbegooddamage(ent))
42 accuracy_add(ent, ent.weapon, maxdamage, 0);
44 W_HitPlotAnalysis(ent, v_forward, v_right, v_up);
46 if(ent.weaponentity.movedir_x > 0)
47 vecs = ent.weaponentity.movedir;
51 dv = v_right * -vecs_y + v_up * vecs_z;
52 w_shotorg = ent.origin + ent.view_ofs + dv;
54 // now move the shotorg forward as much as requested if possible
58 tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + v_forward * (vecs_x + nudge), MOVE_NORMAL, ent, ent.antilag_debug);
60 tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + v_forward * (vecs_x + nudge), MOVE_NORMAL, ent, ANTILAG_LATENCY(ent));
63 tracebox(w_shotorg, mi, ma, w_shotorg + v_forward * (vecs_x + nudge), MOVE_NORMAL, ent);
64 w_shotorg = trace_endpos - v_forward * nudge;
65 // calculate the shotdir from the chosen shotorg
66 w_shotdir = normalize(w_shotend - w_shotorg);
69 if (!ent.cvar_cl_noantilag)
71 if (autocvar_g_antilag == 1) // switch to "ghost" if not hitting original
73 traceline(w_shotorg, w_shotorg + w_shotdir * range, MOVE_NORMAL, ent);
74 if (!trace_ent.takedamage)
76 traceline_antilag_force (ent, w_shotorg, w_shotorg + w_shotdir * range, MOVE_NORMAL, ent, ANTILAG_LATENCY(ent));
77 if (trace_ent.takedamage && IS_PLAYER(trace_ent))
81 traceline(w_shotorg, e.origin, MOVE_NORMAL, ent);
83 w_shotdir = normalize(trace_ent.origin - w_shotorg);
87 else if(autocvar_g_antilag == 3) // client side hitscan
89 // this part MUST use prydon cursor
90 if (ent.cursor_trace_ent) // client was aiming at someone
91 if (ent.cursor_trace_ent != ent) // just to make sure
92 if (ent.cursor_trace_ent.takedamage) // and that person is killable
93 if (IS_PLAYER(ent.cursor_trace_ent)) // and actually a player
95 // verify that the shot would miss without antilag
96 // (avoids an issue where guns would always shoot at their origin)
97 traceline(w_shotorg, w_shotorg + w_shotdir * range, MOVE_NORMAL, ent);
98 if (!trace_ent.takedamage)
100 // verify that the shot would hit if altered
101 traceline(w_shotorg, ent.cursor_trace_ent.origin, MOVE_NORMAL, ent);
102 if (trace_ent == ent.cursor_trace_ent)
103 w_shotdir = normalize(ent.cursor_trace_ent.origin - w_shotorg);
105 print("antilag fail\n");
111 ent.dphitcontentsmask = oldsolid; // restore solid type (generally SOLID_SLIDEBOX)
114 ent.punchangle_x = recoil * -1;
118 sound (ent, chan, snd, VOL_BASE, ATTN_NORM);
119 W_PlayStrengthSound(ent);
122 // nudge w_shotend so a trace to w_shotend hits
123 w_shotend = w_shotend + normalize(w_shotend - w_shotorg) * nudge;
126 #define W_SetupShot_Dir_ProjectileSize(ent,s_forward,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize_Range(ent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, MAX_SHOT_DISTANCE)
127 #define W_SetupShot_ProjectileSize(ent,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize(ent, v_forward, mi, ma, antilag, recoil, snd, chan, maxdamage)
128 #define W_SetupShot_Dir(ent,s_forward,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize(ent, s_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage)
129 #define W_SetupShot(ent,antilag,recoil,snd,chan,maxdamage) W_SetupShot_ProjectileSize(ent, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage)
130 #define W_SetupShot_Range(ent,antilag,recoil,snd,chan,maxdamage,range) W_SetupShot_Dir_ProjectileSize_Range(ent, v_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, range)
132 vector W_CalculateProjectileVelocity(vector pvelocity, vector mvelocity, float forceAbsolute)
138 mvelocity = mvelocity * g_weaponspeedfactor;
140 mdirection = normalize(mvelocity);
141 mspeed = vlen(mvelocity);
143 outvelocity = get_shotvelocity(pvelocity, mdirection, mspeed, (forceAbsolute ? 0 : autocvar_g_projectiles_newton_style), autocvar_g_projectiles_newton_style_2_minfactor, autocvar_g_projectiles_newton_style_2_maxfactor);
150 float mspercallsstyle;
151 float mspercallcount;
153 void W_SetupProjectileVelocityEx(entity missile, vector dir, vector upDir, float pSpeed, float pUpSpeed, float pZSpeed, float spread, float forceAbsolute)
155 if(missile.owner == world)
156 error("Unowned missile");
158 dir = dir + upDir * (pUpSpeed / pSpeed);
159 dir_z += pZSpeed / pSpeed;
161 dir = normalize(dir);
164 if(autocvar_g_projectiles_spread_style != mspercallsstyle)
166 mspercallsum = mspercallcount = 0;
167 mspercallsstyle = autocvar_g_projectiles_spread_style;
169 mspercallsum -= gettime(GETTIME_HIRES);
171 dir = W_CalculateSpread(dir, spread, g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
173 mspercallsum += gettime(GETTIME_HIRES);
175 print("avg: ", ftos(mspercallcount / mspercallsum), " per sec\n");
178 missile.velocity = W_CalculateProjectileVelocity(missile.owner.velocity, pSpeed * dir, forceAbsolute);
181 void W_SetupProjectileVelocity(entity missile, float pSpeed, float spread)
183 W_SetupProjectileVelocityEx(missile, w_shotdir, v_up, pSpeed, 0, 0, spread, FALSE);
186 #define W_SETUPPROJECTILEVELOCITY_UP(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), cvar(#s "_speed_up"), cvar(#s "_speed_z"), cvar(#s "_spread"), FALSE)
187 #define W_SETUPPROJECTILEVELOCITY(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), 0, 0, cvar(#s "_spread"), FALSE)
190 // ====================
191 // Ballistics Tracing
192 // ====================
194 .float railgundistance;
195 .vector railgunforce;
196 void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, float mindist, float maxdist, float halflifedist, float forcehalflifedist, float deathtype)
198 vector hitloc, force, endpoint, dir;
200 float endq3surfaceflags;
207 entity pseudoprojectile;
210 pseudoprojectile = world;
212 railgun_start = start;
215 dir = normalize(end - start);
216 length = vlen(end - start);
217 force = dir * bforce;
219 // go a little bit into the wall because we need to hit this wall later
224 // trace multiple times until we hit a wall, each obstacle will be made
225 // non-solid so we can hit the next, while doing this we spawn effects and
226 // note down which entities were hit so we can damage them later
230 if(self.antilag_debug)
231 WarpZone_traceline_antilag (self, start, end, FALSE, o, self.antilag_debug);
233 WarpZone_traceline_antilag (self, start, end, FALSE, o, ANTILAG_LATENCY(self));
234 if(o && WarpZone_trace_firstzone)
240 if(trace_ent.solid == SOLID_BSP || trace_ent.solid == SOLID_SLIDEBOX)
241 Damage_DamageInfo(trace_endpos, bdamage, 0, 0, force, deathtype, trace_ent.species, self);
243 // if it is world we can't hurt it so stop now
244 if (trace_ent == world || trace_fraction == 1)
247 // make the entity non-solid so we can hit the next one
248 trace_ent.railgunhit = TRUE;
249 trace_ent.railgunhitloc = end;
250 trace_ent.railgunhitsolidbackup = trace_ent.solid;
251 trace_ent.railgundistance = vlen(WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos) - start);
252 trace_ent.railgunforce = WarpZone_TransformVelocity(WarpZone_trace_transform, force);
254 // stop if this is a wall
255 if (trace_ent.solid == SOLID_BSP)
258 // make the entity non-solid
259 trace_ent.solid = SOLID_NOT;
262 endpoint = trace_endpos;
264 endq3surfaceflags = trace_dphitq3surfaceflags;
266 // find all the entities the railgun hit and restore their solid state
267 ent = findfloat(world, railgunhit, TRUE);
270 // restore their solid type
271 ent.solid = ent.railgunhitsolidbackup;
272 ent = findfloat(ent, railgunhit, TRUE);
275 // spawn a temporary explosion entity for RadiusDamage calls
276 //explosion = spawn();
278 // Find all non-hit players the beam passed close by
279 if(deathtype == WEP_MINSTANEX || deathtype == WEP_NEX)
281 FOR_EACH_REALCLIENT(msg_entity) if(msg_entity != self) if(!msg_entity.railgunhit) if not(IS_SPEC(msg_entity) && msg_entity.enemy == self) // we use realclient, so spectators can hear the whoosh too
283 // nearest point on the beam
284 beampos = start + dir * bound(0, (msg_entity.origin - start) * dir, length);
286 f = bound(0, 1 - vlen(beampos - msg_entity.origin) / 512, 1);
290 snd = strcat("weapons/nexwhoosh", ftos(floor(random() * 3) + 1), ".wav");
292 if(!pseudoprojectile)
293 pseudoprojectile = spawn(); // we need this so the sound uses the "entchannel4" volume
294 soundtoat(MSG_ONE, pseudoprojectile, beampos, CH_SHOTS, snd, VOL_BASE * f, ATTN_NONE);
298 remove(pseudoprojectile);
301 // find all the entities the railgun hit and hurt them
302 ent = findfloat(world, railgunhit, TRUE);
305 // get the details we need to call the damage function
306 hitloc = ent.railgunhitloc;
308 f = ExponentialFalloff(mindist, maxdist, halflifedist, ent.railgundistance);
309 ffs = ExponentialFalloff(mindist, maxdist, forcehalflifedist, ent.railgundistance);
311 if(accuracy_isgooddamage(self.realowner, ent))
312 totaldmg += bdamage * f;
316 Damage (ent, self, self, bdamage * f, deathtype, hitloc, ent.railgunforce * ffs);
318 // create a small explosion to throw gibs around (if applicable)
319 //setorigin (explosion, hitloc);
320 //RadiusDamage (explosion, self, 10, 0, 50, world, world, 300, deathtype);
322 ent.railgunhitloc = '0 0 0';
323 ent.railgunhitsolidbackup = SOLID_NOT;
324 ent.railgunhit = FALSE;
325 ent.railgundistance = 0;
327 // advance to the next entity
328 ent = findfloat(ent, railgunhit, TRUE);
331 // calculate hits and fired shots for hitscan
332 accuracy_add(self, self.weapon, 0, min(bdamage, totaldmg));
334 trace_endpos = endpoint;
336 trace_dphitq3surfaceflags = endq3surfaceflags;
343 void W_BallisticBullet_Hit (void)
347 f = pow(bound(0, vlen(self.velocity) / vlen(self.oldvelocity), 1), 2); // energy multiplier
348 q = 1 + self.dmg_edge / self.dmg;
350 if(other.solid == SOLID_BSP || other.solid == SOLID_SLIDEBOX)
351 Damage_DamageInfo(self.origin, self.dmg * f, 0, 0, max(1, self.dmg_force) * normalize(self.velocity) * f, self.projectiledeathtype, other.species, self);
353 if(other && other != self.enemy)
355 endzcurveparticles();
358 railgun_start = self.origin - 2 * frametime * self.velocity;
359 railgun_end = self.origin + 2 * frametime * self.velocity;
360 g = accuracy_isgooddamage(self.realowner, other);
361 Damage(other, self, self.realowner, self.dmg * f, self.projectiledeathtype, self.origin, self.dmg_force * normalize(self.velocity) * f);
363 /*if(yoda && (time > (self.last_yoda + 5)))
365 Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
366 self.last_yoda = time;
369 // calculate hits for ballistic weapons
372 // do not exceed 100%
373 q = min(self.dmg * q, self.dmg_total + f * self.dmg) - self.dmg_total;
374 self.dmg_total += f * self.dmg;
375 accuracy_add(self.realowner, self.realowner.weapon, 0, q);
379 self.enemy = other; // don't hit the same player twice with the same bullet
382 .void(void) W_BallisticBullet_LeaveSolid_think_save;
383 .float W_BallisticBullet_LeaveSolid_nextthink_save;
384 .vector W_BallisticBullet_LeaveSolid_origin;
385 .vector W_BallisticBullet_LeaveSolid_velocity;
387 void W_BallisticBullet_LeaveSolid_think()
389 setorigin(self, self.W_BallisticBullet_LeaveSolid_origin);
390 self.velocity = self.W_BallisticBullet_LeaveSolid_velocity;
392 self.think = self.W_BallisticBullet_LeaveSolid_think_save;
393 self.nextthink = max(time, self.W_BallisticBullet_LeaveSolid_nextthink_save);
394 self.W_BallisticBullet_LeaveSolid_think_save = func_null;
396 self.flags &~= FL_ONGROUND;
398 if(self.enemy.solid == SOLID_BSP)
401 f = pow(bound(0, vlen(self.velocity) / vlen(self.oldvelocity), 1), 2); // energy multiplier
402 Damage_DamageInfo(self.origin, 0, 0, 0, max(1, self.dmg_force) * normalize(self.velocity) * -f, self.projectiledeathtype, 0, self);
405 UpdateCSQCProjectile(self);
408 float W_BallisticBullet_LeaveSolid(float eff)
410 // move the entity along its velocity until it's out of solid, then let it resume
411 vector vel = self.velocity;
412 float dt, dst, velfactor, v0, vs;
415 float constant = self.dmg_radius * (other.ballistics_density ? other.ballistics_density : 1);
417 // outside the world? forget it
418 if(self.origin_x > world.maxs_x || self.origin_y > world.maxs_y || self.origin_z > world.maxs_z || self.origin_x < world.mins_x || self.origin_y < world.mins_y || self.origin_z < world.mins_z)
421 // special case for zero density and zero bullet constant:
423 if(self.dmg_radius == 0)
425 if(other.ballistics_density < 0)
426 constant = 0; // infinite travel distance
428 return 0; // no penetration
432 if(other.ballistics_density < 0)
433 constant = 0; // infinite travel distance
434 else if(other.ballistics_density == 0)
435 constant = self.dmg_radius;
437 constant = self.dmg_radius * other.ballistics_density;
440 // E(s) = E0 - constant * s, constant = area of bullet circle * material constant / mass
443 E0_m = 0.5 * v0 * v0;
447 maxdist = E0_m / constant;
448 // maxdist = 0.5 * v0 * v0 / constant
449 // dprint("max dist = ", ftos(maxdist), "\n");
451 if(maxdist <= autocvar_g_ballistics_mindistance)
456 maxdist = vlen(other.maxs - other.mins) + 1; // any distance, as long as we leave the entity
459 traceline_inverted (self.origin, self.origin + normalize(vel) * maxdist, MOVE_NORMAL, self, TRUE);
460 if(trace_fraction == 1) // 1: we never got out of solid
463 self.W_BallisticBullet_LeaveSolid_origin = trace_endpos;
465 dst = max(autocvar_g_ballistics_mindistance, vlen(trace_endpos - self.origin));
466 // E(s) = E0 - constant * s, constant = area of bullet circle * material constant / mass
467 Es_m = E0_m - constant * dst;
470 // roundoff errors got us
476 dt = dst / (0.5 * (v0 + vs));
477 // this is not correct, but the differential equations have no analytic
478 // solution - and these times are very small anyway
479 //print("dt = ", ftos(dt), "\n");
481 self.W_BallisticBullet_LeaveSolid_think_save = self.think;
482 self.W_BallisticBullet_LeaveSolid_nextthink_save = self.nextthink;
483 self.think = W_BallisticBullet_LeaveSolid_think;
484 self.nextthink = time + dt;
486 vel = vel * velfactor;
488 self.velocity = '0 0 0';
489 self.flags |= FL_ONGROUND; // prevent moving
490 self.W_BallisticBullet_LeaveSolid_velocity = vel;
493 if(vlen(trace_endpos - self.origin) > 4)
495 endzcurveparticles();
496 trailparticles(self, eff, self.origin, trace_endpos);
502 void W_BallisticBullet_Touch (void)
506 if(self.think == W_BallisticBullet_LeaveSolid_think) // skip this!
510 W_BallisticBullet_Hit ();
512 if(self.dmg_radius < 0) // these NEVER penetrate solid
518 // if we hit "weapclip", bail out
520 // rationale of this check:
522 // any shader that is solid, nodraw AND trans is meant to clip weapon
523 // shots and players, but has no other effect!
525 // if it is not trans, it is caulk and should not have this side effect
528 // common/weapclip (intended)
529 // common/noimpact (is supposed to eat projectiles, but is erased farther above)
530 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
531 if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID)
532 if not(trace_dphitcontents & DPCONTENTS_OPAQUE)
539 if(!W_BallisticBullet_LeaveSolid(-1))
545 self.projectiledeathtype |= HITTYPE_BOUNCE;
548 void endFireBallisticBullet()
550 endzcurveparticles();
553 entity fireBallisticBullet_trace_callback_ent;
554 float fireBallisticBullet_trace_callback_eff;
555 void fireBallisticBullet_trace_callback(vector start, vector hit, vector end)
557 if(vlen(trace_endpos - fireBallisticBullet_trace_callback_ent.origin) > 16)
558 zcurveparticles_from_tracetoss(fireBallisticBullet_trace_callback_eff, fireBallisticBullet_trace_callback_ent.origin, trace_endpos, fireBallisticBullet_trace_callback_ent.velocity);
559 WarpZone_trace_forent = world;
563 void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, float lifetime, float damage, float force, float dtype, float tracereffects, float gravityfactor, float bulletconstant)
565 float lag, dt, savetime; //, density;
569 antilagging = (autocvar_g_antilag_bullets && (pSpeed >= autocvar_g_antilag_bullets));
573 proj.classname = "bullet";
574 proj.owner = proj.realowner = self;
575 PROJECTILE_MAKETRIGGER(proj);
576 if(gravityfactor > 0)
578 proj.movetype = MOVETYPE_TOSS;
579 proj.gravity = gravityfactor;
582 proj.movetype = MOVETYPE_FLY;
583 proj.think = SUB_Remove;
584 proj.nextthink = time + lifetime; // min(pLifetime, vlen(world.maxs - world.mins) / pSpeed);
585 W_SetupProjectileVelocityEx(proj, dir, v_up, pSpeed, 0, 0, spread, antilagging);
586 proj.angles = vectoangles(proj.velocity);
587 if(bulletconstant > 0)
588 proj.dmg_radius = autocvar_g_ballistics_materialconstant / bulletconstant;
589 else if(bulletconstant == 0)
592 proj.dmg_radius = -1;
593 // so: bulletconstant = bullet mass / area of bullet circle
594 setorigin(proj, start);
595 proj.flags = FL_PROJECTILE;
597 proj.touch = W_BallisticBullet_Touch;
599 proj.dmg_force = force;
600 proj.projectiledeathtype = dtype;
602 proj.oldvelocity = proj.velocity;
604 other = proj; MUTATOR_CALLHOOK(EditProjectile);
610 if(tracereffects & EF_RED)
611 eff = particleeffectnum("tr_rifle");
612 else if(tracereffects & EF_BLUE)
613 eff = particleeffectnum("tr_rifle_weak");
615 eff = particleeffectnum("tr_bullet");
617 // NOTE: this may severely throw off weapon balance
618 lag = ANTILAG_LATENCY(self);
621 if not(IS_REAL_CLIENT(self))
623 if(autocvar_g_antilag == 0 || self.cvar_cl_noantilag)
624 lag = 0; // only do hitscan, but no antilag
629 antilag_takeback(pl, time - lag);
634 savetime = frametime;
639 // DP tracetoss is stupid and always traces in 0.05s
640 // ticks. This makes it trace in 0.05*0.125s ticks
646 self.velocity = self.velocity * 0.125;
647 self.gravity *= 0.125 * 0.125;
649 fireBallisticBullet_trace_callback_ent = self;
650 fireBallisticBullet_trace_callback_eff = eff;
651 WarpZone_TraceToss_ThroughZone(self, self.owner, world, fireBallisticBullet_trace_callback);
655 if(trace_fraction == 1)
657 // won't hit anything anytime soon (DP's
658 // tracetoss does 200 tics of, here,
659 // 0.05*0.125s, that is, 1.25 seconds
662 dt = WarpZone_tracetoss_time * 0.125; // this is only approximate!
663 setorigin(self, trace_endpos);
664 self.velocity = WarpZone_tracetoss_velocity * (1 / 0.125);
666 if(!SUB_OwnerCheck())
668 if(SUB_NoImpactCheck())
672 W_BallisticBullet_Hit();
675 if(proj.dmg_radius < 0) // these NEVER penetrate solid
678 // if we hit "weapclip", bail out
680 // rationale of this check:
682 // any shader that is solid, nodraw AND trans is meant to clip weapon
683 // shots and players, but has no other effect!
685 // if it is not trans, it is caulk and should not have this side effect
688 // common/weapclip (intended)
689 // common/noimpact (is supposed to eat projectiles, but is erased farther above)
690 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
691 if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID)
692 if not(trace_dphitcontents & DPCONTENTS_OPAQUE)
696 if(!W_BallisticBullet_LeaveSolid((other && (other.solid != SOLID_BSP)) ? eff : -1))
699 W_BallisticBullet_LeaveSolid_think();
701 self.projectiledeathtype |= HITTYPE_BOUNCE;
703 frametime = savetime;
716 if(tracereffects & EF_RED)
717 CSQCProjectile(proj, TRUE, PROJECTILE_BULLET_GLOWING_TRACER, TRUE);
718 else if(tracereffects & EF_BLUE)
719 CSQCProjectile(proj, TRUE, PROJECTILE_BULLET_GLOWING, TRUE);
721 CSQCProjectile(proj, TRUE, PROJECTILE_BULLET, TRUE);
724 void fireBullet (vector start, vector dir, float spread, float damage, float force, float dtype, float tracer)
728 dir = normalize(dir + randomvec() * spread);
729 end = start + dir * MAX_SHOT_DISTANCE;
730 if(self.antilag_debug)
731 traceline_antilag (self, start, end, FALSE, self, self.antilag_debug);
733 traceline_antilag (self, start, end, FALSE, self, ANTILAG_LATENCY(self));
737 if (pointcontents (trace_endpos) != CONTENT_SKY)
739 if not (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
740 Damage_DamageInfo(trace_endpos, damage, 0, 0, dir * max(1, force), dtype, trace_ent.species, self);
742 Damage (trace_ent, self, self, damage, dtype, trace_endpos, dir * force);