Esempio n. 1
0
void BasiliskAreaHurt::animate(Frame *space)
{
	STACKTRACE;
	if (state == 0)
		return;
	int i, j;
	double t = 1 - life_counter/(double)lifetime;
	double  x0, y0, dx, dy;
	int xi, yi;
	Vector2 p0;
	drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
	for (i=0; i<num; i++) {
		p0 = corner(xp[i]);
		x0 = p0.x;
		y0 = p0.y;
		p0 = unit_vector(xv[i]) * 3 * space_zoom;
		dx = p0.x;
		dy = p0.y;
		for (j=3; j>=0; j--) {
			if (space_zoom <= 1)
				set_trans_blender(0, 0, 0, iround(space_zoom * 255 * t * (4-j) / 4.0));
			else
				set_trans_blender(0, 0, 0, iround(1 * 255 * t * (4-j) / 4.0));
			xi = iround(x0 - dx * j);
			yi = iround(y0 - dy * j);
			putpixel(space->surface, xi, yi, color);
			space->add_pixel(xi, yi);
		}
	}
	drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
}
Esempio n. 2
0
File: misc.c Progetto: arvidfm/fiend
void draw_pickup_message(void)
{
	if(pickup.ready)
	{
		if(pickup.alpha==255)
		{
			if(pickup.pic!=NULL){
				set_trans_blender(0,0,0,158);
				draw_trans_sprite(virt, pickup.pic, 240-pickup.pic->w/2,240-120);}

			draw_sprite(virt, pickup.buffer, 0, 145);
						
		}
		else
		{
			if(pickup.pic!=NULL){
				set_trans_blender(0,0,0,((float)pickup.alpha/200)*158);
				draw_trans_sprite(virt, pickup.pic, 240-pickup.pic->w/2,240-120);}
			
			set_trans_blender(0,0,0,pickup.alpha);
			draw_trans_sprite(virt, pickup.buffer, 0, 145);
			
		}
	}
}
/**
 * Remember, the buttons are already drawn 'unpressed' with the overall GUI picture (GERALD_XXX , see datafile).
 *
 * So only draw over these buttons the 'not available' or 'pressed' version.
 *
 * @param list
 * @param pressed
 */
void cBuildingListDrawer::drawButton(cBuildingList *list, bool pressed) {
	assert(list != NULL);

	int x = list->getButtonDrawX();
	int y = list->getButtonDrawY();
	int id = list->getButtonIconIdUnpressed();
	bool available = list->isAvailable();

	if (pressed) {
		id = list->getButtonIconIdPressed();
	}

	assert(id > -1);

	int width = ((BITMAP *)gfxinter[BTN_INFANTRY_PRESSED].dat)->w;
	int height = ((BITMAP *)gfxinter[BTN_INFANTRY_PRESSED].dat)->h;

    // clear
	draw_sprite(bmp_screen, (BITMAP *)gfxinter[list->getButtonIconIdUnpressed()].dat, x, y);		// draw pressed button version (unpressed == default in gui)

    // set blender
    set_trans_blender(0,0,0,128);
	draw_sprite(bmp_screen, (BITMAP *)gfxinter[id].dat, x, y);		// draw pressed button version (unpressed == default in gui)

    if (!available) {
    	fblend_rect_trans(bmp_screen, x, y, width, height, makecol(0,0,0), 96);
    }

}
Esempio n. 4
0
void draw_background(BITMAP *dest, BITMAP *src, int x, int y, int alpha)
{
	int nx1,ny1,ny2,nx2;
	
	set_trans_blender(0,0,0,0);
	
	
	if(x<=0)nx1=480+x;
	if(x>0)nx1=-(480-x);
	ny1=y;

	if(y<=0)ny2=480+y;
	if(y>0)ny2=-(480-y);
	nx2=x;
	
	
	if(alpha>0)
	{
		draw_lit_sprite(dest,src,x,y, alpha);
		draw_lit_sprite(dest,src,nx1,ny1, alpha);
		draw_lit_sprite(dest,src,nx2,ny2, alpha);
		draw_lit_sprite(dest,src,nx1,ny2, alpha);
	}
	else
	{
		draw_sprite(dest,src,x,y);
		draw_sprite(dest,src,nx1,ny1);
		draw_sprite(dest,src,nx2,ny2);
		draw_sprite(dest,src,nx1,ny2);
	}
}
Esempio n. 5
0
void highcolor_fade_out(int speed)
{
    BITMAP *bmp_orig, *bmp_buff;

    if ((bmp_orig = create_bitmap(SCREEN_W, SCREEN_H)))
    {
        if ((bmp_buff = create_bitmap(SCREEN_W, SCREEN_H)))
        {
            int a;
            blit(screen, bmp_orig, 0,0, 0,0, SCREEN_W, SCREEN_H);
            if (speed <= 0) speed = 16;
        
            for (a = 255-speed; a > 0; a-=speed)
            {
                clear(bmp_buff);
                set_trans_blender(0,0,0,a);
                draw_trans_sprite(bmp_buff, bmp_orig, 0, 0);
                vsync();
                blit(bmp_buff, screen, 0,0, 0,0, SCREEN_W, SCREEN_H);
            }
            destroy_bitmap(bmp_buff);
        }
        destroy_bitmap(bmp_orig);
    }

    rectfill(screen, 0,0, SCREEN_W,SCREEN_H, makecol(0,0,0));
}
Esempio n. 6
0
File: misc.c Progetto: arvidfm/fiend
void draw_bloodpools(void)
{
	int i;
	float j;
	float dec;
	float alpha;
	float temp;

	for(i=0;i<BLOODPOOL_NUM;i++)
		if(bloodpool[i].used)
			if(object_is_in_player_los(bloodpool[i].x-bloodpool[i].size, bloodpool[i].y-bloodpool[i].size, bloodpool[i].size*2,bloodpool[i].size*2,0,0))
			{
				temp = bloodpool[i].size*0.5;
				
				circlefill(virt, bloodpool[i].x-map_x, bloodpool[i].y-map_y, temp*2, bloodpool[i].color );

				dec = (255)/(bloodpool[i].size*0.5);
				alpha = 255;

			 
				drawing_mode(DRAW_MODE_TRANS,NULL,0,0);
				for(j=temp;j<bloodpool[i].size;j+=1)
				{
					set_trans_blender(0,0,0,(int)alpha);
					circle(virt, bloodpool[i].x-map_x, bloodpool[i].y-map_y, temp+j, bloodpool[i].color);
					alpha-=dec;
					if(alpha<0)alpha=0;
				}
				drawing_mode(DRAW_MODE_SOLID,NULL,0,0);
			}
}
/**
 * Draw the amount of squares a structure would take. The X and Y coordinates are the top
 * left coordinates of an icon.
 *
 * @param structureId
 * @param x
 * @param y
 */
void cBuildingListDrawer::drawStructureSize(int structureId, int x, int y) {
	// figure out size
	int iW=structures[structureId].bmp_width/32;
	int iH=structures[structureId].bmp_height/32;
	int iTile = GRID_1X1;

	if (iW == 2 && iH == 2) {
		iTile = GRID_2X2;
	}

	if (iW == 3 && iH == 2) {
		iTile = GRID_3X2;
	}

	if (iW == 3 && iH == 3) {
		iTile = GRID_3X3;
	}

	BITMAP *temp=create_bitmap(19,19);
	clear_bitmap(temp);
	set_trans_blender(0, 0, 0, 192);

	draw_trans_sprite(temp, bmp_screen, x + 43, y + 20);

	draw_sprite(temp, (BITMAP *)gfxinter[GRID_0X0].dat, 0, 0);

	draw_trans_sprite(bmp_screen, temp, x + 43, y + 20);

	draw_sprite(bmp_screen, (BITMAP *)gfxinter[iTile].dat, x + 43, y + 20);

	destroy_bitmap(temp);

}
Esempio n. 8
0
void drawEnemy(Enemy *enemy, BITMAP *buffer, BITMAP *auxiliar, unsigned int tick)
{
    if(enemy != NULL)
    {
        if(enemy->hp > 0)
        {
            masked_blit(enemy->sheet, buffer, ((int)(enemy->speed * tick)/(10) % 2) * TILE_SIZE, (enemy->orientation * TILE_SIZE),
                        (enemy->centre->x - TILE_SIZE/2), (enemy->centre->y - TILE_SIZE/1.5),
                        TILE_SIZE, TILE_SIZE);
        }

        else
        {
            set_trans_blender(255, 255, 255, enemy->blenderTax);
            blit(enemy->sheet, auxiliar, ((int)(enemy->speed * tick)/(10) % 2) * TILE_SIZE, (4 * TILE_SIZE),
                 0, 0, TILE_SIZE, TILE_SIZE);
            draw_trans_sprite(buffer, auxiliar, (enemy->centre->x - TILE_SIZE/2), (enemy->centre->y - TILE_SIZE/1.5));

            if(enemy->blenderTax > 0)
            {
                enemy->blenderTax--;
            }

        }
    }
}
Esempio n. 9
0
/* Desenha o botão */
void ClassButton::DrawButton(BITMAP *GameBuffer)
{
 set_trans_blender(0, 0, 0, 180);
 if(clicked)
  draw_trans_sprite(GameBuffer, ButtonSelect, x, y);
 else
  draw_trans_sprite(GameBuffer, ButtonNull, x, y);
}
Esempio n. 10
0
void test_fire_lit_allegro_rle(BITMAP *dst, int x, int y, int frame, int brightness)
{
    if (brightness >= 255) {
        draw_rle_sprite(dst, fire_rle_sprites[frame % SPRITE_COUNT], x, y);
    } else {
        set_trans_blender(0, 0, 0, 0);
        draw_lit_rle_sprite(dst, fire_rle_sprites[frame % SPRITE_COUNT], x, y, 255 - brightness);
    }
}
Esempio n. 11
0
void CPanel::Draw(BITMAP *buffer)
{
	rect(buffer,x,y,x + w,y + h,border_color);
	drawing_mode(DRAW_MODE_TRANS,NULL,0,0);
	set_trans_blender(0,0,0,alpha);
	rectfill(buffer,x + 1,y + 1,x + w - 1,y + h - 1,color);
	solid_mode();
	alfont_textout_centre_aa_ex(buffer,font,caption,x + w/2,y,caption_color,-1);
}
Esempio n. 12
0
void Alleg4Surface::drawLine(gfx::Color color, const gfx::Point& a, const gfx::Point& b)
{
  if (gfx::geta(color) < 255) {
    set_trans_blender(0, 0, 0, gfx::geta(color));
    drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
  }

  line(m_bmp, a.x, a.y, b.x, b.y, to_allegro(bitmap_color_depth(m_bmp), color));
  solid_mode();
}
Esempio n. 13
0
void Alleg4Surface::fillRect(gfx::Color color, const gfx::Rect& rc)
{
  if (gfx::geta(color) < 255) {
    set_trans_blender(0, 0, 0, gfx::geta(color));
    drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
  }

  rectfill(m_bmp, rc.x, rc.y, rc.x+rc.w-1, rc.y+rc.h-1, to_allegro(bitmap_color_depth(m_bmp), color));
  solid_mode();
}
Esempio n. 14
0
void Alleg4Surface::drawVLine(gfx::Color color, int x, int y, int h)
{
  if (gfx::geta(color) < 255) {
    set_trans_blender(0, 0, 0, gfx::geta(color));
    drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
  }

  vline(m_bmp, x, y, y+h-1, to_allegro(bitmap_color_depth(m_bmp), color));
  solid_mode();
}
Esempio n. 15
0
// Draw
void key_manager::draw( BITMAP *tempImage){
  if( !switch_flicked){
    // Background
    rectfill( tempImage, x+15, y+75, x   +209-80, y +83+ (key_queue.size() * 90), makecol( 155, 155, 155));

    // Draw keys
    for( unsigned int i = 0; i < key_queue.size(); i++){
      set_trans_blender(255, 255, 255, 255 - ((255/4) * i));
      draw_trans_sprite( tempImage, keys[key_queue.at(i).getValue()], x + 20,  -(i * 90)+y + 350);
    }
  }
}
void Explosion::draw(const GraphicsContext &gc)
{
	int x = getx() - parent->getViewPort()->getx();
	int y = gety() - parent->getViewPort()->gety();

	drawing_mode (DRAW_MODE_TRANS, NULL, 0, 0);
	set_trans_blender (0, 0, 0, 128);

	circlefill (gc.buffer, x, y, size, RED);
	circlefill (gc.buffer, x, y, size * 2 / 3, YELLOW);

	drawing_mode (DRAW_MODE_SOLID, NULL, 0, 0);
}
Esempio n. 17
0
// DRAW PRIMATIVE ROUTINGS //
void messy_line( BITMAP *bmp, float x1, float y1, float x2, float y2, int c){
	int i = 0;
	
	set_write_alpha_blender();
	drawing_mode(DRAW_MODE_TRANS,0,0,0);
	
	set_trans_blender(0,0,0,LINE_WEIGHT);
	for ( i = 0; i < LINE_RETRIES; i++ ){
		line( bmp, x1+POINT_ACCURACY, y1+POINT_ACCURACY,x2+POINT_ACCURACY, y2+POINT_ACCURACY, c );	
	}
	drawing_mode(DRAW_MODE_SOLID,0,0,0);
	
}
Esempio n. 18
0
void tur_draw_turret(BITMAP *dest, turret_t *turret)
{
	int x, y;
	float bx, by;
	int i;
	
	x = turret->x * 32;
	y = turret->y * 32;
		
	/* XXX/DEBUG: SHOW ANGLE */
 	bx = x + turret->bitmap->w/2;
	by = y + turret->bitmap->h/2;
	drawing_mode(DRAW_MODE_TRANS,NULL,0,0);
    set_trans_blender(0,0,0,100);
	for (i = 0; i < turret->range; i += 10) {
		float result;
		result = fixtof(fixcos(turret->angle));
		by -= result * 10;
		result = fixtof(fixsin(turret->angle));
		bx += result * 10;			
		//putpixel(dest, bx, by, makecol(255,255,0));
		//putpixel(dest, bx+1, by, makecol(255,255,0));
	}
	solid_mode();
	/* ---- */

	/* range */
	drawing_mode(DRAW_MODE_TRANS,NULL,0,0);
    set_trans_blender(0,0,0,60);
	//circle(dest, turret->x * 32 + 16, turret->y * 32 + 16, turret->range, makecol(200,200,200));
	/*circlefill(dest, turret->x * 32 + 16, turret->y * 32 + 16, turret->range, makecol(200,200,200));*/
	solid_mode();


	/* turret */
	rotate_sprite(dest, turret->bitmap, turret->x * 32, turret->y * 32, turret->angle);
	
}
Esempio n. 19
0
void
Imagen::Pintar(int x, int y)
{
    set_trans_blender(0, 0, 0, alpha);
    if ( !bitmap )
    {
        //throw Excepcion("Imagen::Pintar(int, int): Imagen no valida");
        return ;
    }
    if ( !mascara && alpha == 255)
    {
        blit( bitmap, graficos.GetScreen(), 0, 0, x, y, bitmap->w, bitmap->h );
    }
    else if ( mascara && alpha == 255)
    {
        masked_blit( bitmap, graficos.GetScreen(), 0, 0, x, y, bitmap->w, bitmap->h );
    }
    else
    {
        set_trans_blender(0, 0, 0, alpha);
        draw_trans_sprite( graficos.GetScreen(), bitmap, x, y);
    }
}
Esempio n. 20
0
void show_gripdesign(void)
{
	BITMAP *bmp;
	BITMAP *bmp2;
	int end=0;
	int time=0;
	
	int alpha=255;


	bmp2 = load_bitmap("graphic/menu/logo.pcx",NULL);
	bmp = create_bitmap(480,480);
	
	stretch_sprite(bmp,bmp2,0,0,480,480);
		
	speed_counter = 0;
	

	while(!key[KEY_ESC] && !end)
	{
		
		while(speed_counter>0)
		{
			
			time++;

			if(time<350 && alpha>0)
				alpha-=2;

			if(alpha<0)alpha=0;

			if(time>350)
				alpha+=4;
			
			if(alpha>255)alpha=255;

			if(time>450)end=1;

			speed_counter--;
		}
		
		set_trans_blender(0,0,0,0);
		draw_lit_sprite(virt,bmp,0,0,alpha);
		vsync();
		blit(virt,screen,0,0,80,0,480,480);
	}

	destroy_bitmap(bmp);
	destroy_bitmap(bmp2);
}
Esempio n. 21
0
    void AllegroGraphics::setColor(const Color& color)
    {
        mColor = color;
        mAllegroColor = makecol(color.r, color.g, color.b);

        if (color.a != 255)
        {
            set_trans_blender(255, 255, 255, color.a);
            drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
        }
        else
        {
            solid_mode();
        }
    }
Esempio n. 22
0
void shadowed_masked_image::set_image(BITMAP *_image)
{
  if (image = _image)
  {  
    if (bitmap_color_depth(image) != 8)
    {
      if (shadow_mask) destroy_bitmap(shadow_mask);
      shadow_mask = create_bitmap_ex(bitmap_color_depth(image), image->w, image->h);
  
      clear_to_color(shadow_mask, bitmap_mask_color(shadow_mask));
  
      set_trans_blender(shadow_level, shadow_level, shadow_level, 0);
      draw_lit_sprite(shadow_mask, image, 0, 0, 255);
      set_trans_blender(255, 0, 255, 0);
      draw_lit_sprite(shadow_mask, image, -x_offset, -y_offset, 255);
    } else
    {
      if (shadow_mask) destroy_bitmap(shadow_mask);
      shadow_mask = 0;
    }
  
    resize(image->w - 1 + x_offset, image->h - 1 + y_offset);
  } 
}                                                       
void Background::init()
{
	texture = create_bitmap (TILEW, TILEH);
	assert (texture);

	int c1 = WHITE;
	int c2 = GREY;
	clear_to_color (texture, c1);
	circlefill(texture, TILEW / 2, TILEW / 2, 60, c2);
	circlefill (texture, TILEW / 2, TILEH / 2, 30, c1);
	
	drawing_mode (DRAW_MODE_TRANS, NULL, 0, 0);
	set_trans_blender (0, 0, 0, 160);
	rectfill (texture, 0, 0, TILEW, TILEH, BROWN);
	solid_mode();
}
Esempio n. 24
0
// DRAW STRUCTURE ROUTINES //
void color_poly( BITMAP *bmp, polytype *poly, float x, float y, float z ){
	float half_w=bmp->w/2;
	float half_h=bmp->h/2;
	int i ;
	int *pt;
	pt = malloc(sizeof(int) * poly->pts );
	
	set_trans_blender( 0,0,0, poly->a );
	for ( i = 0; i < poly->pts; i++ ){
		pt[i] = (((((float)(poly->pt[i]-128)/128.0) + x )/(z*Z_SCALE))*half_w)+half_w + PAINT_ACCURACY;
		i++;
		pt[i] = (((((float)(poly->pt[i]-128)/128.0) + y )/(z*Z_SCALE))*half_h)+half_h + PAINT_ACCURACY;
	}
	
	polygon( bmp, poly->pts/2, pt, makecol(poly->r,poly->g,poly->b) );	
	free(pt);
}
Esempio n. 25
0
// Fade in
void highcolor_fade_in(BITMAP* bmp_orig, int speed){
  BITMAP* bmp_buff = create_bitmap(SCREEN_W,SCREEN_H);
  BITMAP* str_orig = create_bitmap( SCREEN_W, SCREEN_H);
  stretch_sprite( str_orig, bmp_orig, 0, 0, SCREEN_W, SCREEN_H);

  if ( speed<=0)
    speed=16;

  for(int a=0; a<256; a+=speed){
    clear( bmp_buff);
    set_trans_blender( 0, 0, 0, a);
    draw_trans_sprite( bmp_buff, str_orig, 0, 0);
    vsync();
    stretch_sprite( screen, bmp_buff, 0, 0,  SCREEN_W, SCREEN_H);
  }
  stretch_sprite( screen, str_orig, 0, 0,  SCREEN_W, SCREEN_H);
}
void Tilemap::Draw(BITMAP* buffer) // Uncomment the code in here to turn fog of war on
{
    for (int i=0; i<(int)tiles.size(); ++i) {
        for (int j=0; j<(int)tiles[i].size(); ++j) {
            //if (visible[i][j] > 0)
                tiles[i][j].Draw(buffer, Vector(tile_dim.XInt()*i, tile_dim.YInt()*j));
        }
    }
    draw_sprite(buffer, grid, 0, 0);

    for (int i=0; i<(int)tiles.size(); ++i) {
        for (int j=0; j<(int)tiles[i].size(); ++j) {
            //if (visible[i][j] == 256)
                tiles[i][j].DrawObjects(buffer, Vector(tile_dim.XInt()*i, tile_dim.YInt()*j));
            /*else {
                set_trans_blender(0, 0, 0, 256 - visible[i][j]);
                drawing_mode(DRAW_MODE_TRANS, 0, 0, 0);
                rectfill(buffer, tile_dim.XInt()*i, tile_dim.YInt()*j, tile_dim.XInt()*(i+1)-1, tile_dim.YInt()*(j+1)-1,  Colour::Black());
                drawing_mode(DRAW_MODE_SOLID, 0, 0, 0);
            }*/
        }
    }

    if (need_to_draw_message) {
        int w = citizen_saved->w * message_scale;
        int h = citizen_saved->h * message_scale;
        int x = scr_w/2 - w/2;
        int y = scr_h/2 - h/2;
        stretch_sprite(buffer, citizen_saved, x, y, w, h);
    }

    if (need_to_draw_blood) {
        set_trans_blender(0, 0, 0, blood_alpha);
        drawing_mode(DRAW_MODE_TRANS, 0, 0, 0);
        draw_trans_sprite(buffer, blood, 0, 0);
        drawing_mode(DRAW_MODE_SOLID, 0, 0, 0);
    }
    if (!need_to_draw_blood && need_fresh_blood && blood != NULL) {
        clear_to_color(blood, Colour::MagicPink());
        int how_many_splatters = 4 + rand() % 6;
        for (int i=0; i<how_many_splatters; ++i)
            draw_sprite(blood, GetBloodSplatter(), rand() % 540, rand() % 300);
        need_fresh_blood = false;
    }
}
Esempio n. 27
0
void ALSoftwareGraphicsDriver::draw_sprite_with_transparency(BITMAP* piccy, int xxx, int yyy, int transparency)
{
    int screen_depth = bitmap_color_depth(virtualScreen);
    int sprite_depth = bitmap_color_depth(piccy);

    if (sprite_depth < screen_depth) {

        if ((sprite_depth == 8) && (screen_depth >= 24)) {
            // 256-col sprite -> truecolor background
            // this is automatically supported by allegro, no twiddling needed
            draw_sprite(virtualScreen, piccy, xxx, yyy);
            return;
        }
        // 256-col spirte -> hi-color background, or
        // 16-bit sprite -> 32-bit background
        BITMAP* hctemp=create_bitmap_ex(screen_depth, piccy->w, piccy->h);
        blit(piccy,hctemp,0,0,0,0,hctemp->w,hctemp->h);
        int bb,cc,mask_col = bitmap_mask_color(virtualScreen);

        if (sprite_depth == 8) {
            // only do this for 256-col, cos the blit call converts
            // transparency for 16->32 bit
            for (bb=0; bb<hctemp->w; bb++) {
                for (cc=0; cc<hctemp->h; cc++)
                    if (_getpixel(piccy,bb,cc)==0) putpixel(hctemp,bb,cc,mask_col);
            }
        }

        draw_sprite(virtualScreen, hctemp, xxx, yyy);
        destroy_bitmap(hctemp);
    }
    else
    {
        if ((transparency != 0) && (screen_depth > 8) &&
                (sprite_depth > 8) && (bitmap_color_depth(virtualScreen) > 8))
        {
            set_trans_blender(0,0,0, transparency);
            draw_trans_sprite(virtualScreen, piccy, xxx, yyy);
        }
        else
            draw_sprite(virtualScreen, piccy, xxx, yyy);
    }

}
Esempio n. 28
0
/**
	fade.c - High Color Fading Routines

	Last Revision: 21 June, 2002

	Author: Matthew Leverton
**/
void ALSoftwareGraphicsDriver::highcolor_fade_in(BITMAP *currentVirtScreen, int speed, int targetColourRed, int targetColourGreen, int targetColourBlue)
{
    BITMAP *bmp_buff;
    BITMAP *bmp_orig = currentVirtScreen;

    if ((_global_y_offset != 0) || (_global_x_offset != 0))
    {
        bmp_orig = create_bitmap(_screenWidth, _screenHeight);
        clear(bmp_orig);
        blit(currentVirtScreen, bmp_orig, 0, 0, _global_x_offset, _global_y_offset, currentVirtScreen->w, currentVirtScreen->h);
    }

    bmp_buff = create_bitmap(bmp_orig->w, bmp_orig->h);
    int clearColor = makecol_depth(bitmap_color_depth(bmp_buff),
                                   targetColourRed, targetColourGreen, targetColourBlue);

    int a;
    if (speed <= 0) speed = 16;

    for (a = 0; a < 256; a+=speed)
    {
        int timerValue = *_loopTimer;
        clear_to_color(bmp_buff, clearColor);
        set_trans_blender(0,0,0,a);
        draw_trans_sprite(bmp_buff, bmp_orig, 0, 0);
        this->Vsync();
        _filter->RenderScreen(bmp_buff, 0, 0);
        do
        {
            if (_callback)
                _callback();
            Sleep(1);
        }
        while (timerValue == *_loopTimer);
    }
    destroy_bitmap(bmp_buff);

    _filter->RenderScreen(currentVirtScreen, _global_x_offset, _global_y_offset);

    if ((_global_y_offset != 0) || (_global_x_offset != 0))
        destroy_bitmap(bmp_orig);
}
Esempio n. 29
0
BITMAP* generate_bg(BITMAP *img, unsigned char r, unsigned char g, unsigned char b)
{
    bg_r = r;
    bg_g = g;
    bg_b = b;
    
    BITMAP *bg2 = create_bitmap(img->w*2, img->h*2);
    BITMAP *bg = create_bitmap(img->w*2, img->h*2);
    draw_sprite(bg, img, 0,0);
    draw_sprite_h_flip(bg, img, img->w,0);
    draw_sprite_v_flip(bg, img, 0,img->h);
    draw_sprite_vh_flip(bg, img, img->w,img->h);
    
    set_trans_blender(r,g,b,255);
    draw_lit_sprite(bg2, bg, 0,0, 96);

	destroy_bitmap(bg);
    
    return bg2;
}
void AnimFrame::Draw(BITMAP* bmp, Vector pos, float scale, bool vertical_flip, float rotation, int alpha)
{
    BITMAP* graphic = (BITMAP*)global_datafile[graphic_id].dat;
    if (graphic == NULL) {
        erlog("Graphic ID out of bounds in frame draw", 3);
        return;
    }
    if (bmp == NULL) {
        erlog("Buffer out of bounds in frame draw", 3);
        return;
    }
    if (scale == 0.0 && vertical_flip == false && rotation == 0.0 && (alpha >= 256 || alpha < 0)) {
        draw_sprite(bmp, graphic, pos.XInt(), pos.YInt());
        return;
    }
    if (alpha >= 256 || alpha < 0) {
        if (vertical_flip == false) {
            rotate_scaled_sprite(bmp, graphic, pos.XInt(), pos.YInt(), fixmul(ftofix(rotation), radtofix_r), ftofix(scale));
            return;
        }
        rotate_scaled_sprite_v_flip(bmp, graphic, pos.XInt(), pos.YInt(), fixmul(ftofix(rotation), radtofix_r), ftofix(scale));
        return;
    }


    float fdiagonal = sqrt(static_cast<float>(graphic->w*graphic->w + graphic->h*graphic->h));
    int diagonal = static_cast<int>(fdiagonal + 1);
    BITMAP* temp_bmp = create_bitmap(diagonal, diagonal);

    if (vertical_flip == false) {
        rotate_scaled_sprite(temp_bmp, graphic, 0, 0, fixmul(ftofix(rotation), radtofix_r), ftofix(scale));
    }
    else {
        rotate_scaled_sprite_v_flip(temp_bmp, graphic, 0, 0, fixmul(ftofix(rotation), radtofix_r), ftofix(scale));
    }

    set_trans_blender(0, 0, 0, alpha);
    drawing_mode(DRAW_MODE_TRANS, 0, 0, 0);
    draw_trans_sprite(temp_bmp, bmp, pos.XInt(), pos.YInt());
    drawing_mode(DRAW_MODE_SOLID, 0, 0, 0);
}