Made tweaks suggested by toaster to make the code a bit less dumb.

This commit is contained in:
Nevur 2017-03-15 15:46:04 +01:00
parent be9ca534d7
commit 191623e246
1 changed files with 4 additions and 11 deletions

View File

@ -254,7 +254,7 @@ static inline void R_DrawTransColumnInCache(column_t *patch, UINT8 *cache, texpa
if (count > 0) if (count > 0)
{ {
for (; dest < cache + position + count; source++, dest++) for (; dest < cache + position + count; source++, dest++)
*dest = *dest == 0xFF ? *dest : *(mytransmap + ((*dest)<<8) + (*source)); if (*dest != 0xFF) *dest = *(mytransmap + ((*dest)<<8) + (*source));
} }
patch = (column_t *)((UINT8 *)patch + patch->length + 4); patch = (column_t *)((UINT8 *)patch + patch->length + 4);
@ -298,7 +298,7 @@ static inline void R_DrawTransFlippedColumnInCache(column_t *patch, UINT8 *cache
if (count > 0) if (count > 0)
{ {
for (; dest < cache + position + count; --source, dest++) for (; dest < cache + position + count; --source, dest++)
*dest = *dest == 0xFF ? *dest : *(mytransmap + ((*dest)<<8) + (*source)); if (*dest != 0xFF) *dest = *(mytransmap + ((*dest)<<8) + (*source));
} }
patch = (column_t *)((UINT8 *)patch + patch->length + 4); patch = (column_t *)((UINT8 *)patch + patch->length + 4);
@ -422,20 +422,13 @@ static UINT8 *R_GenerateTexture(size_t texnum)
{ {
if (patch->alpha < 255/11) // Is the patch way too translucent? Don't render then. if (patch->alpha < 255/11) // Is the patch way too translucent? Don't render then.
continue; continue;
if (patch->flip & 2) ColumnDrawerPointer = (patch->flip & 2) ? &R_DrawTransFlippedColumnInCache : &R_DrawTransColumnInCache;
ColumnDrawerPointer = &R_DrawTransFlippedColumnInCache;
else
ColumnDrawerPointer = &R_DrawTransColumnInCache;
} }
else else
{ {
if (patch->flip & 2) ColumnDrawerPointer = (patch->flip & 2) ? &R_DrawFlippedColumnInCache : &R_DrawColumnInCache;
ColumnDrawerPointer = &R_DrawFlippedColumnInCache;
else
ColumnDrawerPointer = &R_DrawColumnInCache;
} }
realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE); realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
x1 = patch->originx; x1 = patch->originx;
width = SHORT(realpatch->width); width = SHORT(realpatch->width);