mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-30 13:21:04 +00:00
- re-fixed the fix: Turned out that flipped offsetting is a bit more tricky.
Due to how this works it cannot be done automatically, it must be passed as a parameter because at the point where the offset gets applied, all information about how it was specified is lost. This must be enabled as a specific parameter to DrawTexture.
This commit is contained in:
parent
2ea9811e0a
commit
efb73d04a0
4 changed files with 11 additions and 2 deletions
|
@ -426,13 +426,11 @@ void F2DDrawer::AddTexture(FGameTexture* img, DrawParms& parms)
|
||||||
if (parms.flipX)
|
if (parms.flipX)
|
||||||
{
|
{
|
||||||
std::swap(u1, u2);
|
std::swap(u1, u2);
|
||||||
parms.left = parms.texwidth - parms.left;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parms.flipY)
|
if (parms.flipY)
|
||||||
{
|
{
|
||||||
std::swap(v1, v2);
|
std::swap(v1, v2);
|
||||||
parms.top = parms.texheight - parms.top;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parms.rotateangle == 0)
|
if (parms.rotateangle == 0)
|
||||||
|
|
|
@ -413,6 +413,9 @@ bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FGameTexture *img, do
|
||||||
parms->destwidth *= parms->patchscalex;
|
parms->destwidth *= parms->patchscalex;
|
||||||
parms->destheight *= parms->patchscaley;
|
parms->destheight *= parms->patchscaley;
|
||||||
|
|
||||||
|
if (parms->flipoffsets && parms->flipY) parms->top = parms->texwidth - parms->top;
|
||||||
|
if (parms->flipoffsets && parms->flipX) parms->left = parms->texwidth - parms->left;
|
||||||
|
|
||||||
switch (parms->cleanmode)
|
switch (parms->cleanmode)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
|
@ -637,6 +640,7 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
|
||||||
parms->patchscalex = parms->patchscaley = 1;
|
parms->patchscalex = parms->patchscaley = 1;
|
||||||
parms->viewport = { 0,0,drawer->GetWidth(), drawer->GetHeight() };
|
parms->viewport = { 0,0,drawer->GetWidth(), drawer->GetHeight() };
|
||||||
parms->rotateangle = 0;
|
parms->rotateangle = 0;
|
||||||
|
parms->flipoffsets = false;
|
||||||
|
|
||||||
// Parse the tag list for attributes. (For floating point attributes,
|
// Parse the tag list for attributes. (For floating point attributes,
|
||||||
// consider that the C ABI dictates that all floats be promoted to
|
// consider that the C ABI dictates that all floats be promoted to
|
||||||
|
@ -834,6 +838,10 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
|
||||||
parms->flipY = ListGetInt(tags);
|
parms->flipY = ListGetInt(tags);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DTA_FlipOffsets:
|
||||||
|
parms->flipoffsets = ListGetInt(tags);
|
||||||
|
break;
|
||||||
|
|
||||||
case DTA_SrcX:
|
case DTA_SrcX:
|
||||||
parms->srcx = ListGetDouble(tags) / img->GetDisplayWidth();
|
parms->srcx = ListGetDouble(tags) / img->GetDisplayWidth();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -104,6 +104,7 @@ enum
|
||||||
DTA_TopLeft, // always align to top left. Added to have a boolean condition for this alignment.
|
DTA_TopLeft, // always align to top left. Added to have a boolean condition for this alignment.
|
||||||
DTA_Pin, // Pin a non-widescreen image to the left/right edge of the screen.
|
DTA_Pin, // Pin a non-widescreen image to the left/right edge of the screen.
|
||||||
DTA_Rotate,
|
DTA_Rotate,
|
||||||
|
DTA_FlipOffsets, // Flips offsets when using DTA_FlipX and DTA_FlipY, this cannot be automatic due to unexpected behavior with unoffsetted graphics.
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -169,6 +170,7 @@ struct DrawParms
|
||||||
bool fortext;
|
bool fortext;
|
||||||
bool virtBottom;
|
bool virtBottom;
|
||||||
bool burn;
|
bool burn;
|
||||||
|
bool flipoffsets;
|
||||||
int8_t fsscalemode;
|
int8_t fsscalemode;
|
||||||
double srcx, srcy;
|
double srcx, srcy;
|
||||||
double srcwidth, srcheight;
|
double srcwidth, srcheight;
|
||||||
|
|
|
@ -550,6 +550,7 @@ void hud_drawsprite(double sx, double sy, int z, int a, int picnum, int dashade,
|
||||||
DTA_FlipX, !!(dastat & RS_YFLIP), // the weapon drawer uses y-flip+180° rotation for x-flip but no other transformation.
|
DTA_FlipX, !!(dastat & RS_YFLIP), // the weapon drawer uses y-flip+180° rotation for x-flip but no other transformation.
|
||||||
DTA_Pin, (dastat & RS_ALIGN_R) ? 1 : (dastat & RS_ALIGN_L) ? -1 : 0,
|
DTA_Pin, (dastat & RS_ALIGN_R) ? 1 : (dastat & RS_ALIGN_L) ? -1 : 0,
|
||||||
DTA_Rotate, a * (-360./2048),
|
DTA_Rotate, a * (-360./2048),
|
||||||
|
DTA_FlipOffsets, !(dastat & (RS_TOPLEFT | RS_CENTER)),
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue