mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-03 23:11:14 +00:00
Use cached patch even if it hasn't been loaded
This commit is contained in:
parent
9c758e68e8
commit
30cc998e4f
2 changed files with 11 additions and 11 deletions
|
@ -475,12 +475,14 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex)
|
||||||
// Composite the columns together.
|
// Composite the columns together.
|
||||||
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
|
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
|
||||||
{
|
{
|
||||||
UINT8 *pdata = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
|
UINT16 wadnum = patch->wad;
|
||||||
|
lumpnum_t lumpnum = patch->lump;
|
||||||
|
UINT8 *pdata = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
|
||||||
patch_t *realpatch = NULL;
|
patch_t *realpatch = NULL;
|
||||||
boolean free_patch = true;
|
boolean free_patch = true;
|
||||||
|
|
||||||
#ifndef NO_PNG_LUMPS
|
#ifndef NO_PNG_LUMPS
|
||||||
size_t lumplength = W_LumpLengthPwad(patch->wad, patch->lump);
|
size_t lumplength = W_LumpLengthPwad(wadnum, lumpnum);
|
||||||
if (Picture_IsLumpPNG(pdata, lumplength))
|
if (Picture_IsLumpPNG(pdata, lumplength))
|
||||||
realpatch = (patch_t *)Picture_PNGConvert(pdata, PICFMT_PATCH, NULL, NULL, NULL, NULL, lumplength, NULL, 0);
|
realpatch = (patch_t *)Picture_PNGConvert(pdata, PICFMT_PATCH, NULL, NULL, NULL, NULL, lumplength, NULL, 0);
|
||||||
else
|
else
|
||||||
|
@ -490,13 +492,12 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If this patch has already been loaded, we just use it from the cache.
|
// If this patch has already been loaded, we just use it from the cache.
|
||||||
realpatch = W_GetCachedPatchNumPwad(patch->wad, patch->lump);
|
realpatch = W_GetCachedPatchNumPwad(wadnum, lumpnum);
|
||||||
|
free_patch = false;
|
||||||
|
|
||||||
// Otherwise, we convert it here.
|
// Otherwise, we load it here.
|
||||||
if (realpatch == NULL)
|
if (realpatch == NULL)
|
||||||
realpatch = Patch_Create((softwarepatch_t *)pdata, NULL);
|
realpatch = W_CachePatchNumPwad(wadnum, lumpnum, PU_PATCH);
|
||||||
else
|
|
||||||
free_patch = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HWR_DrawTexturePatchInCache(&grtex->mipmap, blockwidth, blockheight, texture, patch, realpatch);
|
HWR_DrawTexturePatchInCache(&grtex->mipmap, blockwidth, blockheight, texture, patch, realpatch);
|
||||||
|
|
|
@ -381,12 +381,11 @@ UINT8 *R_GenerateTexture(size_t texnum)
|
||||||
{
|
{
|
||||||
// If this patch has already been loaded, we just use it from the cache.
|
// If this patch has already been loaded, we just use it from the cache.
|
||||||
realpatch = W_GetCachedPatchNumPwad(wadnum, lumpnum);
|
realpatch = W_GetCachedPatchNumPwad(wadnum, lumpnum);
|
||||||
|
free_patch = false;
|
||||||
|
|
||||||
// Otherwise, we convert it here.
|
// Otherwise, we load it here.
|
||||||
if (realpatch == NULL)
|
if (realpatch == NULL)
|
||||||
realpatch = Patch_Create((softwarepatch_t *)pdata, NULL);
|
realpatch = W_CachePatchNumPwad(wadnum, lumpnum, PU_PATCH);
|
||||||
else
|
|
||||||
free_patch = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
x1 = patch->originx;
|
x1 = patch->originx;
|
||||||
|
|
Loading…
Reference in a new issue