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 862 of file server.qc.

863{
864#ifndef WARPZONE_DONT_FIX_VANGLE
865 if(IS_REAL_CLIENT(this))
866 if(this.v_angle.z <= 360) // if not already adjusted
867 if(time - CS(this).ping * 0.001 < this.warpzone_teleport_time)
868 {
870 this.v_angle_z += 720; // mark as adjusted
871 }
872#endif
873}
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:524
entity warpzone_teleport_zone
Definition server.qc:36
float warpzone_teleport_time
Definition server.qc:34
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:65
#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 378 of file server.qc.

379{
380 if(toucher.classname == "trigger_warpzone")
381 return true;
382
383 // no further impacts if we teleported this frame!
384 // this is because even if we did teleport, the engine still may raise
385 // touch events for the previous location
386 // engine now aborts moves on teleport, so this SHOULD not happen any more
387 // but if this is called from TouchAreaGrid of the projectile moving,
388 // then this won't do
389 if(time == this.warpzone_teleport_time)
390 return true;
391
392#ifdef SVQC
393#ifdef WARPZONELIB_KEEPDEBUG
394 // this SEEMS to not happen at the moment, but if it did, it would be more reliable
395 {
396 float save_dpstartcontents;
397 float save_dphitcontents;
398 float save_dphitq3surfaceflags;
399 string save_dphittexturename;
400 float save_allsolid;
401 float save_startsolid;
402 float save_fraction;
403 vector save_endpos;
404 vector save_plane_normal;
405 float save_plane_dist;
406 entity save_ent;
407 float save_inopen;
408 float save_inwater;
409 save_dpstartcontents = trace_dpstartcontents;
410 save_dphitcontents = trace_dphitcontents;
411 save_dphitq3surfaceflags = trace_dphitq3surfaceflags;
412 save_dphittexturename = trace_dphittexturename;
413 save_allsolid = trace_allsolid;
414 save_startsolid = trace_startsolid;
415 save_fraction = trace_fraction;
416 save_endpos = trace_endpos;
417 save_plane_normal = trace_plane_normal;
418 save_plane_dist = trace_plane_dist;
419 save_ent = trace_ent;
420 save_inopen = trace_inopen;
421 save_inwater = trace_inwater;
422 float f = WarpZone_CheckProjectileImpact(this);
423 if (f) return (f > 0);
424 trace_dpstartcontents = save_dpstartcontents;
425 trace_dphitcontents = save_dphitcontents;
426 trace_dphitq3surfaceflags = save_dphitq3surfaceflags;
427 trace_dphittexturename = save_dphittexturename;
428 trace_allsolid = save_allsolid;
429 trace_startsolid = save_startsolid;
430 trace_fraction = save_fraction;
431 trace_endpos = save_endpos;
432 trace_plane_normal = save_plane_normal;
433 trace_plane_dist = save_plane_dist;
434 trace_ent = save_ent;
435 trace_inopen = save_inopen;
436 trace_inwater = save_inwater;
437 }
438#endif
439
441 return true;
442#endif
443
444 return false;
445}
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:92
entity entity toucher
Definition self.qh:72
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:74
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 769 of file server.qc.

770{
772 {
774 for(entity e = warpzone_first; e; e = e.warpzone_next)
776 for(entity e = warpzone_position_first; e; e = e.warpzone_next)
778 for(entity e = warpzone_first; e; e = e.warpzone_next)
782 }
783
785 {
787 {
789 });
790 }
791
792
793 FOREACH_CLIENT(true,
794 {
796 WarpZone_StoreProjectileData(it); // TODO: not actually needed
797
798 if((IS_OBSERVER(it) || it.solid == SOLID_NOT))
799 {
800 // warpzones
802 entity e = WarpZone_Find(it.origin + it.mins, it.origin + it.maxs);
803 if (e)
804 if (WarpZoneLib_ExactTrigger_Touch(e, it, false))
805 if (WarpZone_PlaneDist(e, it.origin + it.view_ofs) <= 0)
806 WarpZone_Teleport(e, it, -1, 0); // NOT triggering targets by this!
807 }
808
809 // teleporters
810 if(it.teleportable)
811 {
812 entity ent = Teleport_Find(it.origin + it.mins, it.origin + it.maxs);
813 if (ent)
814 if (WarpZoneLib_ExactTrigger_Touch(ent, it, false))
815 Simple_TeleportPlayer(ent, it); // NOT triggering targets by this!
816 }
817 }
818 });
819}
const float SOLID_NOT
#define IL_EACH(this, cond, body)
entity WarpZone_Find(vector mi, vector ma)
Definition common.qc:167
bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher, bool touchfunc)
Definition common.qc:813
float WarpZone_PlaneDist(entity wz, vector v)
Definition common.qc:499
float warpzone_warpzones_exist
Definition common.qh:9
IntrusiveList g_projectiles
Definition common.qh:58
float warpzone_initialized
Definition server.qc:673
void WarpZone_InitStep_FindOriginTarget(entity this)
Definition server.qc:449
entity warpzone_position_first
Definition server.qc:675
void WarpZones_Reconnect()
Definition server.qc:738
#define WarpZone_StoreProjectileData(e_)
Definition server.qc:38
void WarpZone_InitStep_UpdateTransform(entity this)
Definition server.qc:531
float WarpZone_Teleport(entity wz, entity player, float f0, float f1)
Definition server.qc:82
void WarpZonePosition_InitStep_FindTarget(entity this)
Definition server.qc:463
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 4 of file server.qh.