From: terencehill Date: Fri, 5 Apr 2019 17:02:33 +0000 (+0200) Subject: Fix #2195: "Clan Arena: own name tag displayed over teammate's head when a round... X-Git-Tag: xonotic-v0.8.5~1564^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bf06bdd456c94ac6c851aadfc4ecb5eafaa7af50;p=xonotic%2Fxonotic-data.pk3dir.git Fix #2195: "Clan Arena: own name tag displayed over teammate's head when a round ends" --- diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index c48390bcd..ec0c83669 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -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); diff --git a/qcsrc/common/ent_cs.qc b/qcsrc/common/ent_cs.qc index f4ef79eda..c0a44b111 100644 --- a/qcsrc/common/ent_cs.qc +++ b/qcsrc/common/ent_cs.qc @@ -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; diff --git a/qcsrc/common/ent_cs.qh b/qcsrc/common/ent_cs.qh index c46d31b12..e44ccdabb 100644 --- a/qcsrc/common/ent_cs.qh +++ b/qcsrc/common/ent_cs.qh @@ -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); } /**