X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fwarpzonelib%2Fcommon.qh;h=e7cf23908eda0198025a0c5ebaf437b1eb890757;hb=8a000d27bdf428db93e0304c4fdee5a26b89e9e8;hp=1b594d96d73b7c9da95404ad43e73185a1f66ba6;hpb=4ffbca256f8bc337262838c28168b3253853d114;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/warpzonelib/common.qh b/qcsrc/warpzonelib/common.qh index 1b594d96d..e7cf23908 100644 --- a/qcsrc/warpzonelib/common.qh +++ b/qcsrc/warpzonelib/common.qh @@ -4,8 +4,6 @@ float warpzone_warpzones_exist; float warpzone_cameras_exist; -const void func_null(void); // never assign to this one please - .float warpzone_isboxy; .vector warpzone_shift; .vector warpzone_origin; @@ -27,9 +25,12 @@ void WarpZone_MakeAllSolid(); void WarpZone_MakeAllOther(); #define MOVE_NOTHING -1 +entity WarpZone_trace_forent; // temp, callback is allowed to change it typedef void(vector start, vector hit, vector end) WarpZone_trace_callback_t; // called on every elementary trace const var WarpZone_trace_callback_t WarpZone_trace_callback_t_null; entity WarpZone_trace_transform; // transform accumulator during a trace +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) +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) vector WarpZone_tracetoss_velocity; // ending velocity of a tracetoss (post-transform) float WarpZone_tracetoss_time; // duration of toss (approximate) void WarpZone_TraceBox(vector org, vector min, vector max, vector end, float nomonsters, entity forent); @@ -61,11 +62,41 @@ vector WarpZone_UnTransformAngles(entity wz, vector v); vector WarpZone_UnTransformVAngles(entity wz, vector v); // reference systems (chained warpzone transforms) -void WarpZone_RefSys_Add(entity me, entity wz); -void WarpZone_RefSys_AddIncrementally(entity me, entity ref); -void WarpZone_RefSys_BeginAddingIncrementally(entity me, entity ref); -vector WarpZone_RefSys_TransformOrigin(entity from, entity to, vector org); -vector WarpZone_RefSys_TransformVelocity(entity from, entity to, vector vel); -vector WarpZone_RefSys_TransformAngles(entity from, entity to, vector ang); -vector WarpZone_RefSys_TransformVAngles(entity from, entity to, vector ang); -entity WarpZone_RefSys_SpawnSameRefSys(entity me); +void WarpZone_RefSys_Clear(entity me); // R := id +void WarpZone_RefSys_Add(entity me, entity wz); // me.R := wz me.R +void WarpZone_RefSys_AddInverse(entity me, entity wz); // me.R := wz^-1 me.R +void WarpZone_RefSys_AddTransform(entity me, vector t, vector s); // me.R := [t s] me.R +void WarpZone_RefSys_AddInverseTransform(entity me, vector t, vector s); // me.R := [t s]^-1 me.R + +// makes this reference system track ref's changes +// NOTE: this is ONLY sensible if WarpZone_RefSys_Add is no longer called on "me" while doing this +// To achieve this, make sure no touch events on warpzone are raised by this entity +// or set a movetype that causes no warpzoning (e.g. MOVETYPE_NONE, MOVETYPE_FOLLOW) +void WarpZone_RefSys_AddIncrementally(entity me, entity ref); // me.R := ref.R me.Rref^-1 me.R; me.Rref := ref.R +void WarpZone_RefSys_BeginAddingIncrementally(entity me, entity ref); // me.Rref := ref.R + +vector WarpZone_RefSys_TransformOrigin(entity from, entity to, vector org); // return to.R from.R^-1 org +vector WarpZone_RefSys_TransformVelocity(entity from, entity to, vector vel); // return to.R from.R^-1 vel +vector WarpZone_RefSys_TransformAngles(entity from, entity to, vector ang); // return to.R from.R^-1 ang +vector WarpZone_RefSys_TransformVAngles(entity from, entity to, vector ang); // return to.R from.R^-1 ang +void WarpZone_RefSys_Copy(entity me, entity from); // to.R := from.R +entity WarpZone_RefSys_SpawnSameRefSys(entity me); // spawn().R = me.R + +#ifndef BITCLR +# define BITCLR(a,b) ((a) - ((a) & (b))) +#endif +#ifndef BITSET +# define BITSET(a,b) ((a) | (b)) +#endif +#ifndef BITXOR +# define BITXOR(a,b) (((a) | (b)) - ((a) & (b))) +#endif +#ifndef BITCLR_ASSIGN +# define BITCLR_ASSIGN(a,b) ((a) = (a) - ((a) & (b))) +#endif +#ifndef BITSET_ASSIGN +# define BITSET_ASSIGN(a,b) ((a) |= (b)) +#endif +#ifndef BITXOR_ASSIGN +# define BITXOR_ASSIGN(a,b) ((a) = ((a) | (b)) - ((a) & (b))) +#endif