mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-25 13:55:36 -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;
|
||||
// [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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user