mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-25 22:05:20 -04:00
simplify V_DrawPatchGeneral() overflow guard
This commit is contained in:
parent
8ecb882201
commit
314e8d5e51
@ -346,14 +346,11 @@ void V_DrawPatchGeneral(int x, int y, int scrn, patch_t *patch,
|
|||||||
{
|
{
|
||||||
int topy = y + column->topdelta;
|
int topy = y + column->topdelta;
|
||||||
// [FG] too high
|
// [FG] too high
|
||||||
while (topy < 0)
|
while (topy < 0 && count)
|
||||||
count--, source++, dest += SCREENWIDTH*4, topy++;
|
count--, source++, dest += SCREENWIDTH*4, topy++;
|
||||||
// [FG] too low, too tall
|
// [FG] too low, too tall
|
||||||
while (topy + count > SCREENHEIGHT)
|
while (topy + count > SCREENHEIGHT && count)
|
||||||
count--;
|
count--;
|
||||||
// [FG] nothing left to draw?
|
|
||||||
if (count < 1)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((count-=4)>=0)
|
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;
|
int topy = y + column->topdelta;
|
||||||
// [FG] too high
|
// [FG] too high
|
||||||
while (topy < 0)
|
while (topy < 0 && count)
|
||||||
count--, source++, dest += SCREENWIDTH, topy++;
|
count--, source++, dest += SCREENWIDTH, topy++;
|
||||||
// [FG] too low, too tall
|
// [FG] too low, too tall
|
||||||
while (topy + count > SCREENHEIGHT)
|
while (topy + count > SCREENHEIGHT && count)
|
||||||
count--;
|
count--;
|
||||||
// [FG] nothing left to draw?
|
|
||||||
if (count < 1)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((count-=4)>=0)
|
if ((count-=4)>=0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user