Example #1
0
/**
 * Renders the output of the logos handler's current game state.
 *
 * The drawing routines are all blocking, meaning one "frame" is enough
 * to fade all logos in and out.
 */
void logos_render(BITMAP *buffer) {
    // We're going to draw text on top of the image,
    // so add the text palette to the image.
    add_flim_palette_colors(LOGOS_DAT[ASLOGO_PALETTE].dat);

    // Display the main logo with text drawn on top.
    set_palette(black_palette);
    blit(LOGOS_DAT[ASLOGO_IMG].dat, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
    draw_text(screen, 160, 154, TXT_WHITE, -1, -1,
        TXT_REGULAR, TXT_CENTER, "(C) 2016, Avalanche Studios");
    draw_text(screen, 160, 154 + FLIM_HEIGHT + 2, TXT_WHITE, -1, -1,
        TXT_REGULAR, TXT_CENTER, "www.avalanchestudios.net");
    if (DEBUG) {
        draw_text(screen, 160, 154 + FLIM_HEIGHT + 18, TXT_GRAY, -1, -1,
            TXT_SMALL, TXT_CENTER, (char *)get_short_version());
    }
    fade_from(black_palette, LOGOS_DAT[ASLOGO_PALETTE].dat, FADE_SPEED);

    // Wait for any key, then draw the second logo.
    readkey();
    fade_out(FADE_SPEED);
    set_palette(black_palette);
    blit(LOGOS_DAT[TEST_IMG].dat, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
    fade_from(black_palette, LOGOS_DAT[TEST_PALETTE].dat, FADE_SPEED);

    // Wait for any key, then finish. This handler immediately exits
    // after running the logos_render() function once, so this code
    // is guaranteed to only run once.
    readkey();
    fade_out(FADE_SPEED);
}
Example #2
0
void draw_difficulty_menu(MenuData *menu) {
	draw_options_menu_bg(menu);
	draw_text(AL_Right, 210*(1-menu->fade), 30, "Rank Select", _fonts.mainmenu);
	
	int i;
	for(i = 0; i < menu->ecount; i++) {
		menu->entries[i].drawdata += 0.2 * (30*(i == menu->cursor) - menu->entries[i].drawdata);
		
		glPushMatrix();
		glTranslatef(SCREEN_W/3 - menu->entries[i].drawdata, 200 + 70*i,0);
		
		glColor4f(1,1-0.1*i,1-0.1*i,0.7);
		glPushMatrix();
		glTranslatef(145,0,0);
		glScalef(310,60,1);
		
		draw_quad();
		glPopMatrix();
		
		glColor4f(0,0,0,1);
		
		if(i == menu->cursor)
			glColor3f(0.2,0,0.1);
		draw_text(AL_Left, 0, -15, menu->entries[i].name, _fonts.standard);
		glColor3f(1,1,1);
		glPopMatrix();
	}
	
	fade_out(menu->fade);
}
Example #3
0
static void
fade_out_and_quit (void)
{
  fade_out (stage);
  g_signal_connect (stage, "transitions-completed",
                    G_CALLBACK (clutter_main_quit), NULL);
}
Example #4
0
void draw_stage_menu(MenuData *m) {
	draw_options_menu_bg(m);
	draw_text(AL_Right, (stringwidth(m->title, _fonts.mainmenu) + 10) * (1-m->fade), 30, m->title, _fonts.mainmenu);
	
	glPushMatrix();
	glTranslatef(100, 100 + (((m->ecount * 20 + 290) > SCREEN_W)? min(0, SCREEN_H * 0.7 - 100 - m->drawdata[2]) : 0), 0);
	
	/*
	glPushMatrix();
	glTranslatef(SCREEN_W/2 - 100, m->drawdata[2], 0);
	glScalef(SCREEN_W - 200, 20, 1);
	glColor4f(0,0,0,0.5);
	draw_quad();
	glPopMatrix();
	*/
	
	Texture *bg = get_tex("part/smoke");
	glPushMatrix();
	glTranslatef(m->drawdata[0], m->drawdata[2], 0);
	glScalef(m->drawdata[1]/100.0, 0.2, 1);
	glRotatef(m->frames*2,0,0,1);
	glColor4f(0,0,0,0.5);
	draw_texture_p(0,0,bg);
	glPopMatrix();
	
	MenuEntry *s = &(m->entries[m->cursor]);
	m->drawdata[0] += ((s->draw? SCREEN_W/2 - 100 : (stringwidth(s->name, _fonts.mainmenu)/2 - s->drawdata*1.5)) - m->drawdata[0])/10.0;
	m->drawdata[1] += ((s->draw? (SCREEN_W - 200)*0.85 : stringwidth(s->name, _fonts.mainmenu)) - m->drawdata[1])/10.0;
	m->drawdata[2] += (20*m->cursor - m->drawdata[2])/10.0;
	
	int i;
	for(i = 0; i < m->ecount; i++) {
		MenuEntry *e = &(m->entries[i]);
		
		e->drawdata += 0.2 * (10*(i == m->cursor) - e->drawdata);
		float a = e->drawdata * 0.1;
		
		if(e->action == NULL)
			glColor4f(0.5, 0.5, 0.5, 0.5);
		else {
			//glColor4f(0.7 + 0.3 * (1-a), 1, 1, 0.7 + 0.3 * a);
			float ia = 1-a;
			glColor4f(0.9 + ia * 0.1, 0.6 + ia * 0.4, 0.2 + ia * 0.8, 0.7 + 0.3 * a);
		}
		
		if(e->draw)
			e->draw(e, i, m->ecount);
		else if(e->name)
			draw_text(AL_Left, 20 - e->drawdata, 20*i, e->name, _fonts.standard);
	}
	
	glPopMatrix();
	
	fade_out(m->fade);
}
Example #5
0
static void intro_screen(void)
{
   BITMAP *bmp;
   play_sample(data[INTRO_SPL].dat, 255, 128, 1000, FALSE);

   bmp =
       create_sub_bitmap(screen, SCREEN_W / 2 - 160, SCREEN_H / 2 - 100,
                         320, 200);
   play_memory_fli(data[INTRO_ANIM].dat, bmp, FALSE, NULL);
   destroy_bitmap(bmp);

   rest(1000);
   fade_out(1);
}
Example #6
0
void FX_Moving_Text::update(void)
{
  if (!m_running) return;

  float fx_time = g_timer->now() - m_start_time;

  if (fx_time > m_duration) {
    m_running = false;
    return;
  }

  m_pos = m_startpos + (normalized(m_dir) * m_speed * fx_time);
  m_textcolor[3] = fade_out(0.3,m_duration,fx_time);
}
Example #7
0
void end_stats()
{
  time_marker now;
  while (now.diff_time(&stat_show_start)<2)
    now.get_time();

  view *f=player_list;
  for (;f;f=f->next)
    f->kills=0;

  fade_out(8);
  switch_mode(VMODE_320x200);
  pal->load();
  stat_man=old_stat;
}
Example #8
0
/* handles fade effects and timing for the ready, steady, go messages */
static int fade_intro_item(int music_pos, int fade_speed)
{
   while (midi_pos < music_pos) {
      if (keypressed())
         return TRUE;

      poll_joystick();

      if ((joy[0].button[0].b) || (joy[0].button[1].b))
         return TRUE;
   }

   set_palette(data[GAME_PAL].dat);
   fade_out(fade_speed);

   return FALSE;
}
Example #9
0
static void replayview_draw(MenuData *m) {
	draw_stage_menu(m);
	
	if(m->context) {
		MenuData *sm = m->context;
		menu_logic(sm);
		if(sm->quit == 2) {
			destroy_menu(sm);
			m->context = NULL;
		} else {
			fade_out(0.3 * (1 - sm->fade));
			replayview_draw_stagemenu(sm);
			
			if(!sm->abort && sm->quit == 1)
				m->fade = sm->fade;
		}
	}
}
Example #10
0
void show_stats()
{
  if (current_level)
  {
    fade_out(8);
    wm->SetMousePos(ivec2(0, 0));
    main_screen->clear();
    image *im=cache.img(cache.reg("art/frame.spe","end_level_screen",SPEC_IMAGE,1));
    main_screen->PutImage(im, ivec2(0, 0));


    int x1=im->Size().x+1,y1=0,x2=xres,y2=main_screen->Size().y;
    fade_in(NULL,16);

    char name[50];
    strcpy(name,current_level->original_name());
    char dig1=name[strlen(name)-strlen(".spe")-2];
    char dig2=name[strlen(name)-strlen(".spe")-1];


    char msg[50];

    if (isdigit(dig1) && isdigit(dig2))
    {
      if (dig1!='0')
        sprintf(msg,"%s : %c%c",symbol_str("lev_complete"),dig1,dig2);
      else
        sprintf(msg,"%s : %c",symbol_str("lev_complete"),dig2);
    } else sprintf(msg,"%s : %s",symbol_str("lev_complete"),current_level->original_name());

    int w = wm->font()->Size().x * strlen(msg),
        h = wm->font()->Size().y;
    int x=(x1+x2)/2-w/2,y=(y1+y2)/2-h/2;
    main_screen->Bar(ivec2(x - 10, y - 10), ivec2(x + w + 10, y + h + 10),
                     wm->bright_color());
    main_screen->Bar(ivec2(x - 9, y - 9), ivec2(x + w + 9, y + h + 9),
                     wm->medium_color());

    wm->font()->PutString(main_screen, ivec2(x + 1, y + 1), msg, wm->dark_color());
    wm->font()->PutString(main_screen, ivec2(x, y), msg, wm->bright_color());
    wm->flush_screen();
    Timer now; now.WaitMs(500);
  }
}
Example #11
0
int main(int argc, char **argv) {
	monome_t *monome;
	int i;
	i =0;

	if( !(monome = monome_open((argc == 2 ) ? argv[1] : DEFAULT_MONOME_DEVICE, "8000")) )
		return -1;

	test_led_ring_set(monome);
	return 0;

	monome_led_all(monome, 0);

	for( i = 0; i < 2; i++ ) {
		test_led_row_8(monome, 1);
		test_led_col_8(monome, 1);
	}

	for( i = 0; i < 2; i++ ) {
		test_led_row_16(monome, 1);
		test_led_col_16(monome, 1);
	}

	test_led_col_16(monome, 0);
	test_led_on_off(monome);
	test_led_map(monome);

	chill(4);
	test_mode(monome);

	fade_out(monome);

	monome_led_all(monome, 0);
	monome_led_intensity(monome, 0x0F);

	return 0;
}
Example #12
0
void plat_gameover(struct game_ctx_t *ctx)
{
    SDL_Surface *text = TTF_RenderText_Blended(gameover_font, "Game Over", (SDL_Color){255,255,255,0});
    if(!text)
    {
        plat_logf("WARNING: font render failed");
        return;
    }

    SDL_Rect dest = { screen->w / 2 - text->w / 2,
                      screen->h / 2 - 3 * text->h,
                      text->w, text->h };

    SDL_BlitSurface(text, NULL, screen, &dest);
    SDL_FreeSurface(text);

    text = TTF_RenderText_Blended(font, "Press any key to continue...", (SDL_Color){255,255,255,0});
    if(!text)
    {
        plat_logf("WARNING: font render failed");
        return;
    }

    SDL_Rect dest2 = { screen->w / 2 - text->w / 2,
                       screen->h / 2 - 3 * text->h,
                       text->w, text->h };

    SDL_BlitSurface(text, NULL, screen, &dest2);
    SDL_FreeSurface(text);

    plat_update();
    while(plat_pollaction() == NONE)
    {
        plat_yield();
    }
    fade_out();
}
Example #13
0
void draw_options_menu(MenuData *menu) {
	draw_options_menu_bg(menu);
	
	draw_text(AL_Right, 140*(1-menu->fade), 30, "Options", _fonts.mainmenu);
	
	glPushMatrix();
	glTranslatef(100, 100, 0);
	
	/*
	glPushMatrix();
	glTranslatef(SCREEN_W/2 - 100, menu->drawdata[2], 0);
	glScalef(SCREEN_W - 200, 20, 1);
	glColor4f(0,0,0,0.5);
	draw_quad();
	glPopMatrix();
	*/
	
	Texture *bg = get_tex("part/smoke");
	glPushMatrix();
	glTranslatef(menu->drawdata[0], menu->drawdata[2], 0);
	glScalef(menu->drawdata[1]/100.0, 0.2, 1);
	glRotatef(menu->frames*2,0,0,1);
	glColor4f(0,0,0,0.5);
	draw_texture_p(0,0,bg);
	glPopMatrix();
	
	OptionBinding *binds = (OptionBinding*)menu->context;
	OptionBinding *bind;
	
	menu->drawdata[0] += ((SCREEN_W/2 - 100) - menu->drawdata[0])/10.0;
	menu->drawdata[1] += ((SCREEN_W - 200) - menu->drawdata[1])/10.0;
	menu->drawdata[2] += (20*menu->cursor - menu->drawdata[2])/10.0;
	
	int i, caption_drawn = 0;
	
	for(i = 0; i < menu->ecount; i++) {
		if(!menu->entries[i].name)
			continue;
		
		menu->entries[i].drawdata += 0.2 * (10*(i == menu->cursor) - menu->entries[i].drawdata);
		float a = menu->entries[i].drawdata * 0.1;
		
		bind = &(binds[i]);
		int hasbind = bind->enabled;
		float alpha = (!hasbind || bind_isactive(bind))? 1 : 0.5;
		
		if(menu->entries[i].action == NULL) {
			glColor4f(0.5, 0.5, 0.5, 0.7 * alpha);
		} else {
			//glColor4f(0.7 + 0.3 * (1-a), 1, 1, (0.7 + 0.3 * a) * alpha);
			float ia = 1-a;
			glColor4f(0.9 + ia * 0.1, 0.6 + ia * 0.4, 0.2 + ia * 0.8, (0.7 + 0.3 * a) * alpha);
		}
		
		draw_text(AL_Left,
					((hasbind && bind->dependence)? 20 : 0)	// hack hack hack
					+ 20 - menu->entries[i].drawdata, 20*i, menu->entries[i].name, _fonts.standard);
		
		if(hasbind)
		{
			int j, origin = SCREEN_W - 220;
			
			switch(bind->type)
			{
				case BT_IntValue:
					if(bind->valrange_max) {
						char tmp[16];	// who'd use a 16-digit number here anyway?
						snprintf(tmp, 16, "%d", bind_getvalue(bind));
						draw_text(AL_Right, origin, 20*i, tmp, _fonts.standard);
					} else for(j = bind->valcount-1; j+1; --j) {
						if(j != bind->valcount-1)
							origin -= strlen(bind->values[j+1])/2.0 * 20;
						
						if(bind_getvalue(bind) == j) {
							glColor4f(0.9, 0.6, 0.2, alpha);
						} else {
							glColor4f(0.5,0.5,0.5,0.7 * alpha);
						}
							
						draw_text(AL_Right, origin, 20*i, bind->values[j], _fonts.standard);
					}
					break;
				
				case BT_KeyBinding:
					if(bind->blockinput) {
						glColor4f(0.5, 1, 0.5, 1);
						draw_text(AL_Right, origin, 20*i, "Press a key to assign, ESC to cancel", _fonts.standard);
					} else
						draw_text(AL_Right, origin, 20*i, SDL_GetKeyName(tconfig.intval[bind->configentry]), _fonts.standard);
					
					if(!caption_drawn) {
						glColor4f(1,1,1,0.7);
						draw_text(AL_Center, (SCREEN_W - 200)/2, 20*(i-1), "Controls", _fonts.standard);
						caption_drawn = 1;
					}
					break;
				
				case BT_StrValue:
					if(bind->blockinput) {
						glColor4f(0.5, 1, 0.5, 1.0);
						if(strlen(*bind->values))
							draw_text(AL_Right, origin, 20*i, *bind->values, _fonts.standard);
					} else
						draw_text(AL_Right, origin, 20*i, tconfig.strval[bind->configentry], _fonts.standard);
					break;
				
				case BT_Resolution: {
					char tmp[16];
					int w, h;
					
					if(bind->selected == -1) {
						w = video.intended.width;
						h = video.intended.height;
					} else {
						VideoMode *m = &(video.modes[bind->selected]);
						w = m->width;
						h = m->height;
					}
					
					snprintf(tmp, 16, "%dx%d", w, h);
					draw_text(AL_Right, origin, 20*i, tmp, _fonts.standard);
					break;
				}
			}
		}
	}
	
	
	glPopMatrix();
	
	fade_out(menu->fade);
}
Example #14
0
File: main.c Project: puyo/dogfight
int main(void)
{
 BITMAP *scrbuffer;
 DATAFILE *main_data;
 int vmode_error;

 RGB black = { 0,  0,  0 };

 // initialise allegro
 allegro_init();
 install_keyboard();
 install_timer();
 //install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL);

 // load main data file into memory
 main_data = load_datafile("dogfight.dat");

 // use the palette stored in the datafile and
 // set the "clear" colour from a working hot pink to an invisible black
 memcpy(&pal, main_data[MAINPAL].dat, sizeof(pal));

 // enter graphics mode -- don't debug from here --
 vmode_error = set_gfx_mode(GFX_AUTODETECT, SET_W, SET_H, 0, 0);
 if (vmode_error) {
   printf("Error setting graphics mode...\n%s\n\n", allegro_error);
   allegro_exit();
   exit(1);
 }

 set_palette(pal);
 set_color(0, &black);

 // build a colour lookup table for translucent drawing
 // NB: 128 translucency = 50%
 textout_centre_ex(screen, main_data[FONTSMALL].dat, "Dogfight by Gregory McIntyre", SCREEN_W/2, SCREEN_H/2-58, GREY+15, -1);
 textout_centre_ex(screen, font, "Loading. Please wait...", SCREEN_W/2, SCREEN_H/2-20, GREY+15, -1);
 callback_count = 0;
 create_trans_table(&trans_table, main_data[MAINPAL].dat, CLOUD_TRANSPARENCY, CLOUD_TRANSPARENCY, CLOUD_TRANSPARENCY, callback_func);

 // allocate memory for screen buffer
 scrbuffer = create_bitmap(SCREEN_W, SCREEN_H); clear(scrbuffer);

 // when everything is ready fade out and go to the title screen
 fade_out(10);
 title_page(scrbuffer, main_data);

 // free allocated memory and exit allegro
 destroy_bitmap(scrbuffer);

 unload_datafile(main_data);
 allegro_exit();

 // print a message that will be displayed at the DOS prompt on leaving
 printf("Thankyou for playing Dogfight.\n");
 printf("Dogfight was created using the Allegro game library.\n");
 printf("It's free so enjoy and distribute at your leasure.\n\n");

 printf("-------------------------------\n");
 printf("The author can be contacted at:\n\n");
 printf("[email protected]*\n\n");
 printf("-------------------------------\n\n");
 printf("Have a nice day!\n");
 printf("\n");
 printf("* Email no longer valid.\n");
 return 0;
}
Example #15
0
void Main(u16 PLAYERS)
{
	int incl, incl_x, incl_y, i, delay;
	u16 boton, PLAYER=1;
	u16 bx, by, incl_c;
	u16 rx = 16,
	      ry = 144,
	      saltoX = 1,
	      saltoY = 1,
		incRaqueta;
	u16 LifeCount = 3;
	u32 ScoreCount = 0;
	boolean jugando, rastro;
	u16 direccion, tipoBola, long_r, mesias;
	u16 nivel = 1;
	u8 *nivelMap;

	GANA_NIVEL:

	if(nivel>1) fade_out(30, 1, 0);
	RefrescaBG(nivel,mesias);
	limpia_oam();
	Wait(100);	//Espera 3 segundos
	fade_in(30, 1, 0);

	IniciaPropiedadesBloques(nivel);
	RefrescaNivel(nivel);

	if(nivel==1) { nivelMap = blockMap_1; }//N1 = N2 = 12; }
	if(nivel==2) { nivelMap = blockMap_2; }//N1 = N2 = 13; }
	if(nivel==3) { nivelMap = blockMap_3; }//N1 = N2 = 14; }
	if(nivel==4) { nivelMap = blockMap_4; }//N1 = N2 = 15; }
	if(nivel==5) { nivelMap = blockMap_5; }//N1 = N2 = 16; }

	REINICIA:

	RefrescaLife(LifeCount);
	limpia_activoBonXY();

	jugando=TRUE;
	mesias=FALSE;
	RefrescaBG(nivel,mesias);

	tipoBola=BOLA1;
	ANCHO_BOLA=6;
	ALTO_BOLA=6;
	long_r=FALSE;
	ANCHO_RAQUETA=32;

	if(PLAYERS==2) {
		if(PLAYER==2) { PLAYER=1; goto DO_PLAYER; }
		if(PLAYER==1) { PLAYER=2; goto DO_PLAYER; }
	}
	DO_PLAYER:
	if(LifeCount==0 || nivel==6) jugando=FALSE;

	if(jugando==TRUE) IniciaMovimientoRaqueta(rx,ry,long_r,PLAYER,ScoreCount);

	rastro=FALSE;
	MAX_Y=160;

	delay=0;

	bx = Inicio_Bx;
	by = ry - ALTO_BOLA;
	rx = Inicio_Rx;

	while (LifeCount > 0 && nivel<=5)

		{

		/*<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><*/

		if(bx>( MAX_X - ANCHO_BOLA ) ) incl_x=-1;
		if(bx< MIN_X ) incl_x=1;
		if(by>( MAX_Y - ALTO_BOLA) )
		{
			incl_y=-1;
			if(mesias==FALSE) { LifeCount--; goto REINICIA; }
			if(mesias==TRUE) { mesias=FALSE; MAX_Y=160; }
		}
		if(by<= MIN_Y ) incl_y=1;

	if(long_r==FALSE)
	{
		if (by == (ry-ALTO_BOLA) && bx >= (rx-ANCHO_BOLA) && bx <= (rx-ANCHO_BOLA)+8 ) {incl_x=-1; incl_y=-1; incl=supizq;}
		if (by == (ry-ALTO_BOLA) && bx >= (rx-ANCHO_BOLA)+9 && bx <= (rx-ANCHO_BOLA)+16 ) {incl_x=-1; incl_y=-1; incl=supsupizq;}
		if (by == (ry-ALTO_BOLA) && bx >= (rx-ANCHO_BOLA)+17 && bx <= (rx-ANCHO_BOLA)+24 ) {incl_x=1; incl_y=-1; incl=supsupder;}
		if (by == (ry-ALTO_BOLA) && bx >= (rx-ANCHO_BOLA)+25 && bx <= (rx-ANCHO_BOLA)+32 ) {incl_x=1; incl_y=-1; incl=supder;}
			if (bx == (rx-ANCHO_BOLA) && ( by>=ry-ALTO_BOLA && by<=ry+8) ) {incl_x=-1; incl_y=-1; incl=izqizqsup;}
			if (bx == (rx+ANCHO_RAQUETA) && ( by>=ry-ALTO_BOLA && by<=ry+8) ) {incl_x=1; incl_y=-1; incl=derdersup;}
	}
	if(long_r==TRUE)
	{
		if (by == (ry-ALTO_BOLA) && bx >= (rx-ANCHO_BOLA) && bx <= (rx-ANCHO_BOLA)+8 ) {incl_x=-1; incl_y=-1; incl=supizq;}
		if (by == (ry-ALTO_BOLA) && bx >= (rx-ANCHO_BOLA)+9 && bx <= (rx-ANCHO_BOLA)+16 ) {incl_x=-1; incl_y=-1; incl=supizq;}
		if (by == (ry-ALTO_BOLA) && bx >= (rx-ANCHO_BOLA)+17 && bx <= (rx-ANCHO_BOLA)+24 ) {incl_x=-1; incl_y=-1; incl=supsupizq;}
		if (by == (ry-ALTO_BOLA) && bx >= (rx-ANCHO_BOLA)+25 && bx <= (rx-ANCHO_BOLA)+32 ) {incl_x=1; incl_y=-1; incl=supsupder;}
		if (by == (ry-ALTO_BOLA) && bx >= (rx-ANCHO_BOLA)+33 && bx <= (rx-ANCHO_BOLA)+40 ) {incl_x=1; incl_y=-1; incl=supder;}
		if (by == (ry-ALTO_BOLA) && bx >= (rx-ANCHO_BOLA)+41 && bx <= (rx-ANCHO_BOLA)+48 ) {incl_x=1; incl_y=-1; incl=supder;}
			if (bx == (rx-ANCHO_BOLA) && ( by>=ry-ALTO_BOLA && by<=ry+8) ) {incl_x=-1; incl_y=-1; incl=izqizqsup;}
			if (bx == (rx+ANCHO_RAQUETA) && ( by>=ry-ALTO_BOLA && by<=ry+8) ) {incl_x=1; incl_y=-1; incl=derdersup;}
	}

for (i=0 ; i <= 162 ; i++)
		{
		if ( by == L[i].y-ALTO_BOLA && (bx >= L[i].x-ANCHO_BOLA && bx <= L[i].xM) )
			{ incl_y=-1;
			if(L[i].BONUS!=NO_BONUS && L[i].golpes <= 1) { L[i].activoBonus=TRUE; }
			if(rastro==TRUE && L[i].destruye==TRUE)
			{
				L[i].golpes = 0;
				incl_y=1;
			}
			if (L[i].golpes > 0)
				{
				L[i].golpes--;
				ScoreCount+=25;
				}
			if (L[i].destruye == TRUE && L[i].golpes == 0)
				{ 
				L[i].x = L[i].y = L[i].xM = L[i].yM = 0;
				nivelMap[L[i].tile1] = O1; nivelMap[L[i].tile2] = O2;
				ScoreCount+=100;
				}
			}

		if ( by == L[i].yM && (bx >= L[i].x-ANCHO_BOLA && bx <= L[i].xM) )
			{ incl_y=1;
			if(L[i].BONUS!=NO_BONUS && L[i].golpes <= 1) { L[i].activoBonus=TRUE; }
			if(rastro==TRUE && L[i].destruye==TRUE)
			{
				L[i].golpes = 0;
				incl_y=-1;
			}
			if (L[i].golpes > 0)
				{
				L[i].golpes--;
				ScoreCount+=25;
				}
			if (L[i].destruye == TRUE && L[i].golpes == 0)
				{ 
				L[i].x = L[i].y = L[i].xM = L[i].yM = 0;
				nivelMap[L[i].tile1] = O1; nivelMap[L[i].tile2] = O2;
				ScoreCount+=100;
				}
			}

		if ( bx == L[i].x-ANCHO_BOLA && (by >= L[i].y-ALTO_BOLA && by <= L[i].yM) )
			{ incl_x=-1;
			if(L[i].BONUS!=NO_BONUS && L[i].golpes <= 1) { L[i].activoBonus=TRUE; }
			if(rastro==TRUE && L[i].destruye==TRUE)
			{
				L[i].golpes = 0;
				incl_x=1;
			}
			if (L[i].golpes > 0)
				{
				L[i].golpes--;
				ScoreCount+=25;
				}
			if (L[i].destruye == TRUE)
				{ 
				L[i].x = L[i].y = L[i].xM = L[i].yM = 0;
				nivelMap[L[i].tile1] = O1; nivelMap[L[i].tile2] = O2;
				ScoreCount+=100;
				}
			}

		if ( bx == L[i].xM && (by >= L[i].y-ALTO_BOLA && by <= L[i].yM) )
			{ incl_x=1;
			if(L[i].BONUS!=NO_BONUS && L[i].golpes <= 1) { L[i].activoBonus=TRUE; }
			if(rastro==TRUE && L[i].destruye==TRUE)
			{
				L[i].golpes = 0;
				incl_x=-1;
			}
			if (L[i].golpes > 0)
				{
				L[i].golpes--;
				ScoreCount+=25;
				}
			if (L[i].destruye == TRUE && L[i].golpes == 0)
				{ 
				L[i].x = L[i].y = L[i].xM = L[i].yM = 0;
				nivelMap[L[i].tile1] = O1; nivelMap[L[i].tile2] = O2;
				ScoreCount+=100;
				}
			}
		}

	for (i=0 ; i <= 108 ; i++)
		if(L[i].activoBonus == TRUE)	
		{
			if(L[i].BONUS!=NO_BONUS)
				{
					RefrescaBonus(L[i].bonX,L[i].bonY,L[i].BONUS,L[i].bonN);
					L[i].bonY++;
					if(L[i].bonX+16>=rx && L[i].bonX<=rx+ANCHO_RAQUETA && L[i].bonY>=ry && L[i].bonY<=ry+ALTO_RAQUETA)
					{
						if(L[i].BONUS==COMET_BONUS)
							{
							rastro=TRUE;
							L[i].BONUS=NO_BONUS;
							L[i].activoBonus=FALSE;
							RefrescaBonus(240+8,160+8,L[i].BONUS,L[i].bonN);
							}
						if(L[i].BONUS==LONG_R_BONUS)
							{
							ANCHO_RAQUETA=48;
							long_r=TRUE;
							L[i].BONUS=NO_BONUS;
							L[i].activoBonus=FALSE;
							RefrescaBonus(240+8,160+8,L[i].BONUS,L[i].bonN);
							}
						if(L[i].BONUS==LIFE_BONUS)
							{
							LifeCount++;
							L[i].BONUS=NO_BONUS;
							L[i].activoBonus=FALSE;
							RefrescaBonus(240+8,160+8,L[i].BONUS,L[i].bonN);
							}
						if(L[i].BONUS==BIGBALL_BONUS)
							{
							rastro=FALSE;
							tipoBola = BOLA2;
							ANCHO_BOLA=8;
							ALTO_BOLA=8;
							L[i].BONUS=NO_BONUS;
							L[i].activoBonus=FALSE;
							RefrescaBonus(240+8,160+8,L[i].BONUS,L[i].bonN);
							}
						if(L[i].BONUS==MESIAS_BONUS)
							{
							mesias=TRUE;
							MAX_Y=160-12;
							L[i].BONUS=NO_BONUS;
							L[i].activoBonus=FALSE;
							RefrescaBonus(240+8,160+8,L[i].BONUS,L[i].bonN);
							}
					}
					if(L[i].bonY>=MAX_Y+16)
					{
						L[i].BONUS=NO_BONUS;
						L[i].activoBonus=FALSE;
						RefrescaBonus(240+8,160+8,L[i].BONUS,L[i].bonN);
					}
				}
		}

		boton = joypad();
		if ( (boton & J_B)) incRaqueta=3;
		if (!(boton & J_B)) incRaqueta=4;

		if (!(boton & J_RIGHT) && rx < (MAX_X - ANCHO_RAQUETA) ) rx+=incRaqueta;
		if (!(boton & J_LEFT) && rx > MIN_X ) rx-=incRaqueta;
		if (rx > MAX_X - ANCHO_RAQUETA) rx=MAX_X - ANCHO_RAQUETA;

		if (!(boton & J_SELECT)) goto REINICIA;

		//bx += col;
		//by += fil;

		if(incl_x==1) {	if(incl==0) incl=1;	if(incl==2) incl=3;	if(incl==4) incl=5;
					if(incl==6) incl=7;	if(incl==8) incl=9;	if(incl==10) incl=11; }
		if(incl_x==-1) {	if(incl==1) incl=0;	if(incl==3) incl=2;	if(incl==5) incl=4;
					if(incl==7) incl=6;	if(incl==9) incl=8;	if(incl==11) incl=10; }
		if(incl_y==1) {	if(incl==4) incl=6;	if(incl==2) incl=8;	if(incl==0) incl=10;
					if(incl==1) incl=11;	if(incl==3) incl=9;	if(incl==5) incl=7; }
		if(incl_y==-1) {	if(incl==6) incl=4;	if(incl==8) incl=2;	if(incl==10) incl=0;
					if(incl==11) incl=1;	if(incl==9) incl=3;	if(incl==7) incl=5; }

		if(incl==0) {
			if(incl_c<2) { by--; }
			if(incl_c>=2) { by--; bx--; incl_c=0; }
		}
		if(incl==1) {
			if(incl_c<2) { by--; }
			if(incl_c>=2) { by--; bx++; incl_c=0; }
		}
		if(incl==2) if(incl_c>=1) {bx--; by--; incl_c=0;}
		if(incl==3) if(incl_c>=1) {by--; bx++; incl_c=0;}
		if(incl==4) {
			if(incl_c<2) { bx--; }
			if(incl_c>=2) { bx--; by--; incl_c=0; }
		}
		if(incl==5) {
			if(incl_c<2) { bx++; }
			if(incl_c>=2) { bx++; by--; incl_c=0; }
		}
		if(incl==6) {
			if(incl_c<2) { bx--; }
			if(incl_c>=2) { bx--; by++; incl_c=0; }
		}
		if(incl==7) {
			if(incl_c<2) { bx++; }
			if(incl_c>=2) { bx++; by++; incl_c=0; }
		}
		if(incl==8) if(incl_c>=1) {bx--; by++; incl_c=0;}
		if(incl==9) if(incl_c>=1) {bx++; by++; incl_c=0;}
		if(incl==10) {
			if(incl_c<2) { by++; }
			if(incl_c>=2) { by++; bx--; incl_c=0; }
		}
		if(incl==11) {
			if(incl_c<2) { by++; }
			if(incl_c>=2) { by++; bx++; incl_c=0; }
		}

		wait_vbl_done();
		//Wait(2);

		EstableceRaqueta(rx, ry, long_r, PLAYER);
		if(incl_x<0 && incl_y<0) direccion=0;
		if(incl_x>0 && incl_y<0) direccion=1;
		if(incl_x<0 && incl_y>0) direccion=2;
		if(incl_x>0 && incl_y>0) direccion=3;
		EstableceBola(bx, by, rastro, direccion, tipoBola);
		RefrescaScore(ScoreCount);

		if(LifeCount>99) LifeCount=99;
		RefrescaLife(LifeCount);

		if(ChecaTerminadoNivel()==TRUE) {nivel++; goto GANA_NIVEL;}
		RefrescaBG(nivel,mesias);

		incl_c++;
		}

}
Example #16
0
void title_page(BITMAP *scrbuffer, DATAFILE *main_data)
{
// function sets up the title screen and allows access to the actual game

    DATAFILE *plane_data, *explosion_data, *shot_data, *object_data;
    struct menuinfo title_menu, options_menu, stats_menu;
    struct optionsinfo options;
    FILE *cfgfile;

// load game specific datafiles into memory
    plane_data      = (DATAFILE *)main_data[PLANE].dat;
    explosion_data  = (DATAFILE *)main_data[EXPLOSION].dat;
    object_data     = (DATAFILE *)main_data[OBJECT].dat;

    title_menu.highlight = 0;

    strcpy(title_menu.option[0], "2 Player Game");
    strcpy(title_menu.option[1], "3 Player Game");
    strcpy(title_menu.option[2], "4 Player Game");
    strcpy(title_menu.option[3], "Options");
    strcpy(title_menu.option[4], "Credits");
    strcpy(title_menu.option[5], "Exit");
    title_menu.num_of_options = 6;
    title_menu.row = 25*8;
    title_menu.col = SCREEN_W/2-78;
    title_menu.fontsize = 2;

    strcpy(options_menu.option[0], "Player Statistics");
    strcpy(options_menu.option[1], "Player Controls");
    strcpy(options_menu.option[2], "Level Options");
    strcpy(options_menu.option[3], "Other Options");
    strcpy(options_menu.option[4], "Back");
    options_menu.num_of_options = 5;
    options_menu.row = 25*8;
    options_menu.col = SCREEN_W/2-92;
    options_menu.fontsize = 2;

    strcpy(stats_menu.option[0],  "Vehicle         :");
    strcpy(stats_menu.option[1],  "Turning Speed   :");
    strcpy(stats_menu.option[2],  "Acceleration    :");
    strcpy(stats_menu.option[3],  "Minimum Speed   :");
    strcpy(stats_menu.option[4],  "Maximum Speed   :");
    strcpy(stats_menu.option[5],  "Number of Shots :");
    strcpy(stats_menu.option[6],  "Shot Life       :");
    strcpy(stats_menu.option[7],  "Shot Lag        :");
    strcpy(stats_menu.option[8],  "Shot Base Speed :");
    strcpy(stats_menu.option[9],  "Laser Length    :");
    strcpy(stats_menu.option[10], "Reset to Vehicle Type");
    strcpy(stats_menu.option[11], "Save Vehicle to Configuration File");
    strcpy(stats_menu.option[12], "Return to Options Menu Without Saving");
    stats_menu.num_of_options = 13;
    stats_menu.row = 22*8;
    stats_menu.col = SCREEN_W/3;
    stats_menu.fontsize = 1;

// load the game's various options from the config file
    cfgfile = fopen("dogfight.cfg", "r");

    options.vehicle      = stats_menu.optionval[0] = read_value(cfgfile, '@',
                           "user vehicle",
                           "vehicle");
    options.turn_speed   = stats_menu.optionval[1] = read_value(cfgfile, '@',
                           "user vehicle",
                           "turn_speed");
    options.acceleration = stats_menu.optionval[2] = read_value(cfgfile, '@',
                           "user vehicle",
                           "acceleration");
    options.min_speed    = stats_menu.optionval[3] = read_value(cfgfile, '@',
                           "user vehicle",
                           "min_speed");
    options.max_speed    = stats_menu.optionval[4] = read_value(cfgfile, '@',
                           "user vehicle",
                           "max_speed");
    options.num_of_shots = stats_menu.optionval[5] = read_value(cfgfile, '@',
                           "user vehicle",
                           "num_of_shots");
    options.shot_life    = stats_menu.optionval[6] = read_value(cfgfile, '@',
                           "user vehicle",
                           "shot_life");
    options.shot_lag     = stats_menu.optionval[7] = read_value(cfgfile, '@',
                           "user vehicle",
                           "shot_lag");
    options.shot_base_speed = stats_menu.optionval[8] = read_value(cfgfile, '@',
                              "user vehicle",
                              "shot_base_speed");
    options.laser_length    = stats_menu.optionval[9] = read_value(cfgfile, '@',
                              "user vehicle",
                              "laser_length");

    options.gravity            = read_value(cfgfile, '@', "user level", "gravity");
    options.backdrop           = read_value(cfgfile, '@', "user level", "backdrop");
    options.cloud_type         = read_value(cfgfile, '@', "user level", "cloud_type");
    options.invincibility_life = read_value(cfgfile, '@', "options",    "invincibility_life");
    options.explosion_speed    = read_value(cfgfile, '@', "options",    "explosion_speed");
    options.coralie            = read_value(cfgfile, '@', "options",    "coralie_mode");

    fclose(cfgfile);

// draw the title page and fade in to it
    base_title_page(scrbuffer, main_data, plane_data, title_menu);
    fade_in(pal, 5);

    do {
        // reset the selection in case a game has just been exited
        title_menu.selection = -1;

        // draw the title page
        base_title_page(scrbuffer, main_data, plane_data, title_menu);

        // move the cursor
        title_menu = move_menu_cursor(title_menu);

        // start a game with the appropriate number of players
        if (title_menu.selection >= 0 && title_menu.selection <= 2) {
            fade_out(10);
            game(scrbuffer, main_data, plane_data, explosion_data, object_data, options,
                 title_menu.selection+2);

            // fix up the title screen before fading in to it
            title_menu.highlight = 0;
            base_title_page(scrbuffer, main_data, plane_data, title_menu);
            fade_in(pal, 5);
        }
        else if (title_menu.selection == 3) {
            // go to the options sub menu
            options = goto_options_menu(scrbuffer, main_data, plane_data, options, options_menu,
                                        stats_menu);
            title_menu.highlight = 0;
        }

    } while (title_menu.selection != title_menu.num_of_options-1);
}
Example #17
0
void EL_EscudoClass::fade_out(char channel)
{
    fade_out(channel, 10);
}
Example #18
0
void show_stats()
{
  if (current_level)
  {
    int xp,yp;

    if (!player_list->next)
    {
      fade_out(8);
      eh->set_mouse_position(0,0);
      screen->clear();

      switch_mode(VMODE_640x480);

      load_image_into_screen("art/frame.spe","end_level_screen",xp,yp);
      fade_in(NULL,16);
    } else
    {
      xp=screen->width()/2-640/2;
      yp=screen->height()/2-480/2;
    }



    char name[50];
    strcpy(name,current_level->original_name());
    char dig1=name[strlen(name)-strlen(".spe")-2];
    char dig2=name[strlen(name)-strlen(".spe")-1];

   
    char msg[50];
    int lev_num;


    if (isdigit(dig1) && isdigit(dig2))
      lev_num=(dig1-'0')*10+dig2-'0';
    else
      lev_num=dig2-'0';

    sprintf(msg,symbol_str("lev_complete"),lev_num);   

    int w=eh->font()->width()*strlen(msg),h=eh->font()->height();    
    int x1=0,y1=0,x2=xres,y2=yres;
    //    int x=(x1+x2)/2-w/2,y=(y1+y2)/2-h/2;
    int x=444+xp,y=293+yp;   
   
    eh->font()->put_string(screen,x+1,y+1,msg,eh->dark_color());    
    eh->font()->put_string(screen,x,y,msg,eh->bright_color());
    
    y+=eh->font()->height();
    sprintf(msg,"Time taken.. %0.1f minutes",current_level->time_taken()/60.0);
    eh->font()->put_string(screen,x+1,y+1,msg,eh->dark_color());    
    eh->font()->put_string(screen,x,y,msg,eh->bright_color());

    y+=eh->font()->height();
    sprintf(msg,"Kills....... %d",player_list->kills);
    eh->font()->put_string(screen,x+1,y+1,msg,eh->dark_color());    
    eh->font()->put_string(screen,x,y,msg,eh->bright_color());



    eh->flush_screen();
    stat_show_start.get_time();

    old_stat=stat_man;
    stat_man=new next_level_status_manager(xp+443,yp+424,xp+589,yp+443,93);  
  }
}
Example #19
0
int opMenu()
{
     DATAFILE *menu = load_datafile("data\\menu.dat");
 	 BITMAP *buffer = create_bitmap(640,480);
 	 
 	 blit((BITMAP *)menu[1].dat, buffer, 0, 0, 0, 0, MAX_W, MAX_H);
 	 textprintf_centre_ex(buffer, font, 320, 305, makecol(0,30,50),-1, "Para trocar entre o modo fullscreen e janela, aperte ENTER.");
 	 
 	 font = (FONT *)menu[9].dat;
 	 
 	 fade_in(buffer, 10);
 	 
 	 FILE *conf = fopen("config.cdb", "wb");
 	 
 	 if (conf == NULL)
 	 {
        allegro_message("Problema com o arquivo de configuraĆ§Ć£o: config.cdb");
        return 5;
     }
 	 
 	 while (!key[KEY_ESC])
 	 {
        clear(buffer);
        
        blit((BITMAP *)menu[1].dat, buffer, 0, 0, 0, 0, MAX_W, MAX_H);
 	    textprintf_centre_ex(buffer, font, 320, 305, makecol(0,30,50),-1, "Para trocar entre o modo fullscreen e janela, aperte ENTER.");
        
        if (key[KEY_ENTER])
        {
        
           if (is_windowed_mode())
           {
	          if (set_gfx_mode(GFX_AUTODETECT, MAX_W, MAX_H, 0, 0) != 0) {
		         allegro_message(allegro_error);
		         exit(-1);
	          }
	          fade_out(10);
	          unload_datafile(menu);
              destroy_bitmap(buffer);
              
              fprintf(conf, "%d", 2);
              fclose(conf);
     
              return 0;
           }
           else
           {
	          if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, MAX_W, MAX_H, 0, 0) != 0) {
		         allegro_message(allegro_error);
		         exit(-1);
	          }
	          fade_out(10);
	          unload_datafile(menu);
              destroy_bitmap(buffer);
              
              fprintf(conf, "%d", 1);
              fclose(conf);
     
              return 0;
           }
        }
        
        draw_sprite(buffer, (BITMAP *)menu[0].dat, mouse_x, mouse_y);
        
        blit(buffer, screen, 0, 0, 0, 0, MAX_W, MAX_H);
     }
     fade_out(10);
     
     unload_datafile(menu);
     destroy_bitmap(buffer);
     
     return 0;
}
Example #20
0
int menu_play()
{
 	 DATAFILE *menu = load_datafile("data\\menu.dat");
 	 BITMAP *buffer = create_bitmap(640,480);
 	 BITMAP *mbuffer = create_bitmap(640,480);
 	 MIDI *inicio = load_midi("musics\\inicio.midi");
 	 font = (FONT *)menu[9].dat;
 	 
 	 int ret;
 	 
 	 CBotao Jogar;
 	 Jogar.Start();
 	 Jogar.img[NORMAL] = (BITMAP *)menu[2].dat;
	 Jogar.img[CIMA] = (BITMAP *)menu[3].dat;
	 Jogar.tx = 134;
  	 Jogar.ty = 30;

	 CBotao Opcoes;
	 Opcoes.Start();
	 Opcoes.img[NORMAL] = (BITMAP *)menu[4].dat;
	 Opcoes.img[CIMA] = (BITMAP *)menu[5].dat;
	 Opcoes.tx = 134;
	 Opcoes.ty = 30;
	
	 CBotao Sair;
	 Sair.Start();
	 Sair.img[NORMAL] = (BITMAP *)menu[6].dat;
	 Sair.img[CIMA] = (BITMAP *)menu[7].dat;
	 Sair.tx = 134;
	 Sair.ty = 30;

 	 
     blit((BITMAP *)menu[1].dat, buffer, 0, 0, 0, 0, 640, 480);
 	 draw_sprite(buffer, Jogar.img[NORMAL], 253, 274);
 	 draw_sprite(buffer, Opcoes.img[NORMAL], 253, 315);
 	 draw_sprite(buffer, Sair.img[NORMAL], 253, 356);
 	 
 	 
 	 play_fli("movie\\filme.flc", screen, 0 , check_escape_key);
 	 fade_in((BITMAP *)menu[10].dat, 10);
 	 play_fli("movie\\filme2.flc", screen, 0 , check_escape_key);
 	 fade_out(10);

 	 
 	 set_trans_blender(255, 255, 255, 75);
     draw_trans_sprite(buffer, (BITMAP*)menu[8].dat, 30, 480-323);

 	 fade_in(buffer, 10);
 	 play_midi(inicio, 100);
 	 
 	 while(!key[KEY_ESC])
 	 {
        rest(3);
        clear_bitmap(buffer);
        clear_to_color(mbuffer, makecol(255,0,255));

	    blit((BITMAP *)menu[1].dat, buffer, 0, 0, 0, 0, 640, 480);
	    
        if (!Jogar.Manage(buffer, 253, 274, mbuffer, "Clique aqui para Jogar"))
        {   
           ret = JOGAR;
		   break;
        }
		if (!Opcoes.Manage(buffer, 253, 315, mbuffer, "Opcoes de Jogo"))
		{
           ret = OPCOES;
		   break;
        }
		if (!Sair.Manage(buffer, 253, 356, mbuffer, "Sair do Jogo"))
		{
           ret = SAIR;
		   break;
        }
	    set_trans_blender(255, 255, 255, 70);
	    draw_trans_sprite(buffer, (BITMAP*)menu[8].dat, 30, 480-323);
	    
	    
	    draw_sprite(mbuffer, (BITMAP *)menu[0].dat, mouse_x, mouse_y);
	    
	    //textprintf_ex(buffer, font, 10, 10, makecol(0,0,0),-1, "FPS: %d", fps); 	 	 	   
	    set_trans_blender(255, 255, 255, 150);
	    draw_trans_sprite(buffer, mbuffer, 0, 0);
	    blit(buffer, screen, 0, 0, 0, 0, 640, 480);
	 }
	 fade_out(10);
	 //destroy_bitmap(mbuffer);
	 Jogar.Destroy();
	 Opcoes.Destroy();
	 Sair.Destroy();
	 destroy_bitmap(buffer);
	 
	 return ret;
}
Example #21
0
void play_intro(void)
{
#define COL(index,red,green,blue) \
  if ((index>=min) && (index<=max)) { \
    pal[index].r = (red);             \
    pal[index].g = (green);           \
    pal[index].b = (blue);            \
  }

#define FADE(speed) \
  fade_from(source, pal, speed); \
  get_palette(source)

#define NORMAL() \
  min = 0;         \
  max = PAL_SIZE-1

  BITMAP *bg = (BITMAP *)datafile[MYLOGO_BMP].dat;
  PALETTE source, pal;
  int n, n2;
  int min, max;

  /* play the introduction theme */
  qtetris_music(MUSIC_INTRO, FALSE);

  n = 0;
  NORMAL();

  set_palette(black_palette);
  get_palette(source);
  get_palette(pal);

  /* DAC *********************************/
  clear(virtual);
  blit(bg, virtual, 0, 0,
    QTETRIS_SCREEN_W/2 - bg->w/2,
    QTETRIS_SCREEN_H/2 - bg->h/2, bg->w, bg->h);
  qtetris_blit(virtual);
  FADE(1);

  /* David A. Capello */
  /* fg */
  min = 1;
  max = 28;
  for (n2=0, n=min; n<=max+2; n2=n, n+=2) {
    COL(n2,  0,  0,  0);
    COL(n,   32, 32, 63);
    COL(n+1, 63, 63, 63);
    FADE(32);
  }

  /* bg */
  min = 32;
  max = 45;
  for (n=max; n>=min-4; n--) {
    NORMAL();
    for (n2=1; n2<=28; n2+=2) {
      COL(n2+1, 63-(-63*(n-45)/(45-32+4)),
                63-(-63*(n-45)/(45-32+4)),
                63-(-63*(n-45)/(45-32+4)));
      COL(n2, -63*(n-45)/(45-32+4), 0, 0);
    }

    min = 32;
    max = 45;
    COL(n+4, 63, 63, 63);
    COL(n+2, 63,  0,  0);
    COL(n,   63, 63,  0);

    FADE(64);
  }

  /* Present */
  NORMAL();
  COL(253, 63, 63, 63);
  COL(254, 32, 32, 32);
  COL(255, 16, 16, 16);
  FADE(4);

  /* fin de la primer etapa **************/
  fade_out(2);

  /* QUEEN LOGO **************************/
  fade_out(2);

  clear(virtual);
  blit(datafile[QUEENLOG_BMP].dat, virtual, 0, 0,
    QTETRIS_SCREEN_W/2-((BITMAP *)datafile[QUEENLOG_BMP].dat)->w/2,
    QTETRIS_SCREEN_H/2-((BITMAP *)datafile[QUEENLOG_BMP].dat)->h/2,
    ((BITMAP *)datafile[QUEENLOG_BMP].dat)->w,
    ((BITMAP *)datafile[QUEENLOG_BMP].dat)->h);
  qtetris_blit(virtual);

  fade_in(datafile[PALETTE_BMP].dat, 1);
  get_palette(pal);
  get_palette(source);
  FADE(2);
  fade_out(2);

  /* TETRIS ******************************/
  set_palette(black_palette);

  get_palette(source);
  get_palette(pal);

  NORMAL();
  for (n=0; n<PAL_SIZE; n++) {
    COL(n, 63, 63, 63);
  }
  FADE(2);

  /* mainscreen */
  clear(virtual);
  drawing_mode(DRAW_MODE_COPY_PATTERN, datafile[TETRISBG_BMP].dat, 0, 0);
  rectfill(virtual, 0, 0, QTETRIS_SCREEN_W, QTETRIS_SCREEN_H, -1);

  color_map = shadow_map;
  drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
  draw_trans_sprite(virtual, datafile[TETRIS_BMP].dat,
    QTETRIS_SCREEN_W/2 - ((BITMAP *)datafile[TETRIS_BMP].dat)->w/2 + 6,
    QTETRIS_SCREEN_H/2 - ((BITMAP *)datafile[TETRIS_BMP].dat)->h/2 + 12);
  solid_mode();

  draw_sprite(virtual, datafile[TETRIS_BMP].dat,
    QTETRIS_SCREEN_W/2 - ((BITMAP *)datafile[TETRIS_BMP].dat)->w/2,
    QTETRIS_SCREEN_H/2 - ((BITMAP *)datafile[TETRIS_BMP].dat)->h/2);
  qtetris_blit(virtual);

  for (n=15; n<112; n++) {
    COL(n, 0, 0, 0);
  }
  FADE(2);
  FADE(2);

  fade_from(pal, datafile[PALETTE_BMP].dat, 2);
}
Example #22
0
void show_sell(int abortable)
{
#if 0
  void *ss=make_find_symbol("sell_screens");
  if (!DEFINEDP(symbol_value(ss)))
  {
    int sp=current_space;
    current_space=PERM_SPACE;
//    char *prog="((\"art/help.spe\" . \"sell2\")(\"art/help.spe\" . \"sell4\")(\"art/help.spe\" . \"sell3\")(\"art/endgame.spe\" . \"credit\"))";
    char *prog="((\"art/endgame.spe\" . \"credit\") (\"art/help.spe\" . \"sell6\"))";
    set_symbol_value(ss,compile(prog));
    current_space=sp;
  }

  if (DEFINEDP(symbol_value(ss)))
  {
    image blank(2,2); blank.clear();
    eh->set_mouse_shape(blank.copy(),0,0);      // don't show mouse

    ss=symbol_value(ss);
    int quit=0;
    while (ss && !quit)
    {
      int im=cash.reg_object("art/help.spe",CAR(ss),SPEC_IMAGE,1);
      fade_in(cash.img(im),16);

      event ev;
      do
      { 
      	eh->flush_screen();
				eh->get_event(ev);
      } while (ev.type!=EV_KEY);
      if (ev.key==JK_ESC && abortable)
        quit=1;
      fade_out(16);
      ss=CDR(ss);
    }
    eh->set_mouse_shape(cash.img(c_normal)->copy(),1,1);
  }
#else
 	image blank(2,2); blank.clear();
  eh->set_mouse_shape(blank.copy(),0,0);      // don't show mouse
	screen->clear();

  image *im;
  event ev;
	int i;
  
  im=cash.img(cash.reg("art/endgame.spe","credit",SPEC_IMAGE,1));
  char *str=lstring_value(eval(make_find_symbol("thanks_text")));

	int dx=(xres+1)/2-im->width()/2,dy=(yres+1)/2-im->height()/2;
	im->put_image(screen,dx,dy);

  fade_in(0,16);	

  uchar cmap[32];
  for (i=0;i<32;i++)
    cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32);

	i = 0;

	int tx = 300, ty = 350, twx = 319, twy = 119;	
	
  while (eh->event_waiting()) eh->get_event(ev);
	ev.type = EV_SPURIOUS;

	time_marker start;
	int txti = 0;
  do
  { 
  	im->put_part(screen,dx+tx,dy+ty,tx,ty,tx+twx,ty+twy);
		txti++;
    text_draw(twy+5-txti,dx+tx+15,dy+ty,dx+tx+twx-15,dy+ty+twy,str,eh->font(),cmap,eh->bright_color()); 		
  	eh->flush_screen();
		
		time_marker now;
    while (now.diff_time(&start)<0.10) 
      now.get_time();
    start.get_time();

    while (eh->event_waiting() && ev.type!=EV_KEY) eh->get_event(ev);
  } while (txti<600 && ev.type!=EV_KEY && ev.type!=EV_MOUSE_BUTTON);
  fade_out(16);

	if (!abortable || !(ev.type==EV_KEY && ev.key==JK_ESC))
	{ 
	  im=cash.img(cash.reg("art/help.spe","sell6",SPEC_IMAGE,1));
	  fade_in(im,16);	
	
	  do
	  { 
	  	eh->flush_screen();
			eh->get_event(ev);
	  } while (ev.type!=EV_KEY && ev.type!=EV_MOUSE_BUTTON);
	  fade_out(16);
	}
  eh->set_mouse_shape(cash.img(c_normal)->copy(),1,1);
#endif
}
Example #23
0
void TransFadeBlack(double fade) {
	fade_out(fade);
}