simplify V_DrawPatchGeneral() overflow guard

This commit is contained in:
Fabian Greffrath 2021-01-11 12:23:43 +01:00
parent 8ecb882201
commit 314e8d5e51

View File

@ -346,14 +346,11 @@ void V_DrawPatchGeneral(int x, int y, int scrn, patch_t *patch,
{
int topy = y + column->topdelta;
// [FG] too high
while (topy < 0)
while (topy < 0 && count)
count--, source++, dest += SCREENWIDTH*4, topy++;
// [FG] too low, too tall
while (topy + count > SCREENHEIGHT)
while (topy + count > SCREENHEIGHT && count)
count--;
// [FG] nothing left to draw?
if (count < 1)
break;
}
if ((count-=4)>=0)
@ -429,14 +426,11 @@ void V_DrawPatchGeneral(int x, int y, int scrn, patch_t *patch,
{
int topy = y + column->topdelta;
// [FG] too high
while (topy < 0)
while (topy < 0 && count)
count--, source++, dest += SCREENWIDTH, topy++;
// [FG] too low, too tall
while (topy + count > SCREENHEIGHT)
while (topy + count > SCREENHEIGHT && count)
count--;
// [FG] nothing left to draw?
if (count < 1)
break;
}
if ((count-=4)>=0)