]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix #2195: "Clan Arena: own name tag displayed over teammate's head when a round...
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 c48390bcdb0f4c2b9a0c4a6ade3a6cc01c7cec80..ec0c836698f74baf09e1999ae2c1877b1a6a4e11 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 f4ef79eda495f5e064ed81146b7e0fb24dacca9c..c0a44b111477e1d688d486b15dd6836cc70a8827 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 c46d31b12b5b597577232717c14b542ea0805951..e44ccdabbe897511371c8d5b4cbacf22491f120f 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);
        }
 
        /**