Update r_data.c
This commit is contained in:
parent
79e99dc471
commit
1a44159ce9
48
src/r_data.c
48
src/r_data.c
|
@ -2683,37 +2683,25 @@ void R_PatchToFlat_16bpp(patch_t *patch, UINT16 *raw, boolean flip)
|
||||||
desttop = raw;
|
desttop = raw;
|
||||||
deststop = desttop + (SHORT(patch->width) * SHORT(patch->height));
|
deststop = desttop + (SHORT(patch->width) * SHORT(patch->height));
|
||||||
|
|
||||||
#define DEAR_GOD_FORGIVE_ME_FOR_MY_MACROS \
|
for (col = 0; col < SHORT(patch->width); col++, desttop++)
|
||||||
{ \
|
|
||||||
INT32 topdelta, prevdelta = -1; \
|
|
||||||
column = (column_t *)((UINT8 *)patch + LONG(patch->columnofs[col])); \
|
|
||||||
while (column->topdelta != 0xff) \
|
|
||||||
{ \
|
|
||||||
topdelta = column->topdelta; \
|
|
||||||
if (topdelta <= prevdelta) \
|
|
||||||
topdelta += prevdelta; \
|
|
||||||
prevdelta = topdelta; \
|
|
||||||
dest = desttop + (topdelta * SHORT(patch->width)); \
|
|
||||||
source = (UINT8 *)(column) + 3; \
|
|
||||||
for (ofs = 0; dest < deststop && ofs < column->length; ofs++) \
|
|
||||||
{ \
|
|
||||||
*dest = source[ofs]; \
|
|
||||||
dest += SHORT(patch->width); \
|
|
||||||
} \
|
|
||||||
column = (column_t *)((UINT8 *)column + column->length + 4); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!flip)
|
|
||||||
{
|
{
|
||||||
for (col = 0; col < SHORT(patch->width); col++, desttop++)
|
INT32 topdelta, prevdelta = -1;
|
||||||
DEAR_GOD_FORGIVE_ME_FOR_MY_MACROS
|
column = (column_t *)((UINT8 *)patch + LONG(patch->columnofs[flip ? (patch->width-1-col) : col]));
|
||||||
}
|
while (column->topdelta != 0xff)
|
||||||
else
|
{
|
||||||
{
|
topdelta = column->topdelta;
|
||||||
// flipped
|
if (topdelta <= prevdelta)
|
||||||
for (col = SHORT(patch->width)-1; col >= 0; col--, desttop++)
|
topdelta += prevdelta;
|
||||||
DEAR_GOD_FORGIVE_ME_FOR_MY_MACROS
|
prevdelta = topdelta;
|
||||||
|
dest = desttop + (topdelta * SHORT(patch->width));
|
||||||
|
source = (UINT8 *)(column) + 3;
|
||||||
|
for (ofs = 0; dest < deststop && ofs < column->length; ofs++)
|
||||||
|
{
|
||||||
|
*dest = source[ofs];
|
||||||
|
dest += SHORT(patch->width);
|
||||||
|
}
|
||||||
|
column = (column_t *)((UINT8 *)column + column->length + 4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue