define stuff idk

This commit is contained in:
Jaime Passos 2019-09-06 19:41:29 -03:00
parent 02a7d8e0a2
commit d38ba4d88c
3 changed files with 16 additions and 3 deletions

View file

@ -664,8 +664,10 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
{ {
size_t lumplength = W_LumpLengthPwad(patch->wad, patch->lump); size_t lumplength = W_LumpLengthPwad(patch->wad, patch->lump);
realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE); realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
#ifndef NO_PNG_LUMPS
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength)) if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength); realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength);
#endif
HWR_DrawTexturePatchInCache(&grtex->mipmap, HWR_DrawTexturePatchInCache(&grtex->mipmap,
blockwidth, blockheight, blockwidth, blockheight,
texture, patch, texture, patch,
@ -892,8 +894,10 @@ static void HWR_LoadPatchFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
{ {
patch_t *patch = (patch_t *)W_CacheLumpNum(flatlumpnum, PU_STATIC); patch_t *patch = (patch_t *)W_CacheLumpNum(flatlumpnum, PU_STATIC);
size_t lumplength = W_LumpLength(flatlumpnum); size_t lumplength = W_LumpLength(flatlumpnum);
#ifndef NO_PNG_LUMPS
if (R_IsLumpPNG((UINT8 *)patch, lumplength)) if (R_IsLumpPNG((UINT8 *)patch, lumplength))
patch = R_PNGToPatch((UINT8 *)patch, lumplength); patch = R_PNGToPatch((UINT8 *)patch, lumplength);
#endif
grMipmap->width = (UINT16)SHORT(patch->width); grMipmap->width = (UINT16)SHORT(patch->width);
grMipmap->height = (UINT16)SHORT(patch->height); grMipmap->height = (UINT16)SHORT(patch->height);

View file

@ -376,8 +376,10 @@ static UINT8 *R_GenerateTexture(size_t texnum)
lumpnum = patch->lump; lumpnum = patch->lump;
lumplength = W_LumpLengthPwad(wadnum, lumpnum); lumplength = W_LumpLengthPwad(wadnum, lumpnum);
realpatch = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE); realpatch = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
#ifndef NO_PNG_LUMPS
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength)) if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength); realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength);
#endif
// Check the patch for holes. // Check the patch for holes.
if (texture->width > SHORT(realpatch->width) || texture->height > SHORT(realpatch->height)) if (texture->width > SHORT(realpatch->width) || texture->height > SHORT(realpatch->height))
@ -468,8 +470,10 @@ static UINT8 *R_GenerateTexture(size_t texnum)
lumpnum = patch->lump; lumpnum = patch->lump;
lumplength = W_LumpLengthPwad(wadnum, lumpnum); lumplength = W_LumpLengthPwad(wadnum, lumpnum);
realpatch = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE); realpatch = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
#ifndef NO_PNG_LUMPS
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength)) if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength); realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength);
#endif
x1 = patch->originx; x1 = patch->originx;
width = SHORT(realpatch->width); width = SHORT(realpatch->width);
@ -734,6 +738,8 @@ void R_LoadTextures(void)
// Set texture properties. // Set texture properties.
M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name)); M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name));
#ifndef NO_PNG_LUMPS
if (R_IsLumpPNG((UINT8 *)patchlump, lumplength)) if (R_IsLumpPNG((UINT8 *)patchlump, lumplength))
{ {
INT16 width, height; INT16 width, height;
@ -742,6 +748,7 @@ void R_LoadTextures(void)
texture->height = height; texture->height = height;
} }
else else
#endif
{ {
texture->width = SHORT(patchlump->width); texture->width = SHORT(patchlump->width);
texture->height = SHORT(patchlump->height); texture->height = SHORT(patchlump->height);

View file

@ -963,12 +963,14 @@ void R_DrawSinglePlane(visplane_t *pl)
// Check if the flat is actually a wall texture. // Check if the flat is actually a wall texture.
if (levelflat->texturenum != 0 && levelflat->texturenum != -1) if (levelflat->texturenum != 0 && levelflat->texturenum != -1)
flat = R_GetPatchFlat(levelflat, true, false); flat = R_GetPatchFlat(levelflat, true, false);
// Maybe it's just a patch, then? #ifndef NO_PNG_LUMPS
else if (R_CheckIfPatch(levelflat->lumpnum))
flat = R_GetPatchFlat(levelflat, false, false);
// Maybe it's a PNG?! // Maybe it's a PNG?!
else if (R_IsLumpPNG(ds_source, size)) else if (R_IsLumpPNG(ds_source, size))
flat = R_GetPatchFlat(levelflat, false, true); flat = R_GetPatchFlat(levelflat, false, true);
#endif
// Maybe it's just a patch, then?
else if (R_CheckIfPatch(levelflat->lumpnum))
flat = R_GetPatchFlat(levelflat, false, false);
// It's a raw flat. // It's a raw flat.
else else
{ {