X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fwarpzonelib%2Fserver.qc;h=25bcd2901f9e449cffa4a1274a99b19c78936a7f;hp=6c27842ef27f2066034a09e7bc81dd3e372bb074;hb=db20e10f5f82423356007ed51deb53c05f964a9a;hpb=d9708336de4c01e81ea08bb205093b676b7cb882 diff --git a/qcsrc/warpzonelib/server.qc b/qcsrc/warpzonelib/server.qc index 6c27842ef..25bcd2901 100644 --- a/qcsrc/warpzonelib/server.qc +++ b/qcsrc/warpzonelib/server.qc @@ -1,4 +1,6 @@ -#define REMOVEHACK +#ifdef WARPZONELIB_KEEPDEBUG +#define WARPZONELIB_REMOVEHACK +#endif // for think function .vector warpzone_save_origin; @@ -29,7 +31,7 @@ void WarpZone_TeleportPlayer(entity teleporter, entity player, vector to, vector 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); @@ -54,7 +56,7 @@ float WarpZone_Teleport(entity wz, entity player, float f0, float f1) 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); @@ -114,7 +116,7 @@ float WarpZone_Teleport(entity wz, entity player, float f0, float f1) 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; @@ -170,7 +172,7 @@ void WarpZone_Touch (void) // 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; @@ -257,7 +259,7 @@ float WarpZone_Send(entity to, float sendflags) float WarpZone_Camera_Send(entity to, float sendflags) { - float f; + float f = 0; WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_CAMERA); if(self.warpzone_fadestart) @@ -300,6 +302,7 @@ float WarpZone_Camera_Send(entity to, float sendflags) return TRUE; } +#ifdef WARPZONELIB_KEEPDEBUG float WarpZone_CheckProjectileImpact(entity player) { vector o0, v0; @@ -317,7 +320,7 @@ float WarpZone_CheckProjectileImpact(entity player) 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"); @@ -326,7 +329,7 @@ float WarpZone_CheckProjectileImpact(entity player) print("Origin: ", vtos(player.origin), "\n"); print("Velocity: ", vtos(player.velocity), "\n"); -#ifdef REMOVEHACK +#ifdef WARPZONELIB_REMOVEHACK return 0; #else // retry previous move @@ -365,16 +368,23 @@ float WarpZone_CheckProjectileImpact(entity player) 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; @@ -403,6 +413,7 @@ float WarpZone_Projectile_Touch() 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; @@ -419,6 +430,7 @@ float WarpZone_Projectile_Touch() trace_inopen = save_inopen; trace_inwater = save_inwater; } +#endif if(WarpZone_Projectile_Touch_ImpactFilter_Callback()) return TRUE; @@ -558,6 +570,9 @@ void WarpZone_InitStep_UpdateTransform() norm = normalize(norm); } +#ifdef GMQCC + ang = '0 0 0'; +#endif if(self.aiment) { org = self.aiment.origin; @@ -795,8 +810,7 @@ void WarpZone_StartFrame() { 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) @@ -819,7 +833,7 @@ void WarpZone_StartFrame() } } - if(f == CLIENTTYPE_NOTACLIENT) + if(IS_NOT_A_CLIENT(e)) { if(warpzone_warpzones_exist) for(; (e = nextent(e)); ) @@ -835,8 +849,8 @@ void WarpZone_StartFrame() 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; @@ -879,7 +893,7 @@ void spawnfunc_target_warpzone_reconnect() 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) {