mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-01 01:25:38 +03:00
Added texture and seqgroup auto precache
This commit is contained in:
parent
f74d3842da
commit
81d5369e97
@ -1455,6 +1455,38 @@ int EXT_FUNC PF_precache_model_I(const char *s)
|
||||
g_psv.models[i] = Mod_ForName(s, 1, 1);
|
||||
if (!iOptional)
|
||||
g_psv.model_precache_flags[i] |= 1u;
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
if (g_psv.models[i]->type == mod_studio)
|
||||
{
|
||||
studiohdr_t *pStudioHeader = (studiohdr_t *)Mod_Extradata(g_psv.models[i]);
|
||||
|
||||
size_t modelNameLength = Q_strlen(s);
|
||||
if (!pStudioHeader->textureindex && modelNameLength < MAX_QPATH - 1)
|
||||
{
|
||||
char textureModelName[MAX_QPATH];
|
||||
Q_strcpy(textureModelName, s);
|
||||
|
||||
size_t modelExtensionLength = sizeof(".mdl") - 1;
|
||||
char *modelExtension = &textureModelName[modelNameLength - modelExtensionLength];
|
||||
Q_strcpy(modelExtension, "T.mdl");
|
||||
|
||||
PF_precache_model_I(textureModelName);
|
||||
}
|
||||
if (pStudioHeader->numseqgroups)
|
||||
{
|
||||
mstudioseqgroup_t *pSeqGroup = (mstudioseqgroup_t *)((uint8_t *)pStudioHeader + pStudioHeader->seqgroupindex);
|
||||
for (int i = 0; i < pStudioHeader->numseqgroups; i++, pSeqGroup++)
|
||||
{
|
||||
if (pSeqGroup->name[0] == '\0')
|
||||
continue;
|
||||
|
||||
PF_precache_generic_I(pSeqGroup->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // REHLDS_FIXES
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user