]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move projectile handling to new folder as well
authorSamual Lenks <samual@xonotic.org>
Mon, 10 Jun 2013 18:35:28 +0000 (14:35 -0400)
committerSamual Lenks <samual@xonotic.org>
Mon, 10 Jun 2013 18:35:28 +0000 (14:35 -0400)
qcsrc/server/csqcprojectile.qc [deleted file]
qcsrc/server/csqcprojectile.qh [deleted file]
qcsrc/server/weapons/csqcprojectile.qc [new file with mode: 0644]
qcsrc/server/weapons/csqcprojectile.qh [new file with mode: 0644]

diff --git a/qcsrc/server/csqcprojectile.qc b/qcsrc/server/csqcprojectile.qc
deleted file mode 100644 (file)
index 3554f1f..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-.float csqcprojectile_type;
-
-float CSQCProjectile_SendEntity(entity to, float sf)
-{
-       float ft, fr;
-
-       // note: flag 0x08 = no trail please (teleport bit)
-       sf = sf & 0x0F;
-
-       if(self.csqcprojectile_clientanimate)
-               sf |= 0x80; // client animated, not interpolated
-
-       if(self.flags & FL_ONGROUND)
-               sf |= 0x40;
-
-       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;
-               if(ft <= 255 && fr <= 255 && fr >= 1)
-                       sf |= 0x20;
-       }
-
-       if(self.gravity != 0)
-               sf |= 0x10;
-
-       WriteByte(MSG_ENTITY, ENT_CLIENT_PROJECTILE);
-       WriteByte(MSG_ENTITY, sf);
-
-       if(sf & 1)
-       {
-               WriteCoord(MSG_ENTITY, self.origin_x);
-               WriteCoord(MSG_ENTITY, self.origin_y);
-               WriteCoord(MSG_ENTITY, self.origin_z);
-
-               if(sf & 0x80)
-               {
-                       WriteCoord(MSG_ENTITY, self.velocity_x);
-                       WriteCoord(MSG_ENTITY, self.velocity_y);
-                       WriteCoord(MSG_ENTITY, self.velocity_z);
-                       if(sf & 0x10)
-                               WriteCoord(MSG_ENTITY, self.gravity);
-               }
-
-               if(sf & 0x20)
-               {
-                       WriteByte(MSG_ENTITY, ft);
-                       WriteByte(MSG_ENTITY, fr);
-               }
-       }
-
-       if(sf & 2)
-               WriteByte(MSG_ENTITY, self.csqcprojectile_type); // TODO maybe put this into sf?
-       
-       return 1;
-}
-
-.vector csqcprojectile_oldorigin;
-void CSQCProjectile_Check(entity e)
-{
-       if(e.csqcprojectile_clientanimate)
-       if(e.flags & FL_ONGROUND)
-       if(e.origin != e.csqcprojectile_oldorigin)
-               UpdateCSQCProjectile(e);
-       e.csqcprojectile_oldorigin = e.origin;
-}
-
-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)
-                       e.gravity = 1;
-       }
-       else
-               e.gravity = 0;
-
-       if(!sound_allowed(MSG_BROADCAST, e))
-               type |= 0x80;
-       e.csqcprojectile_type = type;
-}
-
-void UpdateCSQCProjectile(entity e)
-{
-       if(e.SendEntity == CSQCProjectile_SendEntity)
-       {
-               // send new origin data
-               e.SendFlags |= 0x01;
-       }
-}
-
-void UpdateCSQCProjectileAfterTeleport(entity e)
-{
-       if(e.SendEntity == CSQCProjectile_SendEntity)
-       {
-               // send new origin data
-               e.SendFlags |= 0x01;
-               // mark as teleported
-               e.SendFlags |= 0x08;
-       }
-}
diff --git a/qcsrc/server/csqcprojectile.qh b/qcsrc/server/csqcprojectile.qh
deleted file mode 100644 (file)
index e00c098..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-.float csqcprojectile_clientanimate;
-
-void CSQCProjectile(entity e, float clientanimate, float type, float docull);
-void UpdateCSQCProjectile(entity e);
-void UpdateCSQCProjectileAfterTeleport(entity e);
-void CSQCProjectile_Check(entity e);
diff --git a/qcsrc/server/weapons/csqcprojectile.qc b/qcsrc/server/weapons/csqcprojectile.qc
new file mode 100644 (file)
index 0000000..3554f1f
--- /dev/null
@@ -0,0 +1,106 @@
+.float csqcprojectile_type;
+
+float CSQCProjectile_SendEntity(entity to, float sf)
+{
+       float ft, fr;
+
+       // note: flag 0x08 = no trail please (teleport bit)
+       sf = sf & 0x0F;
+
+       if(self.csqcprojectile_clientanimate)
+               sf |= 0x80; // client animated, not interpolated
+
+       if(self.flags & FL_ONGROUND)
+               sf |= 0x40;
+
+       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;
+               if(ft <= 255 && fr <= 255 && fr >= 1)
+                       sf |= 0x20;
+       }
+
+       if(self.gravity != 0)
+               sf |= 0x10;
+
+       WriteByte(MSG_ENTITY, ENT_CLIENT_PROJECTILE);
+       WriteByte(MSG_ENTITY, sf);
+
+       if(sf & 1)
+       {
+               WriteCoord(MSG_ENTITY, self.origin_x);
+               WriteCoord(MSG_ENTITY, self.origin_y);
+               WriteCoord(MSG_ENTITY, self.origin_z);
+
+               if(sf & 0x80)
+               {
+                       WriteCoord(MSG_ENTITY, self.velocity_x);
+                       WriteCoord(MSG_ENTITY, self.velocity_y);
+                       WriteCoord(MSG_ENTITY, self.velocity_z);
+                       if(sf & 0x10)
+                               WriteCoord(MSG_ENTITY, self.gravity);
+               }
+
+               if(sf & 0x20)
+               {
+                       WriteByte(MSG_ENTITY, ft);
+                       WriteByte(MSG_ENTITY, fr);
+               }
+       }
+
+       if(sf & 2)
+               WriteByte(MSG_ENTITY, self.csqcprojectile_type); // TODO maybe put this into sf?
+       
+       return 1;
+}
+
+.vector csqcprojectile_oldorigin;
+void CSQCProjectile_Check(entity e)
+{
+       if(e.csqcprojectile_clientanimate)
+       if(e.flags & FL_ONGROUND)
+       if(e.origin != e.csqcprojectile_oldorigin)
+               UpdateCSQCProjectile(e);
+       e.csqcprojectile_oldorigin = e.origin;
+}
+
+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)
+                       e.gravity = 1;
+       }
+       else
+               e.gravity = 0;
+
+       if(!sound_allowed(MSG_BROADCAST, e))
+               type |= 0x80;
+       e.csqcprojectile_type = type;
+}
+
+void UpdateCSQCProjectile(entity e)
+{
+       if(e.SendEntity == CSQCProjectile_SendEntity)
+       {
+               // send new origin data
+               e.SendFlags |= 0x01;
+       }
+}
+
+void UpdateCSQCProjectileAfterTeleport(entity e)
+{
+       if(e.SendEntity == CSQCProjectile_SendEntity)
+       {
+               // send new origin data
+               e.SendFlags |= 0x01;
+               // mark as teleported
+               e.SendFlags |= 0x08;
+       }
+}
diff --git a/qcsrc/server/weapons/csqcprojectile.qh b/qcsrc/server/weapons/csqcprojectile.qh
new file mode 100644 (file)
index 0000000..e00c098
--- /dev/null
@@ -0,0 +1,6 @@
+.float csqcprojectile_clientanimate;
+
+void CSQCProjectile(entity e, float clientanimate, float type, float docull);
+void UpdateCSQCProjectile(entity e);
+void UpdateCSQCProjectileAfterTeleport(entity e);
+void CSQCProjectile_Check(entity e);