24 void W_SetupShot_Dir_ProjectileSize_Range(
entity ent, .
entity weaponentity,
vector s_forward,
vector mi,
vector ma,
float antilag,
float recoil,
Sound snd,
float chan,
float maxdamage,
float range,
int deathtype)
28 float oldsolid = ent.dphitcontentsmask;
73 vector vecs = ((md.x > 0) ? md :
'0 0 0');
75 vector dv = right * -vecs.y + up * vecs.z;
79 if(
CS(ent).antilag_debug)
110 if (!
CS_CVAR(ent).cvar_cl_noantilag)
132 if (
CS(ent).cursor_trace_ent != ent)
133 if (
CS(ent).cursor_trace_ent.takedamage)
152 ent.dphitcontentsmask = oldsolid;
155 ent.punchangle_x = recoil * -1;
157 if (snd != SND_Null) {
178 mspeed =
vlen(mvelocity);
187 if(proj.owner ==
NULL)
188 error(
"Unowned missile");
190 dir = dir + upDir * (pUpSpeed / pSpeed);
191 dir.z += pZSpeed / pSpeed;
198 mspercallsum = mspercallcount = 0;
209 LOG_INFO(
"avg: ",
ftos(mspercallcount / mspercallsum),
" per sec");
222 if(!
IS_PLAYER(targ) ||
IS_DEAD(targ) || STAT(FROZEN, targ) || !targ.takedamage)
225 vector headmins = org +
'0.6 0 0' * targ.mins_x +
'0 0.6 0' * targ.mins_y +
'0 0 1' * (1.3 * targ.view_ofs_z - 0.3 * targ.maxs_z);
226 vector headmaxs = org +
'0.6 0 0' * targ.maxs_x +
'0 0.6 0' * targ.maxs_y +
'0 0 1' * targ.maxs_z;
228 return trace_hits_box(start, end, headmins, headmaxs);
231 void FireRailgunBullet (
entity this, .
entity weaponentity,
vector start,
vector end,
float bdamage,
bool headshot_notify,
float bforce,
float mindist,
float maxdist,
float halflifedist,
float forcehalflifedist,
int deathtype)
234 vector force = dir * bforce;
240 bool headshot =
false;
291 it.solid = it.railgunhitsolidbackup;
295 float length =
vlen(endpoint - start);
299 if (
IS_SPEC(it) && it.enemy ==
this)
continue;
302 vector beampos = start + dir *
bound(0, (it.origin - start) * dir, length);
304 if(!pseudoprojectile)
305 pseudoprojectile =
new(pseudoprojectile);
312 delete(pseudoprojectile);
319 float foff = ExponentialFalloff(mindist, maxdist, halflifedist, it.railgundistance);
320 float ffs = ExponentialFalloff(mindist, maxdist, forcehalflifedist, it.railgundistance);
322 if(accuracy_isgooddamage(this, it))
323 totaldmg += bdamage * foff;
327 Damage(it, this, this, bdamage * foff, deathtype, weaponentity, it.railgunhitloc, it.railgunforce * ffs);
329 it.railgunhitloc =
'0 0 0';
330 it.railgunhitsolidbackup = SOLID_NOT;
331 it.railgunhit = false;
332 it.railgundistance = 0;
338 Send_Notification(NOTIF_ONE,
this, MSG_ANNCE, ANNCE_HEADSHOT);
341 if(this.(weaponentity))
342 accuracy_add(
this, this.(weaponentity).m_weapon, 0,
min(bdamage, totaldmg));
351 if(
vdist(hit - start, >, 16))
357 void fireBullet_antilag(
entity this, .
entity weaponentity,
vector start,
vector dir,
float spread,
float max_solid_penetration,
float damage,
float headshot_multiplier,
float force,
float dtype,
entity tracer_effect,
bool do_antilag)
360 vector end = start + dir * max_shot_distance;
365 float solid_penetration_fraction = 1;
366 float damage_fraction = 1;
367 float total_damage = 0;
380 bool headshot =
false;
413 bool is_weapclip =
false;
420 Damage_DamageInfo(start, damage * damage_fraction, 0, 0,
max(1, force) * dir * damage_fraction, dtype, hit.species,
this);
426 MUTATOR_CALLHOOK(FireBullet_Hit,
this, hit, start, end, damage, this.(weaponentity));
427 damage =
M_ARGV(4,
float);
428 if(headshot_multiplier &&
Headshot(hit,
this, start, end))
430 damage *= headshot_multiplier;
434 Damage(hit,
this,
this, damage * damage_fraction, dtype, weaponentity, start, force * dir * damage_fraction);
439 float added_damage =
min(damage - total_damage, damage * damage_fraction);
440 total_damage += damage * damage_fraction;
441 accuracy_add(
this, this.(weaponentity).m_weapon, 0, added_damage);
450 if(start.x >
world.maxs.x || start.y >
world.maxs.y || start.z >
world.maxs.z || start.x <
world.mins.x || start.y <
world.mins.y || start.z <
world.mins.z)
455 if(max_solid_penetration < 0)
457 else if(hitstore.ballistics_density < -1)
459 else if(hitstore.ballistics_density < 0)
460 maxdist =
vlen(hit.maxs - hit.mins) + 1;
461 else if(hitstore.ballistics_density == 0)
462 maxdist = max_solid_penetration * solid_penetration_fraction;
464 maxdist = max_solid_penetration * solid_penetration_fraction / hitstore.ballistics_density;
476 float fraction_used_of_what_is_left = dist_taken / maxdist;
477 solid_penetration_fraction -= solid_penetration_fraction * fraction_used_of_what_is_left;
478 solid_penetration_fraction =
max(solid_penetration_fraction, 0);
493 Send_Notification(NOTIF_ONE,
this, MSG_ANNCE, ANNCE_HEADSHOT);
503 void fireBullet(
entity this, .
entity weaponentity,
vector start,
vector dir,
float spread,
float max_solid_penetration,
float damage,
float headshot_multiplier,
float force,
float dtype,
entity tracer_effect)
505 fireBullet_antilag(
this, weaponentity, start, dir, spread, max_solid_penetration, damage, headshot_multiplier, force, dtype, tracer_effect,
true);
529 it.solid = SOLID_BSP;
530 IL_PUSH(g_ctrace_changed, it);
const int WEP_FLAG_PENETRATEWALLS
#define IL_EACH(this, cond, body)
const float SOLID_SLIDEBOX
IntrusiveList g_ctrace_changed
#define IL_CLEAR(this)
Remove all elements.
float trace_dphitq3surfaceflags
void fireBullet_trace_callback(vector start, vector hit, vector end)
IntrusiveList g_railgunhit
vector W_CalculateSpread(vector forward, float spread, float spreadfactor, float spreadstyle)
void tracebox_antilag(entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag)
float antilag_getlag(entity e)
float trace_dphitcontents
float Q3SURFACEFLAG_NONSOLID
vector WarpZone_TransformOrigin(entity wz, vector v)
ClientState CS(Client this)
#define FOREACH_CLIENT(cond, body)
float autocvar_g_ballistics_mindistance
vector cursor_trace_start
vector cursor_trace_endpos
void crosshair_trace_plusvisibletriggers__is_wz(entity pl, bool is_wz)
float autocvar_g_projectiles_newton_style_2_maxfactor
#define DEATH_WEAPONOF(t)
int autocvar_g_projectiles_newton_style
void crosshair_trace(entity pl)
#define IS_REAL_CLIENT(v)
void WarpZone_traceline_antilag(entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
vector WarpZone_UnTransformOrigin(entity wz, vector v)
float autocvar_g_trueaim_minrange
void antilag_restore_all(entity ignore)
int spawnflags
M: flags : WEPSPAWNFLAG_...
void W_HitPlotAnalysis(entity player, entity wep, vector screenforward, vector screenright, vector screenup)
void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float pSpeed, float pUpSpeed, float pZSpeed, float spread, float forceAbsolute)
entity WarpZone_trace_forent
const float MOVE_NOMONSTERS
void traceline_antilag_force(entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
void W_PlayStrengthSound(entity player)
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
void fireBullet(entity this,.entity weaponentity, vector start, vector dir, float spread, float max_solid_penetration, float damage, float headshot_multiplier, float force, float dtype, entity tracer_effect)
entity WarpZone_trace_firstzone
bool W_DualWielding(entity player)
int autocvar_g_projectiles_spread_style
void W_SetupShot_Dir_ProjectileSize_Range(entity ent,.entity weaponentity, vector s_forward, vector mi, vector ma, float antilag, float recoil, Sound snd, float chan, float maxdamage, float range, int deathtype)
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
bool Headshot(entity targ, entity ent, vector start, vector end)
vector WarpZone_TransformVelocity(entity wz, vector v)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
entity WarpZone_trace_transform
float autocvar_g_ballistics_solidpenetration_exponent
float autocvar_g_weaponspreadfactor
void WarpZone_crosshair_trace(entity pl)
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
void accuracy_add(entity this, Weapon w, float fired, float hit)
float W_WeaponSpeedFactor(entity this)
void WarpZone_TraceLine(vector org, vector end, float nomonsters, entity forent)
float Q3SURFACEFLAG_NODRAW
bool autocvar_g_ballistics_penetrate_clips
float autocvar_g_projectiles_newton_style_2_minfactor
const float SOLID_TRIGGER
bool accuracy_isgooddamage(entity attacker, entity targ)
#define MUTATOR_CALLHOOK(id,...)
void Damage_DamageInfo(vector org, float coredamage, float edgedamage, float rad, vector force, int deathtype, float bloodtype, entity dmgowner)
#define ANTILAG_LATENCY(e)
entity fireBullet_trace_callback_eff
const float VOL_BASEVOICE
void crosshair_trace_plusvisibletriggers(entity pl)
vector W_CalculateProjectileVelocity(entity actor, vector pvelocity, vector mvelocity, float forceAbsolute)
#define sound(e, c, s, v, a)
void FireRailgunBullet(entity this,.entity weaponentity, vector start, vector end, float bdamage, bool headshot_notify, float bforce, float mindist, float maxdist, float halflifedist, float forcehalflifedist, int deathtype)
void WarpZone_crosshair_trace_plusvisibletriggers(entity pl)
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
void antilag_takeback_all(entity ignore, float lag)
bool accuracy_canbegooddamage(entity attacker)
entity fireBullet_last_hit
vector get_shotvelocity(vector myvel, vector mydir, float spd, float newton_style, float mi, float ma)
void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end, float nomonsters, entity forent, entity zone, WarpZone_trace_callback_t cb)
void traceline_antilag(entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
void fireBullet_antilag(entity this,.entity weaponentity, vector start, vector dir, float spread, float max_solid_penetration, float damage, float headshot_multiplier, float force, float dtype, entity tracer_effect, bool do_antilag)
#define FOREACH_ENTITY_FLOAT(fld, match, body)