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

Go to the source code of this file.

Functions

void WarpZone_PlayerPhysics_FixVAngle (entity this)
void WarpZone_PostInitialize_Callback ()
void WarpZone_PostTeleportPlayer_Callback (entity pl)
float WarpZone_Projectile_Touch (entity this, entity toucher)
bool WarpZone_Projectile_Touch_ImpactFilter_Callback (entity this, entity toucher)
void WarpZone_StartFrame ()

Variables

entity warpzone_first
entity warpzone_next

Function Documentation

◆ WarpZone_PlayerPhysics_FixVAngle()

void WarpZone_PlayerPhysics_FixVAngle ( entity this)

Definition at line 817 of file server.qc.

818{
819#ifndef WARPZONE_DONT_FIX_VANGLE
820 if (IS_REAL_CLIENT(this))
821 if (this.v_angle.z <= 360) // if not already adjusted
822 if (time - CS(this).ping * 0.001 < this.warpzone_teleport_time)
823 {
825 this.v_angle_z += 720; // mark as adjusted
826 }
827#endif
828}
float ping
Definition main.qh:169
vector v_angle
Definition player.qh:236
float time
vector WarpZone_TransformVAngles(entity wz, vector ang)
Definition common.qc:501
entity warpzone_teleport_zone
Definition server.qc:34
float warpzone_teleport_time
Definition server.qc:32
ClientState CS(Client this)
Definition state.qh:47
#define IS_REAL_CLIENT(v)
Definition utils.qh:17

References CS(), entity(), IS_REAL_CLIENT, ping, time, v_angle, warpzone_teleport_time, warpzone_teleport_zone, and WarpZone_TransformVAngles().

Referenced by PlayerPreThink(), and sys_phys_fix().

◆ WarpZone_PostInitialize_Callback()

void WarpZone_PostInitialize_Callback ( )

Definition at line 518 of file main.qc.

519{
520 // create waypoint links for warpzones
521 entity tracetest_ent = spawn();
522 setsize(tracetest_ent, PL_MIN_CONST, PL_MAX_CONST);
523 tracetest_ent.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
524 //for(entity e = warpzone_first; e; e = e.warpzone_next)
525 for(entity e = NULL; (e = find(e, classname, "trigger_warpzone")); )
526 waypoint_spawnforteleporter_wz(e, tracetest_ent);
527 delete(tracetest_ent);
528}
void waypoint_spawnforteleporter_wz(entity e, entity tracetest_ent)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
const vector PL_MIN_CONST
Definition constants.qh:56
const vector PL_MAX_CONST
Definition constants.qh:55
string classname
float DPCONTENTS_BOTCLIP
float DPCONTENTS_SOLID
float DPCONTENTS_BODY
float DPCONTENTS_PLAYERCLIP
#define spawn
entity find(entity start,.string field, string match)
#define NULL
Definition post.qh:14

References classname, DPCONTENTS_BODY, DPCONTENTS_BOTCLIP, DPCONTENTS_PLAYERCLIP, DPCONTENTS_SOLID, entity(), find(), NULL, PL_MAX_CONST, PL_MIN_CONST, spawn, and waypoint_spawnforteleporter_wz().

Referenced by WarpZone_StartFrame().

◆ WarpZone_PostTeleportPlayer_Callback()

void WarpZone_PostTeleportPlayer_Callback ( entity pl)

Definition at line 303 of file teleporters.qc.

304{
305#ifdef SVQC
306 makevectors(pl.angles);
310 if (IS_PLAYER(pl)) anticheat_fixangle(pl);
311#endif
312 // "disown" projectiles after teleport
313 if(pl.owner)
314 if(pl.owner == pl.realowner)
315 {
316 #ifdef SVQC
317 if(!(pl.flags & FL_PROJECTILE))
318 #elif defined(CSQC)
319 if(!(pl.flags & BIT(15))) // FL_PROJECTILE
320 #endif
321 LOG_INFO("A non-projectile got through a warpzone and its owner cleared. It's a ", pl.classname, ".");
322 pl.owner = NULL;
323 }
324 if(IS_PLAYER(pl))
325 {
326 // reset tracking of oldvelocity for impact damage (sudden velocity changes)
327 #ifdef SVQC
328 pl.oldvelocity = pl.velocity;
329 #endif
330 }
331}
void anticheat_fixangle(entity this)
Definition anticheat.qc:244
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
#define IS_PLAYER(s)
Definition player.qh:242
const int FL_PROJECTILE
Definition constants.qh:85
vector v_forward
void Reset_ArcBeam()
Definition arc.qc:820
void UpdateCSQCProjectileAfterTeleport(entity e)
#define LOG_INFO(...)
Definition log.qh:62
#define makevectors
Definition post.qh:21
void UpdateItemAfterTeleport(entity this)
Definition items.qc:106

References anticheat_fixangle(), BIT, entity(), FL_PROJECTILE, IS_PLAYER, LOG_INFO, makevectors, NULL, Reset_ArcBeam(), UpdateCSQCProjectileAfterTeleport(), UpdateItemAfterTeleport(), and v_forward.

Referenced by WarpZone_TeleportPlayer().

◆ WarpZone_Projectile_Touch()

float WarpZone_Projectile_Touch ( entity this,
entity toucher )

Definition at line 344 of file server.qc.

345{
346 if (toucher.classname == "trigger_warpzone")
347 return true;
348
349 // no further impacts if we teleported this frame!
350 // this is because even if we did teleport, the engine still may raise
351 // touch events for the previous location
352 // engine now aborts moves on teleport, so this SHOULD not happen any more
353 // but if this is called from TouchAreaGrid of the projectile moving,
354 // then this won't do
355 if (time == this.warpzone_teleport_time)
356 return true;
357
358#ifdef SVQC
359#ifdef WARPZONELIB_KEEPDEBUG
360 // this SEEMS to not happen at the moment, but if it did, it would be more reliable
361 {
362 float save_dpstartcontents;
363 float save_dphitcontents;
364 float save_dphitq3surfaceflags;
365 string save_dphittexturename;
366 float save_allsolid;
367 float save_startsolid;
368 float save_fraction;
369 vector save_endpos;
370 vector save_plane_normal;
371 float save_plane_dist;
372 entity save_ent;
373 float save_inopen;
374 float save_inwater;
375 save_dpstartcontents = trace_dpstartcontents;
376 save_dphitcontents = trace_dphitcontents;
377 save_dphitq3surfaceflags = trace_dphitq3surfaceflags;
378 save_dphittexturename = trace_dphittexturename;
379 save_allsolid = trace_allsolid;
380 save_startsolid = trace_startsolid;
381 save_fraction = trace_fraction;
382 save_endpos = trace_endpos;
383 save_plane_normal = trace_plane_normal;
384 save_plane_dist = trace_plane_dist;
385 save_ent = trace_ent;
386 save_inopen = trace_inopen;
387 save_inwater = trace_inwater;
388 float f = WarpZone_CheckProjectileImpact(this);
389 if (f) return (f > 0);
390 trace_dpstartcontents = save_dpstartcontents;
391 trace_dphitcontents = save_dphitcontents;
392 trace_dphitq3surfaceflags = save_dphitq3surfaceflags;
393 trace_dphittexturename = save_dphittexturename;
394 trace_allsolid = save_allsolid;
395 trace_startsolid = save_startsolid;
396 trace_fraction = save_fraction;
397 trace_endpos = save_endpos;
398 trace_plane_normal = save_plane_normal;
399 trace_plane_dist = save_plane_dist;
400 trace_ent = save_ent;
401 trace_inopen = save_inopen;
402 trace_inwater = save_inwater;
403 }
404#endif
405
407 return true;
408#endif
409
410 return false;
411}
float trace_dphitcontents
entity trace_ent
float trace_dpstartcontents
string trace_dphittexturename
vector trace_endpos
float trace_startsolid
float trace_inopen
float trace_dphitq3surfaceflags
float trace_fraction
float trace_allsolid
vector trace_plane_normal
float trace_plane_dist
float trace_inwater
vector
Definition self.qh:96
entity entity toucher
Definition self.qh:76
bool WarpZone_Projectile_Touch_ImpactFilter_Callback(entity this, entity toucher)
Definition common.qc:150

References entity(), time, toucher, trace_allsolid, trace_dphitcontents, trace_dphitq3surfaceflags, trace_dphittexturename, trace_dpstartcontents, trace_endpos, trace_ent, trace_fraction, trace_inopen, trace_inwater, trace_plane_dist, trace_plane_normal, trace_startsolid, vector, WarpZone_Projectile_Touch_ImpactFilter_Callback(), and warpzone_teleport_time.

Referenced by W_Devastator_Touch(), and W_OverkillRocketPropelledChainsaw_Touch().

◆ WarpZone_Projectile_Touch_ImpactFilter_Callback()

bool WarpZone_Projectile_Touch_ImpactFilter_Callback ( entity this,
entity toucher )

Definition at line 150 of file common.qc.

151{
152 if (toucher && toucher == this.owner)
153 return true;
154
155 if (autocvar_g_projectiles_interact == 1 && toucher.classname == "blasterbolt")
156 {
158 // We'll bounce off it due to limitations so let it deflect us
159 // to hide the problem, see PROJECTILE_MAKETRIGGER.
160 gettouch(toucher)(toucher, this);
161 return true;
162 }
163
164 if (SUB_NoImpactCheck(this, toucher))
165 {
166 if (this.classname == "nade")
167 return false; // no checks here
168 else if (this.classname == "grapplinghook")
169 RemoveHook(this);
170 else
171 delete(this);
172 return true;
173 }
174 if (trace_ent && trace_ent.solid > SOLID_TRIGGER)
176 return false;
177}
entity owner
Definition main.qh:87
float movetype
const float SOLID_TRIGGER
void UpdateCSQCProjectile(entity e)
const int MOVETYPE_BOUNCEMISSILE
Definition movetypes.qh:140
const int MOVETYPE_BOUNCE
Definition movetypes.qh:139
#define gettouch(e)
Definition self.qh:78
void RemoveHook(entity this)
Definition hook.qc:48
bool SUB_NoImpactCheck(entity this, entity toucher)
Definition common.qc:113
int autocvar_g_projectiles_interact
Definition common.qh:4

References autocvar_g_projectiles_interact, classname, entity(), gettouch, movetype, MOVETYPE_BOUNCE, MOVETYPE_BOUNCEMISSILE, owner, RemoveHook(), SOLID_TRIGGER, SUB_NoImpactCheck(), toucher, trace_ent, and UpdateCSQCProjectile().

Referenced by WarpZone_Projectile_Touch().

◆ WarpZone_StartFrame()

void WarpZone_StartFrame ( )

Definition at line 733 of file server.qc.

734{
736 {
738 for (entity e = warpzone_first; e; e = e.warpzone_next)
740 for (entity e = warpzone_position_first; e; e = e.warpzone_next)
742 for (entity e = warpzone_first; e; e = e.warpzone_next)
746 }
747
750
751 FOREACH_CLIENT(true,
752 {
754 WarpZone_StoreProjectileData(it); // TODO: not actually needed
755
756 if (IS_OBSERVER(it) || it.solid == SOLID_NOT)
757 {
758 // warpzones
760 {
761 entity e = WarpZone_Find(it.origin + it.mins, it.origin + it.maxs);
762 if (e)
763 if (WarpZoneLib_ExactTrigger_Touch(e, it, false))
764 if (WarpZone_PlaneDist(e, it.origin + it.view_ofs) <= 0)
765 WarpZone_Teleport(e, it, -1, 0); // NOT triggering targets by this!
766 }
767
768 // teleporters
769 if (it.teleportable)
770 {
771 entity ent = Teleport_Find(it.origin + it.mins, it.origin + it.maxs);
772 if (ent && WarpZoneLib_ExactTrigger_Touch(ent, it, false))
773 Simple_TeleportPlayer(ent, it); // NOT triggering targets by this!
774 }
775 }
776 });
777}
const float SOLID_NOT
#define IL_EACH(this, cond, body)
entity WarpZone_Find(vector mi, vector ma)
Definition common.qc:158
bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher, bool touchfunc)
Definition common.qc:789
float WarpZone_PlaneDist(entity wz, vector v)
Definition common.qc:476
float warpzone_warpzones_exist
Definition common.qh:12
IntrusiveList g_projectiles
Definition common.qh:58
float warpzone_initialized
Definition server.qc:637
void WarpZone_InitStep_FindOriginTarget(entity this)
Definition server.qc:415
entity warpzone_position_first
Definition server.qc:639
void WarpZones_Reconnect()
Definition server.qc:702
#define WarpZone_StoreProjectileData(e_)
Definition server.qc:36
void WarpZone_InitStep_UpdateTransform(entity this)
Definition server.qc:497
float WarpZone_Teleport(entity wz, entity player, float f0, float f1)
Definition server.qc:80
void WarpZonePosition_InitStep_FindTarget(entity this)
Definition server.qc:429
void WarpZone_PostInitialize_Callback()
Definition main.qc:518
entity warpzone_first
Definition server.qh:4
entity Simple_TeleportPlayer(entity teleporter, entity player)
entity Teleport_Find(vector mi, vector ma)
#define IS_OBSERVER(v)
Definition utils.qh:11
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:52

References entity(), FOREACH_CLIENT, g_projectiles, IL_EACH, IS_OBSERVER, Simple_TeleportPlayer(), SOLID_NOT, Teleport_Find(), WarpZone_Find(), warpzone_first, warpzone_initialized, WarpZone_InitStep_FindOriginTarget(), WarpZone_InitStep_UpdateTransform(), WarpZone_PlaneDist(), warpzone_position_first, WarpZone_PostInitialize_Callback(), WarpZone_StoreProjectileData, WarpZone_Teleport(), warpzone_warpzones_exist, WarpZoneLib_ExactTrigger_Touch(), WarpZonePosition_InitStep_FindTarget(), and WarpZones_Reconnect().

Referenced by StartFrame().

Variable Documentation

◆ warpzone_first

entity warpzone_first

◆ warpzone_next

entity warpzone_next

Definition at line 5 of file server.qh.