diff --git a/src/v_video.c b/src/v_video.c index dfe56e37f8ac3ee99e8593b0caa2d4dff50e11cc..1ed5939d335206058213e3f6412bcdd863614295 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1046,9 +1046,15 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_ prevdelta = topdelta; source = (const UINT8 *)(column) + 3; 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) *dest = patchdrawfunc(dest, source, ofs);