V_DrawFixedPatch: Tinker with the left/top offsets code so that V_OFFSET can support V_FLIP

This commit is contained in:
Monster Iestyn 2018-10-29 12:06:22 +00:00
parent 0e6c5cf342
commit 834a5e6b35
1 changed files with 22 additions and 9 deletions

View File

@ -406,22 +406,35 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
colfrac = FixedDiv(FRACUNIT, fdup);
rowfrac = FixedDiv(FRACUNIT, fdup);
if (scrn & V_OFFSET) // Crosshair shit
// So it turns out offsets aren't scaled in V_NOSCALESTART unless V_OFFSET is applied ...poo, that's terrible
// For now let's just at least give V_OFFSET the ability to support V_FLIP
// I'll probably make a better fix for 2.2 where I don't have to worry about breaking existing support for stuff
// -- Monster Iestyn 29/10/18
{
y -= FixedMul((SHORT(patch->topoffset)*dupy)<<FRACBITS, pscale);
x -= FixedMul((SHORT(patch->leftoffset)*dupx)<<FRACBITS, pscale);
}
else
{
y -= FixedMul(SHORT(patch->topoffset)<<FRACBITS, pscale);
fixed_t offsetx = 0, offsety = 0;
// left offset
if (scrn & V_FLIP)
{
flip = true;
x -= FixedMul((SHORT(patch->width) - SHORT(patch->leftoffset))<<FRACBITS, pscale) + 1;
offsetx = FixedMul((SHORT(patch->width) - SHORT(patch->leftoffset))<<FRACBITS, pscale) + 1;
}
else
x -= FixedMul(SHORT(patch->leftoffset)<<FRACBITS, pscale);
offsetx = FixedMul(SHORT(patch->leftoffset)<<FRACBITS, pscale);
// top offset
// TODO: make some kind of vertical version of V_FLIP, maybe by deprecating V_OFFSET in future?!?
offsety = FixedMul(SHORT(patch->topoffset)<<FRACBITS, pscale);
if (scrn & V_OFFSET) // Multiply by dupx/dupy for crosshairs
{
offsetx = FixedMul(offsetx, dupx<<FRACBITS);
offsety = FixedMul(offsety, dupy<<FRACBITS);
}
// Subtract the offsets from x/y positions
x -= offsetx;
y -= offsety;
}
if (scrn & V_SPLITSCREEN)