Do not show names for prey
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 8 Jul 2011 23:56:03 +0000 (02:56 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 8 Jul 2011 23:56:03 +0000 (02:56 +0300)
data/qcsrc/client/Main.qc
data/qcsrc/client/shownames.qc
data/qcsrc/client/shownames.qh
data/qcsrc/server/ent_cs.qc

index cea3273..48e137c 100644 (file)
@@ -686,6 +686,8 @@ void Ent_ReadEntCS()
                self.healthvalue = ReadByte() * 10;\r
        if(sf & 16)\r
                self.armorvalue = ReadByte() * 10;\r
+       if(sf & 32)\r
+               self.eaten = ReadByte();\r
 \r
        entcs_receiver[self.sv_entnum] = self;\r
        self.entremove = Ent_RemoveEntCS;\r
index eb15a24..37bd0bf 100644 (file)
@@ -2,6 +2,7 @@
 // self.origin = player origin TODO: should maybe move this so it's the origin of the shownames tag already in SSQC for culling?
 // self.healthvalue
 // self.armorvalue
+// self.eaten
 // self.sameteam = player is on same team as local client
 //
 const float SHOWNAMES_FADESPEED = 4;
@@ -13,6 +14,9 @@ void Draw_ShowNames(entity ent)
        if(ent.sv_entnum == player_localentnum && !cvar("chase_active"))
                return;
 
+       if(ent.eaten) // don't show names for prey
+               return;
+
        if(ent.sameteam || (!ent.sameteam && cvar("hud_shownames_enemies")))
        {
                ent.origin_z += cvar("hud_shownames_offset");
@@ -167,12 +171,14 @@ void Draw_ShowNames_All()
                        e.healthvalue = entcs.healthvalue;
                        e.armorvalue = entcs.armorvalue;
                        e.sameteam = 1; /* (teamplay && (t == myteam)); */
+                       e.eaten = entcs.eaten;
                }
                else
                {
                        e.healthvalue = 2342;
                        e.armorvalue = 0;
                        e.sameteam = 0;
+                       e.eaten = 0;
                }
 
                e.origin = getplayerorigin(i);
index 11f1e74..fbd20f0 100644 (file)
@@ -1,3 +1,4 @@
 .float healthvalue;
 .float armorvalue;
+.float eaten;
 .float sameteam;
index 128b14a..9f564b4 100644 (file)
@@ -55,12 +55,14 @@ float entcs_send(entity to, float sf)
                WriteByte(MSG_ENTITY, self.health / 10); // FIXME use a better scale?\r
        if(sf & 16)\r
                WriteByte(MSG_ENTITY, self.armorvalue / 10); // FIXME use a better scale?\r
+       if(sf & 32)\r
+               WriteByte(MSG_ENTITY, self.stat_eaten);\r
        return TRUE;\r
 };\r
 \r
 void entcs_think()\r
 {\r
-       self.nextthink = time + 0.033333333333; // increase this to like 0.15 once the client can do smoothing\r
+       self.nextthink = time + 0.01;\r
 \r
        entity o;\r
        o = self.owner;\r
@@ -85,6 +87,11 @@ void entcs_think()
                self.armorvalue = o.armorvalue;\r
                self.SendFlags |= 16;\r
        }\r
+       if(o.stat_eaten != self.stat_eaten)\r
+       {\r
+               self.stat_eaten = o.stat_eaten;\r
+               self.SendFlags |= 32;\r
+       }\r
 };\r
 \r
 entity attach_entcs()\r