예제 #1
0
void UpdatePalette() {
    if (game.color_depth > 1)
        invalidate_screen();

    if (!play.fast_forward)  
        setpal();
}
예제 #2
0
void SetPalRGB(int inndx,int rr,int gg,int bb) {
    if (game.color_depth > 1)
        invalidate_screen();

    wsetrgb(inndx,rr,gg,bb,palette);
    set_palette_range(palette, inndx, inndx, 0);
}
예제 #3
0
void IAGSEngine::ReleaseBitmapSurface (BITMAP *bmp) {
  release_bitmap (bmp);

  if (bmp == virtual_screen) {
    // plugin does not manaually invalidate stuff, so
    // we must invalidate the whole screen to be safe
    if (!plugins[this->pluginId].invalidatedRegion)
      invalidate_screen();
  }
}
예제 #4
0
void CyclePalette(int strt,int eend) {
    // hi-color game must invalidate screen since the palette changes
    // the effect of the drawing operations
    if (game.color_depth > 1)
        invalidate_screen();

    if ((strt < 0) || (strt > 255) || (eend < 0) || (eend > 255))
        quit("!CyclePalette: start and end must be 0-255");

    if (eend > strt) {
        // forwards
        wcolrotate(strt, eend, 0, palette);
        set_palette_range(palette, strt, eend, 0);
    }
    else {
        // backwards
        wcolrotate(eend, strt, 1, palette);
        set_palette_range(palette, eend, strt, 0);
    }

}
예제 #5
0
void play_theora_video(const char *name, int skip, int flags)
{
  apeg_set_display_depth(bitmap_color_depth(screen));
  // we must disable length detection, otherwise it takes ages to start
  // playing if the file is large because it seeks through the whole thing
  apeg_disable_length_detection(TRUE);
  apeg_enable_framedrop(TRUE);
  update_polled_stuff();

  stretch_flc = (flags % 10);
  canabort = skip;
  apeg_ignore_audio((flags >= 10) ? 1 : 0);

  int videoWidth, videoHeight;
  APEG_STREAM *oggVid = get_theora_size(name, &videoWidth, &videoHeight);

  if (videoWidth == 0)
  {
    Display("Unable to load theora video '%s'", name);
    return;
  }

  if (flags < 10)
  {
    stop_all_sound_and_music();
  }

  fli_target = NULL;
  //fli_buffer = create_bitmap_ex(final_col_dep, videoWidth, videoHeight);
  calculate_destination_size_maintain_aspect_ratio(videoWidth, videoHeight, &fliTargetWidth, &fliTargetHeight);

  if ((fliTargetWidth == videoWidth) && (fliTargetHeight == videoHeight) && (stretch_flc))
  {
    // don't need to stretch after all
    stretch_flc = 0;
  }

  if ((stretch_flc) && (!gfxDriver->HasAcceleratedStretchAndFlip()))
  {
    fli_target = create_bitmap_ex(final_col_dep, scrnwid, scrnhit);
    clear(fli_target);
    fli_ddb = gfxDriver->CreateDDBFromBitmap(fli_target, false, true);
  }
  else
  {
    fli_ddb = NULL;
  }

  update_polled_stuff();

  clear(virtual_screen);

  if (apeg_play_apeg_stream(oggVid, NULL, 0, theora_playing_callback) == APEG_ERROR)
  {
    Display("Error playing theora video '%s'", name);
  }
  apeg_close_stream(oggVid);

  //destroy_bitmap(fli_buffer);
  if (fli_target != NULL)
    destroy_bitmap(fli_target);
  gfxDriver->DestroyDDB(fli_ddb);
  fli_ddb = NULL;
  invalidate_screen();
}
예제 #6
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();
}