Fix #2195: "Clan Arena: own name tag displayed over teammate's head when a round... 629/head
authorterencehill <piuntn@gmail.com>
Fri, 5 Apr 2019 17:02:33 +0000 (19:02 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 5 Apr 2019 17:02:33 +0000 (19:02 +0200)
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/common/ent_cs.qc
qcsrc/common/ent_cs.qh

index c48390b..ec0c836 100644 (file)
@@ -824,7 +824,7 @@ void Scoreboard_DrawItem(vector item_pos, vector rgb, entity pl, bool is_self, i
 {
        TC(bool, is_self); TC(int, pl_number);
        string str;
-       bool is_spec = entcs_IsSpectating(pl.sv_entnum);
+       bool is_spec = (entcs_GetSpecState(pl.sv_entnum) == ENTCS_SPEC_PURE);
 
        vector h_pos = item_pos;
        vector h_size = vec2(panel_size.x, hud_fontsize.y * 1.25);
index f4ef79e..c0a44b1 100644 (file)
@@ -146,6 +146,10 @@ ENTCS_PROP(FRAGS, true, frags, ENTCS_SET_NORMAL,
        { WriteShort(chan, ent.frags); },
        { ent.frags = ReadShort(); })
 
+ENTCS_PROP(SOLID, true, solid, ENTCS_SET_NORMAL,
+       { WriteByte(chan, ent.solid); },
+       { ent.solid = ReadByte(); })
+
 #ifdef SVQC
 
        int ENTCS_PUBLICMASK = 0;
index c46d31b..e44ccda 100644 (file)
@@ -67,11 +67,21 @@ REGISTER_NET_TEMP(CLIENT_ENTCS)
      * @param i zero indexed player
      */
     .int frags;
-       bool entcs_IsSpectating(int i)
+       const int ENTCS_SPEC_PURE = 1; // real spectator
+       const int ENTCS_SPEC_IN_SCOREBOARD = 2; // spectator but still in game (can be in a team)
+       #define entcs_IsSpectating(i) boolean(entcs_GetSpecState(i))
+
+       int entcs_GetSpecState(int i)
        {
                bool unconnected = !playerslots[i].gotscores;
                entity e = entcs_receiver(i);
-               return unconnected || ((e) ? e.frags : stof(getplayerkeyvalue(i, "frags"))) == FRAGS_SPECTATOR;
+               int fr = ((e) ? e.frags : stof(getplayerkeyvalue(i, "frags")));
+               if (unconnected || fr == FRAGS_SPECTATOR)
+                       return ENTCS_SPEC_PURE;
+               int sol = ((e) ? e.solid : SOLID_NOT);
+               if (fr == FRAGS_PLAYER_OUT_OF_GAME && sol == SOLID_NOT)
+                       return ENTCS_SPEC_IN_SCOREBOARD;
+               return 0;
        }
 
        /**
@@ -94,11 +104,10 @@ REGISTER_NET_TEMP(CLIENT_ENTCS)
 
        /**
        * @param i zero indexed player
-       * @returns 0 if not teamplay | NUM_TEAM_##N | NUM_SPECTATOR
        */
        int entcs_GetTeam(int i)
        {
-               return entcs_IsSpectating(i) ? NUM_SPECTATOR : entcs_GetTeamColor(i);
+               return (entcs_GetSpecState(i) == ENTCS_SPEC_PURE) ? NUM_SPECTATOR : entcs_GetTeamColor(i);
        }
 
        /**