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:684
#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:187
#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:338

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 89 of file common.qc.

90{
91 e.warpzone_origin = my_org;
92 e.warpzone_angles = my_ang;
94}
vector WarpZone_Camera_camera_transform(entity this, vector org, vector ang)
Definition common.qc:76
#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 156 of file common.qc.

157{
158 // if we are near any warpzone planes - MOVE AWAY (work around nearclip)
160 IL_EACH(g_warpzones, WarpZoneLib_BoxTouchesBrush(mi, ma, it, NULL), return it);
161 return NULL;
162}
#define IL_EACH(this, cond, body)
float WarpZoneLib_BoxTouchesBrush(vector mi, vector ma, entity e, entity ig)
Definition common.qc:124
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 170 of file common.qc.

171{
173 IL_EACH(g_warpzones, true, it.solid = SOLID_TRIGGER);
174}
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 164 of file common.qc.

165{
167 IL_EACH(g_warpzones, true, it.solid = SOLID_BSP);
168}
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 482 of file common.qc.

483{
484 return (p - wz.warpzone_origin) * wz.warpzone_forward;
485}

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 772 of file common.qc.

773{
774 //vector t, s;
775 if (me.WarpZone_refsys_incremental_transform == ref.WarpZone_refsys.warpzone_transform
776 && me.WarpZone_refsys_incremental_shift == ref.WarpZone_refsys.warpzone_shift)
777 return;
778 WarpZone_Accumulator_AddInverseTransform(me.WarpZone_refsys, me.WarpZone_refsys_incremental_transform, me.WarpZone_refsys_incremental_shift);
779 WarpZone_Accumulator_Add(me.WarpZone_refsys, ref.WarpZone_refsys);
780 me.WarpZone_refsys_incremental_shift = ref.WarpZone_refsys.warpzone_shift;
781 me.WarpZone_refsys_incremental_transform = ref.WarpZone_refsys.warpzone_transform;
782}
#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 763 of file common.qc.

764{
765 if (t == '0 0 0' && s == '0 0 0')
766 return;
768 WarpZone_Accumulator_AddInverseTransform(me.WarpZone_refsys, t, s);
769}
void WarpZone_RefSys_CheckCreate(entity me)
Definition common.qc:741

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 756 of file common.qc.

757{
758 if (t == '0 0 0' && s == '0 0 0')
759 return;
761 WarpZone_Accumulator_AddTransform(me.WarpZone_refsys, t, s);
762}
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 783 of file common.qc.

784{
785 me.WarpZone_refsys_incremental_shift = ref.WarpZone_refsys.warpzone_shift;
786 me.WarpZone_refsys_incremental_transform = ref.WarpZone_refsys.warpzone_transform;
787}

References entity().

Referenced by GrapplingHookTouch().

◆ WarpZone_RefSys_Clear()

void WarpZone_RefSys_Clear ( entity me)

Definition at line 749 of file common.qc.

750{
751 if (!me.WarpZone_refsys)
752 return;
753 delete(me.WarpZone_refsys);
754 me.WarpZone_refsys = NULL;
755}

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 828 of file common.qc.

829{
830 if (from.WarpZone_refsys)
831 {
833 me.WarpZone_refsys.warpzone_shift = from.WarpZone_refsys.warpzone_shift;
834 me.WarpZone_refsys.warpzone_transform = from.WarpZone_refsys.warpzone_transform;
835 }
836 else
838}
void WarpZone_RefSys_Clear(entity me)
Definition common.qc:749

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 842 of file common.qc.

843{
844 entity e = spawn();
846 return e;
847}
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:828

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 809 of file common.qc.

810{
811 if (from.WarpZone_refsys)
812 ang = WarpZone_UnTransformAngles(from.WarpZone_refsys, ang);
813 if (to.WarpZone_refsys)
814 ang = WarpZone_TransformAngles(to.WarpZone_refsys, ang);
815 return ang;
816}
vector WarpZone_UnTransformAngles(entity wz, vector ang)
Transforms angle ang backwards through warpzone wz, as the inverse of WarpZone_TransformAngles.
Definition common.qc:540
vector WarpZone_TransformAngles(entity wz, vector ang)
Transforms angle v across warpzone wz.
Definition common.qc:504
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 791 of file common.qc.

792{
793 if (from.WarpZone_refsys)
794 org = WarpZone_UnTransformOrigin(from.WarpZone_refsys, org);
795 if (to.WarpZone_refsys)
796 org = WarpZone_TransformOrigin(to.WarpZone_refsys, org);
797 return org;
798}
vector WarpZone_UnTransformOrigin(entity wz, vector org)
Transforms origin org backwards through warpzone wz, as the inverse of WarpZone_TransformOrigin.
Definition common.qc:530
vector WarpZone_TransformOrigin(entity wz, vector org)
Transforms origin org across warpzone wz.
Definition common.qc:493

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 818 of file common.qc.

819{
820 if (from.WarpZone_refsys)
821 ang = WarpZone_UnTransformVAngles(from.WarpZone_refsys, ang);
822 if (to.WarpZone_refsys)
823 ang = WarpZone_TransformVAngles(to.WarpZone_refsys, ang);
824 return ang;
825}
vector WarpZone_UnTransformVAngles(entity wz, vector ang)
Transforms v_angle ang backwards through warpzone wz, as the inverse of WarpZone_TransformVAngles.
Definition common.qc:545
vector WarpZone_TransformVAngles(entity wz, vector ang)
Transforms v_angle ang across warpzone wz.
Definition common.qc:509

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 800 of file common.qc.

801{
802 if (from.WarpZone_refsys)
803 vel = WarpZone_UnTransformVelocity(from.WarpZone_refsys, vel);
804 if (to.WarpZone_refsys)
805 vel = WarpZone_TransformVelocity(to.WarpZone_refsys, vel);
806 return vel;
807}
vector WarpZone_UnTransformVelocity(entity wz, vector vel)
Transforms angle vel backwards through warpzone wz, as the inverse of WarpZone_TransformVelocity.
Definition common.qc:535
vector WarpZone_TransformVelocity(entity wz, vector vel)
Transforms velocity v across warpzone wz.
Definition common.qc:499

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 684 of file common.qc.

685{
686 bool nearby_warpzones = false;
687 // use FOREACH_ENTITY_RADIUS if no warpzone is touching the box of side 2 * rad and center org
688 // which includes the sphere of radius rad and center org
690 {
691 vector boxmin = vec3(org.x - rad, org.y - rad, org.z - rad);
692 vector boxmax = vec3(org.x + rad, org.y + rad, org.z + rad);
693 IL_EACH(g_warpzones, boxesoverlap(it.absmin, it.absmax, boxmin, boxmax),
694 {
695 nearby_warpzones = true;
696 break;
697 });
698 }
699
701 if (nearby_warpzones)
702 {
706 _WarpZone_FindRadius_Recurse(org, rad, org, '0 0 0', '0 0 0');
707 FOREACH_LIST(_WarpZone_FindRadius_goodents, chain, true, it.WarpZone_findradius_hit = WarpZone_FindRadius_Hit_UNSEEN);
708 FOREACH_LIST(_WarpZone_FindRadius_badents, WarpZone_findradius_next, true, it.WarpZone_findradius_hit = WarpZone_FindRadius_Hit_UNSEEN);
709 }
710 else // cheaper than _WarpZone_FindRadius_Recurse
712 {
713 vector p = NearestPointOnBoundingBox(it.origin + it.mins, it.origin + it.maxs, org);
714 if (nomonsters != MOVE_NOTHING)
715 {
716 traceline(org, p, nomonsters, it);
717 if (trace_fraction < 1)
718 continue;
719 }
720
721 it.chain = _WarpZone_FindRadius_goodents_first; // fine to use .chain since FOREACH_ENTITY_RADIUS doesn't use it
723 it.WarpZone_findradius_nearest = p;
724 it.WarpZone_findradius_dist = org - p;
725 WarpZone_Accumulator_Clear(it); // reset .warpzone_transform and .warpzone_shift
726 });
727
729}
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:608
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:609
entity _WarpZone_FindRadius_badents_first
Definition common.qc:605
bool WarpZoneLib_BadEntity(entity e, WarpZone_FindRadius_cond_callback_t cb)
Blacklist of entities that WarpZone_FindRadius doesn't care about.
Definition common.qc:572
entity _WarpZone_FindRadius_goodents_first
Definition common.qc:604
var WarpZone_FindRadius_cond_callback_t _WarpZone_FindRadius_cond_cb
Definition common.qc:607
float _WarpZone_FindRadius_nomonsters
Definition common.qc:606
const int WarpZone_FindRadius_Hit_UNSEEN
Definition common.qc:568
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 // fix small representation errors so that math operations with 0 will be cheaper
60 if (fabs(e.warpzone_transform.x) <= 0.000000000001) e.warpzone_transform.x = 0;
61 if (fabs(e.warpzone_transform.y) <= 0.000000000001) e.warpzone_transform.y = 0;
62 if (fabs(e.warpzone_transform.z) <= 0.000000000001) e.warpzone_transform.z = 0;
63 e.warpzone_shift = AnglesTransform_PrePostShift_GetPostShift(my_org, e.warpzone_transform, other_org);
64 e.warpzone_origin = my_org;
65 e.warpzone_targetorigin = other_org;
66 e.warpzone_angles = my_ang;
67 e.warpzone_targetangles = other_ang;
68 vector forward, right, up;
69 FIXED_MAKE_VECTORS(my_ang, forward, right, up);
70 e.warpzone_forward = forward;
71 FIXED_MAKE_VECTORS(other_ang, forward, right, up);
72 e.warpzone_targetforward = forward;
74}
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
float fabs(float f)

References AnglesTransform_PrePostShift_GetPostShift(), AnglesTransform_RightDivide(), AnglesTransform_TurnDirectionFR(), entity(), fabs(), 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 487 of file common.qc.

488{
489 return (p - wz.warpzone_targetorigin) * wz.warpzone_targetforward;
490}

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 187 of file common.qc.

188{
189 WarpZone_trace_forent = forent;
193
194 bool nearby_warpzones = false;
195 // use tracebox if no warpzone is touching the box the entity would be traced through
197 {
198 vector boxmin = mi;
199 vector boxmax = ma;
200 #define CHOOSE_AXIS(axis) \
201 if (org.axis < end.axis) { boxmin.axis += org.axis; boxmax.axis += end.axis; } \
202 else { boxmin.axis += end.axis; boxmax.axis += org.axis; }
203 CHOOSE_AXIS(x);
204 CHOOSE_AXIS(y);
205 CHOOSE_AXIS(z);
206 #undef CHOOSE_AXIS
207 /* Above is equivalent to the following, but more efficient
208 * boxmin += vec_to_min(org, end);
209 * boxmax += vec_to_max(org, end);
210 */
211 IL_EACH(g_warpzones, boxesoverlap(it.absmin, it.absmax, boxmin, boxmax),
212 {
213 nearby_warpzones = true;
214 break;
215 });
216 }
217 if (!nearby_warpzones)
218 {
219 if (nomonsters == MOVE_NOTHING)
220 {
221 trace_endpos = end;
222 trace_fraction = 1;
223 }
224 else
225 tracebox(org, mi, ma, end, nomonsters, WarpZone_trace_forent);
226
227 if (cb)
228 cb(org, trace_endpos, end);
229 return;
230 }
231
232 vector vf = v_forward;
233 vector vr = v_right;
234 vector vu = v_up;
235
236 float nomonsters_adjusted;
237 switch (nomonsters)
238 {
239 case MOVE_WORLDONLY:
240 case MOVE_NOTHING:
241 nomonsters_adjusted = MOVE_NOMONSTERS;
242 break;
243 default:
244 nomonsters_adjusted = nomonsters;
245 break;
246 }
247 bool contents_hack = (WarpZone_trace_forent.dphitcontentsmask && !(WarpZone_trace_forent.dphitcontentsmask & DPCONTENTS_SOLID));
248 if (contents_hack)
250
251 // if starting in warpzone, first transform
252 entity wz = WarpZone_Find(org + mi, org + ma);
253 float sol;
254 if (wz)
255 {
258 if (zone && wz != zone)
259 {
260 // we are in ANOTHER warpzone. This is bad. Make a zero length trace and return.
261 sol = 1;
262 trace_fraction = 0;
264 goto fail;
265 }
268 end = WarpZone_TransformOrigin(wz, end);
269 }
271 sol = -1;
272 float frac = 0;
273 float i = 16;
274 for (;;)
275 {
276 if (--i < 1)
277 {
278 LOG_TRACE("Too many warpzones in sequence, aborting trace.");
279 trace_ent = NULL;
280 break;
281 }
282 tracebox(org, mi, ma, end, nomonsters_adjusted, WarpZone_trace_forent);
283 if (cb)
284 cb(org, trace_endpos, end);
285 if (sol < 0)
286 sol = trace_startsolid;
287
288 frac = trace_fraction = frac + (1 - frac) * trace_fraction;
289 if (trace_fraction >= 1)
290 break;
291 if (trace_ent.classname != "trigger_warpzone")
292 {
293 if (nomonsters == MOVE_NOTHING
294 || (nomonsters == MOVE_WORLDONLY && trace_ent)
295 || (contents_hack && (trace_dphitcontents & WarpZone_trace_forent.dphitcontentsmask) == DPCONTENTS_SOLID))
296 {
297 // continue the trace, ignoring this hit (we only care for warpzones)
298 org = trace_endpos + normalize(end - org);
299 continue;
300 // we cannot do an inverted trace here, as we do care for further warpzones inside that "solid" to be found
301 // otherwise, players could block entrances that way
302 }
303 break;
304 }
305 /*if (trace_ent == wz)
306 {
307 // FIXME can this check be removed? Do we really need it?
308 LOG_TRACE("I transformed into the same zone again, wtf, aborting the trace");
309 trace_ent = NULL;
310 break;
311 }*/
312 wz = trace_ent;
316 if (zone && wz != zone)
317 break;
319 // we hit a warpzone... so, let's perform the trace after the warp again
321 end = WarpZone_TransformOrigin(wz, end);
322
323 // we got warped, so let's step back a bit
324 tracebox(org, mi, ma, org + normalize(org - end) * 32, nomonsters_adjusted, WarpZone_trace_forent);
326 }
328LABEL(fail)
329 if (contents_hack)
331 trace_startsolid = sol;
332 v_forward = vf;
333 v_right = vr;
334 v_up = vu;
335}
#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:156
void WarpZone_Trace_InitTransform()
Definition common.qc:176
#define WarpZone_Trace_AddTransform(wz)
Definition common.qc:182
void WarpZone_MakeAllOther()
Definition common.qc:170
void WarpZone_MakeAllSolid()
Definition common.qc:164
#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 338 of file common.qc.

339{
340 vector o0 = e.origin;
341 vector v0 = e.velocity;
342 float dt, i, g = PHYS_GRAVITY(NULL) * e.gravity;
343
344 WarpZone_trace_forent = forent;
350 {
351 tracetoss(e, WarpZone_trace_forent);
352 if (cb)
353 cb(e.origin, trace_endpos, trace_endpos);
354 dt = sqrt(vlen2(e.origin - o0) / vlen2(e.velocity));
356 e.velocity.z -= dt * g;
357 WarpZone_tracetoss_velocity = e.velocity;
358 e.velocity = v0;
359 return;
360 }
361
362 vector vf = v_forward;
363 vector vr = v_right;
364 vector vu = v_up;
365
366 // if starting in warpzone, first transform
367 entity wz = WarpZone_Find(e.origin + e.mins, e.origin + e.maxs);
368 if (wz)
369 {
372 if (zone && wz != zone)
373 {
374 // we are in ANOTHER warpzone. This is bad. Make a zero length trace and return.
375
377 trace_endpos = o0;
378 goto fail;
379 }
381 vector org = WarpZone_TransformOrigin(wz, e.origin);
382 setorigin(e, org);
383 e.velocity = WarpZone_TransformVelocity(wz, e.velocity);
384 }
386 i = 16;
387 for (;;)
388 {
389 if (--i < 1)
390 {
391 LOG_TRACE("Too many warpzones in sequence, aborting trace.");
392 trace_ent = NULL;
393 break;
394 }
395 tracetoss(e, WarpZone_trace_forent);
396 if (cb)
397 cb(e.origin, trace_endpos, trace_endpos);
398 dt = sqrt(vlen2(trace_endpos - e.origin) / vlen2(e.velocity));
400 e.origin = trace_endpos;
401 e.velocity.z -= dt * g;
402 if (trace_fraction >= 1)
403 break;
404 if (trace_ent.classname != "trigger_warpzone")
405 break;
406 if (trace_ent == wz)
407 {
408 // FIXME can this check be removed? Do we really need it?
409 LOG_TRACE("I transformed into the same zone again, wtf, aborting the trace");
410 trace_ent = NULL;
411 break;
412 }
413 wz = trace_ent;
417 if (zone && wz != zone)
418 break;
420 // we hit a warpzone... so, let's perform the trace after the warp again
421 e.origin = WarpZone_TransformOrigin(wz, e.origin);
422 e.velocity = WarpZone_TransformVelocity(wz, e.velocity);
423
424 // we got warped, so let's step back a bit
425 e.velocity = -e.velocity;
426 tracetoss(e, WarpZone_trace_forent);
427 dt = sqrt(vlen2(trace_endpos - e.origin) / vlen2(e.velocity));
429 e.origin = trace_endpos;
430 e.velocity = -e.velocity;
431 }
433LABEL(fail)
434 WarpZone_tracetoss_velocity = e.velocity;
435 v_forward = vf;
436 v_right = vr;
437 v_up = vu;
438 // restore old entity data (caller just uses trace_endpos, WarpZone_tracetoss_velocity and the transform)
439 e.velocity = v0;
440 e.origin = o0;
441}
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 450 of file common.qc.

451{
455}
entity WarpZone_TrailParticles_trace_callback_own
Definition common.qc:443
void WarpZone_TrailParticles_trace_callback(vector from, vector endpos, vector to)
Definition common.qc:445
float WarpZone_TrailParticles_trace_callback_eff
Definition common.qc:444
#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 504 of file common.qc.

505{
506 return AnglesTransform_ApplyToAngles(wz.warpzone_transform, ang);
507}
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 493 of file common.qc.

494{
495 return wz.warpzone_shift + AnglesTransform_Apply(wz.warpzone_transform, org);
496}
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 509 of file common.qc.

510{
511#ifdef KEEP_ROLL
512 float roll = ang.z;
513 ang.z = 0;
514#endif
515
516 ang = AnglesTransform_ApplyToVAngles(wz.warpzone_transform, ang);
517#ifdef KEEP_ROLL
520 ang.z = roll;
521#else
523#endif
524 return ang;
525}
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 499 of file common.qc.

500{
501 return AnglesTransform_Apply(wz.warpzone_transform, vel);
502}

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 540 of file common.qc.

541{
542 return AnglesTransform_ApplyToAngles(AnglesTransform_Invert(wz.warpzone_transform), ang);
543}
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 530 of file common.qc.

531{
532 return AnglesTransform_Apply(AnglesTransform_Invert(wz.warpzone_transform), org - wz.warpzone_shift);
533}

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 545 of file common.qc.

546{
547#ifdef KEEP_ROLL
548 float roll = ang.z;
549 ang.z = 0;
550#endif
551
553#ifdef KEEP_ROLL
556 ang.z = roll;
557#else
559#endif
560 return ang;
561}

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 535 of file common.qc.

536{
537 return AnglesTransform_Apply(AnglesTransform_Invert(wz.warpzone_transform), vel);
538}

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 124 of file common.qc.

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

850{
851 vector emin = toucher.absmin, emax = toucher.absmax;
852 if (!Q3COMPAT_COMMON)
853 {
854 // Xonotic and Nexuiz maps assume triggers will be activated by adjacent players
855 // prior to sv_legacy_bbox_expand 0 DP always did this for SVQC and never for CSQC
856 emin -= '1 1 1';
857 emax += '1 1 1';
858 }
859
860 // if called from a touch func, we can assume the boxes do overlap
861 if (!touchfunc && !boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
862 return false;
863
864 return WarpZoneLib_BoxTouchesBrush(emin, emax, this, toucher); // accurate
865}
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 879 of file common.qc.

880{
881 vector o = e.origin;
882 traceline(o, o, MOVE_WORLDONLY, e);
884 return 0; // too stuck, giving up
885
886 tracebox(o, e.mins, e.maxs, o, MOVE_WORLDONLY, e);
887 if (!trace_startsolid)
888 return -1; // wasn't stuck
889
890 vector m0 = e.mins;
891 vector m1 = e.maxs;
892 e.mins = '0 0 0';
893 e.maxs = '0 0 0';
894 WarpZoneLib_MoveOutOfSolid_Expand(e, eX * m0.x); e.mins.x = m0.x;
895 WarpZoneLib_MoveOutOfSolid_Expand(e, eX * m1.x); e.maxs.x = m1.x;
896 WarpZoneLib_MoveOutOfSolid_Expand(e, eY * m0.y); e.mins.y = m0.y;
897 WarpZoneLib_MoveOutOfSolid_Expand(e, eY * m1.y); e.maxs.y = m1.y;
898 WarpZoneLib_MoveOutOfSolid_Expand(e, eZ * m0.z); e.mins.z = m0.z;
899 WarpZoneLib_MoveOutOfSolid_Expand(e, eZ * m1.z); e.maxs.z = m1.z;
900 setorigin(e, e.origin);
901
902 tracebox(e.origin, e.mins, e.maxs, e.origin, MOVE_WORLDONLY, e);
904 {
905 setorigin(e, o);
906 return 0; // can't fix
907 }
908
909 return 1; // was stuck but is fixed now
910}
void WarpZoneLib_MoveOutOfSolid_Expand(entity e, vector by)
Definition common.qc:868
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