tmp64/BugfixedHL

VGUI2 Scoreboard TODO list

tmp64 opened this issue · 5 comments

tmp64 commented
  • Add a label to spectators
  • Mark muted players with icons (on top of avatars or in a separate column like in the original scoreboard)
  • Allow server to change team scores as it is done in the original scoreboard

Hi
there bug in spectator list :
https://imgur.com/a/oXiAk4f

  1. hud_colortext 0/1

i mean this hud :
https://imgur.com/a/mHYGr2K

  1. ability to show sprites in HUD:

the sprite is not stabel in the screen when move.
Perhaps from this proposition you will understand what I mean:
http://aghl.ru/forum/viewtopic.php?f=32&t=689#p8672
https://www.youtube.com/watch?v=fHD0OuDdJdk

tmp64 commented

@abdobiskra I've opened #3 regarding sprites in HUD.
It would be nice if you said how to reproduce the spectator bug in issue #4
I will check colors in names later.

Please add the ability to hide spectator labels from regular players. It's needed to hide spectating admins.

tmp64 commented

That should be done on the server-side.

There are two ways a client can know that some player is spectating.

First is via "Spectator" message. It is sent when player is connecting to the server and when someone begins/ends spectating.
This message is also sent in hl.inc AMXX include.

BugfixedHL/dlls/player.cpp

Lines 4114 to 4126 in c2606b3

// Send spectator statuses
CBasePlayer *plr;
for (int i = 1; i <= gpGlobals->maxClients; i++)
{
plr = (CBasePlayer *)UTIL_PlayerByIndex( i );
if ( !plr || !plr->IsObserver() )
continue;
MESSAGE_BEGIN( MSG_ONE, gmsgSpectator, NULL, pev );
WRITE_BYTE(ENTINDEX(plr->edict())); // index number of primary entity
WRITE_BYTE(1);
MESSAGE_END();
}

// Send Spectator message (it is not used in client dll)
MESSAGE_BEGIN(MSG_ALL, gmsgSpectator);
WRITE_BYTE(ENTINDEX(edict())); // index number of primary entity
WRITE_BYTE(1);
MESSAGE_END();

// Send Spectator message (it is not used in client dll)
MESSAGE_BEGIN(MSG_ALL, gmsgSpectator);
WRITE_BYTE(ENTINDEX(edict())); // index number of primary entity
WRITE_BYTE(0);
MESSAGE_END();

Second is using an obscure "feature" in team info. Every player has a team name and a team number (even in DM mode, in that case number is 0 and name is "Players"). But spectators have an empty team name.

if (g_PlayerExtraInfo[i].teamname[0] != '\0')
iNonEmptyTeamNum++;
else
iEmptyTeamNum++;

if (iEmptyTeamNum > 0 && iNonEmptyTeamNum > 0)
{
m_iSpectatorSection = SPECTATOR_TEAM;
m_pPlayerList->AddSection(m_iSpectatorSection, "", m_pPlayerSortFunction);
m_pPlayerList->AddColumnToSection(m_iSpectatorSection, "avatar", "", CPlayerListPanel::COLUMN_IMAGE, m_iAvatarWidth + m_iAvatarPaddingLeft + m_iAvatarPaddingRight);
m_pPlayerList->AddColumnToSection(m_iSpectatorSection, "name", "#Spectators", CPlayerListPanel::COLUMN_BRIGHT | CPlayerListPanel::COLUMN_COLORED, nameWidth);
if (gHUD.m_ScoreBoard->m_CvarShowSteamId->value)
m_pPlayerList->AddColumnToSection(m_iSpectatorSection, "steamid", "", CPlayerListPanel::COLUMN_BRIGHT, vgui2::scheme()->GetProportionalScaledValueEx(GetScheme(), STEAMID_WIDTH));
if (gHUD.m_ScoreBoard->m_CvarShowEff->value)
m_pPlayerList->AddColumnToSection(m_iSpectatorSection, "eff", "", CPlayerListPanel::COLUMN_BRIGHT, vgui2::scheme()->GetProportionalScaledValueEx(GetScheme(), DEATH_WIDTH));
m_pPlayerList->AddColumnToSection(m_iSpectatorSection, "frags", "", CPlayerListPanel::COLUMN_BRIGHT, vgui2::scheme()->GetProportionalScaledValueEx(GetScheme(), SCORE_WIDTH));
m_pPlayerList->AddColumnToSection(m_iSpectatorSection, "deaths", "", CPlayerListPanel::COLUMN_BRIGHT, vgui2::scheme()->GetProportionalScaledValueEx(GetScheme(), DEATH_WIDTH));
m_pPlayerList->AddColumnToSection(m_iSpectatorSection, "ping", "", CPlayerListPanel::COLUMN_BRIGHT, vgui2::scheme()->GetProportionalScaledValueEx(GetScheme(), PING_WIDTH));
m_pPlayerList->SetSectionFgColor(m_iSpectatorSection, gHUD.GetTeamColor(0));
}