2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-23 02:15:55 +01:00

ref: gl: replace va function calls.

This commit is contained in:
Andrey Akhmichin 2022-12-18 22:55:53 +05:00 committed by Alibek Omarov
parent 9e9703e6de
commit 9040c34f48
4 changed files with 17 additions and 8 deletions

View File

@ -627,6 +627,7 @@ void Mod_LoadAliasModel( model_t *mod, const void *buffer, qboolean *loaded )
daliasframetype_t *pframetype;
daliasskintype_t *pskintype;
int i, j, size;
char poolname[MAX_VA_STRING];
if( loaded ) *loaded = false;
pinmodel = (daliashdr_t *)buffer;
@ -641,7 +642,8 @@ void Mod_LoadAliasModel( model_t *mod, const void *buffer, qboolean *loaded )
if( pinmodel->numverts <= 0 || pinmodel->numtris <= 0 || pinmodel->numframes <= 0 )
return; // how to possible is make that?
mod->mempool = Mem_AllocPool( va( "^2%s^7", mod->name ));
Q_snprintf( poolname, sizeof( poolname ), "^2%s^7", mod->name );
mod->mempool = Mem_AllocPool( poolname );
// allocate space for a working header, plus all the data except the frames,
// skin and group info

View File

@ -335,6 +335,7 @@ qboolean GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char
const dllfunc_t *func;
cvar_t *parm = NULL;
const char *extensions_string;
char desc[MAX_VA_STRING];
gEngfuncs.Con_Reportf( "GL_CheckExtension: %s ", name );
GL_SetExtension( r_ext, true );
@ -342,7 +343,8 @@ qboolean GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char
if( cvarname )
{
// system config disable extensions
parm = gEngfuncs.Cvar_Get( cvarname, "1", FCVAR_GLCONFIG|FCVAR_READ_ONLY, va( CVAR_GLCONFIG_DESCRIPTION, name ));
Q_snprintf( desc, sizeof( desc ), CVAR_GLCONFIG_DESCRIPTION, name );
parm = gEngfuncs.Cvar_Get( cvarname, "1", FCVAR_GLCONFIG|FCVAR_READ_ONLY, desc );
}
if(( parm && !CVAR_TO_BOOL( parm )) || ( !CVAR_TO_BOOL( gl_extensions ) && r_ext != GL_OPENGL_110 ))
@ -763,6 +765,8 @@ void GL_InitExtensionsBigGL( void )
void GL_InitExtensions( void )
{
char value[MAX_VA_STRING];
GL_OnContextCreated();
// initialize gl extensions
@ -803,8 +807,9 @@ void GL_InitExtensions( void )
if( GL_Support( GL_TEXTURE_2D_RECT_EXT ))
pglGetIntegerv( GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT, &glConfig.max_2d_rectangle_size );
gEngfuncs.Cvar_Get( "gl_max_size", va( "%i", glConfig.max_2d_texture_size ), 0, "opengl texture max dims" );
gEngfuncs.Cvar_Set( "gl_anisotropy", va( "%f", bound( 0, gl_texture_anisotropy->value, glConfig.max_texture_anisotropy )));
Q_snprintf( value, sizeof( value ), "%i", glConfig.max_2d_texture_size );
gEngfuncs.Cvar_Get( "gl_max_size", value, 0, "opengl texture max dims" );
gEngfuncs.Cvar_SetValue( "gl_anisotropy", bound( 0, gl_texture_anisotropy->value, glConfig.max_texture_anisotropy ));
if( GL_Support( GL_TEXTURE_COMPRESSION_EXT ))
gEngfuncs.Image_AddCmdFlags( IL_DDS_HARDWARE );

View File

@ -242,6 +242,7 @@ void Mod_LoadMapSprite( model_t *mod, const void *buffer, size_t size, qboolean
int linedelta, numframes;
mspriteframe_t *pspriteframe;
msprite_t *psprite;
char poolname[MAX_VA_STRING];
if( loaded ) *loaded = false;
Q_snprintf( texname, sizeof( texname ), "#%s", mod->name );
@ -275,7 +276,8 @@ void Mod_LoadMapSprite( model_t *mod, const void *buffer, size_t size, qboolean
// determine how many frames we needs
numframes = (pix->width * pix->height) / (w * h);
mod->mempool = Mem_AllocPool( va( "^2%s^7", mod->name ));
Q_snprintf( poolname, sizeof( poolname ), "^2%s^7", mod->name );
mod->mempool = Mem_AllocPool( poolname );
psprite = Mem_Calloc( mod->mempool, sizeof( msprite_t ) + ( numframes - 1 ) * sizeof( psprite->frames ));
mod->cache.data = psprite; // make link to extradata

View File

@ -64,7 +64,7 @@ static qboolean CheckSkybox( const char *name, char out[6][MAX_STRING] )
{
const char *skybox_ext[3] = { "dds", "tga", "bmp" };
int i, j, num_checked_sides;
const char *sidename;
char sidename[MAX_VA_STRING];
// search for skybox images
for( i = 0; i < 3; i++ )
@ -74,7 +74,7 @@ static qboolean CheckSkybox( const char *name, char out[6][MAX_STRING] )
for( j = 0; j < 6; j++ )
{
// build side name
sidename = va( "%s%s.%s", name, r_skyBoxSuffix[j], skybox_ext[i] );
Q_snprintf( sidename, sizeof( sidename ), "%s%s.%s", name, r_skyBoxSuffix[j], skybox_ext[i] );
if( gEngfuncs.fsapi->FileExists( sidename, false ))
{
Q_strncpy( out[j], sidename, sizeof( out[j] ));
@ -90,7 +90,7 @@ static qboolean CheckSkybox( const char *name, char out[6][MAX_STRING] )
for( j = 0; j < 6; j++ )
{
// build side name
sidename = va( "%s_%s.%s", name, r_skyBoxSuffix[j], skybox_ext[i] );
Q_snprintf( sidename, sizeof( sidename ), "%s_%s.%s", name, r_skyBoxSuffix[j], skybox_ext[i] );
if( gEngfuncs.fsapi->FileExists( sidename, false ))
{
Q_strncpy( out[j], sidename, sizeof( out[j] ));