3 #include <common/weapons/_all.qh>
4 #include <common/stats.qh>
10 // this function calculates w_shotorg and w_shotdir based on the weapon model
11 // offset, trueaim and antilag, and won't put w_shotorg inside a wall.
12 // make sure you call makevectors first (FIXME?)
13 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);
15 #define W_SetupShot_Dir_ProjectileSize(ent, wepent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype) \
16 W_SetupShot_Dir_ProjectileSize_Range(ent, wepent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, max_shot_distance, deathtype)
17 #define W_SetupShot_ProjectileSize(ent, wepent, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype) \
18 W_SetupShot_Dir_ProjectileSize(ent, wepent, v_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype)
19 #define W_SetupShot_Dir(ent, wepent, s_forward, antilag, recoil, snd, chan, maxdamage, deathtype) \
20 W_SetupShot_Dir_ProjectileSize(ent, wepent, s_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, deathtype)
21 #define W_SetupShot(ent, wepent, antilag, recoil, snd, chan, maxdamage, deathtype) \
22 W_SetupShot_ProjectileSize(ent, wepent, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, deathtype)
23 #define W_SetupShot_Range(ent, wepent, antilag, recoil, snd, chan, maxdamage, range, deathtype) \
24 W_SetupShot_Dir_ProjectileSize_Range(ent, wepent, v_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, range, deathtype)
26 vector W_CalculateProjectileVelocity(entity actor, vector pvelocity, vector mvelocity, float forceAbsolute);
30 float mspercallsstyle;
34 void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float pSpeed, float pUpSpeed, float pZSpeed, float spread, float forceAbsolute);
36 #define W_SetupProjVelocity_Basic(ent,pspeed,pspread) \
37 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, pspeed, 0, 0, pspread, false)
39 #define W_SetupProjVelocity_UP_PRE(ent, wepname, prefix) \
40 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)
41 #define W_SetupProjVelocity_UP_PRI(ent, wepname) \
42 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)
43 #define W_SetupProjVelocity_UP_SEC(ent, wepname) \
44 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)
46 #define W_SetupProjVelocity_UP_BOTH(ent, wepname, isprimary) \
47 if(isprimary) { W_SetupProjVelocity_UP_PRI(ent, wepname); } \
48 else { W_SetupProjVelocity_UP_SEC(ent, wepname); }
50 #define W_SetupProjVelocity_PRE(ent, wepname, prefix) \
51 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR(wepname, prefix##speed), 0, 0, WEP_CVAR(wepname, prefix##spread), false)
52 #define W_SetupProjVelocity_PRI(ent, wepname) \
53 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_PRI(wepname, speed), 0, 0, WEP_CVAR_PRI(wepname, spread), false)
54 #define W_SetupProjVelocity_SEC(ent, wepname) \
55 W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_SEC(wepname, speed), 0, 0, WEP_CVAR_SEC(wepname, spread), false)
57 #define W_SetupProjVelocity_BOTH(ent, wepname, isprimary) \
58 if(isprimary) { W_SetupProjVelocity_PRI(ent, wepname); } \
59 else { W_SetupProjVelocity_SEC(ent, wepname); }
61 // ====================
63 // ====================
65 .float ballistics_density;
67 // for railgun damage (hitting multiple enemies)
69 .float railgunhitsolidbackup;
70 .vector railgunhitloc;
72 IntrusiveList g_railgunhit;
73 STATIC_INIT(g_railgunhit) { g_railgunhit = IL_NEW(); }
75 .float railgundistance;
77 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);
79 entity fireBullet_trace_callback_eff;
80 entity fireBullet_last_hit;
81 void fireBullet_trace_callback(vector start, vector hit, vector end);
82 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);
83 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);
85 void crosshair_trace(entity pl);
87 void crosshair_trace_plusvisibletriggers(entity pl);
88 void WarpZone_crosshair_trace_plusvisibletriggers(entity pl);
89 void crosshair_trace_plusvisibletriggers__is_wz(entity pl, bool is_wz);
91 void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
93 void WarpZone_crosshair_trace(entity pl);
95 void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
97 IntrusiveList g_ctrace_changed;
98 STATIC_INIT(g_ctrace_changed) { g_ctrace_changed = IL_NEW(); }