mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-25 13:55:36 -04:00
Merge branch 'master' of https://github.com/fabiangreffrath/woof
This commit is contained in:
commit
8ecb882201
@ -302,7 +302,7 @@ void V_DrawPatchGeneral(int x, int y, int scrn, patch_t *patch,
|
|||||||
y -= SHORT(patch->topoffset);
|
y -= SHORT(patch->topoffset);
|
||||||
x -= SHORT(patch->leftoffset);
|
x -= SHORT(patch->leftoffset);
|
||||||
|
|
||||||
#ifdef RANGECHECK
|
#ifdef RANGECHECK_NOTHANKS
|
||||||
if (x<0
|
if (x<0
|
||||||
||x+SHORT(patch->width) >SCREENWIDTH
|
||x+SHORT(patch->width) >SCREENWIDTH
|
||||||
|| y<0
|
|| y<0
|
||||||
@ -318,11 +318,21 @@ void V_DrawPatchGeneral(int x, int y, int scrn, patch_t *patch,
|
|||||||
{
|
{
|
||||||
byte *desttop = screens[scrn]+y*SCREENWIDTH*4+x*2;
|
byte *desttop = screens[scrn]+y*SCREENWIDTH*4+x*2;
|
||||||
|
|
||||||
for ( ; col != colstop ; col += colstep, desttop+=2)
|
for ( ; col != colstop ; col += colstep, desttop+=2, x++)
|
||||||
{
|
{
|
||||||
const column_t *column =
|
const column_t *column =
|
||||||
(const column_t *)((byte *)patch + LONG(patch->columnofs[col]));
|
(const column_t *)((byte *)patch + LONG(patch->columnofs[col]));
|
||||||
|
|
||||||
|
// [FG] prevent framebuffer overflows
|
||||||
|
{
|
||||||
|
// [FG] too far left
|
||||||
|
if (x < 0)
|
||||||
|
continue;
|
||||||
|
// [FG] too far right, too wide
|
||||||
|
if (x >= SCREENWIDTH)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// step through the posts in a column
|
// step through the posts in a column
|
||||||
while (column->topdelta != 0xff)
|
while (column->topdelta != 0xff)
|
||||||
{
|
{
|
||||||
@ -332,6 +342,20 @@ void V_DrawPatchGeneral(int x, int y, int scrn, patch_t *patch,
|
|||||||
register byte *dest = desttop + column->topdelta*SCREENWIDTH*4;
|
register byte *dest = desttop + column->topdelta*SCREENWIDTH*4;
|
||||||
register int count = column->length;
|
register int count = column->length;
|
||||||
|
|
||||||
|
// [FG] prevent framebuffer overflows
|
||||||
|
{
|
||||||
|
int topy = y + column->topdelta;
|
||||||
|
// [FG] too high
|
||||||
|
while (topy < 0)
|
||||||
|
count--, source++, dest += SCREENWIDTH*4, topy++;
|
||||||
|
// [FG] too low, too tall
|
||||||
|
while (topy + count > SCREENHEIGHT)
|
||||||
|
count--;
|
||||||
|
// [FG] nothing left to draw?
|
||||||
|
if (count < 1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if ((count-=4)>=0)
|
if ((count-=4)>=0)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -377,11 +401,21 @@ void V_DrawPatchGeneral(int x, int y, int scrn, patch_t *patch,
|
|||||||
{
|
{
|
||||||
byte *desttop = screens[scrn]+y*SCREENWIDTH+x;
|
byte *desttop = screens[scrn]+y*SCREENWIDTH+x;
|
||||||
|
|
||||||
for ( ; col != colstop ; col += colstep, desttop++)
|
for ( ; col != colstop ; col += colstep, desttop++, x++)
|
||||||
{
|
{
|
||||||
const column_t *column =
|
const column_t *column =
|
||||||
(const column_t *)((byte *)patch + LONG(patch->columnofs[col]));
|
(const column_t *)((byte *)patch + LONG(patch->columnofs[col]));
|
||||||
|
|
||||||
|
// [FG] prevent framebuffer overflows
|
||||||
|
{
|
||||||
|
// [FG] too far left
|
||||||
|
if (x < 0)
|
||||||
|
continue;
|
||||||
|
// [FG] too far right, too wide
|
||||||
|
if (x >= SCREENWIDTH)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// step through the posts in a column
|
// step through the posts in a column
|
||||||
while (column->topdelta != 0xff)
|
while (column->topdelta != 0xff)
|
||||||
{
|
{
|
||||||
@ -391,6 +425,20 @@ void V_DrawPatchGeneral(int x, int y, int scrn, patch_t *patch,
|
|||||||
register byte *dest = desttop + column->topdelta*SCREENWIDTH;
|
register byte *dest = desttop + column->topdelta*SCREENWIDTH;
|
||||||
register int count = column->length;
|
register int count = column->length;
|
||||||
|
|
||||||
|
// [FG] prevent framebuffer overflows
|
||||||
|
{
|
||||||
|
int topy = y + column->topdelta;
|
||||||
|
// [FG] too high
|
||||||
|
while (topy < 0)
|
||||||
|
count--, source++, dest += SCREENWIDTH, topy++;
|
||||||
|
// [FG] too low, too tall
|
||||||
|
while (topy + count > SCREENHEIGHT)
|
||||||
|
count--;
|
||||||
|
// [FG] nothing left to draw?
|
||||||
|
if (count < 1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if ((count-=4)>=0)
|
if ((count-=4)>=0)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user