From 47aa327d71ec58c2b44a69e5784b8a4c67b6a342 Mon Sep 17 00:00:00 2001 From: Elinsrc Date: Mon, 9 Sep 2024 19:27:02 +0500 Subject: [PATCH] modified: cl_dll/hud_redraw.cpp --- cl_dll/hud_redraw.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cl_dll/hud_redraw.cpp b/cl_dll/hud_redraw.cpp index fc7cda5..e02b2c3 100644 --- a/cl_dll/hud_redraw.cpp +++ b/cl_dll/hud_redraw.cpp @@ -571,10 +571,10 @@ void CHud::DrawHudModelName(int x, int y, float topcolor, float bottomcolor, con HUEtoRGB(topcolor, top.r, top.g, top.b); HUEtoRGB(bottomcolor, bottom.r, bottom.g, bottom.b); - int Width = GetHudStringWidth(firstcolor.c_str()); + int Len = DrawHudStringLen(firstcolor.c_str()); DrawHudString( x, y, ScreenWidth, firstcolor.c_str(), top.r, top.g, top.b ); - DrawHudString( x + Width, y, ScreenWidth, secondcolor.c_str(), bottom.r, bottom.g, bottom.b ); + DrawHudString( x + Len, y, ScreenWidth, secondcolor.c_str(), bottom.r, bottom.g, bottom.b ); } int CHud::DrawHudText(int x, int y, const char* szString, int r, int g, int b) @@ -588,10 +588,13 @@ int CHud::DrawHudText(int x, int y, const char* szString, int r, int g, int b) int CHud::DrawHudTextCentered(int x, int y, const char* szString, int r, int g, int b) { - if ( !szString ) + if (!szString) return 1; - int width = GetHudStringWidth(szString); - x += DrawHudText(x - width / 2, y, szString, r, g, b); - return x; + int Len = DrawHudStringLen(szString); + + gEngfuncs.pfnDrawSetTextColor(r / 255.0, g / 255.0, b / 255.0); + gEngfuncs.pfnDrawConsoleString(x - Len / 2, y, (char*)szString); + + return x + Len / 2; }