-#define REMOVEHACK
+#ifdef WARPZONELIB_KEEPDEBUG
+#define WARPZONELIB_REMOVEHACK
+#endif
// for think function
.vector warpzone_save_origin;
BITXOR_ASSIGN(player.effects, EF_TELEPORT_BIT);
- if(player.classname == "player")
+ if(IS_PLAYER(player))
BITCLR_ASSIGN(player.flags, FL_ONGROUND);
WarpZone_PostTeleportPlayer_Callback(player);
o10 = o1 = WarpZone_TransformOrigin(wz, o0);
v1 = WarpZone_TransformVelocity(wz, v0);
- if(clienttype(player) != CLIENTTYPE_NOTACLIENT)
+ if not(IS_NOT_A_CLIENT(player))
a1 = WarpZone_TransformVAngles(wz, player.v_angle);
else
a1 = WarpZone_TransformAngles(wz, a0);
player.warpzone_teleport_finishtime += sys_frametime - dt;
#ifndef WARPZONE_USE_FIXANGLE
- if(player.classname == "player")
+ if(IS_PLAYER(player))
{
// instead of fixangle, send the transform to the client for smoother operation
player.fixangle = FALSE;
// 96*frametime
float d;
d = 24 + max(vlen(other.mins), vlen(other.maxs));
- if(clienttype(other) == CLIENTTYPE_NOTACLIENT)
+ if(IS_NOT_A_CLIENT(other))
f = -d / bound(frametime * d * 1, frametime * vlen(other.velocity), d);
else
f = -1;
float WarpZone_Camera_Send(entity to, float sendflags)
{
- float f;
+ float f = 0;
WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_CAMERA);
if(self.warpzone_fadestart)
return TRUE;
}
+#ifdef WARPZONELIB_KEEPDEBUG
float WarpZone_CheckProjectileImpact(entity player)
{
vector o0, v0;
if(!wz)
return 0;
-#ifdef REMOVEHACK
+#ifdef WARPZONELIB_REMOVEHACK
print("impactfilter found something - and it no longer gets handled correctly - please tell divVerent whether anything behaves broken now\n");
#else
print("impactfilter found something - and it even gets handled correctly - please tell divVerent that this code apparently gets triggered again\n");
print("Origin: ", vtos(player.origin), "\n");
print("Velocity: ", vtos(player.velocity), "\n");
-#ifdef REMOVEHACK
+#ifdef WARPZONELIB_REMOVEHACK
return 0;
#else
// retry previous move
return +1;
#endif
}
+#endif
+
float WarpZone_Projectile_Touch()
{
- float f;
if(other.classname == "trigger_warpzone")
return TRUE;
// no further impacts if we teleported this frame!
+ // this is because even if we did teleport, the engine still may raise
+ // touch events for the previous location
+ // engine now aborts moves on teleport, so this SHOULD not happen any more
+ // but if this is called from TouchAreaGrid of the projectile moving,
+ // then this won't do
if(time == self.warpzone_teleport_time)
return TRUE;
+#ifdef WARPZONELIB_KEEPDEBUG
// this SEEMS to not happen at the moment, but if it did, it would be more reliable
{
float save_dpstartcontents;
save_ent = trace_ent;
save_inopen = trace_inopen;
save_inwater = trace_inwater;
+ float f;
if((f = WarpZone_CheckProjectileImpact(self)) != 0)
return (f > 0);
trace_dpstartcontents = save_dpstartcontents;
trace_inopen = save_inopen;
trace_inwater = save_inwater;
}
+#endif
if(WarpZone_Projectile_Touch_ImpactFilter_Callback())
return TRUE;
norm = normalize(norm);
}
+#ifdef GMQCC
+ ang = '0 0 0';
+#endif
if(self.aiment)
{
org = self.aiment.origin;
{
if(warpzone_warpzones_exist) { WarpZone_StoreProjectileData(e); }
- float f = clienttype(e);
- if(f == CLIENTTYPE_REAL)
+ if(IS_REAL_CLIENT(e))
{
if(e.solid == SOLID_NOT) // not spectating?
if(e.movetype == MOVETYPE_NOCLIP || e.movetype == MOVETYPE_FLY || e.movetype == MOVETYPE_FLY_WORLDONLY) // not spectating? (this is to catch observers)
}
}
- if(f == CLIENTTYPE_NOTACLIENT)
+ if(IS_NOT_A_CLIENT(e))
{
if(warpzone_warpzones_exist)
for(; (e = nextent(e)); )
float visible_to_some_client(entity ent)
{
entity e;
- for(e = nextent(world); clienttype(e) != CLIENTTYPE_NOTACLIENT; e = nextent(e))
- if(e.classname == "player" && clienttype(e) == CLIENTTYPE_REAL)
+ for(e = nextent(world); !IS_NOT_A_CLIENT(e); e = nextent(e))
+ if(IS_PLAYER(e) && IS_REAL_CLIENT(e))
if(checkpvs(e.origin + e.view_ofs, ent))
return 1;
return 0;
void WarpZone_PlayerPhysics_FixVAngle(void)
{
#ifndef WARPZONE_DONT_FIX_VANGLE
- if(clienttype(self) == CLIENTTYPE_REAL)
+ if(IS_REAL_CLIENT(self))
if(self.v_angle_z <= 360) // if not already adjusted
if(time - self.ping * 0.001 < self.warpzone_teleport_time)
{