Exemplo n.º 1
0
void vgaputim(int16_t x, int16_t y, int16_t ch, int16_t w, int16_t h)
{
	SDL_Surface *tmp;
	SDL_Surface *mask;
	SDL_Surface *scr = NULL;
	uint8_t   *tmp_pxl, *mask_pxl, *scr_pxl;
	int16_t realsize;
	int16_t i;

	tmp = ch2bmap(sprites[ch*2], w, h);
	mask = ch2bmap(sprites[ch*2+1], w, h);
	vgageti(x, y, (uint8_t *)&scr, w, h);
	realsize = scr->w * scr->h;
	tmp_pxl = (uint8_t *)tmp->pixels;
	mask_pxl = (uint8_t *)mask->pixels;
	scr_pxl = (uint8_t *)scr->pixels;
	for(i=0;i<realsize;i++)
		if(tmp_pxl[i] != 0xff)
			scr_pxl[i] = (scr_pxl[i] & mask_pxl[i]) | \
				tmp_pxl[i];

	vgaputi(x, y, (uint8_t *)&scr, w, h);
	tmp->pixels = NULL;   /* We should NULL'ify these ppointers, or the VGLBitmapDestroy */
	mask->pixels = NULL;  /* will shoot itself in the foot by trying to dellocate statically */
	SDL_FreeSurface(tmp);/* allocated arrays */
	SDL_FreeSurface(mask);
	SDL_FreeSurface(scr);
}
Exemplo n.º 2
0
void
vgaputim(int16_t x, int16_t y, int16_t ch, int16_t w, int16_t h)
{
    VGLBitmap      *tmp;
    VGLBitmap      *mask;
    VGLBitmap      *scr = NULL;
    int16_t           realsize;
    int16_t           i;

    tmp = ch2bmap(sprites[ch * 2], w, h);
    mask = ch2bmap(sprites[ch * 2 + 1], w, h);
    vgageti(x, y, (uint8_t *) & scr, w, h);
    realsize = scr->Xsize * scr->Ysize;
    for (i = 0; i < realsize; i++)
	if (tmp->Bitmap[i] != 0xff)
	    scr->Bitmap[i] = (scr->Bitmap[i] & mask->Bitmap[i]) | \
		tmp->Bitmap[i];

    vgaputi(x, y, (uint8_t *) & scr, w, h);
    tmp->Bitmap = NULL;		/* We should NULL'ify these ppointers, or the
				 * VGLBitmapDestroy */
    mask->Bitmap = NULL;	/* will shoot itself in the foot by trying to
				 * dellocate statically */
    VGLBitmapDestroy(tmp);	/* allocated arrays */
    VGLBitmapDestroy(mask);
    VGLBitmapDestroy(scr);
}
Exemplo n.º 3
0
void vgawrite(int16_t x, int16_t y, int16_t ch, int16_t c)
{
    SDL_Surface *tmp;
    uint8_t *copy;
    uint8_t color;
    int16_t w = 3, h = 12, size;
    int16_t i;

    if (((ch - 32) >= 0x5f) || (ch < 32))
        return;
    tmp = ch2bmap(alphas[ch - 32], w, h);
    size = tmp->w * tmp->h;
    copy = malloc(size);
    memcpy(copy, tmp->pixels, size);

    for (i = size; i != 0;)
    {
        i--;
        color = copy[i];
        if (color == 10)
        {
            if (c == 2)
                color = 12;
            else
            {
                if (c == 3)
                    color = 14;
            }
        }
        else if (color == 12)
        {
            if (c == 1)
                color = 2;
            else if (c == 2)
                color = 4;
            else if (c == 3)
                color = 6;
        }
        copy[i] = color;
    }
    tmp->pixels = copy;
    vgaputi(x, y, (uint8_t *)&tmp, w, h);
    SDL_FreeSurface(tmp);
    free(copy);
}
Exemplo n.º 4
0
void vgawrite(Sint4 x, Sint4 y, Sint4 ch, Sint4 c)
{
	SDL_Surface *tmp;
	Uint8 *copy;
	Uint8 color;
	Sint4 w=3, h=12, size;
	Sint4 i;

	if(((ch - 32) >= 0x5f) || (ch < 32))
		return;
	tmp = ch2bmap(alphas[ch-32], w, h);
	size = tmp->w*tmp->h;
	copy = new Uint8[size];
	memcpy(copy, tmp->pixels, size);

	for(i = size;i!=0;) {
		i--;
		color = copy[i];
		if (color==10) {
			if (c==2)
				color=12;
            		else {
              			if (c==3)
				color=14;
			}
          	} else
			if (color==12) {
				if (c==1)
					color=2;
				else
					if (c==2)
						color=4;
					else
						if (c==3)
							color=6;
			}
		copy[i] = color;
	}
	tmp->pixels = copy;
	vgaputi(x, y, (Uint3 *)&tmp, w, h);
	SDL_FreeSurface(tmp);
}
Exemplo n.º 5
0
void
vgawrite(int16_t x, int16_t y, int16_t ch, int16_t c)
{
    VGLBitmap      *tmp;
    uint8_t          *copy;
    uint8_t           color;
    int16_t           w = 3, h = 12, size;
    int16_t           i;

    if(((ch - 32) >= 0x5f) || (ch < 32))
	return;
    tmp = ch2bmap(alphas[ch - 32], w, h);
    size = tmp->Xsize * tmp->Ysize;
    copy = malloc(size);
    memcpy(copy, tmp->Bitmap, size);

    for (i = size; i != 0;) {
	i--;
	color = copy[i];
	if (color == 10) {
	    if (c == 2)
		color = 12;
	    else if (c == 3)
		color = 14;
	} else {
	    if (color == 12) {
		if (c == 1)
		    color = 2;
		else if (c == 2)
		    color = 4;
		else if (c == 3)
		    color = 6;
	    }
	}
	copy[i] = color;
    }
    tmp->Bitmap = copy;
    vgaputi(x, y, (uint8_t *) & tmp, w, h);
    VGLBitmapDestroy(tmp);
}