Exemplo n.º 1
0
void
draw_floor_reflex (ALLEGRO_BITMAP *bitmap, struct pos *p,
                   enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *floor_right = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: floor_right = dc_floor_right; break;
    case EGA: floor_right = de_floor_right; break;
    case VGA: floor_right = dv_floor_right; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: floor_right = pc_floor_right; break;
    case EGA: floor_right = pe_floor_right; break;
    case VGA: floor_right = pv_floor_right; break;
    }
    break;
  }

  if (vm == VGA) floor_right = apply_hue_palette (floor_right);
  if (hgc) floor_right = apply_palette (floor_right, hgc_palette);
  if (peq (p, &mouse_pos))
    floor_right = apply_palette (floor_right, selection_palette);

  struct pos pl; prel (p, &pl, +0, -1);
  struct coord c;
  int h = al_get_bitmap_height (floor_right);
  draw_bitmap_regionc (floor_right, bitmap, 0, 2, 17, h - 9,
                       floor_reflex_coord (&pl, &c), 0);
}
Exemplo n.º 2
0
void
draw_mirror_fg (ALLEGRO_BITMAP *bitmap, struct pos *p,
                enum em em, enum vm vm)
{
  struct coord c;

  ALLEGRO_BITMAP *mirror = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: mirror = dc_mirror; break;
    case EGA: mirror = de_mirror; break;
    case VGA: mirror = dv_mirror; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: mirror = pc_mirror; break;
    case EGA: mirror = pe_mirror; break;
    case VGA: mirror = pv_mirror; break;
    }
    break;
  }

  if (hgc) mirror = apply_palette (mirror, hgc_palette);

  ALLEGRO_BITMAP *b = mirror_bitmap[p->floor + 1][p->place + 1];
  if (b) draw_bitmapc (b, bitmap, mirror_reflex_coord (p, &c), 0);

  int h = al_get_bitmap_height (mirror);
  draw_bitmap_regionc (mirror, bitmap, 0, 0, 22, h, mirror_coord (p, &c), 0);
}
Exemplo n.º 3
0
void
draw_bitmapc (ALLEGRO_BITMAP *from, ALLEGRO_BITMAP *to,
              struct coord *c, int flags)
{
  int w = al_get_bitmap_width (from);
  int h = al_get_bitmap_height (from);
  draw_bitmap_regionc (from, to, 0, 0, w, h, c, flags);
}
Exemplo n.º 4
0
static void
draw_fg_05 (ALLEGRO_BITMAP *bitmap, struct pos *p, struct chopper *ch,
                    enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *fg = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: fg = dc_chopper_fg_04; break;
    case EGA: fg = de_chopper_fg_04; break;
    case VGA: fg = dv_chopper_fg_04; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: fg = pc_chopper_fg_04; break;
    case EGA: fg = pe_chopper_fg_04; break;
    case VGA: fg = pv_chopper_fg_04; break;
    }
    break;
  }

  if (vm == VGA) fg = apply_hue_palette (fg);
  if (hgc) fg = apply_palette (fg, hgc_palette);
  if (peq (p, &mouse_pos)) fg = apply_palette (fg, selection_palette);

  struct coord c;
  draw_bitmapc (fg, bitmap, chopper_coord (p, &c), 0);
  if (ch->blood) {
    int h = al_get_bitmap_height (chopper_blood_04);
    palette blood_palette = get_blood_palette (vm);
    ALLEGRO_BITMAP *blood = apply_palette (chopper_blood_04, blood_palette);
    if (hgc) blood = apply_palette (blood, hgc_palette);
    draw_bitmap_regionc (blood, bitmap, 0, 0, 2, h, blood_05_coord (p, &c), 0);
  }
}
Exemplo n.º 5
0
void
xdraw_door_grid (ALLEGRO_BITMAP *bitmap, struct pos *p, int i,
                 enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *door_grid = NULL,
    *door_grid_tip = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA:
      door_grid = dc_door_grid;
      door_grid_tip = dc_door_grid_tip;
      break;
    case EGA:
      door_grid = de_door_grid;
      door_grid_tip = de_door_grid_tip;
      break;
    case VGA:
      door_grid = dv_door_grid;
      door_grid_tip = dv_door_grid_tip;
      break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA:
      door_grid = pc_door_grid;
      door_grid_tip = pc_door_grid_tip;
      break;
    case EGA:
      door_grid = pe_door_grid;
      door_grid_tip = pe_door_grid_tip;
      break;
    case VGA:
      door_grid = pv_door_grid;
      door_grid_tip = pv_door_grid_tip;
      break;
    }
    break;
  }

  if (vm == VGA) {
    door_grid = apply_hue_palette (door_grid);
    door_grid_tip = apply_hue_palette (door_grid_tip);
  }

  if (hgc) {
    door_grid = apply_palette (door_grid, hgc_palette);
    door_grid_tip = apply_palette (door_grid_tip, hgc_palette);
  }

  if (peq (p, &mouse_pos)) {
    door_grid = apply_palette (door_grid, selection_palette);
    door_grid_tip = apply_palette (door_grid_tip, selection_palette);
  }

  int q = i / 8;
  int r = i % 8;
  int w = al_get_bitmap_width (door_grid);
  int j;

  struct coord c;
  draw_bitmap_regionc (door_grid, bitmap, 0, 7 - r, w, r + 1,
                       door_grid_coord_base (p, &c), 0);
  for (j = 0; j <= q; j++)
    draw_bitmapc (door_grid, bitmap, door_grid_coord (p, &c, j, i), 0);
  draw_bitmapc (door_grid_tip, bitmap, door_grid_tip_coord (p, &c, i), 0);
}
Exemplo n.º 6
0
void
draw_mirror_fg (ALLEGRO_BITMAP *bitmap, struct pos *p, struct frame *f,
                enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *mirror = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: mirror = dc_mirror; break;
    case EGA: mirror = de_mirror; break;
    case VGA: mirror = dv_mirror; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: mirror = pc_mirror; break;
    case EGA: mirror = pe_mirror; break;
    case VGA: mirror = pv_mirror; break;
    }
    break;
  }

  /* make mirror black */
  struct rect r;
  new_rect (&r, p->room, PLACE_WIDTH * p->place + 2,
            PLACE_HEIGHT * p->floor + 3,
            13, PLACE_HEIGHT - 16);
  draw_filled_rect (bitmap, &r, BLACK);

  /* draw floor reflex */
  draw_floor_reflex (bitmap, p, em, vm);

  ignore_clipping_rectangle_intersection = true;
  /* draw anim */
  if (f) {
    push_clipping_rectangle (bitmap, PLACE_WIDTH * p->place + 2,
                             PLACE_HEIGHT * p->floor + 3,
                             16, PLACE_HEIGHT - 9);
    struct anim *a = get_anim_by_id (f->parent_id);
    struct anim a0 = *a;
    invert_frame_dir (&a0.f, &a0.f);
    a0.f.c.x = (2 * PLACE_WIDTH * p->place + 36)
      - (a->f.c.x + al_get_bitmap_width (a->f.b));
    draw_anim_frame (bitmap, &a0, vm);
    pop_clipping_rectangle ();
  }

  /* draw mirror properly */
  if (vm == VGA) mirror = apply_hue_palette (mirror);
  if (hgc) mirror = apply_palette (mirror, hgc_palette);
  if (peq (p, &mouse_pos))
    mirror = apply_palette (mirror, selection_palette);

  struct coord c;
  int h = al_get_bitmap_height (mirror);
  push_reset_clipping_rectangle (bitmap);
  draw_bitmap_regionc (mirror, bitmap, 0, 0, 22, h, mirror_coord (p, &c), 0);
  pop_clipping_rectangle ();

  ignore_clipping_rectangle_intersection = false;
}