]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/warpzonelib/common.qh
#include this
[xonotic/xonotic-data.pk3dir.git] / qcsrc / warpzonelib / common.qh
1 #ifndef WARPZONELIB_COMMON_H
2 #define WARPZONELIB_COMMON_H
3
4 #if defined(CSQC)
5     #include "../common/util-pre.qh"
6     #include "../client/sys-pre.qh"
7     #include "../dpdefs/csprogsdefs.qc"
8     #include "../client/sys-post.qh"
9     #include "../client/Defs.qc"
10     #include "../dpdefs/keycodes.qc"
11     #include "../common/constants.qh"
12     #include "../common/stats.qh"
13     #include "anglestransform.qh"
14     #include "mathlib.qh"
15 #elif defined(MENUQC)
16 #elif defined(SVQC)
17     #include "../common/util-pre.qh"
18     #include "../server/sys-pre.qh"
19     #include "../dpdefs/progsdefs.qc"
20     #include "../dpdefs/dpextensions.qc"
21     #include "../server/sys-post.qh"
22     #include "anglestransform.qh"
23     #include "mathlib.qh"
24 #endif
25
26 // uncomment this if your mod uses the roll angle in fixangle
27 // #define KEEP_ROLL
28
29 float warpzone_warpzones_exist;
30 float warpzone_cameras_exist;
31
32 .float warpzone_isboxy;
33 .vector warpzone_shift;
34 .vector warpzone_origin;
35 .vector warpzone_angles;
36 .vector warpzone_forward;
37 .vector warpzone_targetorigin;
38 .vector warpzone_targetangles;
39 .vector warpzone_targetforward;
40 .vector warpzone_transform;
41 .float warpzone_fadestart;
42 .float warpzone_fadeend;
43 void WarpZone_SetUp(entity e, vector my_org, vector my_ang, vector other_org, vector other_ang);
44
45 float WarpZoneLib_BoxTouchesBrush(vector mi, vector ma, entity e, entity ig);
46 vector WarpZoneLib_NearestPointOnBox(vector mi, vector ma, vector org);
47
48 entity WarpZone_Find(vector mi, vector ma);
49 void WarpZone_MakeAllSolid();
50 void WarpZone_MakeAllOther();
51
52 #define MOVE_NOTHING -1
53 entity WarpZone_trace_forent; // temp, callback is allowed to change it
54 typedef void(vector start, vector hit, vector end) WarpZone_trace_callback_t; // called on every elementary trace
55 var WarpZone_trace_callback_t WarpZone_trace_callback_t_null;
56 entity WarpZone_trace_transform; // transform accumulator during a trace
57 entity WarpZone_trace_firstzone; // first warpzone hit by a trace (can differ from the requested zone in case of _ThroughZone, the trace is aborted then)
58 entity WarpZone_trace_lastzone; // first warpzone hit by a trace (can differ from the requested zone in case of _ThroughZone, the trace is aborted then)
59 vector WarpZone_tracetoss_velocity; // ending velocity of a tracetoss (post-transform)
60 float WarpZone_tracetoss_time; // duration of toss (approximate)
61 void WarpZone_TraceBox(vector org, vector min, vector max, vector end, float nomonsters, entity forent);
62 void WarpZone_TraceBox_ThroughZone(vector org, vector min, vector max, vector end, float nomonsters, entity forent, entity zone, WarpZone_trace_callback_t cb);
63 void WarpZone_TraceLine(vector org, vector end, float nomonsters, entity forent);
64 void WarpZone_TraceToss(entity e, entity forent);
65 void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZone_trace_callback_t cb);
66 void WarpZone_TrailParticles(entity own, float eff, vector org, vector end);
67 #ifdef CSQC
68 void WarpZone_TrailParticles_WithMultiplier(entity own, float eff, vector org, vector end, float f, float boxflags);
69 #endif
70
71 .vector WarpZone_findradius_dist;
72 .vector WarpZone_findradius_nearest;
73 // also set: warpzone parameters, so WarpZone_TransformOrigin can transform vectors from blast's to victim's system
74 .vector WarpZone_findradius_findorigin;
75 .float WarpZone_findradius_findradius;
76 entity WarpZone_FindRadius(vector org, float radius, float needlineofsight);
77
78 float WarpZone_PlaneDist(entity wz, vector v);
79 float WarpZone_TargetPlaneDist(entity wz, vector v);
80 vector WarpZone_TransformOrigin(entity wz, vector v);
81 vector WarpZone_TransformVelocity(entity wz, vector v);
82 vector WarpZone_TransformAngles(entity wz, vector v);
83 vector WarpZone_TransformVAngles(entity wz, vector v);
84 vector WarpZone_UnTransformOrigin(entity wz, vector v);
85 vector WarpZone_UnTransformVelocity(entity wz, vector v);
86 vector WarpZone_UnTransformAngles(entity wz, vector v);
87 vector WarpZone_UnTransformVAngles(entity wz, vector v);
88
89 // reference systems (chained warpzone transforms)
90 void WarpZone_RefSys_Clear(entity me); // R := id
91 void WarpZone_RefSys_Add(entity me, entity wz); // me.R := wz me.R
92 void WarpZone_RefSys_AddInverse(entity me, entity wz); // me.R := wz^-1 me.R
93 void WarpZone_RefSys_AddTransform(entity me, vector t, vector s); // me.R := [t s] me.R
94 void WarpZone_RefSys_AddInverseTransform(entity me, vector t, vector s); // me.R := [t s]^-1 me.R
95
96 // makes this reference system track ref's changes
97 // NOTE: this is ONLY sensible if WarpZone_RefSys_Add is no longer called on "me" while doing this
98 // To achieve this, make sure no touch events on warpzone are raised by this entity
99 // or set a movetype that causes no warpzoning (e.g. MOVETYPE_NONE, MOVETYPE_FOLLOW)
100 void WarpZone_RefSys_AddIncrementally(entity me, entity ref); // me.R := ref.R me.Rref^-1 me.R; me.Rref := ref.R
101 void WarpZone_RefSys_BeginAddingIncrementally(entity me, entity ref); // me.Rref := ref.R
102
103 vector WarpZone_RefSys_TransformOrigin(entity from, entity to, vector org); // return to.R from.R^-1 org
104 vector WarpZone_RefSys_TransformVelocity(entity from, entity to, vector vel); // return to.R from.R^-1 vel
105 vector WarpZone_RefSys_TransformAngles(entity from, entity to, vector ang); // return to.R from.R^-1 ang
106 vector WarpZone_RefSys_TransformVAngles(entity from, entity to, vector ang); // return to.R from.R^-1 ang
107 void WarpZone_RefSys_Copy(entity me, entity from); // to.R := from.R
108 entity WarpZone_RefSys_SpawnSameRefSys(entity me); // spawn().R = me.R
109
110 #ifndef BITCLR
111 # define BITCLR(a,b) ((a) - ((a) & (b)))
112 #endif
113 #ifndef BITSET
114 # define BITSET(a,b) ((a) | (b))
115 #endif
116 #ifndef BITXOR
117 # define BITXOR(a,b) (((a) | (b)) - ((a) & (b)))
118 #endif
119 #ifndef BITCLR_ASSIGN
120 # define BITCLR_ASSIGN(a,b) ((a) = (a) - ((a) & (b)))
121 #endif
122 #ifndef BITSET_ASSIGN
123 # define BITSET_ASSIGN(a,b) ((a) |= (b))
124 #endif
125 #ifndef BITXOR_ASSIGN
126 # define BITXOR_ASSIGN(a,b) ((a) = ((a) | (b)) - ((a) & (b)))
127 #endif
128 #endif