Attempt to port the shownames feature from Xonotic (floating names above players...
[voretournament/voretournament.git] / data / qcsrc / client / Main.qc
index e96c53b524adaa13fc19b1bf40d72ecf2ef697bd..cea3273d385a5249596a8d362f26e35609e51d1c 100644 (file)
@@ -657,17 +657,38 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
 \r
 // --------------------------------------------------------------------------\r
 // BEGIN OPTIONAL CSQC FUNCTIONS\r
+void Ent_RemoveEntCS()\r
+{\r
+       entcs_receiver[self.sv_entnum] = world;\r
+}\r
 void Ent_ReadEntCS()\r
 {\r
+       float sf;\r
        InterpolateOrigin_Undo();\r
 \r
        self.classname = "entcs_receiver";\r
-       self.sv_entnum = ReadByte() - 1;\r
-       self.origin_x = ReadShort();\r
-       self.origin_y = ReadShort();\r
-       self.origin_z = ReadShort();\r
-       self.angles_y = ReadByte() * 360.0 / 256;\r
-       self.origin_z = self.angles_x = self.angles_z = 0;\r
+       sf = ReadByte();\r
+\r
+       if(sf & 1)\r
+               self.sv_entnum = ReadByte();\r
+       if(sf & 2)\r
+       {\r
+               self.origin_x = ReadShort();\r
+               self.origin_y = ReadShort();\r
+               self.origin_z = ReadShort();\r
+       }\r
+       if(sf & 4)\r
+       {\r
+               self.angles_y = ReadByte() * 360.0 / 256;\r
+               self.angles_x = self.angles_z = 0;\r
+       }\r
+       if(sf & 8)\r
+               self.healthvalue = ReadByte() * 10;\r
+       if(sf & 16)\r
+               self.armorvalue = ReadByte() * 10;\r
+\r
+       entcs_receiver[self.sv_entnum] = self;\r
+       self.entremove = Ent_RemoveEntCS;\r
 \r
        InterpolateOrigin_Note();\r
 }\r