From c1bea796b7bc16526013624733fbf7c5331a878f Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Wed, 24 Mar 2021 07:52:10 +0100 Subject: [PATCH] Add spectator HUD and make the Scoreboard ignore any non player clients --- src/client/hud.qc | 23 ++++++++++++++++++++++- src/client/scoreboard.qc | 8 ++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/client/hud.qc b/src/client/hud.qc index 06b59e5..c6d7c56 100644 --- a/src/client/hud.qc +++ b/src/client/hud.qc @@ -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); } diff --git a/src/client/scoreboard.qc b/src/client/scoreboard.qc index 2e9c14a..f060528 100644 --- a/src/client/scoreboard.qc +++ b/src/client/scoreboard.qc @@ -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 */