예제 #1
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;
}
예제 #2
0
static void pla_play_fli()
{
	hide_mp();
	play_fli();
	show_mp();
}
예제 #3
0
/* *** SCRIPT SYMBOL: [Multimedia] PlayFlic *** */
void play_flc_file(int numb,int playflags) {
  color oldpal[256];

  if (play.fast_forward)
    return;

  wreadpalette(0,255,oldpal);

  int clearScreenAtStart = 1;
  canabort = playflags % 10;
  playflags -= canabort;

  if (canabort == 2) // convert to PlayVideo-compatible setting
    canabort = 3;

  if (playflags % 100 == 0)
    stretch_flc = 1;
  else
    stretch_flc = 0;

  if (playflags / 100)
    clearScreenAtStart = 0;

  char flicnam[20]; sprintf(flicnam,"flic%d.flc",numb);
  FILE*iii=clibfopen(flicnam,"rb");
  if (iii==NULL) { sprintf(flicnam,"flic%d.fli",numb);
    iii=clibfopen(flicnam,"rb"); }
  if (iii==NULL) {
    debug_log("FLIC animation FLIC%d.FLC not found",numb);
    return;
    }
  fseek(iii,8,SEEK_CUR);
  fread(&fliwidth,2,1,iii);
  fread(&fliheight,2,1,iii);
  fclose(iii);
  if (game.color_depth > 1) {
    hicol_buf=create_bitmap_ex(final_col_dep,fliwidth,fliheight);
    clear(hicol_buf);
    }
  // override the stretch option if necessary
  if ((fliwidth==scrnwid) && (fliheight==scrnhit))
    stretch_flc = 0;
  else if ((fliwidth > scrnwid) || (fliheight > scrnhit))
    stretch_flc = 1;
  fli_buffer=create_bitmap_ex(8,fliwidth,fliheight); //640,400); //scrnwid,scrnhit);
  if (fli_buffer==NULL) quit("Not enough memory to play animation");
  clear(fli_buffer);

  if (clearScreenAtStart) {
    clear(screen);
    render_to_screen(screen, 0, 0);
  }

  fli_target = create_bitmap_ex(final_col_dep, BMP_W(screen), BMP_H(screen));
  fli_ddb = gfxDriver->CreateDDBFromBitmap(fli_target, false, true);

  if (play_fli(flicnam,fli_buffer,0,fli_callback)==FLI_ERROR)
    quit("FLI/FLC animation play error");

  wfreeblock(fli_buffer);
  clear(screen);
  wsetpalette(0,255,oldpal);
  render_to_screen(screen, 0, 0);

  destroy_bitmap(fli_target);
  gfxDriver->DestroyDDB(fli_ddb);
  fli_ddb = NULL;

  if (hicol_buf!=NULL) {
    wfreeblock(hicol_buf);
    hicol_buf=NULL; }
//  wsetscreen(screen); wputblock(0,0,backbuffer,0);
  while (ac_mgetbutton()!=NONE) ;
  invalidate_screen();
}