]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/weapons/tracing.qh
#include this
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / tracing.qh
1 #ifndef TRACING_H
2 #define TRACING_H
3
4 #if defined(CSQC)
5 #elif defined(MENUQC)
6 #elif defined(SVQC)
7         #include "../../common/util-pre.qh"
8     #include "../sys-pre.qh"
9     #include "../../dpdefs/progsdefs.qc"
10     #include "../../dpdefs/dpextensions.qc"
11     #include "../sys-post.qh"
12     #include "../../warpzonelib/anglestransform.qh"
13     #include "../../warpzonelib/mathlib.qh"
14     #include "../../warpzonelib/common.qh"
15     #include "../../warpzonelib/util_server.qh"
16     #include "../../warpzonelib/server.qh"
17     #include "../../common/constants.qh"
18     #include "../../common/stats.qh"
19     #include "../../common/teams.qh"
20     #include "../../common/util.qh"
21     #include "../../common/nades.qh"
22     #include "../../common/buffs.qh"
23     #include "../../common/test.qh"
24     #include "../../common/counting.qh"
25     #include "../../common/urllib.qh"
26     #include "../../common/command/markup.qh"
27     #include "../../common/command/rpn.qh"
28     #include "../../common/command/generic.qh"
29     #include "../../common/command/shared_defs.qh"
30     #include "../../common/net_notice.qh"
31     #include "../../common/animdecide.qh"
32     #include "../../common/monsters/monsters.qh"
33     #include "../../common/monsters/sv_monsters.qh"
34     #include "../../common/monsters/spawn.qh"
35     #include "../../common/weapons/config.qh"
36     #include "../../common/weapons/weapons.qh"
37     #include "accuracy.qh"
38     #include "common.qh"
39     #include "csqcprojectile.qh"
40     #include "hitplot.qh"
41     #include "selection.qh"
42     #include "spawning.qh"
43     #include "throwing.qh"
44 #endif
45
46 vector w_shotorg;
47 vector w_shotdir;
48 vector w_shotend;
49
50 // this function calculates w_shotorg and w_shotdir based on the weapon model
51 // offset, trueaim and antilag, and won't put w_shotorg inside a wall.
52 // make sure you call makevectors first (FIXME?)
53 void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector mi, vector ma, float antilag, float recoil, string snd, float chan, float maxdamage, float range);
54
55 #define W_SetupShot_Dir_ProjectileSize(ent,s_forward,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize_Range(ent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, MAX_SHOT_DISTANCE)
56 #define W_SetupShot_ProjectileSize(ent,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize(ent, v_forward, mi, ma, antilag, recoil, snd, chan, maxdamage)
57 #define W_SetupShot_Dir(ent,s_forward,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize(ent, s_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage)
58 #define W_SetupShot(ent,antilag,recoil,snd,chan,maxdamage) W_SetupShot_ProjectileSize(ent, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage)
59 #define W_SetupShot_Range(ent,antilag,recoil,snd,chan,maxdamage,range) W_SetupShot_Dir_ProjectileSize_Range(ent, v_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, range)
60
61 vector W_CalculateProjectileVelocity(vector pvelocity, vector mvelocity, float forceAbsolute);
62
63 #if 0
64 float mspercallsum;
65 float mspercallsstyle;
66 float mspercallcount;
67 #endif
68
69 void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float pSpeed, float pUpSpeed, float pZSpeed, float spread, float forceAbsolute);
70
71 #define W_SetupProjVelocity_Basic(ent,pspeed,pspread) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, pspeed, 0, 0, pspread, false)
72
73 #define W_SetupProjVelocity_UP_PRE(ent,wepname,prefix) 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)
74 #define W_SetupProjVelocity_UP_PRI(ent,wepname) 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)
75 #define W_SetupProjVelocity_UP_SEC(ent,wepname) 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)
76
77 #define W_SetupProjVelocity_UP_BOTH(ent,wepname,isprimary) \
78         if(isprimary) { W_SetupProjVelocity_UP_PRI(ent, wepname); } \
79         else { W_SetupProjVelocity_UP_SEC(ent, wepname); }
80
81 #define W_SetupProjVelocity_PRE(ent,wepname,prefix) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR(wepname, prefix##speed), 0, 0, WEP_CVAR(wepname, prefix##spread), false)
82 #define W_SetupProjVelocity_PRI(ent,wepname) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_PRI(wepname, speed), 0, 0, WEP_CVAR_PRI(wepname, spread), false)
83 #define W_SetupProjVelocity_SEC(ent,wepname) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_SEC(wepname, speed), 0, 0, WEP_CVAR_SEC(wepname, spread), false)
84
85 #define W_SetupProjVelocity_BOTH(ent,wepname,isprimary) \
86         if(isprimary) { W_SetupProjVelocity_PRI(ent, wepname); } \
87         else { W_SetupProjVelocity_SEC(ent, wepname); }
88
89 // ====================
90 //  Ballistics Tracing
91 // ====================
92
93 .float railgundistance;
94 .vector railgunforce;
95 void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, float mindist, float maxdist, float halflifedist, float forcehalflifedist, float deathtype);
96
97 float fireBullet_trace_callback_eff;
98 entity fireBullet_last_hit;
99 void fireBullet_trace_callback(vector start, vector hit, vector end);
100 void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, float tracereffects);
101 #endif