mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-03-11 05:21:07 +00:00
engine: client: font: do not use OpenFile on WADs >_<
This commit is contained in:
parent
77ea03a62c
commit
a19d34035d
@ -79,24 +79,26 @@ qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float sc
|
|||||||
|
|
||||||
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags )
|
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags )
|
||||||
{
|
{
|
||||||
|
fs_offset_t length;
|
||||||
qfont_t src;
|
qfont_t src;
|
||||||
file_t *fd;
|
byte *pfile;
|
||||||
int font_width, i;
|
int font_width, i;
|
||||||
|
|
||||||
if( font->valid )
|
if( font->valid )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
fd = g_fsapi.Open( fontname, "r", false );
|
pfile = g_fsapi.LoadFile( fontname, &length, false );
|
||||||
if( !fd )
|
if( !pfile )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( g_fsapi.Read( fd, &src, sizeof( qfont_t )) != sizeof( qfont_t ))
|
if( length < sizeof( src ))
|
||||||
{
|
{
|
||||||
g_fsapi.Close( fd );
|
Mem_Free( pfile );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_fsapi.Close( fd );
|
memcpy( &src, pfile, sizeof( src ));
|
||||||
|
Mem_Free( pfile );
|
||||||
|
|
||||||
font->hFontTexture = CL_LoadFontTexture( fontname, texFlags, &font_width );
|
font->hFontTexture = CL_LoadFontTexture( fontname, texFlags, &font_width );
|
||||||
if( !font->hFontTexture )
|
if( !font->hFontTexture )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user