From: terencehill Date: Fri, 22 Jan 2021 14:20:31 +0000 (+0100) Subject: Entcs: fix health/armor bar above enemies not updated switching from player to observ... X-Git-Tag: xonotic-v0.8.5~559^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8fa83770802d312174fbfbdd928c213575c73d0b;p=xonotic%2Fxonotic-data.pk3dir.git Entcs: fix health/armor bar above enemies not updated switching from player to observer (and from player-observer to observer in CA) --- diff --git a/qcsrc/common/ent_cs.qc b/qcsrc/common/ent_cs.qc index 3d9127cbb..d5815c01e 100644 --- a/qcsrc/common/ent_cs.qc +++ b/qcsrc/common/ent_cs.qc @@ -159,12 +159,23 @@ ENTCS_PROP(SOLID, true, sv_solid, solid, ENTCS_SET_NORMAL, #ifdef SVQC - int ENTCS_PUBLICMASK = 0; + int ENTCS_PUBLICMASK = 0, ENTCS_PRIVATEMASK = 0; STATIC_INIT(ENTCS_PUBLICMASK) { - FOREACH(EntCSProps, it.m_public, + FOREACH(EntCSProps, true, { - ENTCS_PUBLICMASK |= BIT(it.m_id); + if (it.m_public) + ENTCS_PUBLICMASK |= BIT(it.m_id); + else + ENTCS_PRIVATEMASK |= BIT(it.m_id); + }); + } + + void entcs_update_players(entity player) + { + FOREACH_CLIENT(it != player && IS_PLAYER(it), + { + CS(it).entcs.SendFlags |= ENTCS_PRIVATEMASK; }); } diff --git a/qcsrc/common/ent_cs.qh b/qcsrc/common/ent_cs.qh index 8ae89fd3b..db0dc466b 100644 --- a/qcsrc/common/ent_cs.qh +++ b/qcsrc/common/ent_cs.qh @@ -12,9 +12,6 @@ REGISTER_NET_TEMP(CLIENT_ENTCS) .bool m_entcs_private; /** True when origin is available */ -// FIXME: it seems sometimes this is false when observing even though observers should be able to know about all players -// easily reproducible on heart_v2 or The_Yard with bots - might be because they lack waypoints and bots stand still -// it has happened in matches with players and no bots but much more rarely .bool has_origin; /** True when a recent server sent origin has been received */ @@ -47,6 +44,8 @@ REGISTER_NET_TEMP(CLIENT_ENTCS) void entcs_force_origin(entity player); + void entcs_update_players(entity player); + bool radar_showenemies; #endif diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc index 73d127bd4..bb23f51c8 100644 --- a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc +++ b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc @@ -310,7 +310,10 @@ MUTATOR_HOOKFUNCTION(ca, MakePlayerObserver) if (IS_PLAYER(player) && !IS_DEAD(player)) ca_LastPlayerForTeam_Notify(player); if (player.killindicator_teamchange == -2) // player wants to spectate + { + entcs_update_players(player); player.caplayer = 0; + } if (player.caplayer) player.frags = FRAGS_PLAYER_OUT_OF_GAME; if (!warmup_stage) diff --git a/qcsrc/common/mutators/mutator/damagetext/cl_damagetext.qc b/qcsrc/common/mutators/mutator/damagetext/cl_damagetext.qc index d398ecf3a..e2208fb34 100644 --- a/qcsrc/common/mutators/mutator/damagetext/cl_damagetext.qc +++ b/qcsrc/common/mutators/mutator/damagetext/cl_damagetext.qc @@ -252,8 +252,6 @@ NET_HANDLE(damagetext, bool isNew) } make_impure(NEW(DamageText, server_entity_index, entcs.origin, false, health, armor, potential_damage, deathtype, friendlyfire)); } else if (autocvar_cl_damagetext_2d && spectatee_status != -1) { - // never show 2d damagetext when observing - might be a bug in .has_origin - // screen coords only vector screen_pos = vec2(vid_conwidth * autocvar_cl_damagetext_2d_pos.x, vid_conheight * autocvar_cl_damagetext_2d_pos.y); IL_EACH(g_drawables_2d, it.instanceOfDamageText && it.m_screen_coords && it.m_group == server_entity_index, { diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 69e36d7c4..7c73dee42 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -253,6 +253,7 @@ void PutObserverInServer(entity this) if (vote_called) { VoteCount(false); } ReadyCount(); } + entcs_update_players(this); } entity spot = SelectSpawnPoint(this, true);