Exemplo n.º 1
0
void
redim_multi_room (int w, int h)
{
  destroy_multi_room ();

  mr.w = w;
  mr.h = h;

  if (! cutscene && mr.fit_mode == MR_FIT_NONE) {
    mr.fit_w = mr.w;
    mr.fit_h = mr.h;
  }

  int x, y;
  mr.cell = xcalloc (w, sizeof (* mr.cell));
  mr.last.cell = xcalloc (w, sizeof (* mr.last.cell));
  for (x = 0; x < w; x++) {
    mr.cell[x] = xcalloc (h, sizeof (** mr.cell));
    mr.last.cell[x] = xcalloc (h, sizeof (** mr.last.cell));
    for (y = 0; y < h; y++) {
      mr.cell[x][y].screen = NULL;
      mr.cell[x][y].cache = NULL;
    }
  }
}
Exemplo n.º 2
0
bool
set_multi_room (int w, int h)
{
  if (w == mr.w && h == mr.h) return true;

  int sw = ORIGINAL_WIDTH * w;
  int sh = ROOM_HEIGHT * h + 11;

  ALLEGRO_BITMAP *b = create_bitmap (sw, sh);
  if (! b) return false;
  destroy_bitmap (b);

  destroy_multi_room ();

  mr.h = h;
  mr.w = w;

  set_target_backbuffer (display);
  al_set_new_bitmap_flags (ALLEGRO_VIDEO_BITMAP);

  screen = create_bitmap (sw, sh);
  effect_buffer = create_bitmap (sw, sh);
  black_screen = create_bitmap (sw, sh);
  cache = create_bitmap (sw, sh);

  int x, y;
  mr.cell = xcalloc (w, sizeof (* mr.cell));
  mr.last.cell = xcalloc (w, sizeof (* mr.last.cell));
  for (x = 0; x < w; x++) {
    mr.cell[x] = xcalloc (h, sizeof (** mr.cell));
    mr.last.cell[x] = xcalloc (h, sizeof (** mr.last.cell));
    for (y = 0; y < h; y++) {
      int x0 = ORIGINAL_WIDTH * x;
      int y0 = ROOM_HEIGHT * y;
      int sw = ORIGINAL_WIDTH;
      int sh = ORIGINAL_HEIGHT - (y < h - 1 ? 8 : 0);
      mr.cell[x][y].screen = al_create_sub_bitmap (screen, x0, y0, sw, sh);
      mr.cell[x][y].cache = al_create_sub_bitmap (cache, x0, y0, sw, sh);
    }
  }

  return true;
}