mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 12:50:44 +00:00
wrap prevention code now takes flipped patches into account
This commit is contained in:
parent
76d71bda92
commit
3698c2583d
1 changed files with 22 additions and 9 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;
|
||||
UINT8 *desttop, *dest, *deststart, *destend;
|
||||
const UINT8 *source, *deststop;
|
||||
fixed_t pwidth; // patch width
|
||||
fixed_t offx = 0; // x offset
|
||||
|
||||
if (rendermode == render_none)
|
||||
return;
|
||||
|
@ -476,25 +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
|
||||
{
|
||||
fixed_t pwidth = SHORT(patch->width)<<FRACBITS;
|
||||
pwidth = SHORT(patch->width)<<FRACBITS;
|
||||
pwidth = FixedMul(pwidth, pscale);
|
||||
pwidth = FixedMul(pwidth, dupx<<FRACBITS);
|
||||
pwidth >>= FRACBITS;
|
||||
destend = desttop + pwidth;
|
||||
}
|
||||
else
|
||||
destend = desttop + SHORT(patch->width) * dupx;
|
||||
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;
|
||||
if (x < 0) // don't draw off the left of the screen (WRAP PREVENTION)
|
||||
continue;
|
||||
if (x >= vid.width) // don't draw off the right of the screen (WRAP PREVENTION)
|
||||
break;
|
||||
if (flip) // offx is measured from right edge instead of left
|
||||
{
|
||||
if (x+pwidth-offx < 0) // don't draw off the left of the screen (WRAP PREVENTION)
|
||||
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]));
|
||||
|
||||
while (column->topdelta != 0xff)
|
||||
|
|
Loading…
Reference in a new issue