2 .vector warpzone_save_origin;
3 .vector warpzone_save_angles;
4 .vector warpzone_save_eorigin;
5 .vector warpzone_save_eangles;
8 .vector warpzone_oldorigin, warpzone_oldvelocity, warpzone_oldangles;
9 .float warpzone_teleport_time;
10 .float warpzone_teleport_finishtime;
11 .entity warpzone_teleport_zone;
13 void WarpZone_StoreProjectileData(entity e)
15 e.warpzone_oldorigin = e.origin;
16 e.warpzone_oldvelocity = e.velocity;
17 e.warpzone_oldangles = e.angles;
20 void WarpZone_TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity)
22 setorigin (player, to);
23 player.oldorigin = to; // for DP's unsticking
24 player.angles = to_angles;
25 player.fixangle = TRUE;
26 player.velocity = to_velocity;
28 BITXOR_ASSIGN(player.effects, EF_TELEPORT_BIT);
30 if(player.classname == "player")
31 BITCLR_ASSIGN(player.flags, FL_ONGROUND);
33 WarpZone_PostTeleportPlayer_Callback(player);
36 float WarpZone_Teleported_Send(entity to, float sf)
38 WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_TELEPORTED);
39 WriteCoord(MSG_ENTITY, self.angles_x);
40 WriteCoord(MSG_ENTITY, self.angles_y);
41 WriteCoord(MSG_ENTITY, self.angles_z);
45 #define WARPZONE_TELEPORT_FIXSOLID(ret) \
48 setorigin(player, o1 - player.view_ofs); \
49 if(WarpZoneLib_MoveOutOfSolid(player)) \
51 o1 = player.origin + player.view_ofs; \
52 setorigin(player, o0 - player.view_ofs); \
56 print("would have to put player in solid, won't do that\n"); \
57 setorigin(player, o0 - player.view_ofs); \
62 #define WARPZONE_TELEPORT_DOTELEPORT() \
65 WarpZone_RefSys_Add(player, wz); \
66 WarpZone_TeleportPlayer(wz, player, o1 - player.view_ofs, a1, v1); \
67 WarpZone_StoreProjectileData(player); \
68 player.warpzone_teleport_time = time; \
69 player.warpzone_teleport_finishtime = time; \
70 player.warpzone_teleport_zone = wz; \
74 float WarpZone_Teleport(entity wz, entity player, float f0, float f1)
76 vector o0, a0, v0, o1, a1, v1, o10;
78 o0 = player.origin + player.view_ofs;
82 o10 = o1 = WarpZone_TransformOrigin(wz, o0);
83 v1 = WarpZone_TransformVelocity(wz, v0);
84 if(clienttype(player) != CLIENTTYPE_NOTACLIENT)
85 a1 = WarpZone_TransformVAngles(wz, player.v_angle);
87 a1 = WarpZone_TransformAngles(wz, a0);
89 if(f0 != 0 || f1 != 0)
91 // retry last move but behind the warpzone!
92 // we must first go back as far as we can, then forward again, to not cause double touch events!
94 tracebox(o1 - player.view_ofs + v1 * frametime * f1, player.mins, player.maxs, o1 - player.view_ofs + v1 * frametime * f0, MOVE_WORLDONLY, player);
99 tracebox(trace_endpos, player.mins, player.maxs, o1 - player.view_ofs + v1 * frametime * f1, MOVE_NORMAL, player); // this should get us through the warpzone
102 o1 = trace_endpos + player.view_ofs;
105 md = max(vlen(player.mins), vlen(player.maxs));
106 d = WarpZone_TargetPlaneDist(wz, o1);
107 dv = WarpZone_TargetPlaneDist(wz, v1);
109 o1 = o1 - v1 * (d / dv);
112 // put him inside solid
113 tracebox(o1 - player.view_ofs, player.mins, player.maxs, o1 - player.view_ofs, MOVE_NOMONSTERS, player);
115 WARPZONE_TELEPORT_FIXSOLID(0);
117 WARPZONE_TELEPORT_DOTELEPORT();
119 // prevent further teleports back
120 float dt = (o1 - o10) * v1 * (1 / (v1 * v1));
121 if(dt < sys_frametime)
122 player.warpzone_teleport_finishtime += sys_frametime - dt;
124 #ifndef WARPZONE_USE_FIXANGLE
125 if(player.classname == "player")
127 // instead of fixangle, send the transform to the client for smoother operation
128 player.fixangle = FALSE;
131 setmodel(ts, "null");
132 ts.SendEntity = WarpZone_Teleported_Send;
133 ts.SendFlags = 0xFFFFFF;
134 ts.drawonlytoclient = player;
135 ts.think = SUB_Remove;
136 ts.nextthink = time + 1;
139 ts.effects = EF_NODEPTHTEST;
140 ts.classname = "warpzone_teleported";
141 ts.angles = wz.warpzone_transform;
148 void WarpZone_Touch (void)
152 if(other.classname == "trigger_warpzone")
155 if(time <= other.warpzone_teleport_finishtime) // already teleported this frame
158 // FIXME needs a better check to know what is safe to teleport and what not
159 if(other.movetype == MOVETYPE_NONE || other.movetype == MOVETYPE_FOLLOW || other.tag_entity)
162 if(WarpZoneLib_ExactTrigger_Touch())
165 if(WarpZone_PlaneDist(self, other.origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
169 // number of frames we need to go back:
170 // dist = 16*sqrt(2) qu
173 // 24 qu = v*frametime*n
174 // n = 24 qu/(v*frametime)
175 // for clients go only one frame though, may be too irritating otherwise
176 // but max 0.25 sec = 0.25/frametime frames
177 // 24/(0.25/frametime)
180 d = 24 + max(vlen(other.mins), vlen(other.maxs));
181 if(clienttype(other) == CLIENTTYPE_NOTACLIENT)
182 f = -d / bound(frametime * d * 1, frametime * vlen(other.velocity), d);
185 if(WarpZone_Teleport(self, other, f, 0))
190 save1 = self.target; self.target = string_null;
191 save2 = self.target3; self.target3 = string_null;
193 if not(self.target) self.target = save1;
194 if not(self.target3) self.target3 = save2;
198 save1 = self.target; self.target = string_null;
199 save2 = self.target2; self.target2 = string_null;
201 if not(self.target) self.target = save1;
202 if not(self.target2) self.target2 = save2;
207 dprint("WARPZONE FAIL AHAHAHAHAH))\n");
211 float WarpZone_Send(entity to, float sendflags)
214 WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE);
216 // we must send this flag for clientside to match properly too
218 if(self.warpzone_isboxy)
220 if(self.warpzone_fadestart)
222 if(self.origin != '0 0 0')
224 WriteByte(MSG_ENTITY, f);
226 // we need THESE to render the warpzone (and cull properly)...
229 WriteCoord(MSG_ENTITY, self.origin_x);
230 WriteCoord(MSG_ENTITY, self.origin_y);
231 WriteCoord(MSG_ENTITY, self.origin_z);
234 WriteShort(MSG_ENTITY, self.modelindex);
235 WriteCoord(MSG_ENTITY, self.mins_x);
236 WriteCoord(MSG_ENTITY, self.mins_y);
237 WriteCoord(MSG_ENTITY, self.mins_z);
238 WriteCoord(MSG_ENTITY, self.maxs_x);
239 WriteCoord(MSG_ENTITY, self.maxs_y);
240 WriteCoord(MSG_ENTITY, self.maxs_z);
241 WriteByte(MSG_ENTITY, bound(1, self.scale * 16, 255));
243 // we need THESE to calculate the proper transform
244 WriteCoord(MSG_ENTITY, self.warpzone_origin_x);
245 WriteCoord(MSG_ENTITY, self.warpzone_origin_y);
246 WriteCoord(MSG_ENTITY, self.warpzone_origin_z);
247 WriteCoord(MSG_ENTITY, self.warpzone_angles_x);
248 WriteCoord(MSG_ENTITY, self.warpzone_angles_y);
249 WriteCoord(MSG_ENTITY, self.warpzone_angles_z);
250 WriteCoord(MSG_ENTITY, self.warpzone_targetorigin_x);
251 WriteCoord(MSG_ENTITY, self.warpzone_targetorigin_y);
252 WriteCoord(MSG_ENTITY, self.warpzone_targetorigin_z);
253 WriteCoord(MSG_ENTITY, self.warpzone_targetangles_x);
254 WriteCoord(MSG_ENTITY, self.warpzone_targetangles_y);
255 WriteCoord(MSG_ENTITY, self.warpzone_targetangles_z);
259 WriteShort(MSG_ENTITY, self.warpzone_fadestart);
260 WriteShort(MSG_ENTITY, self.warpzone_fadeend);
266 float WarpZone_Camera_Send(entity to, float sendflags)
269 WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_CAMERA);
271 if(self.warpzone_fadestart)
273 if(self.origin != '0 0 0')
275 WriteByte(MSG_ENTITY, f);
277 // we need THESE to render the warpzone (and cull properly)...
280 WriteCoord(MSG_ENTITY, self.origin_x);
281 WriteCoord(MSG_ENTITY, self.origin_y);
282 WriteCoord(MSG_ENTITY, self.origin_z);
285 WriteShort(MSG_ENTITY, self.modelindex);
286 WriteCoord(MSG_ENTITY, self.mins_x);
287 WriteCoord(MSG_ENTITY, self.mins_y);
288 WriteCoord(MSG_ENTITY, self.mins_z);
289 WriteCoord(MSG_ENTITY, self.maxs_x);
290 WriteCoord(MSG_ENTITY, self.maxs_y);
291 WriteCoord(MSG_ENTITY, self.maxs_z);
292 WriteByte(MSG_ENTITY, bound(1, self.scale * 16, 255));
294 // we need THESE to calculate the proper transform
295 WriteCoord(MSG_ENTITY, self.enemy.origin_x);
296 WriteCoord(MSG_ENTITY, self.enemy.origin_y);
297 WriteCoord(MSG_ENTITY, self.enemy.origin_z);
298 WriteCoord(MSG_ENTITY, self.enemy.angles_x);
299 WriteCoord(MSG_ENTITY, self.enemy.angles_y);
300 WriteCoord(MSG_ENTITY, self.enemy.angles_z);
304 WriteShort(MSG_ENTITY, self.warpzone_fadestart);
305 WriteShort(MSG_ENTITY, self.warpzone_fadeend);
311 float WarpZone_CheckProjectileImpact(entity player)
315 o0 = player.origin + player.view_ofs;
316 v0 = player.velocity;
318 // if we teleported shortly before, abort
319 if(time <= player.warpzone_teleport_finishtime + 0.1)
322 // if player hit a warpzone, abort
324 wz = WarpZone_Find(o0 + player.mins, o0 + player.maxs);
328 print("impactfilter found something - and it even gets handled correctly - please tell divVerent that this code apparently gets triggered again\n");
330 // retry previous move
331 setorigin(player, player.warpzone_oldorigin);
332 player.velocity = player.warpzone_oldvelocity;
333 if(WarpZone_Teleport(wz, player, 0, 1))
343 save1 = self.target; self.target = string_null;
344 save2 = self.target3; self.target3 = string_null;
346 if not(self.target) self.target = save1;
347 if not(self.target3) self.target3 = save2;
350 save1 = self.target; self.target = string_null;
351 save2 = self.target2; self.target2 = string_null;
353 if not(self.target) self.target = save1;
354 if not(self.target2) self.target2 = save2;
359 setorigin(player, o0 - player.view_ofs);
360 player.velocity = v0;
365 float WarpZone_Projectile_Touch()
368 if(other.classname == "trigger_warpzone")
371 // no further impacts if we teleported this frame!
372 if(time == self.warpzone_teleport_time)
375 // this SEEMS to not happen at the moment, but if it did, it would be more reliable
377 float save_dpstartcontents;
378 float save_dphitcontents;
379 float save_dphitq3surfaceflags;
380 string save_dphittexturename;
382 float save_startsolid;
385 vector save_plane_normal;
386 float save_plane_dist;
390 save_dpstartcontents = trace_dpstartcontents;
391 save_dphitcontents = trace_dphitcontents;
392 save_dphitq3surfaceflags = trace_dphitq3surfaceflags;
393 save_dphittexturename = trace_dphittexturename;
394 save_allsolid = trace_allsolid;
395 save_startsolid = trace_startsolid;
396 save_fraction = trace_fraction;
397 save_endpos = trace_endpos;
398 save_plane_normal = trace_plane_normal;
399 save_plane_dist = trace_plane_dist;
400 save_ent = trace_ent;
401 save_inopen = trace_inopen;
402 save_inwater = trace_inwater;
403 if((f = WarpZone_CheckProjectileImpact(self)) != 0)
405 trace_dpstartcontents = save_dpstartcontents;
406 trace_dphitcontents = save_dphitcontents;
407 trace_dphitq3surfaceflags = save_dphitq3surfaceflags;
408 trace_dphittexturename = save_dphittexturename;
409 trace_allsolid = save_allsolid;
410 trace_startsolid = save_startsolid;
411 trace_fraction = save_fraction;
412 trace_endpos = save_endpos;
413 trace_plane_normal = save_plane_normal;
414 trace_plane_dist = save_plane_dist;
415 trace_ent = save_ent;
416 trace_inopen = save_inopen;
417 trace_inwater = save_inwater;
420 if(WarpZone_Projectile_Touch_ImpactFilter_Callback())
426 void WarpZone_InitStep_FindOriginTarget()
428 if(self.killtarget != "")
430 self.aiment = find(world, targetname, self.killtarget);
431 if(self.aiment == world)
433 error("Warp zone with nonexisting killtarget");
436 self.killtarget = string_null;
440 void WarpZonePosition_InitStep_FindTarget()
442 if(self.target == "")
444 error("Warp zone position with no target");
447 self.enemy = find(world, targetname, self.target);
448 if(self.enemy == world)
450 error("Warp zone position with nonexisting target");
453 if(self.enemy.aiment)
455 // already is positioned
456 error("Warp zone position targeting already oriented warpzone");
459 self.enemy.aiment = self;
462 void WarpZoneCamera_Think(void)
464 if(self.warpzone_save_origin != self.origin
465 || self.warpzone_save_angles != self.angles
466 || self.warpzone_save_eorigin != self.enemy.origin
467 || self.warpzone_save_eangles != self.enemy.angles)
469 WarpZone_Camera_SetUp(self, self.enemy.origin, self.enemy.angles);
470 self.warpzone_save_origin = self.origin;
471 self.warpzone_save_angles = self.angles;
472 self.warpzone_save_eorigin = self.enemy.origin;
473 self.warpzone_save_eangles = self.enemy.angles;
475 self.nextthink = time;
478 void WarpZoneCamera_InitStep_FindTarget()
482 if(self.target == "")
484 error("Camera with no target");
488 for(e = world, i = 0; (e = find(e, targetname, self.target)); )
489 if(random() * ++i < 1)
491 if(self.enemy == world)
493 error("Camera with nonexisting target");
496 warpzone_cameras_exist = 1;
497 WarpZone_Camera_SetUp(self, self.enemy.origin, self.enemy.angles);
498 self.SendFlags = 0xFFFFFF;
499 if(self.spawnflags & 1)
501 self.think = WarpZoneCamera_Think;
502 self.nextthink = time;
508 void WarpZone_InitStep_UpdateTransform()
510 vector org, ang, norm, point;
512 vector tri, a, b, c, p, q, n;
518 org = 0.5 * (self.mins + self.maxs);
520 norm = point = '0 0 0';
522 for(i_s = 0; ; ++i_s)
524 tex = getsurfacetexture(self, i_s);
526 break; // this is beyond the last one
527 if(tex == "textures/common/trigger" || tex == "trigger")
529 n_t = getsurfacenumtriangles(self, i_s);
530 for(i_t = 0; i_t < n_t; ++i_t)
532 tri = getsurfacetriangle(self, i_s, i_t);
533 a = getsurfacepoint(self, i_s, tri_x);
534 b = getsurfacepoint(self, i_s, tri_y);
535 c = getsurfacepoint(self, i_s, tri_z);
538 n = '1 0 0' * (q_y * p_z - q_z * p_y)
539 + '0 1 0' * (q_z * p_x - q_x * p_z)
540 + '0 0 1' * (q_x * p_y - q_y * p_x);
541 area = area + vlen(n);
543 point = point + vlen(n) * (a + b + c);
548 norm = norm * (1 / area);
549 point = point * (1 / (3 * area));
550 if(vlen(norm) < 0.99)
552 print("trigger_warpzone near ", vtos(self.aiment.origin), " is nonplanar. BEWARE.\n");
553 area = 0; // no autofixing in this case
555 norm = normalize(norm);
560 org = self.aiment.origin;
561 ang = self.aiment.angles;
564 org = org - ((org - point) * norm) * norm; // project to plane
566 if(norm * v_forward < 0)
568 print("Position target of trigger_warpzone near ", vtos(self.aiment.origin), " points into trigger_warpzone. BEWARE.\n");
571 ang = vectoangles(norm, v_up); // keep rotation, but turn exactly against plane
573 if(norm * v_forward < 0.99)
574 print("trigger_warpzone near ", vtos(self.aiment.origin), " has been turned to match plane orientation (", vtos(self.aiment.angles), " -> ", vtos(ang), "\n");
575 if(vlen(org - self.aiment.origin) > 0.5)
576 print("trigger_warpzone near ", vtos(self.aiment.origin), " has been moved to match the plane (", vtos(self.aiment.origin), " -> ", vtos(org), ").\n");
582 ang = vectoangles(norm);
586 error("cannot infer origin/angles for this warpzone, please use a killtarget or a trigger_warpzone_position");
588 self.warpzone_origin = org;
589 self.warpzone_angles = ang;
592 void WarpZone_InitStep_ClearTarget()
595 self.enemy.enemy = world;
599 entity warpzone_first; .entity warpzone_next;
600 void WarpZone_InitStep_FindTarget()
608 // this way only one of the two ents needs to target
609 if(self.target != "")
611 self.enemy = self; // so the if(!e.enemy) check also skips self, saves one IF
614 for(e = world, i = 0; (e = find(e, targetname, self.target)); )
616 if(e.classname == self.classname) // possibly non-warpzones may use the same targetname!
617 if(random() * ++i < 1)
622 error("Warpzone with non-existing target");
630 void WarpZone_Think();
631 void WarpZone_InitStep_FinalizeTransform()
633 if(!self.enemy || self.enemy.enemy != self)
635 error("Invalid warp zone detected. Killed.");
639 warpzone_warpzones_exist = 1;
640 WarpZone_SetUp(self, self.warpzone_origin, self.warpzone_angles, self.enemy.warpzone_origin, self.enemy.warpzone_angles);
641 self.touch = WarpZone_Touch;
642 self.SendFlags = 0xFFFFFF;
643 if(self.spawnflags & 1)
645 self.think = WarpZone_Think;
646 self.nextthink = time;
652 float warpzone_initialized;
653 entity warpzone_first;
654 entity warpzone_position_first;
655 entity warpzone_camera_first;
656 .entity warpzone_next;
657 void spawnfunc_misc_warpzone_position(void)
659 // "target", "angles", "origin"
660 self.warpzone_next = warpzone_position_first;
661 warpzone_position_first = self;
663 void spawnfunc_trigger_warpzone_position(void)
665 spawnfunc_misc_warpzone_position();
667 void spawnfunc_trigger_warpzone(void)
669 // warp zone entities must have:
670 // "killtarget" pointing to a target_position with a direction arrow
671 // that points AWAY from the warp zone, and that is inside
672 // the warp zone trigger
673 // "target" pointing to an identical warp zone at another place in
674 // the map, with another killtarget to designate its
677 #ifndef WARPZONE_USE_FIXANGLE
678 // used when teleporting
679 precache_model("null");
683 self.scale = self.modelscale;
688 WarpZoneLib_ExactTrigger_Init();
692 setmodel(self, m); // no precision needed
694 setorigin(self, self.origin);
696 setsize(self, self.mins * self.scale, self.maxs * self.scale);
698 setsize(self, self.mins, self.maxs);
699 self.SendEntity = WarpZone_Send;
700 self.SendFlags = 0xFFFFFF;
701 BITSET_ASSIGN(self.effects, EF_NODEPTHTEST);
702 self.warpzone_next = warpzone_first;
703 warpzone_first = self;
705 void spawnfunc_func_camera(void)
708 self.scale = self.modelscale;
713 precache_model(self.model);
714 setmodel(self, self.model); // no precision needed
716 setorigin(self, self.origin);
718 setsize(self, self.mins * self.scale, self.maxs * self.scale);
720 setsize(self, self.mins, self.maxs);
722 self.solid = SOLID_BSP;
723 else if(self.solid < 0)
724 self.solid = SOLID_NOT;
725 self.SendEntity = WarpZone_Camera_Send;
726 self.SendFlags = 0xFFFFFF;
727 self.warpzone_next = warpzone_camera_first;
728 warpzone_camera_first = self;
730 void WarpZones_Reconnect()
734 for(self = warpzone_first; self; self = self.warpzone_next)
735 WarpZone_InitStep_ClearTarget();
736 for(self = warpzone_first; self; self = self.warpzone_next)
737 WarpZone_InitStep_FindTarget();
738 for(self = warpzone_camera_first; self; self = self.warpzone_next)
739 WarpZoneCamera_InitStep_FindTarget();
740 for(self = warpzone_first; self; self = self.warpzone_next)
741 WarpZone_InitStep_FinalizeTransform();
745 void WarpZone_Think()
747 if(self.warpzone_save_origin != self.origin
748 || self.warpzone_save_angles != self.angles
749 || self.warpzone_save_eorigin != self.enemy.origin
750 || self.warpzone_save_eangles != self.enemy.angles)
754 WarpZone_InitStep_UpdateTransform();
756 WarpZone_InitStep_UpdateTransform();
758 WarpZone_InitStep_FinalizeTransform();
760 WarpZone_InitStep_FinalizeTransform();
762 self.warpzone_save_origin = self.origin;
763 self.warpzone_save_angles = self.angles;
764 self.warpzone_save_eorigin = self.enemy.origin;
765 self.warpzone_save_eangles = self.enemy.angles;
767 self.nextthink = time;
770 void WarpZone_StartFrame()
773 if(warpzone_initialized == 0)
775 warpzone_initialized = 1;
777 for(self = warpzone_first; self; self = self.warpzone_next)
778 WarpZone_InitStep_FindOriginTarget();
779 for(self = warpzone_position_first; self; self = self.warpzone_next)
780 WarpZonePosition_InitStep_FindTarget();
781 for(self = warpzone_first; self; self = self.warpzone_next)
782 WarpZone_InitStep_UpdateTransform();
784 WarpZones_Reconnect();
785 WarpZone_PostInitialize_Callback();
788 entity oldself, oldother;
791 for(e = world; (e = nextent(e)); )
793 if(warpzone_warpzones_exist) { WarpZone_StoreProjectileData(e); }
795 float f = clienttype(e);
796 if(f == CLIENTTYPE_REAL)
798 if(e.solid == SOLID_NOT) // not spectating?
799 if(e.movetype == MOVETYPE_NOCLIP || e.movetype == MOVETYPE_FLY || e.movetype == MOVETYPE_FLY_WORLDONLY) // not spectating? (this is to catch observers)
804 if(warpzone_warpzones_exist) {
805 self = WarpZone_Find(e.origin + e.mins, e.origin + e.maxs);
807 if(!WarpZoneLib_ExactTrigger_Touch())
808 if(WarpZone_PlaneDist(self, e.origin + e.view_ofs) <= 0)
809 WarpZone_Teleport(self, e, -1, 0); } // NOT triggering targets by this!
812 self = Teleport_Find(e.origin + e.mins, e.origin + e.maxs);
814 if(!WarpZoneLib_ExactTrigger_Touch())
815 Simple_TeleportPlayer(self, other); // NOT triggering targets by this!
819 if(f == CLIENTTYPE_NOTACLIENT)
821 if(warpzone_warpzones_exist)
822 for(; (e = nextent(e)); )
823 WarpZone_StoreProjectileData(e);
831 .float warpzone_reconnecting;
832 float visible_to_some_client(entity ent)
835 for(e = nextent(world); clienttype(e) != CLIENTTYPE_NOTACLIENT; e = nextent(e))
836 if(e.classname == "player" && clienttype(e) == CLIENTTYPE_REAL)
837 if(checkpvs(e.origin + e.view_ofs, ent))
841 void trigger_warpzone_reconnect_use()
845 // NOTE: this matches for target, not targetname, but of course
846 // targetname must be set too on the other entities
847 for(self = warpzone_first; self; self = self.warpzone_next)
848 self.warpzone_reconnecting = ((e.target == "" || self.target == e.target) && !((e.spawnflags & 1) && (visible_to_some_client(self) || visible_to_some_client(self.enemy))));
849 for(self = warpzone_camera_first; self; self = self.warpzone_next)
850 self.warpzone_reconnecting = ((e.target == "" || self.target == e.target) && !((e.spawnflags & 1) && visible_to_some_client(self)));
851 for(self = warpzone_first; self; self = self.warpzone_next)
852 if(self.warpzone_reconnecting)
853 WarpZone_InitStep_ClearTarget();
854 for(self = warpzone_first; self; self = self.warpzone_next)
855 if(self.warpzone_reconnecting)
856 WarpZone_InitStep_FindTarget();
857 for(self = warpzone_camera_first; self; self = self.warpzone_next)
858 if(self.warpzone_reconnecting)
859 WarpZoneCamera_InitStep_FindTarget();
860 for(self = warpzone_first; self; self = self.warpzone_next)
861 if(self.warpzone_reconnecting || self.enemy.warpzone_reconnecting)
862 WarpZone_InitStep_FinalizeTransform();
866 void spawnfunc_trigger_warpzone_reconnect()
868 self.use = trigger_warpzone_reconnect_use;
871 void spawnfunc_target_warpzone_reconnect()
873 spawnfunc_trigger_warpzone_reconnect(); // both names make sense here :(
876 void WarpZone_PlayerPhysics_FixVAngle(void)
878 #ifndef WARPZONE_DONT_FIX_VANGLE
879 if(clienttype(self) == CLIENTTYPE_REAL)
880 if(self.v_angle_z <= 360) // if not already adjusted
881 if(time - self.ping * 0.001 < self.warpzone_teleport_time)
883 self.v_angle = WarpZone_TransformVAngles(self.warpzone_teleport_zone, self.v_angle);
884 self.v_angle_z += 720; // mark as adjusted