minor fixes

This commit is contained in:
Jaime Passos 2019-11-09 01:45:00 -03:00
parent b88a37949e
commit 773f2efdd9
2 changed files with 10 additions and 4 deletions

View file

@ -464,7 +464,7 @@ static inline void P_FindAnimatedFlat(INT32 animnum)
for (i = 0; i < numlevelflats; i++, foundflats++) for (i = 0; i < numlevelflats; i++, foundflats++)
{ {
// is that levelflat from the flat anim sequence ? // is that levelflat from the flat anim sequence ?
if ((anims[animnum].istexture) && (foundflats->u.texture.num != 0 && foundflats->u.texture.num != -1) if ((anims[animnum].istexture) && (foundflats->type == LEVELFLAT_TEXTURE)
&& ((UINT16)foundflats->u.texture.num >= startflatnum && (UINT16)foundflats->u.texture.num <= endflatnum)) && ((UINT16)foundflats->u.texture.num >= startflatnum && (UINT16)foundflats->u.texture.num <= endflatnum))
{ {
foundflats->u.texture.basenum = startflatnum; foundflats->u.texture.basenum = startflatnum;

View file

@ -456,6 +456,7 @@ static UINT8 *R_GenerateTexture(size_t texnum)
texture_t *texture; texture_t *texture;
texpatch_t *patch; texpatch_t *patch;
patch_t *realpatch; patch_t *realpatch;
boolean dealloc = false;
int x, x1, x2, i, width, height; int x, x1, x2, i, width, height;
size_t blocksize; size_t blocksize;
column_t *patchcol; column_t *patchcol;
@ -487,10 +488,7 @@ static UINT8 *R_GenerateTexture(size_t texnum)
#ifndef NO_PNG_LUMPS #ifndef NO_PNG_LUMPS
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength)) if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
{
realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL, false);
goto multipatch; goto multipatch;
}
#endif #endif
// Check the patch for holes. // Check the patch for holes.
@ -579,9 +577,14 @@ 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);
dealloc = false;
#ifndef NO_PNG_LUMPS #ifndef NO_PNG_LUMPS
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength)) if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
{
realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL, false); realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL, false);
dealloc = true;
}
#endif #endif
x1 = patch->originx; x1 = patch->originx;
@ -619,6 +622,9 @@ static UINT8 *R_GenerateTexture(size_t texnum)
colofs[x] = LONG((x * texture->height) + (texture->width*4)); colofs[x] = LONG((x * texture->height) + (texture->width*4));
ColumnDrawerPointer(patchcol, block + LONG(colofs[x]), patch, texture->height, height); ColumnDrawerPointer(patchcol, block + LONG(colofs[x]), patch, texture->height, height);
} }
if (dealloc)
Z_Free(realpatch);
} }
done: done: