Xonotic
common.qh
Go to the documentation of this file.
1 #pragma once
2 
3 // uncomment this if your mod uses the roll angle in fixangle
4 // #define KEEP_ROLL
5 
7 STATIC_INIT(g_warpzones) { g_warpzones = IL_NEW(); }
8 
11 
23 void WarpZone_SetUp(entity e, vector my_org, vector my_ang, vector other_org, vector other_ang);
24 void WarpZone_Camera_SetUp(entity e, vector my_org, vector my_ang);
25 
28 
32 
33 #define MOVE_NOTHING -1
34 entity WarpZone_trace_forent; // temp, callback is allowed to change it
35 USING(WarpZone_trace_callback_t, void(vector start, vector hit, vector end)); // called on every elementary trace
37 entity WarpZone_trace_transform; // transform accumulator during a trace
38 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)
39 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)
40 vector WarpZone_tracetoss_velocity; // ending velocity of a tracetoss (post-transform)
41 float WarpZone_tracetoss_time; // duration of toss (approximate)
42 void WarpZone_TraceBox(vector org, vector min, vector max, vector end, float nomonsters, entity forent);
43 void WarpZone_TraceBox_ThroughZone(vector org, vector min, vector max, vector end, float nomonsters, entity forent, entity zone, WarpZone_trace_callback_t cb);
44 void WarpZone_TraceLine(vector org, vector end, float nomonsters, entity forent);
45 void WarpZone_TraceToss(entity e, entity forent);
47 void WarpZone_TrailParticles(entity own, float eff, vector org, vector end);
48 #ifdef CSQC
49 void WarpZone_TrailParticles_WithMultiplier(entity own, float eff, vector org, vector end, float f, float boxflags);
50 #endif
51 
54 // also set: warpzone parameters, so WarpZone_TransformOrigin can transform vectors from blast's to victim's system
57 entity WarpZone_FindRadius(vector org, float radius, float needlineofsight);
58 
69 
70 // reference systems (chained warpzone transforms)
71 void WarpZone_RefSys_Clear(entity me); // R := id
72 void WarpZone_RefSys_Add(entity me, entity wz); // me.R := wz me.R
73 void WarpZone_RefSys_AddInverse(entity me, entity wz); // me.R := wz^-1 me.R
74 void WarpZone_RefSys_AddTransform(entity me, vector t, vector s); // me.R := [t s] me.R
75 void WarpZone_RefSys_AddInverseTransform(entity me, vector t, vector s); // me.R := [t s]^-1 me.R
76 
77 // makes this reference system track ref's changes
78 // NOTE: this is ONLY sensible if WarpZone_RefSys_Add is no longer called on "me" while doing this
79 // To achieve this, make sure no touch events on warpzone are raised by this entity
80 // or set a movetype that causes no warpzoning (e.g. MOVETYPE_NONE, MOVETYPE_FOLLOW)
81 void WarpZone_RefSys_AddIncrementally(entity me, entity ref); // me.R := ref.R me.Rref^-1 me.R; me.Rref := ref.R
82 void WarpZone_RefSys_BeginAddingIncrementally(entity me, entity ref); // me.Rref := ref.R
83 
84 vector WarpZone_RefSys_TransformOrigin(entity from, entity to, vector org); // return to.R from.R^-1 org
85 vector WarpZone_RefSys_TransformVelocity(entity from, entity to, vector vel); // return to.R from.R^-1 vel
86 vector WarpZone_RefSys_TransformAngles(entity from, entity to, vector ang); // return to.R from.R^-1 ang
87 vector WarpZone_RefSys_TransformVAngles(entity from, entity to, vector ang); // return to.R from.R^-1 ang
88 void WarpZone_RefSys_Copy(entity me, entity from); // to.R := from.R
89 entity WarpZone_RefSys_SpawnSameRefSys(entity me); // spawn().R = me.R
90 
91 #ifndef BITCLR
92 # define BITCLR(a,b) ((a) - ((a) & (b)))
93 #endif
94 #ifndef BITSET
95 # define BITSET(a,b) ((a) | (b))
96 #endif
97 #ifndef BITXOR
98 # define BITXOR(a,b) (((a) | (b)) - ((a) & (b)))
99 #endif
100 #ifndef BITCLR_ASSIGN
101 # define BITCLR_ASSIGN(a,b) ((a) = (a) - ((a) & (b)))
102 #endif
103 #ifndef BITSET_ASSIGN
104 # define BITSET_ASSIGN(a,b) ((a) |= (b))
105 #endif
106 #ifndef BITXOR_ASSIGN
107 # define BITXOR_ASSIGN(a,b) ((a) = ((a) | (b)) - ((a) & (b)))
108 #endif
110 #define move_out_of_solid(e) WarpZoneLib_MoveOutOfSolid(e)
111 
112 bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher);
114 
115 // WARNING: this kills the trace globals
116 #define EXACTTRIGGER_TOUCH(e,t) if(WarpZoneLib_ExactTrigger_Touch((e), (t))) return
117 #define EXACTTRIGGER_INIT WarpZoneLib_ExactTrigger_Init(this)
float WarpZone_TargetPlaneDist(entity wz, vector v)
Definition: common.qc:494
vector WarpZone_RefSys_TransformOrigin(entity from, entity to, vector org)
Definition: common.qc:748
vector WarpZone_TransformVelocity(entity wz, vector v)
Definition: common.qc:504
float warpzone_fadestart
Definition: common.qh:21
vector WarpZone_TransformAngles(entity wz, vector v)
Definition: common.qc:509
void WarpZone_SetUp(entity e, vector my_org, vector my_ang, vector other_org, vector other_ang)
Definition: common.qc:66
vector WarpZone_findradius_dist
Definition: common.qh:52
entity WarpZone_Find(vector mi, vector ma)
Definition: common.qc:157
void WarpZoneLib_ExactTrigger_Init(entity this)
Definition: util_server.qc:12
STATIC_INIT(g_warpzones)
Definition: common.qh:7
#define IL_NEW()
vector WarpZone_RefSys_TransformVAngles(entity from, entity to, vector ang)
Definition: common.qc:772
void WarpZone_RefSys_BeginAddingIncrementally(entity me, entity ref)
Definition: common.qc:743
vector WarpZone_TransformVAngles(entity wz, vector v)
Definition: common.qc:514
entity() spawn
float WarpZone_findradius_findradius
Definition: common.qh:56
var WarpZone_trace_callback_t WarpZone_trace_callback_t_null
Definition: common.qh:36
float WarpZone_tracetoss_time
Definition: common.qh:41
float radius
Definition: impulse.qh:11
vector warpzone_transform
Definition: common.qh:20
vector warpzone_origin
Definition: common.qh:14
entity to
Definition: self.qh:96
limitations: NULL cannot be present elements can only be present once a maximum of IL_MAX lists can e...
entity WarpZone_trace_lastzone
Definition: common.qh:39
float warpzone_warpzones_exist
Definition: common.qh:9
vector WarpZone_tracetoss_velocity
Definition: common.qh:40
vector warpzone_targetangles
Definition: common.qh:18
bool WarpZoneLib_MoveOutOfSolid(entity e)
Definition: common.qc:826
float warpzone_fadeend
Definition: common.qh:22
void WarpZone_MakeAllOther()
Definition: common.qc:179
entity WarpZone_trace_forent
Definition: common.qh:34
void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZone_trace_callback_t cb)
Definition: common.qc:343
entity WarpZone_FindRadius(vector org, float radius, float needlineofsight)
vector warpzone_forward
Definition: common.qh:16
entity WarpZone_trace_firstzone
Definition: common.qh:38
vector WarpZoneLib_NearestPointOnBox(vector mi, vector ma, vector org)
Definition: common.qc:565
vector WarpZone_RefSys_TransformAngles(entity from, entity to, vector ang)
Definition: common.qc:764
void WarpZone_TrailParticles(entity own, float eff, vector org, vector end)
Definition: common.qc:464
float WarpZone_PlaneDist(entity wz, vector v)
Definition: common.qc:489
void WarpZone_RefSys_AddInverseTransform(entity me, vector t, vector s)
Definition: common.qc:718
vector WarpZone_UnTransformVelocity(entity wz, vector v)
Definition: common.qc:540
void WarpZone_RefSys_Copy(entity me, entity from)
Definition: common.qc:780
vector WarpZone_TransformOrigin(entity wz, vector v)
Definition: common.qc:499
void WarpZone_MakeAllSolid()
Definition: common.qc:169
void WarpZone_TraceToss(entity e, entity forent)
Definition: common.qc:452
vector warpzone_targetorigin
Definition: common.qh:17
void WarpZone_TraceBox(vector org, vector min, vector max, vector end, float nomonsters, entity forent)
Definition: common.qc:333
vector(float skel, float bonenum) _skel_get_boneabs_hidden
entity WarpZone_trace_transform
Definition: common.qh:37
void WarpZone_RefSys_AddInverse(entity me, entity wz)
Definition: common.qc:726
vector warpzone_angles
Definition: common.qh:15
vector v
Definition: ent_cs.qc:116
IntrusiveList g_warpzones
Definition: common.qh:6
vector warpzone_targetforward
Definition: common.qh:19
float warpzone_isboxy
Definition: common.qh:12
bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher)
Definition: common.qc:798
entity WarpZone_RefSys_SpawnSameRefSys(entity me)
Definition: common.qc:791
vector WarpZone_UnTransformOrigin(entity wz, vector v)
Definition: common.qc:535
float warpzone_cameras_exist
Definition: common.qh:10
void WarpZone_TraceBox_ThroughZone(vector org, vector min, vector max, vector end, float nomonsters, entity forent, entity zone, WarpZone_trace_callback_t cb)
Definition: common.qc:202
#define USING(name, T)
Definition: _all.inc:72
void WarpZone_RefSys_Clear(entity me)
Definition: common.qc:698
void WarpZone_RefSys_AddTransform(entity me, vector t, vector s)
Definition: common.qc:706
vector WarpZone_UnTransformAngles(entity wz, vector v)
Definition: common.qc:545
void WarpZone_RefSys_AddIncrementally(entity me, entity ref)
Definition: common.qc:732
vector WarpZone_RefSys_TransformVelocity(entity from, entity to, vector vel)
Definition: common.qc:756
vector warpzone_shift
Definition: common.qh:13
void WarpZone_RefSys_Add(entity me, entity wz)
Definition: common.qc:714
float WarpZoneLib_BoxTouchesBrush(vector mi, vector ma, entity e, entity ig)
Definition: common.qc:138
vector WarpZone_UnTransformVAngles(entity wz, vector v)
Definition: common.qc:550
void WarpZone_Camera_SetUp(entity e, vector my_org, vector my_ang)
Definition: common.qc:95
vector WarpZone_findradius_nearest
Definition: common.qh:53
void(vector start, vector hit, vector end) WarpZone_trace_callback_t
Definition: common.qh:35
void WarpZone_TraceLine(vector org, vector end, float nomonsters, entity forent)
Definition: common.qc:338
vector WarpZone_findradius_findorigin
Definition: common.qh:55