]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/csqcprojectile.qc
Merge branch 'master' into Mario/spawnsystem_mutator
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / csqcprojectile.qc
index aecdcf7f2f186b7091123ee7253fcb02753edf9f..4d208ebda808341f778f242ba0135d7255bd29d9 100644 (file)
@@ -3,10 +3,9 @@
 float CSQCProjectile_SendEntity(entity to, float sf)
 {
        float ft, fr;
-       float s;
 
-       // note: flag 0x10 = no trail please
-       sf = sf & 0x1F;
+       // note: flag 0x08 = no trail please (teleport bit)
+       sf = sf & 0x0F;
 
        if(self.csqcprojectile_clientanimate)
                sf |= 0x80; // client animated, not interpolated
@@ -14,7 +13,8 @@ float CSQCProjectile_SendEntity(entity to, float sf)
        if(self.flags & FL_ONGROUND)
                sf |= 0x40;
 
-       if(self.fade_time != 0 && self.fade_rate != 0)
+       ft = fr = 0;
+       if(self.fade_time != 0 || self.fade_rate != 0)
        {
                ft = (self.fade_time - time) / sys_frametime;
                fr = (1 / self.fade_rate) / sys_frametime;
@@ -22,12 +22,8 @@ float CSQCProjectile_SendEntity(entity to, float sf)
                        sf |= 0x20;
        }
 
-       // HACK: subflags for sendflags = 0x80
-
-       s = 0;
-
-       if (self.movetype == MOVETYPE_BOUNCEMISSILE || self.movetype == MOVETYPE_BOUNCE)
-               s |= 1;
+       if(self.gravity != 0)
+               sf |= 0x10;
 
        WriteByte(MSG_ENTITY, ENT_CLIENT_PROJECTILE);
        WriteByte(MSG_ENTITY, sf);
@@ -43,15 +39,8 @@ float CSQCProjectile_SendEntity(entity to, float sf)
                        WriteCoord(MSG_ENTITY, self.velocity_x);
                        WriteCoord(MSG_ENTITY, self.velocity_y);
                        WriteCoord(MSG_ENTITY, self.velocity_z);
-                       WriteCoord(MSG_ENTITY, self.gravity);
-
-                       WriteByte(MSG_ENTITY, s);
-
-                       if (s & 1)
-                       {
-                               WriteCoord(MSG_ENTITY, self.bouncefactor);
-                               WriteCoord(MSG_ENTITY, self.bouncestop);
-                       }
+                       if(sf & 0x10)
+                               WriteCoord(MSG_ENTITY, self.gravity);
                }
 
                if(sf & 0x20)
@@ -63,7 +52,7 @@ float CSQCProjectile_SendEntity(entity to, float sf)
 
        if(sf & 2)
                WriteByte(MSG_ENTITY, self.csqcprojectile_type); // TODO maybe put this into sf?
-       
+
        return 1;
 }
 
@@ -80,9 +69,9 @@ void CSQCProjectile_Check(entity e)
 void CSQCProjectile(entity e, float clientanimate, float type, float docull)
 {
        Net_LinkEntity(e, docull, 0, CSQCProjectile_SendEntity);
-       
+
        e.csqcprojectile_clientanimate = clientanimate;
-       
+
        if(e.movetype == MOVETYPE_TOSS || e.movetype == MOVETYPE_BOUNCE)
        {
                if(e.gravity == 0)
@@ -91,47 +80,37 @@ void CSQCProjectile(entity e, float clientanimate, float type, float docull)
        else
                e.gravity = 0;
 
-       e.csqcprojectile_type = type;
        if(!sound_allowed(MSG_BROADCAST, e))
                type |= 0x80;
+       e.csqcprojectile_type = type;
 }
 
+// FIXME HACK
+float ItemSend(entity to, float sf);
+void ItemUpdate(entity item);
+// END HACK
 void UpdateCSQCProjectile(entity e)
 {
        if(e.SendEntity == CSQCProjectile_SendEntity)
        {
                // send new origin data
-               e.SendFlags |= 1;
+               e.SendFlags |= 0x01;
        }
-}
-
-void UpdateCSQCProjectileAfterTeleport(entity e)
-{
-       if(e.SendEntity == CSQCProjectile_SendEntity)
+// FIXME HACK
+       else if(e.SendEntity == ItemSend)
        {
-               // send new origin data and mark as teleported
-               e.SendFlags |= 0x11;
+               ItemUpdate(e);
        }
+// END HACK
 }
 
-.void(void) csqcprojectile_oldthink;
-.float csqcprojectile_oldnextthink;
-
-void CSQCProjectile_Update_Think()
-{
-       UpdateCSQCProjectile(self);
-       self.think = self.csqcprojectile_oldthink;
-       self.nextthink = max(time, self.csqcprojectile_oldnextthink);
-}
-
-void UpdateCSQCProjectileNextFrame(entity e)
+void UpdateCSQCProjectileAfterTeleport(entity e)
 {
        if(e.SendEntity == CSQCProjectile_SendEntity)
-       if(e.think != CSQCProjectile_Update_Think)
        {
-               e.csqcprojectile_oldthink = e.think;
-               e.csqcprojectile_oldnextthink = e.nextthink;
-               e.think = CSQCProjectile_Update_Think;
-               e.nextthink = time;
+               // send new origin data
+               e.SendFlags |= 0x01;
+               // mark as teleported
+               e.SendFlags |= 0x08;
        }
 }