engine: common: move model cvars to static allocation

This commit is contained in:
Alibek Omarov 2023-05-19 08:04:22 +03:00
parent 05579927a5
commit e7ece41ba0
4 changed files with 13 additions and 13 deletions

View File

@ -2051,7 +2051,7 @@ static void Mod_LoadTextureData( dbspmodel_t *bmod, int textureIndex )
// 2. Internal from map
// Try WAD texture (force while r_wadtextures is 1)
if(( r_wadtextures->value && bmod->wadlist.count > 0 ) || mipTex->offsets[0] <= 0 )
if(( r_wadtextures.value && bmod->wadlist.count > 0 ) || mipTex->offsets[0] <= 0 )
{
char texpath[MAX_VA_STRING];
int wadIndex = Mod_FindTextureInWadList( &bmod->wadlist, mipTex->name, texpath, sizeof( texpath ));

View File

@ -119,9 +119,9 @@ typedef struct world_static_s
extern world_static_t world;
extern poolhandle_t com_studiocache;
extern model_t *loadmodel;
extern convar_t *mod_studiocache;
extern convar_t *r_wadtextures;
extern convar_t *r_showhull;
extern convar_t mod_studiocache;
extern convar_t r_wadtextures;
extern convar_t r_showhull;
//
// model.c

View File

@ -239,7 +239,7 @@ hull_t *Mod_HullForStudio( model_t *model, float frame, int sequence, vec3_t ang
bSkipShield = false;
*numhitboxes = 0; // assume error
if( mod_studiocache->value )
if( mod_studiocache.value )
{
bonecache = Mod_CheckStudioCache( model, frame, sequence, angles, origin, size, pcontroller, pblending );
@ -286,7 +286,7 @@ hull_t *Mod_HullForStudio( model_t *model, float frame, int sequence, vec3_t ang
// tell trace code about hitbox count
*numhitboxes = (bSkipShield) ? (mod_studiohdr->numhitboxes - 1) : (mod_studiohdr->numhitboxes);
if( mod_studiocache->value )
if( mod_studiocache.value )
Mod_AddToStudioCache( frame, sequence, angles, origin, size, pcontroller, pblending, model, studio_hull, *numhitboxes );
return studio_hull;

View File

@ -28,9 +28,9 @@ static model_info_t mod_crcinfo[MAX_MODELS];
static model_t mod_known[MAX_MODELS];
static int mod_numknown = 0;
poolhandle_t com_studiocache; // cache for submodels
convar_t *mod_studiocache;
convar_t *r_wadtextures;
convar_t *r_showhull;
CVAR_DEFINE( mod_studiocache, "r_studiocache", "1", FCVAR_ARCHIVE, "enables studio cache for speedup tracing hitboxes" );
CVAR_DEFINE_AUTO( r_wadtextures, "0", 0, "completely ignore textures in the bsp-file if enabled" );
CVAR_DEFINE_AUTO( r_showhull, "0", 0, "draw collision hulls 1-3" );
model_t *loadmodel;
/*
@ -134,9 +134,9 @@ Mod_Init
void Mod_Init( void )
{
com_studiocache = Mem_AllocPool( "Studio Cache" );
mod_studiocache = Cvar_Get( "r_studiocache", "1", FCVAR_ARCHIVE, "enables studio cache for speedup tracing hitboxes" );
r_wadtextures = Cvar_Get( "r_wadtextures", "0", 0, "completely ignore textures in the bsp-file if enabled" );
r_showhull = Cvar_Get( "r_showhull", "0", 0, "draw collision hulls 1-3" );
Cvar_RegisterVariable( &mod_studiocache );
Cvar_RegisterVariable( &r_wadtextures );
Cvar_RegisterVariable( &r_showhull );
Cmd_AddCommand( "mapstats", Mod_PrintWorldStats_f, "show stats for currently loaded map" );
Cmd_AddCommand( "modellist", Mod_Modellist_f, "display loaded models list" );
@ -403,7 +403,7 @@ static void Mod_PurgeStudioCache( void )
int i;
// refresh hull data
SetBits( r_showhull->flags, FCVAR_CHANGED );
SetBits( r_showhull.flags, FCVAR_CHANGED );
#if !XASH_DEDICATED
Mod_ReleaseHullPolygons();
#endif