X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fweapons%2Fcsqcprojectile.qc;h=f3e9f22ef6859a2b8e538a39e6b14be0b602c92f;hb=4e21f418ad9e6287efb942c1fa2861a51981110a;hp=7f3d97b943ee9242838778200d42ec9f1e8df500;hpb=9f1091e432a2db424bfad2482694ee8b34edbe9c;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/weapons/csqcprojectile.qc b/qcsrc/server/weapons/csqcprojectile.qc index 7f3d97b94..07f6f5c66 100644 --- a/qcsrc/server/weapons/csqcprojectile.qc +++ b/qcsrc/server/weapons/csqcprojectile.qc @@ -1,11 +1,12 @@ #include "csqcprojectile.qh" -#include "../../common/t_items.qh" - -#include "../command/common.qh" - -#include "../../common/constants.qh" -#include "../../common/weapons/all.qh" +#include +#include +#include +#include +#include +#include +#include .float csqcprojectile_type; @@ -16,22 +17,22 @@ bool CSQCProjectile_SendEntity(entity this, entity to, int sf) // note: flag 0x08 = no trail please (teleport bit) sf = sf & 0x0F; - if(self.csqcprojectile_clientanimate) + if(this.csqcprojectile_clientanimate) sf |= 0x80; // client animated, not interpolated - if(IS_ONGROUND(self)) + if(IS_ONGROUND(this)) sf |= 0x40; ft = fr = 0; - if(self.fade_time != 0 || self.fade_rate != 0) + if(this.fade_time != 0 || this.fade_rate != 0) { - ft = (self.fade_time - time) / sys_frametime; - fr = (1 / self.fade_rate) / sys_frametime; + ft = (this.fade_time - time) / sys_frametime; + fr = (1 / this.fade_rate) / sys_frametime; if(ft <= 255 && fr <= 255 && fr >= 1) sf |= 0x20; } - if(self.gravity != 0) + if(this.gravity != 0) sf |= 0x10; WriteHeader(MSG_ENTITY, ENT_CLIENT_PROJECTILE); @@ -39,17 +40,13 @@ bool CSQCProjectile_SendEntity(entity this, entity to, int sf) if(sf & 1) { - WriteCoord(MSG_ENTITY, self.origin.x); - WriteCoord(MSG_ENTITY, self.origin.y); - WriteCoord(MSG_ENTITY, self.origin.z); + WriteVector(MSG_ENTITY, this.origin); if(sf & 0x80) { - WriteCoord(MSG_ENTITY, self.velocity.x); - WriteCoord(MSG_ENTITY, self.velocity.y); - WriteCoord(MSG_ENTITY, self.velocity.z); + WriteVector(MSG_ENTITY, this.velocity); if(sf & 0x10) - WriteCoord(MSG_ENTITY, self.gravity); + WriteCoord(MSG_ENTITY, this.gravity); } if(sf & 0x20) @@ -58,11 +55,14 @@ bool CSQCProjectile_SendEntity(entity this, entity to, int sf) WriteByte(MSG_ENTITY, fr); } - WriteByte(MSG_ENTITY, self.realowner.team); + if(teamplay) + WriteByte(MSG_ENTITY, this.realowner.team); + else + WriteByte(MSG_ENTITY, this.realowner.clientcolors); // NOTE: doesn't work on non-clients } if(sf & 2) - WriteByte(MSG_ENTITY, self.csqcprojectile_type); // TODO maybe put this into sf? + WriteByte(MSG_ENTITY, this.csqcprojectile_type); // TODO maybe put this into sf? return true; } @@ -83,7 +83,7 @@ void CSQCProjectile(entity e, float clientanimate, int type, float docull) e.csqcprojectile_clientanimate = clientanimate; - if(e.movetype == MOVETYPE_TOSS || e.movetype == MOVETYPE_BOUNCE) + if(e.move_movetype == MOVETYPE_TOSS || e.move_movetype == MOVETYPE_BOUNCE) { if(e.gravity == 0) e.gravity = 1; @@ -98,13 +98,13 @@ void CSQCProjectile(entity e, float clientanimate, int type, float docull) void UpdateCSQCProjectile(entity e) { - if(e.SendEntity3 == CSQCProjectile_SendEntity) + if(getSendEntity(e) == CSQCProjectile_SendEntity) { // send new origin data e.SendFlags |= 0x01; } // FIXME HACK - else if(e.SendEntity3 == ItemSend) + else if(getSendEntity(e) == ItemSend) { ItemUpdate(e); } @@ -113,10 +113,14 @@ void UpdateCSQCProjectile(entity e) void UpdateCSQCProjectileAfterTeleport(entity e) { - if(e.SendEntity3 == CSQCProjectile_SendEntity) + if(getSendEntity(e) == CSQCProjectile_SendEntity) { // send new origin data e.SendFlags |= 0x01; + // send full data as the projectile may need resetting + // this is a workaround for client-side projectiles erroneously calling their SUB_Stop touch function occasionally + // when passing through a warpzone + e.SendFlags |= 2; // mark as teleported e.SendFlags |= 0x08; }