Esempio n. 1
0
void
draw_roll_right (ALLEGRO_BITMAP *from, ALLEGRO_BITMAP *to,
                 int total, int i)
{
  int w = al_get_bitmap_width (from);
  int h = al_get_bitmap_height (from);
  float slice =  w / total;
  draw_bitmap_region (from, to, 0, 0, i * slice, h, 0, 0, 0);
}
Esempio n. 2
0
void
draw_bitmap (ALLEGRO_BITMAP *from, ALLEGRO_BITMAP *to,
             float dx, float dy, int flags)
{
  draw_bitmap_region (from, to, 0, 0,
                      al_get_bitmap_width (from),
                      al_get_bitmap_height (from),
                      dx, dy, flags);
}
Esempio n. 3
0
void
draw_shutter (ALLEGRO_BITMAP *from, ALLEGRO_BITMAP *to,
              int total, int i)
{
  int sw = al_get_bitmap_width (from);
  int sh = al_get_bitmap_height (from);

  int sy;
  for (sy = 0; sy < sh; sy += total)
    draw_bitmap_region (from, to, 0, sy, sw, i, 0, sy, 0);
}
Esempio n. 4
0
void
draw_door_grid_cache (ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP *door_grid,
                      ALLEGRO_BITMAP *door_grid_tip, int i)
{
  int q = i / 8;
  int r = i % 8;
  int w = al_get_bitmap_width (door_grid);
  int j;

  draw_bitmap_region (door_grid, bitmap, 0, 7 - r, w, r + 1,
                      0, 0, 0);
  for (j = 0; j <= q; j++)
    draw_bitmap (door_grid, bitmap, 0, j * 8 + r + 1, 0);
  draw_bitmap (door_grid_tip, bitmap, 0, (q + 1) * 8 + r + 1, 0);
}
Esempio n. 5
0
void
update_mirror_bitmap (ALLEGRO_BITMAP *bitmap, struct pos *p)
{
  struct coord c;

  ALLEGRO_BITMAP *b = mirror_bitmap[p->floor + 1][p->place + 1];
  if (! b) return;

  int i;
  for (i = 0; i < anima_nmemb; i++)
    draw_anim_if_at_pos (bitmap, &anima[i], p, vm);

  mirror_coord (p, &c);
  draw_bitmap_region (bitmap, b, c.x + 22, c.y + 3,
                      MIRROR_BITMAP_W, MIRROR_BITMAP_H, 0, 0,
                      ALLEGRO_FLIP_HORIZONTAL);
}
Esempio n. 6
0
void
draw_bitmap_regionc (ALLEGRO_BITMAP *from, ALLEGRO_BITMAP *to,
                     float sx, float sy, float sw, float sh,
                     struct coord *c, int flags)
{
  if (! from) return;

  struct coord nc = *c;

  if (! cutscene && nc.room != room_view) {
    struct frame f;
    f.b = from;
    f.c = *c;
    frame2room (&f, room_view, &nc);
    if (nc.room != room_view) return;
  }

  draw_bitmap_region (from, to, sx, sy, sw, sh, nc.x, nc.y, flags);

  if (cutscene || con_caching
      || no_recursive_links_continuity) return;

  int x = nc.x;
  int y = nc.y;
  int room = nc.room;
  int w = sw;
  int h = sh;

  struct coord mc;

  push_reset_clipping_rectangle (to);

  if (room == roomd (nc.l, room, LEFT)
      && x < 0) {
    mc = nc;
    mc.x += PLACE_WIDTH * PLACES;
    draw_bitmap_region (from, to, sx, sy, sw, sh, mc.x, mc.y, flags);
  }

  if (room == roomd (nc.l, room, RIGHT)
      && x + w - 1 >= PLACE_WIDTH * PLACES) {
    mc = nc;
    mc.x -= PLACE_WIDTH * PLACES;
    draw_bitmap_region (from, to, sx, sy, sw, sh, mc.x, mc.y, flags);
  }

  if (room == roomd (nc.l, room, ABOVE)
      && y < 3) {
    mc = nc;
    mc.y += PLACE_HEIGHT * FLOORS;
    draw_bitmap_region (from, to, sx, sy, sw, sh, mc.x, mc.y, flags);
  }

  if (room == roomd (nc.l, room, BELOW)
      && y + h - 1 >= PLACE_HEIGHT * FLOORS) {
    mc = nc;
    mc.y -= PLACE_HEIGHT * FLOORS;
    draw_bitmap_region (from, to, sx, sy, sw, sh, mc.x, mc.y, flags);
  }

  if (room == roomd (nc.l, room, LEFT) && x < 0
      && room == roomd (nc.l, room, ABOVE) && y < 3) {
    mc = nc;
    mc.x += PLACE_WIDTH * PLACES;
    mc.y += PLACE_HEIGHT * FLOORS;
    draw_bitmap_region (from, to, sx, sy, sw, sh, mc.x, mc.y, flags);
  }

  if (room == roomd (nc.l, room, RIGHT)
      && x + w - 1 >= PLACE_WIDTH * PLACES
      && room == roomd (nc.l, room, ABOVE) && y < 3) {
    mc = nc;
    mc.x -= PLACE_WIDTH * PLACES;
    mc.y += PLACE_HEIGHT * FLOORS;
    draw_bitmap_region (from, to, sx, sy, sw, sh, mc.x, mc.y, flags);
  }

  if (room == roomd (nc.l, room, LEFT)
      && x < 0
      && room == roomd (nc.l, room, BELOW)
      && y + h - 1 >= PLACE_HEIGHT * FLOORS) {
    mc = nc;
    mc.x += PLACE_WIDTH * PLACES;
    mc.y -= PLACE_HEIGHT * FLOORS;
    draw_bitmap_region (from, to, sx, sy, sw, sh, mc.x, mc.y, flags);
  }

  if (room == roomd (nc.l, room, RIGHT)
      && x + w - 1 >= PLACE_WIDTH * PLACES
      && room == roomd (nc.l, room, BELOW)
      && y + h - 1 >= PLACE_HEIGHT * FLOORS) {
    mc = nc;
    mc.x -= PLACE_WIDTH * PLACES;
    mc.y -= PLACE_HEIGHT * FLOORS;
    draw_bitmap_region (from, to, sx, sy, sw, sh, mc.x, mc.y, flags);
  }

  pop_clipping_rectangle ();
}