mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
DataCache: rework FindUncachedMDL error handling
Remove unnecessary/duplicate code.
This commit is contained in:
parent
743074ac47
commit
c54777d370
@ -156,9 +156,18 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* const cache, const MDLHandle_
|
|||||||
g_pRTech->StringToGuid(modelName);
|
g_pRTech->StringToGuid(modelName);
|
||||||
pStudioData->processing = false;
|
pStudioData->processing = false;
|
||||||
|
|
||||||
if (!pStudioData->modelCache)
|
studiomodelcache_t* const modelCache = pStudioData->GetModelCache();
|
||||||
|
|
||||||
|
if (IS_VALID_DATACACHE_HANDLE(modelCache))
|
||||||
{
|
{
|
||||||
|
FindCachedMDL(cache, pStudioData, a4);
|
||||||
|
studioHdr = modelCache->GetStudioHdr();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Attempt to get studio header from anim cache.
|
||||||
studioanimcache_t* const animCache = pStudioData->GetAnimCache();
|
studioanimcache_t* const animCache = pStudioData->GetAnimCache();
|
||||||
|
|
||||||
if (IS_VALID_DATACACHE_HANDLE(animCache))
|
if (IS_VALID_DATACACHE_HANDLE(animCache))
|
||||||
{
|
{
|
||||||
studioHdr = animCache->GetStudioHdr();
|
studioHdr = animCache->GetStudioHdr();
|
||||||
@ -166,6 +175,7 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* const cache, const MDLHandle_
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
studioHdr = GetErrorModel();
|
studioHdr = GetErrorModel();
|
||||||
|
|
||||||
if (!IsKnownBadModel(handle))
|
if (!IsKnownBadModel(handle))
|
||||||
{
|
{
|
||||||
if (!studioHdr)
|
if (!studioHdr)
|
||||||
@ -173,30 +183,6 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* const cache, const MDLHandle_
|
|||||||
else
|
else
|
||||||
Error(eDLL_T::ENGINE, NO_ERROR, "Model \"%s\" not found; replacing with \"%s\".\n", modelName, ERROR_MODEL);
|
Error(eDLL_T::ENGINE, NO_ERROR, "Model \"%s\" not found; replacing with \"%s\".\n", modelName, ERROR_MODEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return studioHdr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FindCachedMDL(cache, pStudioData, a4);
|
|
||||||
studiomodelcache_t* const modelCache = pStudioData->GetModelCache();
|
|
||||||
|
|
||||||
if (IS_VALID_DATACACHE_HANDLE(modelCache))
|
|
||||||
{
|
|
||||||
studioHdr = GetErrorModel();
|
|
||||||
|
|
||||||
if (!IsKnownBadModel(handle))
|
|
||||||
{
|
|
||||||
if (!studioHdr)
|
|
||||||
Error(eDLL_T::ENGINE, EXIT_FAILURE, "Model \"%s\" has invalid studio data and \"%s\" couldn't be loaded.\n", modelName, ERROR_MODEL);
|
|
||||||
else
|
|
||||||
Error(eDLL_T::ENGINE, NO_ERROR, "Model \"%s\" has invalid studio data; replacing with \"%s\".\n", modelName, ERROR_MODEL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
studioHdr = modelCache->GetStudioHdr();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user