Merge branch 'croppedpatchbleed' into 'master'

Fix the V_DrawCroppedPatch bleeding on the current charsel screen.

See merge request STJr/SRB2Internal!311
This commit is contained in:
Jaime Passos 2019-09-15 12:37:46 -04:00
commit 4e1791bbf4

View file

@ -1046,9 +1046,15 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
prevdelta = topdelta; prevdelta = topdelta;
source = (const UINT8 *)(column) + 3; source = (const UINT8 *)(column) + 3;
dest = desttop; dest = desttop;
dest += FixedInt(FixedMul(topdelta<<FRACBITS,fdup))*vid.width; if (topdelta-sy > 0)
{
dest += FixedInt(FixedMul((topdelta-sy)<<FRACBITS,fdup))*vid.width;
ofs = 0;
}
else
ofs = (sy-topdelta)<<FRACBITS;
for (ofs = sy<<FRACBITS; dest < deststop && (ofs>>FRACBITS) < column->length && (((ofs>>FRACBITS) - sy) + topdelta) < h; ofs += rowfrac) for (; dest < deststop && (ofs>>FRACBITS) < column->length && (((ofs>>FRACBITS) - sy) + topdelta) < h; ofs += rowfrac)
{ {
if (dest >= screens[scrn&V_PARAMMASK]) // don't draw off the top of the screen (CRASH PREVENTION) if (dest >= screens[scrn&V_PARAMMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
*dest = patchdrawfunc(dest, source, ofs); *dest = patchdrawfunc(dest, source, ofs);