- if(!warpzone_fixingview)
- return;
- warpzone_fixingview = 0;
- cvar_set("r_drawexteriormodel", ftos(warpzone_fixingview_drawexteriormodel));
- //cvar_set("cl_sidespeed", ftos(warpzone_fixingview_sidespeed));
- //cvar_set("cl_forwardspeed", ftos(warpzone_fixingview_forwardspeed));
+ vector mi, ma;
+ entity e;
+ float pd;
+
+ mi_x = min5(o_x, c0_x, c1_x, c2_x, c3_x);
+ ma_x = max5(o_x, c0_x, c1_x, c2_x, c3_x);
+ mi_y = min5(o_y, c0_y, c1_y, c2_y, c3_y);
+ ma_y = max5(o_y, c0_y, c1_y, c2_y, c3_y);
+ mi_z = min5(o_z, c0_z, c1_z, c2_z, c3_z);
+ ma_z = max5(o_z, c0_z, c1_z, c2_z, c3_z);
+
+ e = WarpZone_Find(mi, ma);
+ if(e)
+ {
+ if(WarpZone_PlaneDist(e, o) < 0)
+ return '0 0 0';
+ // can't really be, though, but if it is, this is not my warpzone, but a random different one in the same mins/maxs
+ pd = min4(
+ WarpZone_PlaneDist(e, c0),
+ WarpZone_PlaneDist(e, c1),
+ WarpZone_PlaneDist(e, c2),
+ WarpZone_PlaneDist(e, c3)
+ );
+ if(pd < 0)
+ return e.warpzone_forward * -pd;
+ }
+
+ return '0 0 0';
+}
+
+void WarpZone_FixPMove()
+{
+ entity e;
+ e = WarpZone_Find(pmove_org, pmove_org);
+ if(e)
+ {
+ pmove_org = WarpZone_TransformOrigin(e, pmove_org);
+ input_angles = WarpZone_TransformVAngles(e, input_angles);
+ }