3 #include <common/weapons/_all.qh>
4 #include <common/stats.qh>
6 float autocvar_g_ballistics_density_corpse;
7 float autocvar_g_ballistics_density_player;
8 float autocvar_g_ballistics_mindistance;
9 bool autocvar_g_ballistics_penetrate_clips = true;
10 float autocvar_g_ballistics_solidpenetration_exponent = 1;
11 int autocvar_g_projectiles_newton_style;
12 float autocvar_g_projectiles_newton_style_2_maxfactor;
13 float autocvar_g_projectiles_newton_style_2_minfactor;
14 int autocvar_g_projectiles_spread_style;
15 bool autocvar_g_norecoil;
16 float autocvar_g_trueaim_minrange;
22 // this function calculates w_shotorg and w_shotdir based on the weapon model
23 // offset, trueaim and antilag, and won't put w_shotorg inside a wall.
24 // make sure you call makevectors first (FIXME?)
25 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);
27 #define W_SetupShot_Dir_ProjectileSize(ent, wepent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype) \
28 W_SetupShot_Dir_ProjectileSize_Range(ent, wepent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, max_shot_distance, deathtype)
29 #define W_SetupShot_ProjectileSize(ent, wepent, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype) \
30 W_SetupShot_Dir_ProjectileSize(ent, wepent, v_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype)
31 #define W_SetupShot_Dir(ent, wepent, s_forward, antilag, recoil, snd, chan, maxdamage, deathtype) \
32 W_SetupShot_Dir_ProjectileSize(ent, wepent, s_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, deathtype)
33 #define W_SetupShot(ent, wepent, antilag, recoil, snd, chan, maxdamage, deathtype) \
34 W_SetupShot_ProjectileSize(ent, wepent, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, deathtype)
35 #define W_SetupShot_Range(ent, wepent, antilag, recoil, snd, chan, maxdamage, range, deathtype) \
36 W_SetupShot_Dir_ProjectileSize_Range(ent, wepent, v_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, range, deathtype)
38 vector W_CalculateProjectileVelocity(entity actor, vector pvelocity, vector mvelocity, float forceAbsolute);
42 float mspercallsstyle;
46 void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float pSpeed, float pUpSpeed, float pZSpeed, float spread, float forceAbsolute);
48 #define W_SetupProjVelocity_Basic(ent,pspeed,pspread) \
49 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, pspeed, 0, 0, pspread, false)
51 #define W_SetupProjVelocity_UP_PRE(ent, wepname, prefix) \
52 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR(wepname, prefix##speed), WEP_CVAR(wepname, prefix##speed_up), WEP_CVAR(wepname, prefix##speed_z), WEP_CVAR(wepname, prefix##spread), false)
53 #define W_SetupProjVelocity_UP_PRI(ent, wepname) \
54 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_PRI(wepname, speed), WEP_CVAR_PRI(wepname, speed_up), WEP_CVAR_PRI(wepname, speed_z), WEP_CVAR_PRI(wepname, spread), false)
55 #define W_SetupProjVelocity_UP_SEC(ent, wepname) \
56 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_SEC(wepname, speed), WEP_CVAR_SEC(wepname, speed_up), WEP_CVAR_SEC(wepname, speed_z), WEP_CVAR_SEC(wepname, spread), false)
58 #define W_SetupProjVelocity_UP_BOTH(ent, wepname, isprimary) \
59 if(isprimary) { W_SetupProjVelocity_UP_PRI(ent, wepname); } \
60 else { W_SetupProjVelocity_UP_SEC(ent, wepname); }
62 #define W_SetupProjVelocity_PRE(ent, wepname, prefix) \
63 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR(wepname, prefix##speed), 0, 0, WEP_CVAR(wepname, prefix##spread), false)
64 #define W_SetupProjVelocity_PRI(ent, wepname) \
65 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_PRI(wepname, speed), 0, 0, WEP_CVAR_PRI(wepname, spread), false)
66 #define W_SetupProjVelocity_SEC(ent, wepname) \
67 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_SEC(wepname, speed), 0, 0, WEP_CVAR_SEC(wepname, spread), false)
69 #define W_SetupProjVelocity_BOTH(ent, wepname, isprimary) \
70 if(isprimary) { W_SetupProjVelocity_PRI(ent, wepname); } \
71 else { W_SetupProjVelocity_SEC(ent, wepname); }
73 // ====================
75 // ====================
77 .float ballistics_density;
79 // for railgun damage (hitting multiple enemies)
81 .float railgunhitsolidbackup;
82 .vector railgunhitloc;
84 IntrusiveList g_railgunhit;
85 STATIC_INIT(g_railgunhit) { g_railgunhit = IL_NEW(); }
87 .float railgundistance;
89 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);
91 entity fireBullet_trace_callback_eff;
92 entity fireBullet_last_hit;
93 void fireBullet_trace_callback(vector start, vector hit, vector end);
94 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);
95 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);
97 void crosshair_trace(entity pl);
99 void crosshair_trace_plusvisibletriggers(entity pl);
100 void WarpZone_crosshair_trace_plusvisibletriggers(entity pl);
101 void crosshair_trace_plusvisibletriggers__is_wz(entity pl, bool is_wz);
103 void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
105 void WarpZone_crosshair_trace(entity pl);
107 void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
109 IntrusiveList g_ctrace_changed;
110 STATIC_INIT(g_ctrace_changed) { g_ctrace_changed = IL_NEW(); }