Fix rotated flipped patches

This commit is contained in:
Jaime Passos 2020-10-10 19:06:29 -03:00
parent b2f45986ad
commit 6145442a34
1 changed files with 5 additions and 7 deletions

View File

@ -127,17 +127,15 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
#define ROTSPRITE_YCENTER (newheight / 2) #define ROTSPRITE_YCENTER (newheight / 2)
if (flip) if (flip)
idx += rotsprite->angles;
if (rotsprite->patches[idx])
return;
if (bflip)
{ {
idx += rotsprite->angles;
xpivot = width - xpivot; xpivot = width - xpivot;
leftoffset = width - leftoffset; leftoffset = width - leftoffset;
} }
if (rotsprite->patches[idx])
return;
// Find the dimensions of the rotated patch. // Find the dimensions of the rotated patch.
{ {
INT32 w1 = abs(FixedMul(width << FRACBITS, ca) - FixedMul(height << FRACBITS, sa)); INT32 w1 = abs(FixedMul(width << FRACBITS, ca) - FixedMul(height << FRACBITS, sa));
@ -226,7 +224,7 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
rotated = (patch_t *)Picture_Convert(PICFMT_FLAT16, rawdst, PICFMT_PATCH, 0, &size, newwidth, newheight, 0, 0, 0); rotated = (patch_t *)Picture_Convert(PICFMT_FLAT16, rawdst, PICFMT_PATCH, 0, &size, newwidth, newheight, 0, 0, 0);
Z_ChangeTag(rotated, PU_PATCH_ROTATED); Z_ChangeTag(rotated, PU_PATCH_ROTATED);
Z_SetUser(rotated, (void **)(&rotsprite->patches[angle])); Z_SetUser(rotated, (void **)(&rotsprite->patches[idx]));
rotated->leftoffset = (rotated->width / 2) + (leftoffset - xpivot); rotated->leftoffset = (rotated->width / 2) + (leftoffset - xpivot);
rotated->topoffset = (rotated->height / 2) + (patch->topoffset - ypivot); rotated->topoffset = (rotated->height / 2) + (patch->topoffset - ypivot);