]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/ent_cs.qc
make entcs entities use sendflags (preparation for including h/a info)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / ent_cs.qc
index bee79d682e9e2d5d4ad31cd84a8c0231b788187c..970f20a9205a1bdc3200fae83f477ed38dcc8226 100644 (file)
@@ -42,11 +42,17 @@ float entcs_send(entity to, float sf)
        entity o;
        o = self.owner;
        WriteByte(MSG_ENTITY, ENT_CLIENT_ENTCS);
-       WriteByte(MSG_ENTITY, num_for_edict(o));
-       WriteShort(MSG_ENTITY, o.origin_x);
-       WriteShort(MSG_ENTITY, o.origin_y);
-       WriteShort(MSG_ENTITY, o.origin_z);
-       WriteByte(MSG_ENTITY, o.angles_y * 256.0 / 360);
+       WriteByte(MSG_ENTITY, sf);
+       if(sf & 1)
+               WriteByte(MSG_ENTITY, num_for_edict(o));
+       if(sf & 2)
+       {
+               WriteShort(MSG_ENTITY, o.origin_x);
+               WriteShort(MSG_ENTITY, o.origin_y);
+               WriteShort(MSG_ENTITY, o.origin_z);
+       }
+       if(sf & 4)
+               WriteByte(MSG_ENTITY, o.angles_y * 256.0 / 360);
        return TRUE;
 };
 
@@ -57,11 +63,15 @@ void entcs_think()
        entity o;
        o = self.owner;
 
-       if(o.origin != self.origin || o.angles != self.angles)
+       if(o.origin != self.origin)
        {
                setorigin(self, o.origin);
+               self.SendFlags |= 2;
+       }
+       if(o.angles_y != self.angles_y)
+       {
                self.angles = o.angles;
-               self.SendFlags |= 1;
+               self.SendFlags |= 4;
        }
 };