Exemple #1
0
ALLEGRO_BITMAP *
create_bitmap (int w, int h)
{
  set_target_backbuffer (display);
  ALLEGRO_BITMAP *bitmap = al_create_bitmap (w, h);
  if (! bitmap) {
    error (-1, 0, "%s (%i, %i): cannot create bitmap", __func__, w, h);
    return NULL;
  }
  validate_bitmap_for_mingw (bitmap);
  return bitmap;
}
Exemple #2
0
ALLEGRO_BITMAP *
load_bitmap (char *filename)
{
  set_target_backbuffer (display);

  ALLEGRO_BITMAP *bitmap =
    load_resource (filename, (load_resource_f) al_load_bitmap);

  if (! bitmap)
    error (-1, 0, "%s: cannot load bitmap file '%s'",
           __func__, filename);

  validate_bitmap_for_mingw (bitmap);

  if (load_callback) load_callback ();

  return bitmap;
}
Exemple #3
0
ALLEGRO_BITMAP *
create_broken_floor_bitmap (enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *broken_floor_left = NULL,
    *broken_floor_right = NULL,
    *floor_base = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA:
      broken_floor_left = dc_broken_floor_left;
      broken_floor_right = dc_broken_floor_right;
      floor_base = dc_floor_base;
      break;
    case EGA:
      broken_floor_left = de_broken_floor_left;
      broken_floor_right = de_broken_floor_right;
      floor_base = de_floor_base;
      break;
    case VGA:
      broken_floor_left = dv_broken_floor_left;
      broken_floor_right = dv_broken_floor_right;
      floor_base = dv_floor_base;
      break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA:
      broken_floor_left = pc_broken_floor_left;
      broken_floor_right = pc_broken_floor_right;
      floor_base = pc_floor_base;
      break;
    case EGA:
      broken_floor_left = pe_broken_floor_left;
      broken_floor_right = pe_broken_floor_right;
      floor_base = pe_floor_base;
      break;
    case VGA:
      broken_floor_left = pv_broken_floor_left;
      broken_floor_right = pv_broken_floor_right;
      floor_base = pv_floor_base;
      break;
    }
    break;
  }

  int wl = al_get_bitmap_width (broken_floor_left);
  int wr = al_get_bitmap_width (broken_floor_right);
  int w = wl + wr;
  int hl = al_get_bitmap_height (broken_floor_left);
  int hr = al_get_bitmap_height (broken_floor_right);
  int hb = al_get_bitmap_height (floor_base);
  int h = max_int (hl, hr) + hb;

  ALLEGRO_BITMAP *bitmap = create_bitmap (w, h);
  clear_bitmap (bitmap, al_map_rgba (0, 0, 0, 0));
  draw_bitmap (floor_base, bitmap, 0, 14, 0);
  draw_bitmap (broken_floor_left, bitmap, 0, 1, 0);
  draw_bitmap (broken_floor_right, bitmap, 32, 0, 0);

  validate_bitmap_for_mingw (bitmap);

  return bitmap;
}
Exemple #4
0
ALLEGRO_BITMAP *
create_loose_floor_01_bitmap (enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *loose_floor_base_01 = NULL,
    *loose_floor_left_01 = NULL,
    *loose_floor_right_01 = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA:
      loose_floor_base_01 = dc_loose_floor_base_01;
      loose_floor_left_01 = dc_loose_floor_left_01;
      loose_floor_right_01 = dc_loose_floor_right_01;
      break;
    case EGA:
      loose_floor_base_01 = de_loose_floor_base_01;
      loose_floor_left_01 = de_loose_floor_left_01;
      loose_floor_right_01 = de_loose_floor_right_01;
      break;
    case VGA:
      loose_floor_base_01 = dv_loose_floor_base_01;
      loose_floor_left_01 = dv_loose_floor_left_01;
      loose_floor_right_01 = dv_loose_floor_right_01;
      break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA:
      loose_floor_base_01 = pc_loose_floor_base_01;
      loose_floor_left_01 = pc_loose_floor_left_01;
      loose_floor_right_01 = pc_loose_floor_right_01;
      break;
    case EGA:
      loose_floor_base_01 = pe_loose_floor_base_01;
      loose_floor_left_01 = pe_loose_floor_left_01;
      loose_floor_right_01 = pe_loose_floor_right_01;
      break;
    case VGA:
      loose_floor_base_01 = pv_loose_floor_base_01;
      loose_floor_left_01 = pv_loose_floor_left_01;
      loose_floor_right_01 = pv_loose_floor_right_01;
      break;
    }
    break;
  }

  int wl = al_get_bitmap_width (loose_floor_left_01);
  int wr = al_get_bitmap_width (loose_floor_right_01);
  int w = wl + wr;
  int hl = al_get_bitmap_height (loose_floor_left_01);
  int hr = al_get_bitmap_height (loose_floor_right_01);
  int hb = al_get_bitmap_height (loose_floor_base_01);
  int h = max_int (hl, hr) + hb;

  ALLEGRO_BITMAP *bitmap = create_bitmap (w, h);
  clear_bitmap (bitmap, al_map_rgba (0, 0, 0, 0));
  draw_bitmap (loose_floor_base_01, bitmap, 0, 14, 0);
  draw_bitmap (loose_floor_left_01, bitmap, 0, 1, 0);
  draw_bitmap (loose_floor_right_01, bitmap, 32, 0, 0);

  validate_bitmap_for_mingw (bitmap);

  return bitmap;
}