engine: client: handle hud_utf8 in client.dll's draw character functions, rather than in engine's CL_DrawCharacter

This commit is contained in:
Alibek Omarov
2025-03-12 07:31:18 +03:00
parent 9ba7cc88d9
commit 3baeea1253
2 changed files with 15 additions and 2 deletions

View File

@@ -1997,7 +1997,13 @@ static int GAME_EXPORT pfnDrawCharacter( int x, int y, int number, int r, int g,
int flags = FONT_DRAW_HUD;
if( hud_utf8.value )
flags |= FONT_DRAW_UTF8;
{
static utfstate_t utfstate;
number = Q_DecodeUTF8( &utfstate, number );
if( !number )
return 0;
}
return CL_DrawCharacter( x, y, number, color, &cls.creditsFont, flags );
}

View File

@@ -19,6 +19,7 @@ GNU General Public License for more details.
#include "library.h"
#include "input.h"
#include "platform/platform.h"
#include "utflib.h"
static CVAR_DEFINE_AUTO( vibration_length, "1.0", FCVAR_ARCHIVE | FCVAR_PRIVILEGED, "vibration length" );
static CVAR_DEFINE_AUTO( vibration_enable, "1", FCVAR_ARCHIVE | FCVAR_PRIVILEGED, "enable vibration" );
@@ -58,7 +59,13 @@ static int pfnDrawScaledCharacter( int x, int y, int number, int r, int g, int b
int flags = FONT_DRAW_HUD;
if( hud_utf8.value )
SetBits( flags, FONT_DRAW_UTF8 );
{
static utfstate_t utfstate;
number = Q_DecodeUTF8( &utfstate, number );
if( !number )
return 0;
}
if( fabs( g_font_scale - scale ) > 0.1f ||
g_scaled_font.hFontTexture != cls.creditsFont.hFontTexture )