Example #1
0
static void putsprite_blend_flip_(
    unsigned short *dest, int x, int xmin, int xmax, int *linetab, unsigned short *palette, int h, int screenwidth,
    unsigned short (*blendfp)(unsigned short, unsigned short)
)
{
    for(; h > 0; h--, dest += screenwidth)
    {
        register int lx = x; // destination x position
        unsigned char *data = ((unsigned char *)linetab) + (*linetab);
        linetab++;
        while(lx > xmin)
        {
            register int count = *data++; // clearcount - number of transparent pixels
            if(count == 0xFF)
            {
                break;    // end-of-line indicator
            }
            lx -= count;
            if(lx <= xmin)
            {
                break;
            }
            count = *data++; // viscount - number of visible pixels following
            if(!count)
            {
                continue;
            }
            if((lx - count) >= xmax)
            {
                lx -= count;
                data += count;
                continue;
            }
            if(lx > xmax)
            {
                int diff = (lx - xmax);
                count -= diff;
                data += diff;
                lx = xmax;
            }
            if((lx - count) < xmin)
            {
                count = lx - xmin;
            }
            for(; count > 0; count--)
            {
                --lx;
                dest[lx] = blendfp(palette[*data++], dest[lx]);
            }
        }
    }
}
Example #2
0
//src high dest low
static void putsprite_blend_(
    unsigned short *dest, int x, int xmin, int xmax, int *linetab, unsigned short *palette, int h, int screenwidth,
    unsigned short (*blendfp)(unsigned short, unsigned short)
)
{
    for(; h > 0; h--, dest += screenwidth)
    {
        register int lx = x;
        unsigned char *data = ((unsigned char *)linetab) + (*linetab);
        linetab++;
        while(lx < xmax)
        {
            register int count = *data++;
            if(count == 0xFF)
            {
                break;
            }
            lx += count;
            if(lx >= xmax)
            {
                break;
            }
            count = *data++;
            if(!count)
            {
                continue;
            }
            if((lx + count) <= xmin)
            {
                lx += count;
                data += count;
                continue;
            }
            if(lx < xmin)
            {
                int diff = lx - xmin;
                count += diff;
                data -= diff;
                lx = xmin;
            }
            if((lx + count) > xmax)
            {
                count = xmax - lx;
            }
            for(; count > 0; count--, lx++)
            {
                dest[lx] = blendfp(palette[*data++], dest[lx]);
            }
        }
    }
}
Example #3
0
static void putsprite_blend_flip_(unsigned *dest, int x, int *linetab, unsigned *palette, int h, int screenwidth,
				  unsigned (*blendfp) (unsigned, unsigned)
    ) {
	for(; h > 0; h--, dest += screenwidth) {
		register int lx = x;
		unsigned char *data = ((unsigned char *) linetab) + (*linetab);
		linetab++;
		while(lx > 0) {
			register int count = *data++;
			if(count == 0xFF)
				break;
			lx -= count;
			if(lx <= 0)
				break;
			count = *data++;
			if(!count)
				continue;
			if((lx - count) >= screenwidth) {
				lx -= count;
				data += count;
				continue;
			}
			if(lx > screenwidth) {
				int diff = (lx - screenwidth);
				count -= diff;
				data += diff;
				lx = screenwidth;
			}
			if((lx - count) < 0) {
				count = lx;
			}
			for(; count > 0; count--) {
				--lx;
				dest[lx] = blendfp(palette[*data++], dest[lx]);
			}
		}
	}
}
Example #4
0
//src high dest low
static void putsprite_blend_(unsigned *dest, int x, int *linetab, unsigned *palette, int h, int screenwidth,
			     unsigned (*blendfp) (unsigned, unsigned)
    ) {
	for(; h > 0; h--, dest += screenwidth) {
		register int lx = x;
		unsigned char *data = ((unsigned char *) linetab) + (*linetab);
		linetab++;
		while(lx < screenwidth) {
			register int count = *data++;
			if(count == 0xFF)
				break;
			lx += count;
			if(lx >= screenwidth)
				break;
			count = *data++;
			if(!count)
				continue;
			if((lx + count) <= 0) {
				lx += count;
				data += count;
				continue;
			}
			if(lx < 0) {
				count += lx;
				data -= lx;
				lx = 0;
			}
			if((lx + count) > screenwidth) {
				count = screenwidth - lx;
			}
			for(; count > 0; count--, lx++) {
				dest[lx] = blendfp(palette[*data++], dest[lx]);
			}
		}
	}
}