24void 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;
76 vector dv = right * -md.y + up * md.z;
117 if (!
CS_CVAR(ent).cvar_cl_noantilag)
159 ent.dphitcontentsmask = oldsolid;
162 ent.punchangle_x = recoil * -1;
164 if (snd != SND_Null) {
185 mspeed =
vlen(mvelocity);
194 if(proj.owner ==
NULL)
195 error(
"Unowned missile");
197 dir =
dir + upDir * (pUpSpeed / pSpeed);
198 dir.z += pZSpeed / pSpeed;
205 mspercallsum = mspercallcount = 0;
216 LOG_INFO(
"avg: ",
ftos(mspercallcount / mspercallsum),
" per sec");
232 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);
233 vector headmaxs =
org +
'0.6 0 0' * targ.maxs_x +
'0 0.6 0' * targ.maxs_y +
'0 0 1' * targ.maxs_z;
238void 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)
247 bool headshot =
false;
298 it.solid = it.railgunhitsolidbackup;
302 float length =
vlen(endpoint - start);
306 if (
IS_SPEC(it) && it.enemy ==
this)
continue;
311 if(!pseudoprojectile)
312 pseudoprojectile =
new(pseudoprojectile);
319 delete(pseudoprojectile);
326 float foff = ExponentialFalloff(mindist, maxdist, halflifedist, it.railgundistance);
327 float ffs = ExponentialFalloff(mindist, maxdist, forcehalflifedist, it.railgundistance);
329 if(accuracy_isgooddamage(this, it))
330 totaldmg += bdamage * foff;
334 Damage(it, this, this, bdamage * foff, deathtype, weaponentity, it.railgunhitloc, it.railgunforce * ffs);
336 it.railgunhitloc =
'0 0 0';
337 it.railgunhitsolidbackup = SOLID_NOT;
338 it.railgunhit = false;
339 it.railgundistance = 0;
348 if(this.(weaponentity))
358 if(
vdist(hit - start, >, 16))
365 float spread,
float max_solid_penetration,
float damage,
366 float falloff_halflife,
float falloff_mindist,
367 float falloff_maxdist,
float headshot_multiplier,
368 float force,
float falloff_forcehalflife,
369 float dtype,
entity tracer_effect,
bool do_antilag)
377 float solid_penetration_fraction = 1;
378 float damage_fraction = 1;
379 float total_damage = 0;
392 bool headshot =
false;
425 bool is_weapclip =
false;
432 Damage_DamageInfo(start, damage * damage_fraction, 0, 0,
max(1, force) *
dir * damage_fraction, dtype, hit.species,
this);
440 MUTATOR_CALLHOOK(FireBullet_Hit,
this, hit, start, end, damage, this.(weaponentity));
441 damage =
M_ARGV(4,
float);
442 if(headshot_multiplier &&
Headshot(hit,
this, start, end))
444 damage *= headshot_multiplier;
449 float dealt_damage = damage * damage_fraction;
450 vector dealt_force = force *
dir * damage_fraction;
452 if (falloff_halflife || falloff_forcehalflife)
462 if (falloff_halflife)
463 dealt_damage *=
ExponentialFalloff(falloff_mindist, falloff_maxdist, falloff_halflife, dist);
465 if (falloff_forcehalflife)
466 dealt_force *=
ExponentialFalloff(falloff_mindist, falloff_maxdist, falloff_forcehalflife, dist);
469 Damage(hit,
this,
this, dealt_damage, dtype, weaponentity, start, dealt_force);
475 float added_damage =
min(damage - total_damage, damage * damage_fraction);
476 total_damage += damage * damage_fraction;
486 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)
491 if(max_solid_penetration < 0)
493 else if(hitstore.ballistics_density < -1)
495 else if(hitstore.ballistics_density < 0)
496 maxdist =
vlen(hit.maxs - hit.mins) + 1;
497 else if(hitstore.ballistics_density == 0)
498 maxdist = max_solid_penetration * solid_penetration_fraction;
500 maxdist = max_solid_penetration * solid_penetration_fraction / hitstore.ballistics_density;
512 float fraction_used_of_what_is_left = dist_taken / maxdist;
513 solid_penetration_fraction -= solid_penetration_fraction * fraction_used_of_what_is_left;
514 solid_penetration_fraction =
max(solid_penetration_fraction, 0);
539void 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)
541 fireBullet_falloff(
this, weaponentity, start,
dir, spread, max_solid_penetration, damage, 0, 0, 0, headshot_multiplier, force, 0, dtype, tracer_effect, do_antilag);
544void 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)
546 fireBullet_antilag(
this, weaponentity, start,
dir, spread, max_solid_penetration, damage, headshot_multiplier, force, dtype, tracer_effect,
true);
void accuracy_add(entity this, Weapon w, float fired, float hit, float real)
update accuracy stats
bool accuracy_isgooddamage(entity attacker, entity targ)
does this damage count towards accuracy stats?
bool accuracy_canbegooddamage(entity attacker)
if damage were to occur, would accuracy_isgooddamage be able to return true?
void tracebox_antilag(entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag)
void antilag_takeback_all(entity ignore, float lag)
void traceline_antilag(entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
void WarpZone_traceline_antilag(entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
void traceline_antilag_force(entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
float antilag_getlag(entity e)
void antilag_restore_all(entity ignore)
#define ANTILAG_LATENCY(e)
#define MUTATOR_CALLHOOK(id,...)
vector W_CalculateSpread(vector dir, float spread, int spread_style, bool must_normalize)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
int spawnflags
M: flags : WEPSPAWNFLAG_... combined.
vector get_shotvelocity(vector myvel, vector mydir, float spd, float newton_style, float mi, float ma)
float trace_hits_box(vector start, vector end, vector thmi, vector thma)
void traceline_inverted(vector v1, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity)
const float MOVE_NOMONSTERS
const float SOLID_SLIDEBOX
float trace_dphitcontents
float Q3SURFACEFLAG_NONSOLID
const float SOLID_TRIGGER
float Q3SURFACEFLAG_NODRAW
float trace_dphitq3surfaceflags
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
void Damage_DamageInfo(vector org, float coredamage, float edgedamage, float rad, vector force, int deathtype, float bloodtype, entity dmgowner)
#define DEATH_WEAPONOF(t)
vector cursor_trace_start
vector cursor_trace_endpos
#define trailparticles(e, effect, org, vel)
void W_HitPlotAnalysis(entity player, entity wep, vector screenforward, vector screenright, vector screenup)
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define IL_EACH(this, cond, body)
#define IL_CLEAR(this)
Remove all elements.
#define FOREACH_ENTITY_FLOAT(fld, match, body)
void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end, float nomonsters, entity forent, entity zone, WarpZone_trace_callback_t cb)
void WarpZone_TraceLine(vector org, vector end, float nomonsters, entity forent)
vector WarpZone_TransformVelocity(entity wz, vector v)
vector WarpZone_UnTransformOrigin(entity wz, vector v)
vector WarpZone_TransformOrigin(entity wz, vector v)
entity WarpZone_trace_firstzone
entity WarpZone_trace_transform
entity WarpZone_trace_forent
ERASEABLE float ExponentialFalloff(float mindist, float maxdist, float halflifedist, float d)
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
void W_PlayStrengthSound(entity player)
bool W_DualWielding(entity player)
const float VOL_BASEVOICE
#define sound(e, c, s, v, a)
void soundtoat(int to, entity e, vector o, int chan, string samp, float vol, float attenu, float _pitch)
ClientState CS(Client this)
vector W_CalculateProjectileVelocity(entity actor, vector pvelocity, vector mvelocity, float forceAbsolute)
bool Headshot(entity targ, entity ent, vector start, vector end)
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)
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 W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float pSpeed, float pUpSpeed, float pZSpeed, float spread, float forceAbsolute)
void fireBullet_trace_callback(vector start, vector hit, vector end)
void fireBullet_falloff(entity this,.entity weaponentity, vector start, vector dir, float spread, float max_solid_penetration, float damage, float falloff_halflife, float falloff_mindist, float falloff_maxdist, float headshot_multiplier, float force, float falloff_forcehalflife, float dtype, entity tracer_effect, bool do_antilag)
void crosshair_trace(entity pl)
void crosshair_trace_plusvisibletriggers(entity pl)
void WarpZone_crosshair_trace_plusvisibletriggers(entity pl)
void crosshair_trace_plusvisibletriggers__is_wz(entity pl, bool is_wz)
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)
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(entity pl)
int autocvar_g_projectiles_spread_style
IntrusiveList g_railgunhit
float autocvar_g_projectiles_newton_style_2_maxfactor
float autocvar_g_trueaim_minrange
float autocvar_g_ballistics_mindistance
IntrusiveList g_ctrace_changed
int autocvar_g_hitscan_spread_style
int autocvar_g_projectiles_newton_style
float autocvar_g_projectiles_newton_style_2_minfactor
float autocvar_g_ballistics_solidpenetration_exponent
bool autocvar_g_ballistics_penetrate_clips
entity fireBullet_trace_callback_eff
entity fireBullet_last_hit
#define IS_REAL_CLIENT(v)
#define FOREACH_CLIENT(cond, body)
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
const int WEP_FLAG_PENETRATEWALLS
float W_WeaponSpeedFactor(entity this)