Add spectator HUD and make the Scoreboard ignore any non player clients

This commit is contained in:
Marco Cawthorne 2021-03-24 07:52:10 +01:00
parent 134ce9006a
commit c1bea796b7
2 changed files with 30 additions and 1 deletions

View file

@ -429,10 +429,31 @@ HUD_Draw(void)
Damage_Draw();
}
string g_specmodes[] = {
"Free Camera",
"Third Person",
"First Person"
};
/* specatator main entry */
void
HUD_DrawSpectator(void)
{
// FIXME
Textmenu_Draw();
spectator spec = (spectator)pSeat->m_ePlayer;
drawfont = FONT_20;
vector vecPos;
string strText;
strText = sprintf("Tracking: %s", getplayerkeyvalue(spec.spec_ent - 1, "name"));
vecPos[0] = g_hudmins[0] + (g_hudres[0] / 2) - (stringwidth(strText, TRUE, [20,20]) / 2);
vecPos[1] = g_hudmins[1] + g_hudres[1] - 60;
drawstring(vecPos, strText, [20,20], [1,1,1], 1.0f, DRAWFLAG_ADDITIVE);
strText = sprintf("Mode: %s", g_specmodes[spec.spec_mode]);
vecPos[0] = g_hudmins[0] + (g_hudres[0] / 2) - (stringwidth(strText, TRUE, [20,20]) / 2);
vecPos[1] = g_hudmins[1] + g_hudres[1] - 40;
drawstring(vecPos, strText, [20,20], [1,1,1], 1.0f, DRAWFLAG_ADDITIVE);
}

View file

@ -53,6 +53,10 @@ Scores_DrawTeam(player pl, vector pos)
continue;
}
if (getplayerkeyfloat(i, "*spec") != 0) {
continue;
}
temp = getplayerkeyvalue(i, "name");
/* Out of players */
@ -118,6 +122,10 @@ Scores_DrawNormal(player pl, vector pos)
string deaths;
string name;
if (getplayerkeyfloat(i, "*spec") != 0) {
continue;
}
name = getplayerkeyvalue(i, "name");
/* Out of players */