Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
common.qh File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BITCLR(a, b)
#define BITCLR_ASSIGN(a, b)
#define BITSET(a, b)
#define BITSET_ASSIGN(a, b)
#define BITXOR(a, b)
#define BITXOR_ASSIGN(a, b)
#define EXACTTRIGGER_INIT   WarpZoneLib_ExactTrigger_Init(this, true)
#define EXACTTRIGGER_TOUCH(e, t)
#define MOVE_NOTHING   -1
#define move_out_of_solid(e)
#define WarpZone_FindRadius(org, radius)
 Modified findradius aware of warpzones.
#define WarpZone_RefSys_Add(me, wz)
#define WarpZone_RefSys_AddInverse(me, wz)
#define WarpZone_TraceBox(org, mi, ma, end, nomonsters, forent)
#define WarpZone_TraceLine(org, end, nomonsters, forent)
#define WarpZone_TraceLine_ThroughZone(org, end, nomonsters, forent, zone, cb)
#define WarpZone_TraceToss(e, forent)

Typedefs

using WarpZone_FindRadius_cond_callback_t = bool(entity e)
using WarpZone_trace_callback_t = void(vector start, vector hit, vector end)

Functions

 STATIC_INIT (g_warpzones)
var void te_csqc_trace_callback_func (vector start, vector hit)
void WarpZone_Camera_SetUp (entity e, vector my_org, vector my_ang)
entity WarpZone_Find (vector mi, vector ma)
void WarpZone_MakeAllOther ()
void WarpZone_MakeAllSolid ()
float WarpZone_PlaneDist (entity wz, vector v)
void WarpZone_RefSys_AddIncrementally (entity me, entity ref)
void WarpZone_RefSys_AddInverseTransform (entity me, vector t, vector s)
void WarpZone_RefSys_AddTransform (entity me, vector t, vector s)
void WarpZone_RefSys_BeginAddingIncrementally (entity me, entity ref)
void WarpZone_RefSys_Clear (entity me)
void WarpZone_RefSys_Copy (entity me, entity from)
 Copies the warpzone reference of from onto me.
entity WarpZone_RefSys_SpawnSameRefSys (entity me)
 Spawns an entity in the same warpzone reference as me, and sets up its reference.
vector WarpZone_RefSys_TransformAngles (entity from, entity to, vector ang)
 Transform angle ang in from's reference into to's reference.
vector WarpZone_RefSys_TransformOrigin (entity from, entity to, vector org)
 Transform origin org in from's reference into to's reference.
vector WarpZone_RefSys_TransformVAngles (entity from, entity to, vector ang)
 Transform v_angle ang in from's reference into to's reference.
vector WarpZone_RefSys_TransformVelocity (entity from, entity to, vector vel)
 Transform velocity vel in from's reference into to's reference.
entity WarpZone_SearchInRadius (vector org, float radius, float nomonsters, WarpZone_FindRadius_cond_callback_t cb)
 Modified findradius aware of warpzones, that only includes entities that meet the "cb" criteria.
void WarpZone_SetUp (entity e, vector my_org, vector my_ang, vector other_org, vector other_ang)
float WarpZone_TargetPlaneDist (entity wz, vector v)
void WarpZone_TraceBox_ThroughZone (vector org, vector min, vector max, vector end, float nomonsters, entity forent, entity zone, WarpZone_trace_callback_t cb)
 Traces a box from org to end, shifting & transforming each time it goes through a warpzone.
void WarpZone_TraceToss_ThroughZone (entity e, entity forent, entity zone, WarpZone_trace_callback_t cb)
 Traces tossing e, shifting & transforming each time it goes through a warpzone.
void WarpZone_TrailParticles (entity own, float eff, vector org, vector end)
void WarpZone_TrailParticles_WithMultiplier (entity own, float eff, vector org, vector end, float f, float boxflags)
vector WarpZone_TransformAngles (entity wz, vector v)
 Transforms angle v across warpzone wz.
vector WarpZone_TransformOrigin (entity wz, vector v)
 Transforms origin org across warpzone wz.
vector WarpZone_TransformVAngles (entity wz, vector v)
 Transforms v_angle ang across warpzone wz.
vector WarpZone_TransformVelocity (entity wz, vector v)
 Transforms velocity v across warpzone wz.
vector WarpZone_UnTransformAngles (entity wz, vector v)
 Transforms angle ang backwards through warpzone wz, as the inverse of WarpZone_TransformAngles.
vector WarpZone_UnTransformOrigin (entity wz, vector v)
 Transforms origin org backwards through warpzone wz, as the inverse of WarpZone_TransformOrigin.
vector WarpZone_UnTransformVAngles (entity wz, vector v)
 Transforms v_angle ang backwards through warpzone wz, as the inverse of WarpZone_TransformVAngles.
vector WarpZone_UnTransformVelocity (entity wz, vector v)
 Transforms angle vel backwards through warpzone wz, as the inverse of WarpZone_TransformVelocity.
float WarpZoneLib_BoxTouchesBrush (vector mi, vector ma, entity e, entity ig)
bool WarpZoneLib_ExactTrigger_Touch (entity this, entity toucher, bool touchfunc)
int WarpZoneLib_MoveOutOfSolid (entity e)

Variables

IntrusiveList g_warpzones
WarpZone_trace_callback_t te_csqc_trace_callback
vector warpzone_angles
float warpzone_cameras_exist
float warpzone_fadeend
float warpzone_fadestart
vector WarpZone_findradius_dist
vector WarpZone_findradius_nearest
vector warpzone_forward
float warpzone_isboxy
vector warpzone_origin
noref entity WarpZone_SearchInRadius_otherent
 Free to use in the callback.
vector warpzone_shift
 Both a warpzone property, and set on entities found by WarpZone_SearchInRadius.
vector warpzone_targetangles
vector warpzone_targetforward
vector warpzone_targetorigin
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_forent
 Temp, callback is allowed to change it.
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).
entity WarpZone_trace_transform
 Transform accumulator during a trace.
float WarpZone_tracetoss_time
 Duration of toss (approximate).
vector WarpZone_tracetoss_velocity
 Ending velocity of a tracetoss (post-transform).
vector warpzone_transform
 Both a warpzone property, and set on entities found by WarpZone_SearchInRadius.
float warpzone_warpzones_exist

Macro Definition Documentation

◆ BITCLR

#define BITCLR ( a,
b )
Value:
((a) & ~(b))

Definition at line 110 of file common.qh.

◆ BITCLR_ASSIGN

#define BITCLR_ASSIGN ( a,
b )
Value:
((a) &= ~(b))

Definition at line 119 of file common.qh.

Referenced by WarpZone_TeleportPlayer(), and WarpZone_TraceBox_ThroughZone().

◆ BITSET

#define BITSET ( a,
b )
Value:
((a) | (b))

Definition at line 113 of file common.qh.

◆ BITSET_ASSIGN

◆ BITXOR

#define BITXOR ( a,
b )
Value:
(((a) ^ (b))

Definition at line 116 of file common.qh.

◆ BITXOR_ASSIGN

#define BITXOR_ASSIGN ( a,
b )
Value:
((a) ^= (b))

Definition at line 125 of file common.qh.

Referenced by anim_set(), animdecide_setframes(), CheatCommand(), TeleportPlayer(), and WarpZone_TeleportPlayer().

◆ EXACTTRIGGER_INIT

◆ EXACTTRIGGER_TOUCH

#define EXACTTRIGGER_TOUCH ( e,
t )

◆ MOVE_NOTHING

◆ move_out_of_solid

#define move_out_of_solid ( e)

◆ WarpZone_FindRadius

#define WarpZone_FindRadius ( org,
radius )
Value:
float radius
Definition impulse.qh:11
entity WarpZone_SearchInRadius(vector org, float rad, float nomonsters, WarpZone_FindRadius_cond_callback_t cb)
Modified findradius aware of warpzones, that only includes entities that meet the "cb" criteria.
Definition common.qc:680
#define MOVE_NOTHING
Definition common.qh:35
var void func_null()
vector org
Definition self.qh:96

Modified findradius aware of warpzones.

Definition at line 73 of file common.qh.

Referenced by StartItem().

◆ WarpZone_RefSys_Add

#define WarpZone_RefSys_Add ( me,
wz )
Value:
/* me.R := wz me.R */ \
WarpZone_RefSys_AddTransform(me, (wz).warpzone_transform, (wz).warpzone_shift)
vector warpzone_shift
Both a warpzone property, and set on entities found by WarpZone_SearchInRadius.
Definition common.qh:17
vector warpzone_transform
Both a warpzone property, and set on entities found by WarpZone_SearchInRadius.
Definition common.qh:16

Definition at line 88 of file common.qh.

88#define WarpZone_RefSys_Add(me, wz) /* me.R := wz me.R */ \
89 WarpZone_RefSys_AddTransform(me, (wz).warpzone_transform, (wz).warpzone_shift)

Referenced by WarpZone_Teleport().

◆ WarpZone_RefSys_AddInverse

#define WarpZone_RefSys_AddInverse ( me,
wz )
Value:
/* me.R := wz^-1 me.R */ \
WarpZone_RefSys_AddInverseTransform(me, (wz).warpzone_transform, (wz).warpzone_shift)

Definition at line 90 of file common.qh.

90#define WarpZone_RefSys_AddInverse(me, wz) /* me.R := wz^-1 me.R */ \
91 WarpZone_RefSys_AddInverseTransform(me, (wz).warpzone_transform, (wz).warpzone_shift)

Referenced by Monster_Enemy_Check(), and MUTATOR_HOOKFUNCTION().

◆ WarpZone_TraceBox

#define WarpZone_TraceBox ( org,
mi,
ma,
end,
nomonsters,
forent )
Value:
WarpZone_TraceBox_ThroughZone(org, mi, ma, end, nomonsters, forent, NULL, func_null)
void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end, float nomonsters, entity forent, entity zone, WarpZone_trace_callback_t cb)
Traces a box from org to end, shifting & transforming each time it goes through a warpzone.
Definition common.qc:183
#define NULL
Definition post.qh:14

Definition at line 49 of file common.qh.

49#define WarpZone_TraceBox(org, mi, ma, end, nomonsters, forent) \
50 WarpZone_TraceBox_ThroughZone(org, mi, ma, end, nomonsters, forent, NULL, func_null)

Referenced by CommonCommand_editmob(), View_EventChase(), and W_OverkillRocketPropelledChainsaw_Think().

◆ WarpZone_TraceLine

#define WarpZone_TraceLine ( org,
end,
nomonsters,
forent )
Value:
WarpZone_TraceBox(org, '0 0 0', '0 0 0', end, nomonsters, forent)
#define WarpZone_TraceBox(org, mi, ma, end, nomonsters, forent)
Definition common.qh:49

Definition at line 51 of file common.qh.

51#define WarpZone_TraceLine(org, end, nomonsters, forent) \
52 WarpZone_TraceBox(org, '0 0 0', '0 0 0', end, nomonsters, forent)

Referenced by CheatCommand(), CommonCommand_editmob(), ctf_CalculatePassVelocity(), ctf_FlagThink(), Draw_ArcBeam(), HUD_Crosshair(), Monster_Enemy_Check(), RadiusDamageForSource(), sandbox_ObjectSpawn(), View_EventChase(), W_Electro_TriggerCombo(), W_Fireball_Explode(), W_SeekOutEnemy(), and W_SetupShot_Dir_ProjectileSize_Range().

◆ WarpZone_TraceLine_ThroughZone

#define WarpZone_TraceLine_ThroughZone ( org,
end,
nomonsters,
forent,
zone,
cb )
Value:
WarpZone_TraceBox_ThroughZone(org, '0 0 0', '0 0 0', end, nomonsters, forent, zone, cb)

Definition at line 47 of file common.qh.

47#define WarpZone_TraceLine_ThroughZone(org, end, nomonsters, forent, zone, cb) \
48 WarpZone_TraceBox_ThroughZone(org, '0 0 0', '0 0 0', end, nomonsters, forent, zone, cb)

Referenced by Draw_ArcBeam(), Draw_GrapplingHook(), fireBullet_falloff(), M_Golem_Attack_Lightning_Explode(), turret_tesla_toast(), VaporizerBeam_Draw(), W_LaserPlay(), WarpZone_TrailParticles(), and WarpZone_TrailParticles_WithMultiplier().

◆ WarpZone_TraceToss

#define WarpZone_TraceToss ( e,
forent )
Value:
void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZone_trace_callback_t cb)
Traces tossing e, shifting & transforming each time it goes through a warpzone.
Definition common.qc:334

Definition at line 53 of file common.qh.

53#define WarpZone_TraceToss(e, forent) \
54 WarpZone_TraceToss_ThroughZone(e, forent, NULL, func_null)

Typedef Documentation

◆ WarpZone_FindRadius_cond_callback_t

Definition at line 67 of file common.qh.

◆ WarpZone_trace_callback_t

Definition at line 37 of file common.qh.

Function Documentation

◆ STATIC_INIT()

STATIC_INIT ( g_warpzones )

Definition at line 7 of file common.qh.

8{
10}
#define IL_NEW()
IntrusiveList g_warpzones
Definition common.qh:6

References g_warpzones, and IL_NEW.

◆ te_csqc_trace_callback_func()

var void te_csqc_trace_callback_func ( vector start,
vector hit )

◆ WarpZone_Camera_SetUp()

void WarpZone_Camera_SetUp ( entity e,
vector my_org,
vector my_ang )

Definition at line 85 of file common.qc.

86{
87 e.warpzone_origin = my_org;
88 e.warpzone_angles = my_ang;
90}
vector WarpZone_Camera_camera_transform(entity this, vector org, vector ang)
Definition common.qc:72
#define setcamera_transform(e, f)
Definition self.qh:97

References entity(), setcamera_transform, vector, and WarpZone_Camera_camera_transform().

Referenced by NET_HANDLE(), WarpZoneCamera_InitStep_FindTarget(), and WarpZoneCamera_Think().

◆ WarpZone_Find()

entity WarpZone_Find ( vector mi,
vector ma )

Definition at line 152 of file common.qc.

153{
154 // if we are near any warpzone planes - MOVE AWAY (work around nearclip)
156 IL_EACH(g_warpzones, WarpZoneLib_BoxTouchesBrush(mi, ma, it, NULL), return it);
157 return NULL;
158}
#define IL_EACH(this, cond, body)
float WarpZoneLib_BoxTouchesBrush(vector mi, vector ma, entity e, entity ig)
Definition common.qc:120
float warpzone_warpzones_exist
Definition common.qh:12

References entity(), g_warpzones, IL_EACH, NULL, vector, warpzone_warpzones_exist, and WarpZoneLib_BoxTouchesBrush().

Referenced by WarpZone_FixNearClip(), WarpZone_FixPMove(), WarpZone_FixView(), WarpZone_StartFrame(), WarpZone_TraceBox_ThroughZone(), and WarpZone_TraceToss_ThroughZone().

◆ WarpZone_MakeAllOther()

void WarpZone_MakeAllOther ( )

Definition at line 166 of file common.qc.

167{
169 IL_EACH(g_warpzones, true, it.solid = SOLID_TRIGGER);
170}
const float SOLID_TRIGGER

References g_warpzones, IL_EACH, SOLID_TRIGGER, and warpzone_warpzones_exist.

Referenced by WarpZone_TraceBox_ThroughZone(), and WarpZone_TraceToss_ThroughZone().

◆ WarpZone_MakeAllSolid()

void WarpZone_MakeAllSolid ( )

Definition at line 160 of file common.qc.

161{
163 IL_EACH(g_warpzones, true, it.solid = SOLID_BSP);
164}
const float SOLID_BSP

References g_warpzones, IL_EACH, SOLID_BSP, and warpzone_warpzones_exist.

Referenced by WarpZone_TraceBox_ThroughZone(), and WarpZone_TraceToss_ThroughZone().

◆ WarpZone_PlaneDist()

float WarpZone_PlaneDist ( entity wz,
vector v )

Definition at line 478 of file common.qc.

479{
480 return (p - wz.warpzone_origin) * wz.warpzone_forward;
481}

References entity(), and vector.

Referenced by WarpZone_FixNearClip(), WarpZone_StartFrame(), and WarpZone_Touch().

◆ WarpZone_RefSys_AddIncrementally()

void WarpZone_RefSys_AddIncrementally ( entity me,
entity ref )

Definition at line 768 of file common.qc.

769{
770 //vector t, s;
771 if (me.WarpZone_refsys_incremental_transform == ref.WarpZone_refsys.warpzone_transform
772 && me.WarpZone_refsys_incremental_shift == ref.WarpZone_refsys.warpzone_shift)
773 return;
774 WarpZone_Accumulator_AddInverseTransform(me.WarpZone_refsys, me.WarpZone_refsys_incremental_transform, me.WarpZone_refsys_incremental_shift);
775 WarpZone_Accumulator_Add(me.WarpZone_refsys, ref.WarpZone_refsys);
776 me.WarpZone_refsys_incremental_shift = ref.WarpZone_refsys.warpzone_shift;
777 me.WarpZone_refsys_incremental_transform = ref.WarpZone_refsys.warpzone_transform;
778}
#define WarpZone_Accumulator_Add(acc, wz)
Definition common.qc:23
void WarpZone_Accumulator_AddInverseTransform(entity acc, vector t, vector s)
Definition common.qc:25

References entity(), WarpZone_Accumulator_Add, and WarpZone_Accumulator_AddInverseTransform().

Referenced by GrapplingHookThink().

◆ WarpZone_RefSys_AddInverseTransform()

void WarpZone_RefSys_AddInverseTransform ( entity me,
vector t,
vector s )

Definition at line 759 of file common.qc.

760{
761 if (t == '0 0 0' && s == '0 0 0')
762 return;
764 WarpZone_Accumulator_AddInverseTransform(me.WarpZone_refsys, t, s);
765}
void WarpZone_RefSys_CheckCreate(entity me)
Definition common.qc:737

References entity(), vector, WarpZone_Accumulator_AddInverseTransform(), and WarpZone_RefSys_CheckCreate().

◆ WarpZone_RefSys_AddTransform()

void WarpZone_RefSys_AddTransform ( entity me,
vector t,
vector s )

Definition at line 752 of file common.qc.

753{
754 if (t == '0 0 0' && s == '0 0 0')
755 return;
757 WarpZone_Accumulator_AddTransform(me.WarpZone_refsys, t, s);
758}
void WarpZone_Accumulator_AddTransform(entity acc, vector t, vector s)
Definition common.qc:16

References entity(), vector, WarpZone_Accumulator_AddTransform(), and WarpZone_RefSys_CheckCreate().

◆ WarpZone_RefSys_BeginAddingIncrementally()

void WarpZone_RefSys_BeginAddingIncrementally ( entity me,
entity ref )

Definition at line 779 of file common.qc.

780{
781 me.WarpZone_refsys_incremental_shift = ref.WarpZone_refsys.warpzone_shift;
782 me.WarpZone_refsys_incremental_transform = ref.WarpZone_refsys.warpzone_transform;
783}

References entity().

Referenced by GrapplingHookTouch().

◆ WarpZone_RefSys_Clear()

void WarpZone_RefSys_Clear ( entity me)

Definition at line 745 of file common.qc.

746{
747 if (!me.WarpZone_refsys)
748 return;
749 delete(me.WarpZone_refsys);
750 me.WarpZone_refsys = NULL;
751}

References entity(), and NULL.

Referenced by MUTATOR_HOOKFUNCTION(), and WarpZone_RefSys_Copy().

◆ WarpZone_RefSys_Copy()

void WarpZone_RefSys_Copy ( entity me,
entity from )

Copies the warpzone reference of from onto me.

In other words, makes it be "on the same side of the warpzones"

Definition at line 824 of file common.qc.

825{
826 if (from.WarpZone_refsys)
827 {
829 me.WarpZone_refsys.warpzone_shift = from.WarpZone_refsys.warpzone_shift;
830 me.WarpZone_refsys.warpzone_transform = from.WarpZone_refsys.warpzone_transform;
831 }
832 else
834}
void WarpZone_RefSys_Clear(entity me)
Definition common.qc:745

References entity(), WarpZone_RefSys_CheckCreate(), and WarpZone_RefSys_Clear().

Referenced by ctf_Handle_Throw(), FireGrapplingHook(), M_Mage_Attack_Spike(), Monster_Enemy_Check(), MUTATOR_HOOKFUNCTION(), spawn_held_nade(), W_Crylink_Attack(), W_Crylink_Attack2(), W_Devastator_Attack(), W_Fireball_Attack1(), W_Fireball_Attack2(), W_MineLayer_Attack(), W_Seeker_Fire_Missile(), W_Seeker_Fire_Tag(), W_Seeker_Tag_Touch(), and WarpZone_RefSys_SpawnSameRefSys().

◆ WarpZone_RefSys_SpawnSameRefSys()

entity WarpZone_RefSys_SpawnSameRefSys ( entity me)

Spawns an entity in the same warpzone reference as me, and sets up its reference.

Used when you need to spawn en entity, set up the reference system, and you know you're setting its origin "on the same side of the warpzones" as me

Definition at line 838 of file common.qc.

839{
840 entity e = spawn();
842 return e;
843}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define spawn
void WarpZone_RefSys_Copy(entity me, entity from)
Copies the warpzone reference of from onto me.
Definition common.qc:824

References entity(), spawn, and WarpZone_RefSys_Copy().

◆ WarpZone_RefSys_TransformAngles()

vector WarpZone_RefSys_TransformAngles ( entity from,
entity to,
vector ang )

Transform angle ang in from's reference into to's reference.

Definition at line 805 of file common.qc.

806{
807 if (from.WarpZone_refsys)
808 ang = WarpZone_UnTransformAngles(from.WarpZone_refsys, ang);
809 if (to.WarpZone_refsys)
810 ang = WarpZone_TransformAngles(to.WarpZone_refsys, ang);
811 return ang;
812}
vector WarpZone_UnTransformAngles(entity wz, vector ang)
Transforms angle ang backwards through warpzone wz, as the inverse of WarpZone_TransformAngles.
Definition common.qc:536
vector WarpZone_TransformAngles(entity wz, vector ang)
Transforms angle v across warpzone wz.
Definition common.qc:500
vector vector ang
Definition self.qh:96

References ang, entity(), vector, WarpZone_TransformAngles(), and WarpZone_UnTransformAngles().

Referenced by nade_translocate_boom().

◆ WarpZone_RefSys_TransformOrigin()

vector WarpZone_RefSys_TransformOrigin ( entity from,
entity to,
vector org )

Transform origin org in from's reference into to's reference.

E.g., WarpZone_RefSys_TransformOrigin(receiver, flag, receiver.origin + receiver.view_ofs): Returns receiver's view origin as seen by flag

Definition at line 787 of file common.qc.

788{
789 if (from.WarpZone_refsys)
790 org = WarpZone_UnTransformOrigin(from.WarpZone_refsys, org);
791 if (to.WarpZone_refsys)
792 org = WarpZone_TransformOrigin(to.WarpZone_refsys, org);
793 return org;
794}
vector WarpZone_UnTransformOrigin(entity wz, vector org)
Transforms origin org backwards through warpzone wz, as the inverse of WarpZone_TransformOrigin.
Definition common.qc:526
vector WarpZone_TransformOrigin(entity wz, vector org)
Transforms origin org across warpzone wz.
Definition common.qc:489

References entity(), org, vector, WarpZone_TransformOrigin(), and WarpZone_UnTransformOrigin().

Referenced by ctf_FlagThink(), ctf_Handle_Throw(), GrapplingHookThink(), Monster_Enemy_Check(), Monster_Move_Target(), MUTATOR_HOOKFUNCTION(), W_Crylink_LinkJoin(), W_Devastator_RemoteExplode(), W_Devastator_Think(), W_Fireball_Explode(), W_Fireball_Firemine_Think(), W_Nexball_Think(), and W_SeekOutEnemy().

◆ WarpZone_RefSys_TransformVAngles()

vector WarpZone_RefSys_TransformVAngles ( entity from,
entity to,
vector ang )

Transform v_angle ang in from's reference into to's reference.

Definition at line 814 of file common.qc.

815{
816 if (from.WarpZone_refsys)
817 ang = WarpZone_UnTransformVAngles(from.WarpZone_refsys, ang);
818 if (to.WarpZone_refsys)
819 ang = WarpZone_TransformVAngles(to.WarpZone_refsys, ang);
820 return ang;
821}
vector WarpZone_UnTransformVAngles(entity wz, vector ang)
Transforms v_angle ang backwards through warpzone wz, as the inverse of WarpZone_TransformVAngles.
Definition common.qc:541
vector WarpZone_TransformVAngles(entity wz, vector ang)
Transforms v_angle ang across warpzone wz.
Definition common.qc:505

References ang, entity(), vector, WarpZone_TransformVAngles(), and WarpZone_UnTransformVAngles().

◆ WarpZone_RefSys_TransformVelocity()

vector WarpZone_RefSys_TransformVelocity ( entity from,
entity to,
vector vel )

Transform velocity vel in from's reference into to's reference.

Definition at line 796 of file common.qc.

797{
798 if (from.WarpZone_refsys)
799 vel = WarpZone_UnTransformVelocity(from.WarpZone_refsys, vel);
800 if (to.WarpZone_refsys)
801 vel = WarpZone_TransformVelocity(to.WarpZone_refsys, vel);
802 return vel;
803}
vector WarpZone_UnTransformVelocity(entity wz, vector vel)
Transforms angle vel backwards through warpzone wz, as the inverse of WarpZone_TransformVelocity.
Definition common.qc:531
vector WarpZone_TransformVelocity(entity wz, vector vel)
Transforms velocity v across warpzone wz.
Definition common.qc:495

References entity(), vector, WarpZone_TransformVelocity(), and WarpZone_UnTransformVelocity().

Referenced by GrapplingHookThink(), nade_translocate_boom(), W_Crylink_LinkJoin(), and W_Devastator_Think().

◆ WarpZone_SearchInRadius()

entity WarpZone_SearchInRadius ( vector org,
float radius,
float nomonsters,
WarpZone_FindRadius_cond_callback_t cb )

Modified findradius aware of warpzones, that only includes entities that meet the "cb" criteria.

Most useful if lineofsight, when searching with very specific criteria, or over a range likely to contain many entities.

Definition at line 680 of file common.qc.

681{
682 bool nearby_warpzones = false;
683 // use FOREACH_ENTITY_RADIUS if no warpzone is touching the box of side 2 * rad and center org
684 // which includes the sphere of radius rad and center org
686 {
687 vector boxmin = vec3(org.x - rad, org.y - rad, org.z - rad);
688 vector boxmax = vec3(org.x + rad, org.y + rad, org.z + rad);
689 IL_EACH(g_warpzones, boxesoverlap(it.absmin, it.absmax, boxmin, boxmax),
690 {
691 nearby_warpzones = true;
692 break;
693 });
694 }
695
697 if (nearby_warpzones)
698 {
702 _WarpZone_FindRadius_Recurse(org, rad, org, '0 0 0', '0 0 0');
703 FOREACH_LIST(_WarpZone_FindRadius_goodents, chain, true, it.WarpZone_findradius_hit = WarpZone_FindRadius_Hit_UNSEEN);
704 FOREACH_LIST(_WarpZone_FindRadius_badents, WarpZone_findradius_next, true, it.WarpZone_findradius_hit = WarpZone_FindRadius_Hit_UNSEEN);
705 }
706 else // cheaper than _WarpZone_FindRadius_Recurse
708 {
709 vector p = NearestPointOnBoundingBox(it.origin + it.mins, it.origin + it.maxs, org);
710 if (nomonsters != MOVE_NOTHING)
711 {
712 traceline(org, p, nomonsters, it);
713 if (trace_fraction < 1)
714 continue;
715 }
716
717 it.chain = _WarpZone_FindRadius_goodents_first; // fine to use .chain since FOREACH_ENTITY_RADIUS doesn't use it
719 it.WarpZone_findradius_nearest = p;
720 it.WarpZone_findradius_dist = org - p;
721 WarpZone_Accumulator_Clear(it); // reset .warpzone_transform and .warpzone_shift
722 });
723
725}
entity chain
float trace_fraction
#define FOREACH_LIST(list, next, cond, body)
Definition iter.qh:21
#define FOREACH_ENTITY_RADIUS(org, dist, cond, body)
Definition iter.qh:160
entity WarpZone_findradius_next
Definition common.qc:604
void WarpZone_Accumulator_Clear(entity acc)
Definition common.qc:11
void _WarpZone_FindRadius_Recurse(vector org, float rad, vector org0, vector transform, vector shift)
Definition common.qc:605
entity _WarpZone_FindRadius_badents_first
Definition common.qc:601
bool WarpZoneLib_BadEntity(entity e, WarpZone_FindRadius_cond_callback_t cb)
Blacklist of entities that WarpZone_FindRadius doesn't care about.
Definition common.qc:568
entity _WarpZone_FindRadius_goodents_first
Definition common.qc:600
var WarpZone_FindRadius_cond_callback_t _WarpZone_FindRadius_cond_cb
Definition common.qc:603
float _WarpZone_FindRadius_nomonsters
Definition common.qc:602
const int WarpZone_FindRadius_Hit_UNSEEN
Definition common.qc:564
vector
Definition self.qh:96
ERASEABLE vector NearestPointOnBoundingBox(vector mi, vector ma, vector org)
Definition vector.qh:200
ERASEABLE float boxesoverlap(vector m1, vector m2, vector m3, vector m4)
Requires that m2>m1 in all coordinates, and that m4>m3.
Definition vector.qh:72
#define vec3(_x, _y, _z)
Definition vector.qh:100

References _WarpZone_FindRadius_badents_first, _WarpZone_FindRadius_cond_cb, _WarpZone_FindRadius_goodents_first, _WarpZone_FindRadius_nomonsters, _WarpZone_FindRadius_Recurse(), boxesoverlap(), chain, entity(), FOREACH_ENTITY_RADIUS, FOREACH_LIST, g_warpzones, IL_EACH, MOVE_NOTHING, NearestPointOnBoundingBox(), NULL, org, trace_fraction, vec3, vector, WarpZone_Accumulator_Clear(), WarpZone_FindRadius_Hit_UNSEEN, WarpZone_findradius_next, warpzone_warpzones_exist, and WarpZoneLib_BadEntity().

Referenced by M_Golem_Attack_Lightning_Explode(), M_Mage_Defend_Heal(), M_Spider_Attack_Web_Explode(), M_Wyvern_Attack_Fireball_Explode(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), nade_darkness_think(), nade_ice_think(), PlayerFrame(), PlayerUseKey(), RadiusDamageForSource(), setItemGroup(), turret_tesla_toast(), W_Crylink_Touch_WouldHitFriendly(), W_Devastator_DoRemoteExplode(), W_Electro_Bolt_Think(), W_Electro_TriggerCombo(), W_Fireball_Explode(), W_LaserPlay(), W_MineLayer_ProximityExplode(), W_MineLayer_RemoteExplode(), W_MineLayer_Think(), and walker_melee_do_dmg().

◆ WarpZone_SetUp()

void WarpZone_SetUp ( entity e,
vector my_org,
vector my_ang,
vector other_org,
vector other_ang )

Definition at line 56 of file common.qc.

57{
58 e.warpzone_transform = AnglesTransform_RightDivide(other_ang, AnglesTransform_TurnDirectionFR(my_ang));
59 e.warpzone_shift = AnglesTransform_PrePostShift_GetPostShift(my_org, e.warpzone_transform, other_org);
60 e.warpzone_origin = my_org;
61 e.warpzone_targetorigin = other_org;
62 e.warpzone_angles = my_ang;
63 e.warpzone_targetangles = other_ang;
64 vector forward, right, up;
65 FIXED_MAKE_VECTORS(my_ang, forward, right, up);
66 e.warpzone_forward = forward;
67 FIXED_MAKE_VECTORS(other_ang, forward, right, up);
68 e.warpzone_targetforward = forward;
70}
vector AnglesTransform_TurnDirectionFR(vector transform)
vector AnglesTransform_RightDivide(vector to_transform, vector from_transform)
vector AnglesTransform_PrePostShift_GetPostShift(vector sf, vector t, vector st)
#define FIXED_MAKE_VECTORS(angles, forward, right, up)
vector WarpZone_camera_transform(entity this, vector org, vector ang)
Definition common.qc:35

References AnglesTransform_PrePostShift_GetPostShift(), AnglesTransform_RightDivide(), AnglesTransform_TurnDirectionFR(), entity(), FIXED_MAKE_VECTORS, setcamera_transform, vector, and WarpZone_camera_transform().

Referenced by NET_HANDLE(), and WarpZone_InitStep_FinalizeTransform().

◆ WarpZone_TargetPlaneDist()

float WarpZone_TargetPlaneDist ( entity wz,
vector v )

Definition at line 483 of file common.qc.

484{
485 return (p - wz.warpzone_targetorigin) * wz.warpzone_targetforward;
486}

References entity(), and vector.

Referenced by WarpZone_Teleport().

◆ WarpZone_TraceBox_ThroughZone()

void WarpZone_TraceBox_ThroughZone ( vector org,
vector mi,
vector ma,
vector end,
float nomonsters,
entity forent,
entity zone,
WarpZone_trace_callback_t cb )

Traces a box from org to end, shifting & transforming each time it goes through a warpzone.

Hence it only ends at end if it didn't hit something along the way AND it went through no warpzones

Definition at line 183 of file common.qc.

184{
185 WarpZone_trace_forent = forent;
189
190 bool nearby_warpzones = false;
191 // use tracebox if no warpzone is touching the box the entity would be traced through
193 {
194 vector boxmin = mi;
195 vector boxmax = ma;
196 #define CHOOSE_AXIS(axis) \
197 if (org.axis < end.axis) { boxmin.axis += org.axis; boxmax.axis += end.axis; } \
198 else { boxmin.axis += end.axis; boxmax.axis += org.axis; }
199 CHOOSE_AXIS(x);
200 CHOOSE_AXIS(y);
201 CHOOSE_AXIS(z);
202 #undef CHOOSE_AXIS
203 /* Above is equivalent to the following, but more efficient
204 * boxmin += vec_to_min(org, end);
205 * boxmax += vec_to_max(org, end);
206 */
207 IL_EACH(g_warpzones, boxesoverlap(it.absmin, it.absmax, boxmin, boxmax),
208 {
209 nearby_warpzones = true;
210 break;
211 });
212 }
213 if (!nearby_warpzones)
214 {
215 if (nomonsters == MOVE_NOTHING)
216 {
217 trace_endpos = end;
218 trace_fraction = 1;
219 }
220 else
221 tracebox(org, mi, ma, end, nomonsters, WarpZone_trace_forent);
222
223 if (cb)
224 cb(org, trace_endpos, end);
225 return;
226 }
227
228 vector vf = v_forward;
229 vector vr = v_right;
230 vector vu = v_up;
231
232 float nomonsters_adjusted;
233 switch (nomonsters)
234 {
235 case MOVE_WORLDONLY:
236 case MOVE_NOTHING:
237 nomonsters_adjusted = MOVE_NOMONSTERS;
238 break;
239 default:
240 nomonsters_adjusted = nomonsters;
241 break;
242 }
243 bool contents_hack = (WarpZone_trace_forent.dphitcontentsmask && !(WarpZone_trace_forent.dphitcontentsmask & DPCONTENTS_SOLID));
244 if (contents_hack)
246
247 // if starting in warpzone, first transform
248 entity wz = WarpZone_Find(org + mi, org + ma);
249 float sol;
250 if (wz)
251 {
254 if (zone && wz != zone)
255 {
256 // we are in ANOTHER warpzone. This is bad. Make a zero length trace and return.
257 sol = 1;
258 trace_fraction = 0;
260 goto fail;
261 }
264 end = WarpZone_TransformOrigin(wz, end);
265 }
267 sol = -1;
268 float frac = 0;
269 float i = 16;
270 for (;;)
271 {
272 if (--i < 1)
273 {
274 LOG_TRACE("Too many warpzones in sequence, aborting trace.");
275 trace_ent = NULL;
276 break;
277 }
278 tracebox(org, mi, ma, end, nomonsters_adjusted, WarpZone_trace_forent);
279 if (cb)
280 cb(org, trace_endpos, end);
281 if (sol < 0)
282 sol = trace_startsolid;
283
284 frac = trace_fraction = frac + (1 - frac) * trace_fraction;
285 if (trace_fraction >= 1)
286 break;
287 if (trace_ent.classname != "trigger_warpzone")
288 {
289 if (nomonsters == MOVE_NOTHING
290 || (nomonsters == MOVE_WORLDONLY && trace_ent)
291 || (contents_hack && (trace_dphitcontents & WarpZone_trace_forent.dphitcontentsmask) == DPCONTENTS_SOLID))
292 {
293 // continue the trace, ignoring this hit (we only care for warpzones)
294 org = trace_endpos + normalize(end - org);
295 continue;
296 // we cannot do an inverted trace here, as we do care for further warpzones inside that "solid" to be found
297 // otherwise, players could block entrances that way
298 }
299 break;
300 }
301 /*if (trace_ent == wz)
302 {
303 // FIXME can this check be removed? Do we really need it?
304 LOG_TRACE("I transformed into the same zone again, wtf, aborting the trace");
305 trace_ent = NULL;
306 break;
307 }*/
308 wz = trace_ent;
312 if (zone && wz != zone)
313 break;
315 // we hit a warpzone... so, let's perform the trace after the warp again
317 end = WarpZone_TransformOrigin(wz, end);
318
319 // we got warped, so let's step back a bit
320 tracebox(org, mi, ma, org + normalize(org - end) * 32, nomonsters_adjusted, WarpZone_trace_forent);
322 }
324LABEL(fail)
325 if (contents_hack)
327 trace_startsolid = sol;
328 v_forward = vf;
329 v_right = vr;
330 v_up = vu;
331}
#define LABEL(id)
Definition compiler.qh:34
vector v_up
const float MOVE_NOMONSTERS
float trace_dphitcontents
entity trace_ent
float DPCONTENTS_SOLID
vector v_right
vector trace_endpos
float trace_startsolid
float MOVE_WORLDONLY
vector v_forward
v y
Definition ent_cs.qc:146
v z
Definition ent_cs.qc:146
v x
Definition ent_cs.qc:146
entity WarpZone_Find(vector mi, vector ma)
Definition common.qc:152
void WarpZone_Trace_InitTransform()
Definition common.qc:172
#define WarpZone_Trace_AddTransform(wz)
Definition common.qc:178
void WarpZone_MakeAllOther()
Definition common.qc:166
void WarpZone_MakeAllSolid()
Definition common.qc:160
#define CHOOSE_AXIS(axis)
entity WarpZone_trace_firstzone
First warpzone hit by a trace (can differ from the requested zone in case of _ThroughZone,...
Definition common.qh:41
#define BITSET_ASSIGN(a, b)
Definition common.qh:122
#define BITCLR_ASSIGN(a, b)
Definition common.qh:119
entity WarpZone_trace_lastzone
First warpzone hit by a trace (can differ from the requested zone in case of _ThroughZone,...
Definition common.qh:42
entity WarpZone_trace_forent
Temp, callback is allowed to change it.
Definition common.qh:36
#define LOG_TRACE(...)
Definition log.qh:74
vector normalize(vector v)

References BITCLR_ASSIGN, BITSET_ASSIGN, boxesoverlap(), CHOOSE_AXIS, DPCONTENTS_SOLID, entity(), g_warpzones, IL_EACH, LABEL, LOG_TRACE, MOVE_NOMONSTERS, MOVE_NOTHING, MOVE_WORLDONLY, normalize(), NULL, org, trace_dphitcontents, trace_endpos, trace_ent, trace_fraction, trace_startsolid, v_forward, v_right, v_up, vector, WarpZone_Find(), WarpZone_MakeAllOther(), WarpZone_MakeAllSolid(), WarpZone_Trace_AddTransform, WarpZone_trace_firstzone, WarpZone_trace_forent, WarpZone_Trace_InitTransform(), WarpZone_trace_lastzone, WarpZone_TransformOrigin(), warpzone_warpzones_exist, x, y, and z.

Referenced by tracebox_antilag_force_wz().

◆ WarpZone_TraceToss_ThroughZone()

void WarpZone_TraceToss_ThroughZone ( entity e,
entity forent,
entity zone,
WarpZone_trace_callback_t cb )

Traces tossing e, shifting & transforming each time it goes through a warpzone.

Definition at line 334 of file common.qc.

335{
336 vector o0 = e.origin;
337 vector v0 = e.velocity;
338 float dt, i, g = PHYS_GRAVITY(NULL) * e.gravity;
339
340 WarpZone_trace_forent = forent;
346 {
347 tracetoss(e, WarpZone_trace_forent);
348 if (cb)
349 cb(e.origin, trace_endpos, trace_endpos);
350 dt = sqrt(vlen2(e.origin - o0) / vlen2(e.velocity));
352 e.velocity.z -= dt * g;
353 WarpZone_tracetoss_velocity = e.velocity;
354 e.velocity = v0;
355 return;
356 }
357
358 vector vf = v_forward;
359 vector vr = v_right;
360 vector vu = v_up;
361
362 // if starting in warpzone, first transform
363 entity wz = WarpZone_Find(e.origin + e.mins, e.origin + e.maxs);
364 if (wz)
365 {
368 if (zone && wz != zone)
369 {
370 // we are in ANOTHER warpzone. This is bad. Make a zero length trace and return.
371
373 trace_endpos = o0;
374 goto fail;
375 }
377 vector org = WarpZone_TransformOrigin(wz, e.origin);
378 setorigin(e, org);
379 e.velocity = WarpZone_TransformVelocity(wz, e.velocity);
380 }
382 i = 16;
383 for (;;)
384 {
385 if (--i < 1)
386 {
387 LOG_TRACE("Too many warpzones in sequence, aborting trace.");
388 trace_ent = NULL;
389 break;
390 }
391 tracetoss(e, WarpZone_trace_forent);
392 if (cb)
393 cb(e.origin, trace_endpos, trace_endpos);
394 dt = sqrt(vlen2(trace_endpos - e.origin) / vlen2(e.velocity));
396 e.origin = trace_endpos;
397 e.velocity.z -= dt * g;
398 if (trace_fraction >= 1)
399 break;
400 if (trace_ent.classname != "trigger_warpzone")
401 break;
402 if (trace_ent == wz)
403 {
404 // FIXME can this check be removed? Do we really need it?
405 LOG_TRACE("I transformed into the same zone again, wtf, aborting the trace");
406 trace_ent = NULL;
407 break;
408 }
409 wz = trace_ent;
413 if (zone && wz != zone)
414 break;
416 // we hit a warpzone... so, let's perform the trace after the warp again
417 e.origin = WarpZone_TransformOrigin(wz, e.origin);
418 e.velocity = WarpZone_TransformVelocity(wz, e.velocity);
419
420 // we got warped, so let's step back a bit
421 e.velocity = -e.velocity;
422 tracetoss(e, WarpZone_trace_forent);
423 dt = sqrt(vlen2(trace_endpos - e.origin) / vlen2(e.velocity));
425 e.origin = trace_endpos;
426 e.velocity = -e.velocity;
427 }
429LABEL(fail)
430 WarpZone_tracetoss_velocity = e.velocity;
431 v_forward = vf;
432 v_right = vr;
433 v_up = vu;
434 // restore old entity data (caller just uses trace_endpos, WarpZone_tracetoss_velocity and the transform)
435 e.velocity = v0;
436 e.origin = o0;
437}
vector WarpZone_tracetoss_velocity
Ending velocity of a tracetoss (post-transform).
Definition common.qh:43
float WarpZone_tracetoss_time
Duration of toss (approximate).
Definition common.qh:44
float sqrt(float f)
#define PHYS_GRAVITY(s)
Definition movetypes.qh:54
#define vlen2(v)
Definition vector.qh:4

References entity(), LABEL, LOG_TRACE, NULL, org, PHYS_GRAVITY, sqrt(), trace_endpos, trace_ent, trace_fraction, v_forward, v_right, v_up, vector, vlen2, WarpZone_Find(), WarpZone_MakeAllOther(), WarpZone_MakeAllSolid(), WarpZone_Trace_AddTransform, WarpZone_trace_firstzone, WarpZone_trace_forent, WarpZone_Trace_InitTransform(), WarpZone_trace_lastzone, WarpZone_tracetoss_time, WarpZone_tracetoss_velocity, WarpZone_TransformOrigin(), WarpZone_TransformVelocity(), and warpzone_warpzones_exist.

◆ WarpZone_TrailParticles()

void WarpZone_TrailParticles ( entity own,
float eff,
vector org,
vector end )

Definition at line 446 of file common.qc.

447{
451}
entity WarpZone_TrailParticles_trace_callback_own
Definition common.qc:439
void WarpZone_TrailParticles_trace_callback(vector from, vector endpos, vector to)
Definition common.qc:441
float WarpZone_TrailParticles_trace_callback_eff
Definition common.qc:440
#define WarpZone_TraceLine_ThroughZone(org, end, nomonsters, forent, zone, cb)
Definition common.qh:47

References entity(), MOVE_NOMONSTERS, NULL, org, vector, WarpZone_TraceLine_ThroughZone, WarpZone_TrailParticles_trace_callback(), WarpZone_TrailParticles_trace_callback_eff, and WarpZone_TrailParticles_trace_callback_own.

Referenced by CheatCommand(), and ctf_Handle_Throw().

◆ WarpZone_TrailParticles_WithMultiplier()

void WarpZone_TrailParticles_WithMultiplier ( entity own,
float eff,
vector org,
vector end,
float f,
float boxflags )

References entity(), org, and vector.

◆ WarpZone_TransformAngles()

vector WarpZone_TransformAngles ( entity wz,
vector v )

Transforms angle v across warpzone wz.

Definition at line 500 of file common.qc.

501{
502 return AnglesTransform_ApplyToAngles(wz.warpzone_transform, ang);
503}
vector AnglesTransform_ApplyToAngles(vector transform, vector v)

References ang, AnglesTransform_ApplyToAngles(), entity(), and vector.

Referenced by WarpZone_RefSys_TransformAngles(), and WarpZone_Teleport().

◆ WarpZone_TransformOrigin()

vector WarpZone_TransformOrigin ( entity wz,
vector org )

Transforms origin org across warpzone wz.

For example, this'd give you the origin a projectile will have after it crosses the warpzone

Definition at line 489 of file common.qc.

490{
491 return wz.warpzone_shift + AnglesTransform_Apply(wz.warpzone_transform, org);
492}
vector AnglesTransform_Apply(vector transform, vector v)
angles transforms angles in fixedmakevectors/fixedvectoangles space

References AnglesTransform_Apply(), entity(), org, and vector.

Referenced by CheatCommand(), Draw_ArcBeam(), Draw_ArcBeam_callback(), Draw_GrapplingHook(), Draw_GrapplingHook_trace_callback(), Draw_VaporizerBeam_trace_callback(), fireBullet_falloff(), W_Arc_Beam_Think(), W_Fireball_Explode(), W_OverkillRocketPropelledChainsaw_Think(), WarpZone_camera_transform(), WarpZone_FixPMove(), WarpZone_FixView(), WarpZone_RefSys_TransformOrigin(), WarpZone_Teleport(), WarpZone_TraceBox_ThroughZone(), and WarpZone_TraceToss_ThroughZone().

◆ WarpZone_TransformVAngles()

vector WarpZone_TransformVAngles ( entity wz,
vector v )

Transforms v_angle ang across warpzone wz.

Definition at line 505 of file common.qc.

506{
507#ifdef KEEP_ROLL
508 float roll = ang.z;
509 ang.z = 0;
510#endif
511
512 ang = AnglesTransform_ApplyToVAngles(wz.warpzone_transform, ang);
513#ifdef KEEP_ROLL
516 ang.z = roll;
517#else
519#endif
520 return ang;
521}
vector AnglesTransform_ApplyToVAngles(vector transform, vector v)
vector AnglesTransform_CancelRoll(vector t)
vector AnglesTransform_Normalize(vector t, float minimize_roll)

References ang, AnglesTransform_ApplyToVAngles(), AnglesTransform_CancelRoll(), AnglesTransform_Normalize(), entity(), and vector.

Referenced by NET_HANDLE(), sandbox_ObjectSpawn(), View_EventChase(), WarpZone_FixPMove(), WarpZone_FixView(), WarpZone_PlayerPhysics_FixVAngle(), WarpZone_RefSys_TransformVAngles(), and WarpZone_Teleport().

◆ WarpZone_TransformVelocity()

vector WarpZone_TransformVelocity ( entity wz,
vector vel )

Transforms velocity v across warpzone wz.

For example, this can give you the updated v_forward after crossing the warpzone

Definition at line 495 of file common.qc.

496{
497 return AnglesTransform_Apply(wz.warpzone_transform, vel);
498}

References AnglesTransform_Apply(), entity(), and vector.

Referenced by Draw_ArcBeam(), fireBullet_falloff(), FireImoBeam(), FireRailgunBullet(), W_Arc_Beam_Think(), W_Shotgun_Melee_Think(), walker_melee_do_dmg(), WarpZone_camera_transform(), WarpZone_RefSys_TransformVelocity(), WarpZone_Teleport(), and WarpZone_TraceToss_ThroughZone().

◆ WarpZone_UnTransformAngles()

vector WarpZone_UnTransformAngles ( entity wz,
vector v )

Transforms angle ang backwards through warpzone wz, as the inverse of WarpZone_TransformAngles.

Definition at line 536 of file common.qc.

537{
538 return AnglesTransform_ApplyToAngles(AnglesTransform_Invert(wz.warpzone_transform), ang);
539}
vector AnglesTransform_Invert(vector transform)

References ang, AnglesTransform_ApplyToAngles(), AnglesTransform_Invert(), entity(), and vector.

Referenced by WarpZone_RefSys_TransformAngles().

◆ WarpZone_UnTransformOrigin()

vector WarpZone_UnTransformOrigin ( entity wz,
vector org )

Transforms origin org backwards through warpzone wz, as the inverse of WarpZone_TransformOrigin.

E.g., WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos): Returns the endpoint of a warpzone-aware trace, as if the trace had never gone through warpzones

Definition at line 526 of file common.qc.

527{
528 return AnglesTransform_Apply(AnglesTransform_Invert(wz.warpzone_transform), org - wz.warpzone_shift);
529}

References AnglesTransform_Apply(), AnglesTransform_Invert(), entity(), org, and vector.

Referenced by beam_think(), ctf_CalculatePassVelocity(), Draw_ArcBeam(), Draw_ArcBeam_callback(), fireBullet_falloff(), FireImoBeam(), FireRailgunBullet(), M_Golem_Attack_Lightning_Explode(), MUTATOR_HOOKFUNCTION(), PlayerUseKey(), RadiusDamageForSource(), sandbox_ObjectEdit_Get(), SendCSQCVaporizerBeamParticle(), SendCSQCVortexBeamParticle(), turret_tesla_toast(), W_Arc_Beam_Think(), W_LaserPlay(), W_SeekOutEnemy(), W_SetupShot_Dir_ProjectileSize_Range(), W_Vaporizer_Attack(), W_Vortex_Attack(), and WarpZone_RefSys_TransformOrigin().

◆ WarpZone_UnTransformVAngles()

vector WarpZone_UnTransformVAngles ( entity wz,
vector v )

Transforms v_angle ang backwards through warpzone wz, as the inverse of WarpZone_TransformVAngles.

Definition at line 541 of file common.qc.

542{
543#ifdef KEEP_ROLL
544 float roll = ang.z;
545 ang.z = 0;
546#endif
547
549#ifdef KEEP_ROLL
552 ang.z = roll;
553#else
555#endif
556 return ang;
557}

References ang, AnglesTransform_ApplyToVAngles(), AnglesTransform_CancelRoll(), AnglesTransform_Invert(), AnglesTransform_Normalize(), entity(), and vector.

Referenced by WarpZone_RefSys_TransformVAngles().

◆ WarpZone_UnTransformVelocity()

vector WarpZone_UnTransformVelocity ( entity wz,
vector v )

Transforms angle vel backwards through warpzone wz, as the inverse of WarpZone_TransformVelocity.

Definition at line 531 of file common.qc.

532{
533 return AnglesTransform_Apply(AnglesTransform_Invert(wz.warpzone_transform), vel);
534}

References AnglesTransform_Apply(), AnglesTransform_Invert(), entity(), and vector.

Referenced by WarpZone_RefSys_TransformVelocity().

◆ WarpZoneLib_BoxTouchesBrush()

float WarpZoneLib_BoxTouchesBrush ( vector mi,
vector ma,
entity e,
entity ig )

Definition at line 120 of file common.qc.

121{
122 // bones_was_here: TODO: when findbox_OrFallback() is available, use it to
123 // optimise this into a single non-recursive function that only calls tracebox once
124
125 if (!e.modelindex || e.warpzone_isboxy)
126 return 1;
127
128 // work around trigger_hurt on geit3ctf1 not being detected by tracebox
129 // bones_was_here: FIXME: WHY do these triggers only have supercontents == 128 ?!
130 if (Q3COMPAT_COMMON && ig != world)
131 ig.dphitcontentsmask |= 128;
132
133 float s = e.solid;
134 if (e.solid != SOLID_BSP)
135 {
136 e.solid = SOLID_BSP;
137 setorigin(e, e.origin); // update linking
138 }
139 float f = WarpZoneLib_BoxTouchesBrush_Recurse(mi, ma, e, ig);
140 if (e.solid != s) // if we needed to change .solid temporarily
141 {
142 e.solid = s; // restore it
143 setorigin(e, e.origin); // update linking
144 }
145
146 if (Q3COMPAT_COMMON && ig != world)
147 ig.dphitcontentsmask &= ~128;
148
149 return f;
150}
#define Q3COMPAT_COMMON
Definition stats.qh:370
float WarpZoneLib_BoxTouchesBrush_Recurse(vector mi, vector ma, entity e, entity ig)
Definition common.qc:92
#define world
Definition post.qh:15

References entity(), Q3COMPAT_COMMON, SOLID_BSP, vector, WarpZoneLib_BoxTouchesBrush_Recurse(), and world.

Referenced by havocbot_moveto(), Teleport_Find(), WarpZone_Find(), and WarpZoneLib_ExactTrigger_Touch().

◆ WarpZoneLib_ExactTrigger_Touch()

bool WarpZoneLib_ExactTrigger_Touch ( entity this,
entity toucher,
bool touchfunc )

Definition at line 845 of file common.qc.

846{
847 vector emin = toucher.absmin, emax = toucher.absmax;
848 if (!Q3COMPAT_COMMON)
849 {
850 // Xonotic and Nexuiz maps assume triggers will be activated by adjacent players
851 // prior to sv_legacy_bbox_expand 0 DP always did this for SVQC and never for CSQC
852 emin -= '1 1 1';
853 emax += '1 1 1';
854 }
855
856 // if called from a touch func, we can assume the boxes do overlap
857 if (!touchfunc && !boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
858 return false;
859
860 return WarpZoneLib_BoxTouchesBrush(emin, emax, this, toucher); // accurate
861}
vector absmax
vector absmin
entity entity toucher
Definition self.qh:76

References absmax, absmin, boxesoverlap(), entity(), Q3COMPAT_COMMON, toucher, vector, and WarpZoneLib_BoxTouchesBrush().

Referenced by conveyor_think(), func_ladder_think(), SV_PlayerPhysics(), swamp_think(), viewloc_think(), and WarpZone_StartFrame().

◆ WarpZoneLib_MoveOutOfSolid()

int WarpZoneLib_MoveOutOfSolid ( entity e)

Definition at line 875 of file common.qc.

876{
877 vector o = e.origin;
878 traceline(o, o, MOVE_WORLDONLY, e);
880 return 0; // too stuck, giving up
881
882 tracebox(o, e.mins, e.maxs, o, MOVE_WORLDONLY, e);
883 if (!trace_startsolid)
884 return -1; // wasn't stuck
885
886 vector m0 = e.mins;
887 vector m1 = e.maxs;
888 e.mins = '0 0 0';
889 e.maxs = '0 0 0';
890 WarpZoneLib_MoveOutOfSolid_Expand(e, eX * m0.x); e.mins.x = m0.x;
891 WarpZoneLib_MoveOutOfSolid_Expand(e, eX * m1.x); e.maxs.x = m1.x;
892 WarpZoneLib_MoveOutOfSolid_Expand(e, eY * m0.y); e.mins.y = m0.y;
893 WarpZoneLib_MoveOutOfSolid_Expand(e, eY * m1.y); e.maxs.y = m1.y;
894 WarpZoneLib_MoveOutOfSolid_Expand(e, eZ * m0.z); e.mins.z = m0.z;
895 WarpZoneLib_MoveOutOfSolid_Expand(e, eZ * m1.z); e.maxs.z = m1.z;
896 setorigin(e, e.origin);
897
898 tracebox(e.origin, e.mins, e.maxs, e.origin, MOVE_WORLDONLY, e);
900 {
901 setorigin(e, o);
902 return 0; // can't fix
903 }
904
905 return 1; // was stuck but is fixed now
906}
void WarpZoneLib_MoveOutOfSolid_Expand(entity e, vector by)
Definition common.qc:864
const vector eY
Definition vector.qh:44
const vector eZ
Definition vector.qh:45
const vector eX
Definition vector.qh:43

References entity(), eX, eY, eZ, MOVE_WORLDONLY, trace_startsolid, vector, and WarpZoneLib_MoveOutOfSolid_Expand().

Referenced by CheckEngineExtensions(), and WarpZone_Teleport().

Variable Documentation

◆ g_warpzones

◆ te_csqc_trace_callback

WarpZone_trace_callback_t te_csqc_trace_callback

Definition at line 38 of file common.qh.

Referenced by M_Golem_Attack_Lightning_Explode(), and turret_tesla_toast().

◆ warpzone_angles

◆ warpzone_cameras_exist

float warpzone_cameras_exist

Definition at line 13 of file common.qh.

Referenced by NET_HANDLE(), and WarpZoneCamera_InitStep_FindTarget().

◆ warpzone_fadeend

◆ warpzone_fadestart

◆ WarpZone_findradius_dist

vector WarpZone_findradius_dist

Definition at line 62 of file common.qh.

◆ WarpZone_findradius_nearest

vector WarpZone_findradius_nearest

Definition at line 63 of file common.qh.

◆ warpzone_forward

vector warpzone_forward

Definition at line 20 of file common.qh.

◆ warpzone_isboxy

float warpzone_isboxy

◆ warpzone_origin

◆ WarpZone_SearchInRadius_otherent

◆ warpzone_shift

vector warpzone_shift

Both a warpzone property, and set on entities found by WarpZone_SearchInRadius.

Definition at line 17 of file common.qh.

◆ warpzone_targetangles

vector warpzone_targetangles

Definition at line 22 of file common.qh.

Referenced by WarpZone_Send().

◆ warpzone_targetforward

vector warpzone_targetforward

Definition at line 23 of file common.qh.

◆ warpzone_targetorigin

vector warpzone_targetorigin

Definition at line 21 of file common.qh.

Referenced by WarpZone_camera_transform(), and WarpZone_Send().

◆ WarpZone_trace_firstzone

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).

Definition at line 41 of file common.qh.

Referenced by FireImoBeam(), FireRailgunBullet(), WarpZone_TraceBox_ThroughZone(), and WarpZone_TraceToss_ThroughZone().

◆ WarpZone_trace_forent

entity WarpZone_trace_forent

Temp, callback is allowed to change it.

Definition at line 36 of file common.qh.

Referenced by fireBullet_falloff(), fireBullet_trace_callback(), WarpZone_TraceBox_ThroughZone(), and WarpZone_TraceToss_ThroughZone().

◆ WarpZone_trace_lastzone

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).

Definition at line 42 of file common.qh.

Referenced by WarpZone_TraceBox_ThroughZone(), and WarpZone_TraceToss_ThroughZone().

◆ WarpZone_trace_transform

◆ WarpZone_tracetoss_time

float WarpZone_tracetoss_time

Duration of toss (approximate).

Definition at line 44 of file common.qh.

Referenced by WarpZone_TraceToss_ThroughZone().

◆ WarpZone_tracetoss_velocity

vector WarpZone_tracetoss_velocity

Ending velocity of a tracetoss (post-transform).

Definition at line 43 of file common.qh.

Referenced by WarpZone_TraceToss_ThroughZone().

◆ warpzone_transform

vector warpzone_transform

Both a warpzone property, and set on entities found by WarpZone_SearchInRadius.

Definition at line 16 of file common.qh.

Referenced by NET_HANDLE().

◆ warpzone_warpzones_exist