From 31282c700d4451aff8434eb3fbdc989386a1437d Mon Sep 17 00:00:00 2001 From: erysdren Date: Mon, 9 Dec 2024 19:50:04 -0600 Subject: [PATCH] CLIENT: hud.qc: make the readout all fancy and stuff --- source/client/hud.qc | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/source/client/hud.qc b/source/client/hud.qc index 17899c4..a710639 100644 --- a/source/client/hud.qc +++ b/source/client/hud.qc @@ -1941,6 +1941,21 @@ void(float width, float height) HUD_RoundStopWatch = // set from CSQC_Ent_Update vector player_velocity; +// probably only need these right here +static void(vector pos, string label, vector v) Draw_Vector_Fancy = +{ + Draw_String(pos, label, [12, 12], [1, 1, 0], 1, 0); + Draw_String(pos + [32, 16], sprintf("X: %d", v.x), [12, 12], [1, 1, 1], 1, 0); + Draw_String(pos + [32, 32], sprintf("Y: %d", v.y), [12, 12], [1, 1, 1], 1, 0); + Draw_String(pos + [32, 48], sprintf("Z: %d", v.z), [12, 12], [1, 1, 1], 1, 0); +}; + +static void(vector pos, string label, float f, string suffix) Draw_Float_Fancy = +{ + Draw_String(pos, label, [12, 12], [1, 1, 0], 1, 0); + Draw_String(pos + [32, 16], sprintf("%d %s", f, suffix), [12, 12], [1, 1, 1], 1, 0); +}; + void(float width, float height) HUD_PlayerDebugInfo = { static float lastupstime; @@ -1955,20 +1970,15 @@ void(float width, float height) HUD_PlayerDebugInfo = lastupstime = time; } - string str = sprintf("Speed: %3.1f qu/s", lastups); vector pos = [cvar("scr_playerdebuginfo_x"), cvar("scr_playerdebuginfo_y")]; pos.x += GetUltraWideOffset(); - Draw_String(pos, str, [12, 12], [1, 1, 1], 1, 0); + + Draw_Float_Fancy(pos, "Speed:", lastups, "qu/s"); if (cvar("scr_playerdebuginfo") >= 2) { - pos.y += 16; - str = sprintf("Angles: %v", getproperty(VF_ANGLES)); - Draw_String(pos, str, [12, 12], [1, 1, 1], 1, 0); - - pos.y += 16; - str = sprintf("Origin: %v", getproperty(VF_ORIGIN)); - Draw_String(pos, str, [12, 12], [1, 1, 1], 1, 0); + Draw_Vector_Fancy(pos + [0, 36], "Angles:", getproperty(VF_ANGLES)); + Draw_Vector_Fancy(pos + [0, 106], "Origin:", getproperty(VF_ORIGIN)); } };