mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-10 15:22:20 +00:00
Merge branch 'patch-scaling-flip-fix' into 'next'
Fixes for patch scaling and V_FLIP usage The following issues are fixed by this branch: * a patch using both scaling and V_FLIP does not appear in the "correct" place on the screen. Thanks to LJSonic for pointing this out to me on 'fun * Scaled and/or V_FLIPed patches wrap at the left/right screen edges even though they're not supposed to. V_FLIP patches at these edges may also crop the wrong side of the patch if they're at the right edge. See merge request !60
This commit is contained in:
commit
042331edd5
1 changed files with 29 additions and 7 deletions
|
@ -336,6 +336,8 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
||||||
const column_t *column;
|
const column_t *column;
|
||||||
UINT8 *desttop, *dest, *deststart, *destend;
|
UINT8 *desttop, *dest, *deststart, *destend;
|
||||||
const UINT8 *source, *deststop;
|
const UINT8 *source, *deststop;
|
||||||
|
fixed_t pwidth; // patch width
|
||||||
|
fixed_t offx = 0; // x offset
|
||||||
|
|
||||||
if (rendermode == render_none)
|
if (rendermode == render_none)
|
||||||
return;
|
return;
|
||||||
|
@ -476,16 +478,36 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deststart = desttop;
|
if (pscale != FRACUNIT) // scale width properly
|
||||||
destend = desttop + SHORT(patch->width) * dupx;
|
{
|
||||||
|
pwidth = SHORT(patch->width)<<FRACBITS;
|
||||||
|
pwidth = FixedMul(pwidth, pscale);
|
||||||
|
pwidth = FixedMul(pwidth, dupx<<FRACBITS);
|
||||||
|
pwidth >>= FRACBITS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pwidth = SHORT(patch->width) * dupx;
|
||||||
|
|
||||||
for (col = 0; (col>>FRACBITS) < SHORT(patch->width); col += colfrac, ++x, desttop++)
|
deststart = desttop;
|
||||||
|
destend = desttop + pwidth;
|
||||||
|
|
||||||
|
for (col = 0; (col>>FRACBITS) < SHORT(patch->width); col += colfrac, ++offx, desttop++)
|
||||||
{
|
{
|
||||||
INT32 topdelta, prevdelta = -1;
|
INT32 topdelta, prevdelta = -1;
|
||||||
if (x < 0) // don't draw off the left of the screen (WRAP PREVENTION)
|
if (flip) // offx is measured from right edge instead of left
|
||||||
continue;
|
{
|
||||||
if (x >= vid.width) // don't draw off the right of the screen (WRAP PREVENTION)
|
if (x+pwidth-offx < 0) // don't draw off the left of the screen (WRAP PREVENTION)
|
||||||
break;
|
break;
|
||||||
|
if (x+pwidth-offx >= vid.width) // don't draw off the right of the screen (WRAP PREVENTION)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (x+offx < 0) // don't draw off the left of the screen (WRAP PREVENTION)
|
||||||
|
continue;
|
||||||
|
if (x+offx >= vid.width) // don't draw off the right of the screen (WRAP PREVENTION)
|
||||||
|
break;
|
||||||
|
}
|
||||||
column = (const column_t *)((const UINT8 *)(patch) + LONG(patch->columnofs[col>>FRACBITS]));
|
column = (const column_t *)((const UINT8 *)(patch) + LONG(patch->columnofs[col>>FRACBITS]));
|
||||||
|
|
||||||
while (column->topdelta != 0xff)
|
while (column->topdelta != 0xff)
|
||||||
|
|
Loading…
Reference in a new issue