Fix V_DrawStretchyFixedPatch and V_DrawCroppedPatch

This commit is contained in:
Lactozilla 2023-11-28 13:46:03 -03:00
parent 5b8158d779
commit 51b0126d6d

View file

@ -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,vdup));
UINT8 *col_start = screens[0] + ((x + offx)*vid.height);
deststop = col_start + vid.height;
for (ofs = 0; dest < deststop && (ofs>>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);
UINT8 *col_start = screens[0] + (x*vid.height);
deststop = col_start + stop_pos;
for (; dest < deststop && (ofs>>FRACBITS) < column->length && ((ofs - sy) + (topdelta<<FRACBITS)) < h; 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++;
}