Пример #1
0
void Bitmap::AAStretchBlt(Bitmap *src, const Rect &dst_rc, BitmapMaskOption mask)
{
	BITMAP *al_src_bmp = src->_alBitmap;
	// WARNING: For some evil reason Allegro expects dest and src bitmaps in different order for blit and draw_sprite
	if (mask == kBitmap_Transparency)
	{
		aa_stretch_sprite(_alBitmap, al_src_bmp,
			dst_rc.Left, dst_rc.Top, dst_rc.GetWidth(), dst_rc.GetHeight());
	}
	else
	{
		aa_stretch_blit(al_src_bmp, _alBitmap,
			0, 0, al_src_bmp->w, al_src_bmp->h,
			dst_rc.Left, dst_rc.Top, dst_rc.GetWidth(), dst_rc.GetHeight());
	}
}
Пример #2
0
void Bitmap::AAStretchBlt(Bitmap *src, const Rect &src_rc, const Rect &dst_rc, BitmapMaskOption mask)
{
	BITMAP *al_src_bmp = src->_alBitmap;
	if (mask == kBitmap_Transparency)
	{
		// TODO: aastr lib does not expose method for masked stretch blit; should do that at some point since 
		// the source code is a gift-ware anyway
		// aa_masked_blit(_alBitmap, al_src_bmp, src_rc.Left, src_rc.Top, src_rc.GetWidth(), src_rc.GetHeight(), dst_rc.Left, dst_rc.Top, dst_rc.GetWidth(), dst_rc.GetHeight());
		throw "aa_masked_blit is not yet supported!";
	}
	else
	{
		aa_stretch_blit(al_src_bmp, _alBitmap,
			src_rc.Left, src_rc.Top, src_rc.GetWidth(), src_rc.GetHeight(),
			dst_rc.Left, dst_rc.Top, dst_rc.GetWidth(), dst_rc.GetHeight());
	}
}
Пример #3
0
void NaroolLurker::animate(Frame *space)
{
	STACKTRACE;
	if ((cloak_frame > 0) && (cloak_frame < 300))
		sprite->animate_character( pos,
			sprite_index, pallete_color[cloak_color[(int)(cloak_frame / 100)]], space);
	else
	if ((cloak_frame >= 300))
		sprite->animate_character( pos,
				sprite_index, pallete_color[0], space);
	else
		Ship::animate(space);

	//Vector2 lightningrelpos = 0.5 * Vector2(lightningbmp->w,lightningbmp->h);
	calc_lightning();

	//	aa_set_mode(find_aa_mode(general_attributes));

	Vector2 P, S;
	S = sprite->size(0) * ::space_zoom;
	P = corner(pos, sprite->size(0));

	int ix, iy, iw, ih;
	// target position
	ix = iround(P.x);
	iy = iround(P.y);
	// target size
	iw = iround(S.x);
	ih = iround(S.y);

	//int a;
	//a = aa_get_trans();
	//aa_set_trans(128);

	int a;
	a = aa_get_mode();
	aa_set_mode(a | AA_ALPHA);
	aa_stretch_blit(lightningbmp, space->surface,
		0, 0,lightningbmp->w,lightningbmp->h,
		ix, iy, iw, ih);
	aa_set_mode(a);

	space->add_box(ix, iy, iw, ih);
}
Пример #4
0
void GobStation::station_screen(GobPlayer *s)
{
	STACKTRACE;

	BITMAP *background = load_bitmap(data_full_path(background_pic).c_str(), NULL);
	if (!background) {
		message.print(1000, 15, "%s", background_pic);
		tw_error ("couldn't load station background");
	}
	game->window->lock();
	aa_set_mode(AA_DITHER);
	aa_stretch_blit(background, game->window->surface,
		0,0,background->w,background->h,
		game->window->x,game->window->y,game->window->w, game->window->h);
	game->window->unlock();
	while (true) {
		sprintf(dialog_string[0], "%03d Starbucks  %03d Buckazoids", s->starbucks, s->buckazoids);
		int r = 0;
		if (game->is_local(s->channel))
			r = tw_do_dialog(game->window, station_dialog, STATION_DIALOG_DEPART);
		game->log_int(s->channel, r);
		switch (r) {
			case STATION_DIALOG_UPGRADE:
			{
				upgrade_menu(this, s);
				aa_set_mode(AA_DITHER);
				aa_stretch_blit(background, game->window->surface,
					0,0,background->w,background->h,
					game->window->x,game->window->y,
					game->window->w, game->window->h);
			}
			break;
			case STATION_DIALOG_NEWSHIP:
			{
				buy_new_ship_menu(s);
			}
			break;
			case STATION_DIALOG_REPAIR:
			{
				if (s->ship->crew == s->ship->crew_max) {
					if (game->is_local(s->channel))
						alert("You don't need repairs", "", "", "Oh, okay", "I knew that", 0, 0);

					break;
				}
				int p = 0;
				if (game->is_local(s->channel))
					p = alert3("Which would you prefer", "to pay for your repairs", "", "1 &Starbuck", "1 &Buckazoid", "&Nothing!", 's', 'b', 'n');
				game->log_int(s->channel, p);
				switch (p) {
					case 1:
					{
						if (s->starbucks) {
							s->starbucks -= 1;
							s->ship->crew = s->ship->crew_max;
						}
						else {
							if (game->is_local(s->channel))
								alert("You don't have enough!", NULL, NULL, "&Shit", NULL, 's', 0);
						}
					}
					break;
					case 2:
					{
						if (s->buckazoids) {
							s->buckazoids -= 1;
							s->ship->crew = s->ship->crew_max;
						}
						else {
							if (game->is_local(s->channel))
								alert("You don't have enough!", NULL, NULL, "&Shit", NULL, 's', 0);
						}
					}
					break;
					case 3:
					{
						r = STATION_DIALOG_DEPART;
					}
					break;
				}
			}
			break;
		}
		if (r == STATION_DIALOG_DEPART || r == -1) break;
	}
	return;
}