Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
tracing.qh
Go to the documentation of this file.
1#pragma once
2
4#include <common/stats.qh>
5
18
22
23// this function calculates w_shotorg and w_shotdir based on the weapon model
24// offset, trueaim and antilag, and won't put w_shotorg inside a wall.
25// make sure you call makevectors first (FIXME?)
26void 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);
27
28#define W_SetupShot_Dir_ProjectileSize(ent, wepent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype) \
29 W_SetupShot_Dir_ProjectileSize_Range(ent, wepent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, max_shot_distance, deathtype)
30#define W_SetupShot_ProjectileSize(ent, wepent, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype) \
31 W_SetupShot_Dir_ProjectileSize(ent, wepent, v_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype)
32#define W_SetupShot_Dir(ent, wepent, s_forward, antilag, recoil, snd, chan, maxdamage, deathtype) \
33 W_SetupShot_Dir_ProjectileSize(ent, wepent, s_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, deathtype)
34#define W_SetupShot(ent, wepent, antilag, recoil, snd, chan, maxdamage, deathtype) \
35 W_SetupShot_ProjectileSize(ent, wepent, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, deathtype)
36#define W_SetupShot_Range(ent, wepent, antilag, recoil, snd, chan, maxdamage, range, deathtype) \
37 W_SetupShot_Dir_ProjectileSize_Range(ent, wepent, v_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, range, deathtype)
38
39vector W_CalculateProjectileVelocity(entity actor, vector pvelocity, vector mvelocity, float forceAbsolute);
40
41#if 0
42float mspercallsum;
43float mspercallsstyle;
44float mspercallcount;
45#endif
46
47void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float pSpeed, float pUpSpeed, float pZSpeed, float spread, float forceAbsolute);
48
49#define W_SetupProjVelocity_Basic(ent,pspeed,pspread) \
50 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, pspeed, 0, 0, pspread, false)
51
52#define W_SetupProjVelocity_UP_PRE(ent, wep, prefix) \
53 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR(wep, prefix##speed), WEP_CVAR(wep, prefix##speed_up), WEP_CVAR(wep, prefix##speed_z), WEP_CVAR(wep, prefix##spread), false)
54#define W_SetupProjVelocity_UP_PRI(ent, wep) \
55 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_PRI(wep, speed), WEP_CVAR_PRI(wep, speed_up), WEP_CVAR_PRI(wep, speed_z), WEP_CVAR_PRI(wep, spread), false)
56#define W_SetupProjVelocity_UP_SEC(ent, wep) \
57 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_SEC(wep, speed), WEP_CVAR_SEC(wep, speed_up), WEP_CVAR_SEC(wep, speed_z), WEP_CVAR_SEC(wep, spread), false)
58
59#define W_SetupProjVelocity_UP_BOTH(ent, wep, isprimary) \
60 if(isprimary) { W_SetupProjVelocity_UP_PRI(ent, wep); } \
61 else { W_SetupProjVelocity_UP_SEC(ent, wep); }
62
63#define W_SetupProjVelocity_PRE(ent, wep, prefix) \
64 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR(wep, prefix##speed), 0, 0, WEP_CVAR(wep, prefix##spread), false)
65#define W_SetupProjVelocity_PRI(ent, wep) \
66 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_PRI(wep, speed), 0, 0, WEP_CVAR_PRI(wep, spread), false)
67#define W_SetupProjVelocity_SEC(ent, wep) \
68 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_SEC(wep, speed), 0, 0, WEP_CVAR_SEC(wep, spread), false)
69
70#define W_SetupProjVelocity_BOTH(ent, wep, isprimary) \
71 if(isprimary) { W_SetupProjVelocity_PRI(ent, wep); } \
72 else { W_SetupProjVelocity_SEC(ent, wep); }
73
74// ====================
75// Ballistics Tracing
76// ====================
77
79
80// for railgun damage (hitting multiple enemies)
84
87
90void 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);
91
94void fireBullet_trace_callback(vector start, vector hit, vector end);
95void 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);
96void 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);
97
98void crosshair_trace(entity pl);
99
103
104void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
105
107
108void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
109
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
limitations: NULL cannot be present elements can only be present once a maximum of IL_MAX lists can e...
#define IL_NEW()
vector
Definition self.qh:92
int dir
Definition impulse.qc:89
#define STATIC_INIT(func)
during worldspawn
Definition static.qh:32
vector W_CalculateProjectileVelocity(entity actor, vector pvelocity, vector mvelocity, float forceAbsolute)
Definition tracing.qc:176
int autocvar_g_projectiles_spread_style
Definition tracing.qh:14
IntrusiveList g_railgunhit
Definition tracing.qh:85
float autocvar_g_projectiles_newton_style_2_maxfactor
Definition tracing.qh:12
float autocvar_g_trueaim_minrange
Definition tracing.qh:17
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)
Definition tracing.qc:544
bool autocvar_g_norecoil
Definition tracing.qh:16
float autocvar_g_ballistics_mindistance
Definition tracing.qh:8
vector w_shotdir
Definition tracing.qh:20
vector railgunforce
Definition tracing.qh:89
float railgunhitsolidbackup
Definition tracing.qh:82
IntrusiveList g_ctrace_changed
Definition tracing.qh:110
float ballistics_density
Definition tracing.qh:78
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)
Definition tracing.qc:24
void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float pSpeed, float pUpSpeed, float pZSpeed, float spread, float forceAbsolute)
Definition tracing.qc:192
float railgundistance
Definition tracing.qh:88
vector railgunhitloc
Definition tracing.qh:83
void traceline_antilag(entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
Definition antilag.qc:203
void fireBullet_trace_callback(vector start, vector hit, vector end)
Definition tracing.qc:356
int autocvar_g_hitscan_spread_style
Definition tracing.qh:15
void crosshair_trace(entity pl)
Definition tracing.qc:549
int autocvar_g_projectiles_newton_style
Definition tracing.qh:11
float autocvar_g_projectiles_newton_style_2_minfactor
Definition tracing.qh:13
void crosshair_trace_plusvisibletriggers(entity pl)
Definition tracing.qc:554
void WarpZone_crosshair_trace_plusvisibletriggers(entity pl)
Definition tracing.qc:559
void crosshair_trace_plusvisibletriggers__is_wz(entity pl, bool is_wz)
Definition tracing.qc:564
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)
Definition tracing.qc:539
float autocvar_g_ballistics_solidpenetration_exponent
Definition tracing.qh:10
void WarpZone_traceline_antilag(entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
Definition antilag.qc:221
bool autocvar_g_ballistics_penetrate_clips
Definition tracing.qh:9
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)
Definition tracing.qc:238
float autocvar_g_ballistics_density_corpse
Definition tracing.qh:6
vector w_shotorg
Definition tracing.qh:19
entity fireBullet_trace_callback_eff
Definition tracing.qh:92
bool railgunhit
Definition tracing.qh:81
void WarpZone_crosshair_trace(entity pl)
Definition tracing.qc:585
float autocvar_g_ballistics_density_player
Definition tracing.qh:7
entity fireBullet_last_hit
Definition tracing.qh:93
vector w_shotend
Definition tracing.qh:21