From 51b0126d6d7f8ab48a7f495e5678ea4cd24bc381 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Tue, 28 Nov 2023 13:46:03 -0300 Subject: [PATCH] Fix V_DrawStretchyFixedPatch and V_DrawCroppedPatch --- src/v_video.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/v_video.c b/src/v_video.c index 3226fc1d5..17e19f6a5 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -676,8 +676,6 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca if (!desttop) return; - deststop = desttop + vid.rowbytes * vid.width; - if (scrn & V_NOSCALESTART) { x >>= FRACBITS; @@ -778,9 +776,12 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca dest = deststart + (destend - desttop); dest += FixedInt(FixedMul(topdelta<>FRACBITS) < column->length; ofs += rowfrac) { - if (dest >= screens[scrn&V_PARAMMASK]) // don't draw off the top of the screen (CRASH PREVENTION) + if (dest >= col_start) // don't draw off the top of the screen (CRASH PREVENTION) *dest = patchdrawfunc(dest, source, ofs); dest++; } @@ -795,7 +796,6 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, IN UINT8 (*patchdrawfunc)(const UINT8*, const UINT8*, fixed_t); UINT32 alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT); UINT32 blendmode = ((scrn & V_BLENDMASK) >> V_BLENDSHIFT); - // boolean flip = false; fixed_t col, ofs, colfrac, rowfrac, fdup, vdup; INT32 dup; @@ -944,7 +944,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, IN if (!desttop) return; - deststop = desttop + vid.rowbytes * vid.width; + int stop_pos = vid.height; if (scrn & V_NOSCALESTART) { @@ -1011,7 +1011,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, IN if (stplyr == &players[displayplayer]) // Player 1's screen, crop at the bottom { // Just put a big old stop sign halfway through the screen - deststop -= vid.height>>1; + stop_pos -= vid.height>>1; } else //if (stplyr == &players[secondarydisplayplayer]) // Player 2's screen, crop at the top { @@ -1050,9 +1050,12 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, IN else ofs = sy-(topdelta<>FRACBITS) < column->length && ((ofs - sy) + (topdelta<= screens[scrn&V_PARAMMASK]) // don't draw off the top of the screen (CRASH PREVENTION) + if (dest >= col_start) // don't draw off the top of the screen (CRASH PREVENTION) *dest = patchdrawfunc(dest, source, ofs); dest++; }