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

866{
867#ifndef WARPZONE_DONT_FIX_VANGLE
868 if(IS_REAL_CLIENT(this))
869 if(this.v_angle.z <= 360) // if not already adjusted
870 if(time - CS(this).ping * 0.001 < this.warpzone_teleport_time)
871 {
873 this.v_angle_z += 720; // mark as adjusted
874 }
875#endif
876}
float ping
Definition main.qh:169
vector v_angle
Definition player.qh:237
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:245
#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:243
const int FL_PROJECTILE
Definition constants.qh:85
vector v_forward
void Reset_ArcBeam()
Definition arc.qc:852
void UpdateCSQCProjectileAfterTeleport(entity e)
#define LOG_INFO(...)
Definition log.qh:65
#define makevectors
Definition post.qh:21
void UpdateItemAfterTeleport(entity this)
Definition items.qc:107

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

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

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

152{
153 if(toucher && toucher == this.owner)
154 return true;
155
156 if(autocvar_g_projectiles_interact == 1 && toucher.classname == "blasterbolt")
157 {
159 // We'll bounce off it due to limitations so let it deflect us
160 // to hide the problem, see PROJECTILE_MAKETRIGGER.
161 gettouch(toucher)(toucher, this);
162 return true;
163 }
164
165 if(SUB_NoImpactCheck(this, toucher))
166 {
167 if(this.classname == "nade")
168 return false; // no checks here
169 else if(this.classname == "grapplinghook")
170 RemoveHook(this);
171 else
172 delete(this);
173 return true;
174 }
175 if(trace_ent && trace_ent.solid > SOLID_TRIGGER)
177 return false;
178}
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 772 of file server.qc.

773{
775 {
777 for(entity e = warpzone_first; e; e = e.warpzone_next)
779 for(entity e = warpzone_position_first; e; e = e.warpzone_next)
781 for(entity e = warpzone_first; e; e = e.warpzone_next)
785 }
786
788 {
790 {
792 });
793 }
794
795
796 FOREACH_CLIENT(true,
797 {
799 WarpZone_StoreProjectileData(it); // TODO: not actually needed
800
801 if((IS_OBSERVER(it) || it.solid == SOLID_NOT))
802 {
803 // warpzones
805 entity e = WarpZone_Find(it.origin + it.mins, it.origin + it.maxs);
806 if (e)
807 if (WarpZoneLib_ExactTrigger_Touch(e, it, false))
808 if (WarpZone_PlaneDist(e, it.origin + it.view_ofs) <= 0)
809 WarpZone_Teleport(e, it, -1, 0); // NOT triggering targets by this!
810 }
811
812 // teleporters
813 if(it.teleportable)
814 {
815 entity ent = Teleport_Find(it.origin + it.mins, it.origin + it.maxs);
816 if (ent)
817 if (WarpZoneLib_ExactTrigger_Touch(ent, it, false))
818 Simple_TeleportPlayer(ent, it); // NOT triggering targets by this!
819 }
820 }
821 });
822}
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:815
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:676
void WarpZone_InitStep_FindOriginTarget(entity this)
Definition server.qc:452
entity warpzone_position_first
Definition server.qc:678
void WarpZones_Reconnect()
Definition server.qc:741
#define WarpZone_StoreProjectileData(e_)
Definition server.qc:38
void WarpZone_InitStep_UpdateTransform(entity this)
Definition server.qc:534
float WarpZone_Teleport(entity wz, entity player, float f0, float f1)
Definition server.qc:82
void WarpZonePosition_InitStep_FindTarget(entity this)
Definition server.qc:466
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:50

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.